+ // If there's a filter, make sure all of the output glyphs
+ // exist.
+ if (filter != NULL) {
+ for (le_int32 i = 0; i < glyphCount; i += 1) {
+ TTGlyphID substitute = SWAPW(sequenceTable->substituteArray[i]);
+
+ if (! filter->accept(substitute)) {
+ return 0;
+ }
+ }
+ }
+
+ LEGlyphID *newGlyphs = glyphIterator->insertGlyphs(glyphCount, success);
+ if (LE_FAILURE(success)) {
+ return 0;
+ }
+
+ le_int32 insert = 0, direction = 1;
+
+ if (glyphIterator->isRightToLeft()) {
+ insert = glyphCount - 1;
+ direction = -1;
+ }
+
+ for (le_int32 i = 0; i < glyphCount; i += 1) {
+ TTGlyphID substitute = SWAPW(sequenceTable->substituteArray[i]);
+
+ newGlyphs[insert] = LE_SET_GLYPH(glyph, substitute);
+ insert += direction;
+ }
+