+ if (subtable->Format == 1)
+ {
+ OTF_GPOS_Context1 *context1 = &subtable->u.context1;
+ OTF_RuleSet *set = context1->RuleSet + coverage_idx;
+ OTF_Rule *rule;
+ int orig_used;
+ int j, k;
+
+ for (j = 0; j < set->RuleCount; j++)
+ {
+ rule = set->Rule + j;
+ if (match_ids (gstring, gidx + 1, flag,
+ rule->GlyphCount - 1, rule->Input) < 0)
+ continue;
+ orig_used = gstring->used;
+ for (k = 0; k < rule->LookupCount; k++)
+ lookup_gpos (lookup_list,
+ rule->LookupRecord[k].LookupListIndex,
+ gstring,
+ gidx + rule->LookupRecord[k].SequenceIndex);
+ gidx += rule->GlyphCount + (gstring->used - orig_used);
+ break;
+ }
+ }
+ else if (subtable->Format == 2)
+ {
+ OTF_GPOS_Context2 *context2 = &subtable->u.context2;
+ OTF_ClassSet *set;
+ OTF_ClassRule *rule;
+ unsigned class;
+ int orig_used;
+ int j, k;
+
+ class = get_class_def (&context2->ClassDef, g->glyph_id);
+ set = context2->ClassSet + class;
+ if (set)
+ for (j = 0; j < set->ClassRuleCnt; j++)
+ {
+ rule = set->ClassRule + j;
+ if (match_classes (&context2->ClassDef,
+ gstring, gidx + 1, flag,
+ rule->GlyphCount - 1, rule->Class)
+ < 0)
+ continue;
+ orig_used = gstring->used;
+ for (k = 0; k < rule->LookupCount; k++)
+ lookup_gpos (lookup_list,
+ rule->LookupRecord[k].LookupListIndex,
+ gstring,
+ gidx + rule->LookupRecord[k].SequenceIndex);
+ gidx += rule->GlyphCount + (gstring->used - orig_used);
+ break;
+ }
+ }
+ else /* subtable->Format == 3 */
+ {
+ OTF_GPOS_Context3 *context3 = &subtable->u.context3;
+ int orig_used;
+ int j;
+
+ if (match_coverages (gstring, gidx + 1, flag,
+ context3->GlyphCount - 1,
+ context3->Coverage + 1) < 0)
+ continue;
+ orig_used = gstring->used;
+ for (j = 0; j < context3->LookupCount; j++)
+ lookup_gpos (lookup_list,
+ context3->LookupRecord[j].LookupListIndex,
+ gstring,
+ gidx + context3->LookupRecord[j].SequenceIndex);
+ gidx += context3->GlyphCount + (gstring->used - orig_used);
+ }