return gidx;
}
+static void
+print_anchor (char *head, OTF_Anchor *anchor)
+{
+ if (anchor->AnchorFormat == 1)
+ fprintf (stderr, " %s(X:%d Y:%d)", head,
+ anchor->XCoordinate, anchor->YCoordinate);
+ else if (anchor->AnchorFormat == 2)
+ fprintf (stderr, " %s(X:%d Y:%d AP:%d)", head,
+ anchor->XCoordinate, anchor->YCoordinate,
+ anchor->f.f1.AnchorPoint);
+ else
+ fprintf (stderr, " %s(X:%d Y:%d +alpha)", head,
+ anchor->XCoordinate, anchor->YCoordinate);
+}
+
+static void
+print_glyph_positioning (OTF_Glyph *g, int type)
+{
+ if (type)
+ fprintf (stderr, " %0X=", g->glyph_id);
+ switch (g->positioning_type)
+ {
+ case 1: case 2:
+ {
+ int format = g->f.f1.format;
+
+ if (format & OTF_XPlacement)
+ fprintf (stderr, "X:%d", g->f.f1.value->XPlacement);
+ if (format & OTF_XPlaDevice)
+ fprintf (stderr, "+alpha");
+ if (format & OTF_YPlacement)
+ fprintf (stderr, "Y:%d", g->f.f1.value->YPlacement);
+ if (format & OTF_YPlaDevice)
+ fprintf (stderr, "+alpha");
+ if (format & OTF_XAdvance)
+ fprintf (stderr, "X+:%d", g->f.f1.value->XAdvance);
+ if (format & OTF_XAdvDevice)
+ fprintf (stderr, "+alpha");
+ break;
+ }
+ case 3:
+ print_anchor ("entry", g->f.f3.entry_anchor);
+ print_anchor ("exit", g->f.f3.entry_anchor);
+ break;
+ case 4:
+ print_anchor ("mark", g->f.f4.mark_anchor);
+ print_anchor ("base", g->f.f4.base_anchor);
+ break;
+ case 5:
+ print_anchor ("mark", g->f.f5.mark_anchor);
+ print_anchor ("lig", g->f.f5.ligature_anchor);
+ break;
+ case 6:
+ print_anchor ("mark1", g->f.f6.mark1_anchor);
+ print_anchor ("mark2", g->f.f6.mark2_anchor);
+ break;
+ }
+}
+
static int
lookup_gpos (OTF_LookupList *lookup_list, unsigned lookup_list_index,
OTF_GlyphString *gstring, int gidx, int accumulate)
int i;
if (debug_flag)
- fprintf (stderr, "[GPOS] glyph:%X lookup(%d)",
+ fprintf (stderr, "[GPOS] glyph:%04X lookup:%02d",
g->glyph_id, lookup_list_index);
if (IGNORED_GLYPH (g, flag))
{
if (debug_flag)
- fprintf (stderr, " ignored glyph\n");
+ fprintf (stderr, " glyph ignored\n");
return (gidx + 1);
}
}
if (debug_flag)
- fprintf (stderr, " type(%d)", lookup_type);
+ fprintf (stderr, "/%d", lookup_type);
if (subtable->Coverage.offset)
{
coverage_idx = get_coverage_index (&subtable->Coverage,
g->positioning_type = positioning_type;
g->f.f1.format = format;
g->f.f1.value = value;
+ if (debug_flag)
+ print_glyph_positioning (g, 0);
gidx++;
break;
g->positioning_type = lookup_type;
g->f.f2.format = pair1->ValueFormat1;
g->f.f2.value = &set->PairValueRecord[j].Value1;
+ if (debug_flag)
+ print_glyph_positioning (g, 1);
}
gidx = next_gidx;
g = nextg;
g->positioning_type = lookup_type;
g->f.f2.format = pair1->ValueFormat2;
g->f.f2.value = &set->PairValueRecord[j].Value2;
- gidx++;
+ if (debug_flag)
+ print_glyph_positioning (g, 2);
}
break;
}
g->f.f2.format = pair2->ValueFormat1;
g->f.f2.value
= &pair2->Class1Record[class1].Class2Record[class2].Value1;
+ if (debug_flag)
+ print_glyph_positioning (g, 1);
}
gidx = next_gidx;
g = nextg;
g->f.f2.format = pair2->ValueFormat2;
g->f.f2.value
= &pair2->Class1Record[class1].Class2Record[class2].Value2;
- gidx++;
+ if (debug_flag)
+ print_glyph_positioning (g, 2);
}
}
}
{
OTF_GPOS_Cursive1 *cursive1 = &subtable->u.cursive1;
- if (accumulate && g->positioning_type)
- {
- gidx = gstring_insert_for_gpos (gstring, gidx);
- g = gstring->glyphs + gidx;
- }
g->positioning_type = lookup_type;
g->f.f3.entry_anchor
= &cursive1->EntryExitRecord[coverage_idx].EntryAnchor;
g->f.f3.exit_anchor
= &cursive1->EntryExitRecord[coverage_idx].ExitAnchor;
+ if (debug_flag)
+ print_glyph_positioning (g, 0);
gidx++;
}
break;
mark_record = mark_base1->MarkArray.MarkRecord + coverage_idx;
base_record
= mark_base1->BaseArray.AnchorRecord + coverage_idx_base;
- if (accumulate && g->positioning_type)
- {
- gidx = gstring_insert_for_gpos (gstring, gidx);
- g = gstring->glyphs + gidx;
- }
g->f.f4.mark_anchor = &mark_record->MarkAnchor;
g->f.f4.base_anchor
= &base_record->Anchor[mark_record->Class];
g->positioning_type = lookup_type;
+ if (debug_flag)
+ print_glyph_positioning (g, 0);
gidx++;
}
break;
if (lig_anchor[mark_record->Class].AnchorFormat
&& num_class[mark_record->Class]-- == 0)
{
- if (accumulate && g->positioning_type)
- {
- gidx = gstring_insert_for_gpos (gstring, gidx);
- g = gstring->glyphs + gidx;
- }
g->positioning_type = lookup_type;
g->f.f5.mark_anchor = &mark_record->MarkAnchor;
g->f.f5.ligature_anchor = lig_anchor + mark_record->Class;
+ if (debug_flag)
+ print_glyph_positioning (g, 0);
gidx++;
break;
}
mark1_record = mark_mark1->Mark1Array.MarkRecord + coverage_idx;
mark2_record
= mark_mark1->Mark2Array.AnchorRecord + coverage_idx_base;
- if (accumulate && g->positioning_type)
- {
- gidx = gstring_insert_for_gpos (gstring, gidx);
- g = gstring->glyphs + gidx;
- }
g->f.f6.mark1_anchor = &mark1_record->MarkAnchor;
g->f.f6.mark2_anchor
= &mark2_record->Anchor[mark1_record->Class];
g->positioning_type = lookup_type;
+ if (debug_flag)
+ print_glyph_positioning (g, 0);
gidx++;
break;
}
gidx++;
}
else if (debug_flag)
- fprintf (stderr, " match %d glyphs\n", gidx - orig_gidx);
+ fprintf (stderr, "\n");
return gidx;
}