From: handa Date: Thu, 17 Feb 2005 12:45:31 +0000 (+0000) Subject: (gstring_subst): Correctly set temp.f.index. X-Git-Tag: REL-0-9-5~81 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=8a36b1a236434d406737e27628ecb90307ff52cc;p=m17n%2Flibotf.git (gstring_subst): Correctly set temp.f.index. (lookup_gsub): Fix updating gidx. (gstring_subst): New arg OTF. Callers changed. (lookup_gsub): New arg OTF. Callers changed. --- diff --git a/src/otfdrive.c b/src/otfdrive.c index faabc2a..2449faa 100644 --- a/src/otfdrive.c +++ b/src/otfdrive.c @@ -66,13 +66,12 @@ write to the Free Software Foundation, Inc., 59 Temple Place, Suite static int -gstring_subst (OTF_GlyphString *gstring, int from, int to, int flag, +gstring_subst (OTF *otf, OTF_GlyphString *gstring, int from, int to, int flag, OTF_GlyphID *ids, int num) { int errret = -1; int len = to - from; int i; - int c = gstring->glyphs[from].c; int from_idx = gstring->glyphs[from].f.index.from; int to_idx = gstring->glyphs[to - 1].f.index.to; int non_ignored_idx; @@ -98,7 +97,7 @@ gstring_subst (OTF_GlyphString *gstring, int from, int to, int flag, GSTRING_DELETE (gstring, from, (len - num)); for (i = 0; i < num; i++) { - gstring->glyphs[from + i].c = c; + gstring->glyphs[from + i].c = otf->cmap->decode_table[ids[i]]; gstring->glyphs[from + i].glyph_id = ids[i]; gstring->glyphs[from + i].f.index.from = from_idx; gstring->glyphs[from + i].f.index.to = to_idx; @@ -401,7 +400,7 @@ match_chain_coverages (OTF_GlyphString *gstring, int gidx, int flag, } static int -lookup_gsub (OTF_LookupList *lookup_list, unsigned lookup_list_index, +lookup_gsub (OTF *otf, OTF_LookupList *lookup_list, unsigned lookup_list_index, OTF_GlyphString *gstring, int gidx, int alternate_subst) { char *errfmt = "GSUB Looking up%s"; @@ -460,7 +459,7 @@ lookup_gsub (OTF_LookupList *lookup_list, unsigned lookup_list_index, OTF_GSUB_Multiple1 *multiple1 = &subtable->u.multiple1; OTF_Sequence *seq = multiple1->Sequence + coverage_idx; - gstring_subst (gstring, gidx, gidx + 1, flag, + gstring_subst (otf, gstring, gidx, gidx + 1, flag, seq->Substitute, seq->GlyphCount); gidx += seq->GlyphCount; } @@ -474,7 +473,7 @@ lookup_gsub (OTF_LookupList *lookup_list, unsigned lookup_list_index, OTF_GSUB_Alternate1 *alt1 = &subtable->u.alternate1; OTF_AlternateSet *altset = alt1->AlternateSet + coverage_idx; - gstring_subst (gstring, gidx + 1, gidx + 1, flag, + gstring_subst (otf, gstring, gidx + 1, gidx + 1, flag, altset->Alternate, altset->GlyphCount); gidx += altset->GlyphCount;; } @@ -499,7 +498,7 @@ lookup_gsub (OTF_LookupList *lookup_list, unsigned lookup_list_index, lig->CompCount - 1, lig->Component); if (n < 0) continue; - gstring_subst (gstring, gidx, gidx + 1 + n, flag, + gstring_subst (otf, gstring, gidx, gidx + 1 + n, flag, &lig->LigGlyph, 1); gidx += lig->CompCount; break; @@ -526,7 +525,7 @@ lookup_gsub (OTF_LookupList *lookup_list, unsigned lookup_list_index, continue; orig_used = gstring->used; for (k = 0; k < rule->LookupCount; k++) - lookup_gsub (lookup_list, + lookup_gsub (otf, lookup_list, rule->LookupRecord[k].LookupListIndex, gstring, gidx + rule->LookupRecord[k].SequenceIndex, @@ -557,7 +556,7 @@ lookup_gsub (OTF_LookupList *lookup_list, unsigned lookup_list_index, continue; orig_used = gstring->used; for (k = 0; k < rule->LookupCount; k++) - lookup_gsub (lookup_list, + lookup_gsub (otf, lookup_list, rule->LookupRecord[k].LookupListIndex, gstring, gidx + rule->LookupRecord[k].SequenceIndex, @@ -578,7 +577,7 @@ lookup_gsub (OTF_LookupList *lookup_list, unsigned lookup_list_index, continue; orig_used = gstring->used; for (j = 0; j < context3->LookupCount; j++) - lookup_gsub (lookup_list, + lookup_gsub (otf, lookup_list, context3->LookupRecord[j].LookupListIndex, gstring, gidx + context3->LookupRecord[j].SequenceIndex, @@ -607,7 +606,7 @@ lookup_gsub (OTF_LookupList *lookup_list, unsigned lookup_list_index, continue; orig_used = gstring->used; for (k = 0; k < rule->LookupCount; k++) - lookup_gsub (lookup_list, + lookup_gsub (otf, lookup_list, rule->LookupRecord[k].LookupListIndex, gstring, gidx + rule->LookupRecord[k].SequenceIndex, @@ -643,7 +642,7 @@ lookup_gsub (OTF_LookupList *lookup_list, unsigned lookup_list_index, continue; orig_used = gstring->used; for (k = 0; k < rule->LookupCount; k++) - lookup_gsub (lookup_list, + lookup_gsub (otf, lookup_list, rule->LookupRecord[k].LookupListIndex, gstring, gidx + rule->LookupRecord[k].SequenceIndex, @@ -666,7 +665,7 @@ lookup_gsub (OTF_LookupList *lookup_list, unsigned lookup_list_index, continue; orig_used = gstring->used; for (j = 0; j < context3->LookupCount; j++) - lookup_gsub (lookup_list, + lookup_gsub (otf, lookup_list, context3->LookupRecord[j].LookupListIndex, gstring, gidx + context3->LookupRecord[j].SequenceIndex, @@ -1386,7 +1385,7 @@ OTF_drive_gsub_internal (OTF *otf, OTF_GlyphString *gstring, gidx = 0; while (gidx < gstring->used) { - gidx = lookup_gsub (&gsub->LookupList, index, gstring, gidx, + gidx = lookup_gsub (otf, &gsub->LookupList, index, gstring, gidx, alternate_subst); if (gidx < 0) return errret; @@ -1397,7 +1396,7 @@ OTF_drive_gsub_internal (OTF *otf, OTF_GlyphString *gstring, gidx = gstring->used - 1; while (gidx >= 0) { - gidx = lookup_gsub (&gsub->LookupList, index, gstring, gidx, + gidx = lookup_gsub (otf, &gsub->LookupList, index, gstring, gidx, alternate_subst); if (gidx < 0) return errret;