From: handa Date: Fri, 9 Jul 2004 04:01:00 +0000 (+0000) Subject: (lookup_gpos): Ignore glyphs whose ID is 0 (fix X-Git-Tag: REL-0-9-1~48 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2b1485fbd2dd3b68aaed99d1256295969685e00;p=m17n%2Flibotf.git (lookup_gpos): Ignore glyphs whose ID is 0 (fix for the case of LookupType 2). --- diff --git a/src/otfdrive.c b/src/otfdrive.c index fd4bab0..2b18522 100644 --- a/src/otfdrive.c +++ b/src/otfdrive.c @@ -728,52 +728,68 @@ lookup_gpos (OTF_LookupList *lookup_list, unsigned lookup_list_index, 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: