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);
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);
}
}
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);
}
}
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:
{
}
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++;
}
{
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';