From: handa Date: Wed, 4 Nov 2009 02:27:22 +0000 (+0000) Subject: (debug_flag): Extern it. X-Git-Tag: REL-0-9-11~54 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=3c54dd29c9f2f7850978fb9c262c191cf00b7920;p=m17n%2Flibotf.git (debug_flag): Extern it. (lookup_gsub): Print debugging info if requested. Don't ignore a glyph that already has positioning_type. Be sure to increment gidx. --- diff --git a/src/otfdrive.c b/src/otfdrive.c index 24981a0..8dc6dba 100644 --- a/src/otfdrive.c +++ b/src/otfdrive.c @@ -29,6 +29,8 @@ write to the Free Software Foundation, Inc., 59 Temple Place, Suite #include "otf.h" #include "otferror.h" +extern int debug_flag; + /* Return nonzero (-1 if ID is zero, 1 otherwise) if OTF_Glyph *G should be ignored according to LookupFlag FLAG. */ #define IGNORED_GLYPH(g, flag) \ @@ -784,8 +786,15 @@ lookup_gpos (OTF_LookupList *lookup_list, unsigned lookup_list_index, OTF_Glyph *g = gstring->glyphs + gidx; int i; + if (debug_flag) + fprintf (stderr, "[GPOS] glyph:%X lookup(%d)", + g->glyph_id, lookup_list_index); if (IGNORED_GLYPH (g, flag)) - return (gidx + 1); + { + if (debug_flag) + fprintf (stderr, " ignored glyph\n"); + return (gidx + 1); + } /* Try all subtables until one of them handles the current glyph. */ for (i = 0; i < lookup->SubTableCount && gidx == orig_gidx; i++) @@ -806,6 +815,8 @@ lookup_gpos (OTF_LookupList *lookup_list, unsigned lookup_list_index, subtable = extension1->ExtensionSubtable; } + if (debug_flag) + fprintf (stderr, " type(%d)", lookup_type); if (subtable->Coverage.offset) { coverage_idx = get_coverage_index (&subtable->Coverage, @@ -852,8 +863,7 @@ lookup_gpos (OTF_LookupList *lookup_list, unsigned lookup_list_index, next_gidx < gstring->used && IGNORED_GLYPH (nextg, flag); next_gidx++, nextg++); - if (next_gidx >= gstring->used - || nextg->positioning_type) + if (next_gidx >= gstring->used) continue; if (subtable->Format == 1) { @@ -948,6 +958,7 @@ lookup_gpos (OTF_LookupList *lookup_list, unsigned lookup_list_index, = &cursive1->EntryExitRecord[coverage_idx].EntryAnchor; g->f.f3.exit_anchor = &cursive1->EntryExitRecord[coverage_idx].ExitAnchor; + gidx++; } break; @@ -985,6 +996,7 @@ 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_type; + gidx++; } break; @@ -1039,6 +1051,7 @@ lookup_gpos (OTF_LookupList *lookup_list, unsigned lookup_list_index, g->positioning_type = lookup_type; g->f.f5.mark_anchor = &mark_record->MarkAnchor; g->f.f5.ligature_anchor = lig_anchor + mark_record->Class; + gidx++; break; } } @@ -1078,6 +1091,7 @@ lookup_gpos (OTF_LookupList *lookup_list, unsigned lookup_list_index, g->f.f6.mark2_anchor = &mark2_record->Anchor[mark1_record->Class]; g->positioning_type = lookup_type; + gidx++; break; } break; @@ -1255,7 +1269,13 @@ lookup_gpos (OTF_LookupList *lookup_list, unsigned lookup_list_index, } } if (gidx == orig_gidx) - gidx++; + { + if (debug_flag) + fprintf (stderr, " no match\n"); + gidx++; + } + else if (debug_flag) + fprintf (stderr, " match %d glyphs\n", gidx - orig_gidx); return gidx; }