From: handa Date: Tue, 24 Nov 2009 04:31:56 +0000 (+0000) Subject: (update_seq_area): Call X-Git-Tag: REL-0-9-11~24 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=28c3fa7d4cbfdabfea03003c70d86c0fe2cf08ed;p=m17n%2Flibotf.git (update_seq_area): Call OTF_driver_gsub_with_log and OTF_driver_gpos_with_log. Show which features are applied. --- diff --git a/example/otfview.c b/example/otfview.c index 4be053f..98efa4b 100644 --- a/example/otfview.c +++ b/example/otfview.c @@ -353,6 +353,8 @@ update_seq_area () int len = glyph_rec.n_glyphs; Arg arg[1]; int unitsPerEm = face->units_per_EM; + OTF_Tag *log = NULL; + int logsize; gstring.size = gstring.used = len; gstring.glyphs = malloc (sizeof (OTF_Glyph) * len); @@ -393,7 +395,20 @@ update_seq_area () OTF_drive_gsub_alternate (otf, &gstring, script_name, langsys_name, str); else - OTF_drive_gsub (otf, &gstring, script_name, langsys_name, str); + { + OTF_drive_gsub_with_log (otf, &gstring, + script_name, langsys_name, str); + logsize = gstring.used * 2; + log = alloca (sizeof (OTF_Tag) * logsize); + for (i = 0; i < gstring.used; i++) + { + int idx = gstring.glyphs[i].positioning_type >> 4; + if (idx) + log[i] = otf->gsub->FeatureList.Feature[idx - 1].FeatureTag; + else + log[i] = 0; + } + } free (str); } } @@ -402,7 +417,32 @@ update_seq_area () str = get_features (&otf->gpos->FeatureList, &gpos); if (str) { - OTF_drive_gpos2 (otf, &gstring, script_name, langsys_name, str); + OTF_drive_gpos_with_log (otf, &gstring, + script_name, langsys_name, str); + if (log) + { + if (logsize < gstring.used) + { + OTF_Tag *log2 = alloca (sizeof (OTF_Tag) * gstring.used); + memset (log2, 0, sizeof (OTF_Tag) * gstring.used); + memcpy (log2, log, sizeof (OTF_Tag) * logsize); + logsize = gstring.used; + log = log2; + } + } + else + { + logsize = gstring.used; + log = alloca (sizeof (OTF_Tag) * logsize); + memset (log, 0, sizeof (OTF_Tag) * logsize); + } + for (i = 0; i < gstring.used; i++) + { + int idx = gstring.glyphs[i].positioning_type >> 4; + if (idx) + log[i] = otf->gpos->FeatureList.Feature[idx - 1].FeatureTag; + + } free (str); } } @@ -445,11 +485,11 @@ update_seq_area () continue; advance = bmp->advance; } - if (g->positioning_type) + if (g->positioning_type & 0xF) { while (1) { - switch (g->positioning_type) + switch (g->positioning_type & 0xF) { case 1: case 2: { @@ -504,7 +544,7 @@ update_seq_area () } if (i + 1 == gstring.used || gstring.glyphs[i + 1].glyph_id - || ! gstring.glyphs[i + 1].positioning_type) + || ! (gstring.glyphs[i + 1].positioning_type & 0xF)) break; i++, g++; } @@ -530,10 +570,27 @@ update_seq_area () { int size = render_width / FONT_WIDTH; char *buf = alloca (size + 1); + char name[5]; sprintf (buf, "%04X", gstring.glyphs[0].glyph_id); - for (i = 1, x = 4; i < gstring.used; i++, x += 5) - sprintf (buf + x, " %04X", gstring.glyphs[i].glyph_id); + if (log && log[0]) + { + OTF_tag_name (log[0], name); + sprintf (buf + 4, " (%s)", name); + x = 11; + } + else + x = 4; + for (i = 1; i < gstring.used && x + 5 < size; i++, x += 5) + { + sprintf (buf + x, " %04X", gstring.glyphs[i].glyph_id); + if (log && log[i] && x + 11 < size) + { + OTF_tag_name (log[i], name); + sprintf (buf + x + 5, "(%s)", name); + x += 6; + } + } while (x < size) buf[x++] = ' '; buf[x] = '\0';