- const ContextualGlyphSubstitutionStateEntry *entry = &entryTable[index];
- ByteOffset newState = SWAPW(entry->newStateOffset);
- le_int16 flags = SWAPW(entry->flags);
- WordOffset markOffset = SWAPW(entry->markOffset);
- WordOffset currOffset = SWAPW(entry->currOffset);
-
- if (markOffset != 0) {
- const le_int16 *table = (const le_int16 *) ((char *) &stateTableHeader->stHeader + markOffset * 2);
- LEGlyphID mGlyph = glyphStorage[markGlyph];
- TTGlyphID newGlyph = SWAPW(table[LE_GET_GLYPH(mGlyph)]);
-
- glyphStorage[markGlyph] = LE_SET_GLYPH(mGlyph, newGlyph);
- }
-
- if (currOffset != 0) {
- const le_int16 *table = (const le_int16 *) ((char *) &stateTableHeader->stHeader + currOffset * 2);
- LEGlyphID thisGlyph = glyphStorage[currGlyph];
- TTGlyphID newGlyph = SWAPW(table[LE_GET_GLYPH(thisGlyph)]);
-
- glyphStorage[currGlyph] = LE_SET_GLYPH(thisGlyph, newGlyph);
- }
+ LEErrorCode success = LE_NO_ERROR;
+ const ContextualGlyphSubstitutionStateEntry *entry = entryTable.getAlias(index, success);
+ ByteOffset newState = SWAPW(entry->newStateOffset);
+ le_int16 flags = SWAPW(entry->flags);
+ WordOffset markOffset = SWAPW(entry->markOffset);
+ WordOffset currOffset = SWAPW(entry->currOffset);
+
+ if (markOffset != 0 && LE_SUCCESS(success)) {
+ LEGlyphID mGlyph = glyphStorage[markGlyph];
+ TTGlyphID newGlyph = SWAPW(int16Table.getObject(markOffset + LE_GET_GLYPH(mGlyph), success)); // whew.
+
+ glyphStorage[markGlyph] = LE_SET_GLYPH(mGlyph, newGlyph);
+ }
+
+ if (currOffset != 0) {
+ LEGlyphID thisGlyph = glyphStorage[currGlyph];
+ TTGlyphID newGlyph = SWAPW(int16Table.getObject(currOffset + LE_GET_GLYPH(thisGlyph), success)); // whew.
+
+ glyphStorage[currGlyph] = LE_SET_GLYPH(thisGlyph, newGlyph);
+ }