From: handa Date: Thu, 5 Aug 2004 05:20:24 +0000 (+0000) Subject: (lookup_gpos): Add support for LookupType 5. X-Git-Tag: REL-0-9-1~23 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=13c4932cfa9eb40de6a0b4846430e3d41f9b87ae;p=m17n%2Flibotf.git (lookup_gpos): Add support for LookupType 5. --- diff --git a/src/otfdrive.c b/src/otfdrive.c index c5ec6af..7d3a71a 100644 --- a/src/otfdrive.c +++ b/src/otfdrive.c @@ -859,9 +859,16 @@ lookup_gpos (OTF_LookupList *lookup_list, unsigned lookup_list_index, OTF_GPOS_MarkBase1 *mark_base1 = &subtable->u.mark_base1; OTF_MarkRecord *mark_record; OTF_AnchorRecord *base_record; - int coverage_idx_base + OTF_Glyph *baseg = g - 1; + int coverage_idx_base; + + while (baseg >= gstring->glyphs + && (! baseg->glyph_id + || ! (flag & (1 << baseg->GlyphClass)))) + baseg--; + coverage_idx_base = get_coverage_index (&mark_base1->BaseCoverage, - g[-1].glyph_id); + baseg->glyph_id); if (coverage_idx_base < 0) continue; @@ -872,7 +879,6 @@ lookup_gpos (OTF_LookupList *lookup_list, unsigned lookup_list_index, g->f.f4.base_anchor = &base_record->Anchor[mark_record->Class]; g->positioning_type = lookup->LookupType; - break; } break; @@ -881,10 +887,50 @@ lookup_gpos (OTF_LookupList *lookup_list, unsigned lookup_list_index, continue; if (subtable->Format == 1) { - /* As the document of this lookup type is quite - ambiguous, and we can't know the exact procedure to - handle it?!? */ - OTF_ERROR (OTF_ERROR_GPOS_DRIVE, " (not yet supported)"); + OTF_GPOS_MarkLig1 *mark_lig1 = &subtable->u.mark_lig1; + unsigned class = g->MarkAttachClass; + OTF_Glyph *ligg = g - 1; + int coverage_idx_lig; + OTF_MarkRecord *mark_record; + OTF_ComponentRecord *cmp_record; + OTF_LigatureAttach *attach; + int *num_class = alloca (sizeof (int) * mark_lig1->ClassCount); + int j; + + for (j = 0; j < mark_lig1->ClassCount; j++) + num_class[j] = 0; + + while (ligg >= gstring->glyphs + && (! ligg->glyph_id + || ! (flag & (1 << ligg->GlyphClass)))) + { + if (ligg->positioning_type == 5 + && ligg->MarkAttachClass < mark_lig1->ClassCount) + num_class[ligg->MarkAttachClass]++; + ligg--; + } + coverage_idx_lig + = get_coverage_index (&mark_lig1->LigatureCoverage, + ligg->glyph_id); + if (coverage_idx_lig < 0) + continue; + mark_record = mark_lig1->MarkArray.MarkRecord + coverage_idx; + g->MarkAttachClass = mark_record->Class; + attach = (mark_lig1->LigatureArray.LigatureAttach + + coverage_idx_lig); + for (j = 0; j < attach->ComponentCount; j++) + { + OTF_Anchor *lig_anchor = attach->ComponentRecord + j; + + if (lig_anchor[mark_record->Class].AnchorFormat + && num_class[mark_record->Class]-- < 0) + { + g->positioning_type = lookup->LookupType; + g->f.f5.mark_anchor = &mark_record->MarkAnchor; + g->f.f5.ligature_anchor = lig_anchor + mark_record->Class; + break; + } + } } break;