break;
case 2:
- if (gidx + 1 >= gstring->used)
- continue;
- if (subtable->Format == 1)
- {
- OTF_GPOS_Pair1 *pair1 = &subtable->u.pair1;
- OTF_PairSet *set = pair1->PairSet + coverage_idx;
- int j;
+ {
+ int next_gidx = gidx + 1;
+ OTF_Glyph *nextg;
- for (j = 0; j < set->PairValueCount; j++)
- {
- if (set->PairValueRecord[j].SecondGlyph != g[1].glyph_id)
- continue;
- gidx++;
- g->positioning_type = lookup->LookupType;
- g->f.f2.format = pair1->ValueFormat1;
- g->f.f2.value = &set->PairValueRecord[j].Value1;
- if (pair1->ValueFormat2)
+ while (next_gidx < gstring->used
+ && ! gstring->glyphs[next_gidx].glyph_id)
+ next_gidx++;
+
+ if (next_gidx >= gstring->used)
+ continue;
+ nextg = gstring->glyphs + next_gidx;
+ if (subtable->Format == 1)
+ {
+ OTF_GPOS_Pair1 *pair1 = &subtable->u.pair1;
+ OTF_PairSet *set = pair1->PairSet + coverage_idx;
+ int j;
+
+ for (j = 0; j < set->PairValueCount; j++)
+ if (set->PairValueRecord[j].SecondGlyph == nextg->glyph_id)
{
- g++, gidx++;
- g->positioning_type = lookup->LookupType;
- g->f.f2.format = pair1->ValueFormat2;
- g->f.f2.value = &set->PairValueRecord[j].Value2;
+ if (pair1->ValueFormat1)
+ {
+ g->positioning_type = lookup->LookupType;
+ g->f.f2.format = pair1->ValueFormat1;
+ g->f.f2.value = &set->PairValueRecord[j].Value1;
+ }
+ gidx = next_gidx;
+ if (pair1->ValueFormat2)
+ {
+ nextg->positioning_type = lookup->LookupType;
+ nextg->f.f2.format = pair1->ValueFormat2;
+ nextg->f.f2.value = &set->PairValueRecord[j].Value2;
+ gidx++;
+ }
+ break;
}
- }
- }
- else if (subtable->Format == 2)
- {
- OTF_GPOS_Pair2 *pair2 = &subtable->u.pair2;
- unsigned class1, class2;
+ }
+ else if (subtable->Format == 2)
+ {
+ OTF_GPOS_Pair2 *pair2 = &subtable->u.pair2;
+ unsigned class1, class2;
- gidx++;
- class1 = get_class_def (&pair2->ClassDef1, g->glyph_id);
- class2 = get_class_def (&pair2->ClassDef2, g[1].glyph_id);
- g->positioning_type = lookup->LookupType;
- g->f.f2.format = pair2->ValueFormat1;
- g->f.f2.value
- = &pair2->Class1Record[class1].Class2Record[class2].Value1;
- if (pair2->ValueFormat2)
- {
- g++, gidx++;
- g->positioning_type = lookup->LookupType;
- g->f.f2.format = pair2->ValueFormat2;
- g->f.f2.value
- = &pair2->Class1Record[class1].Class2Record[class2].Value2;
- }
- }
+ class1 = get_class_def (&pair2->ClassDef1, g->glyph_id);
+ class2 = get_class_def (&pair2->ClassDef2, nextg->glyph_id);
+ if (pair2->ValueFormat1)
+ {
+ g->positioning_type = lookup->LookupType;
+ g->f.f2.format = pair2->ValueFormat1;
+ g->f.f2.value
+ = &pair2->Class1Record[class1].Class2Record[class2].Value1;
+ }
+ gidx = next_gidx;
+ if (pair2->ValueFormat2)
+ {
+ nextg->positioning_type = lookup->LookupType;
+ nextg->f.f2.format = pair2->ValueFormat2;
+ nextg->f.f2.value
+ = &pair2->Class1Record[class1].Class2Record[class2].Value2;
+ gidx++;
+ }
+ }
+ }
break;
case 3: