Update hb-ot-vorg-table and hb-ot-layout-common to use the updated subset plan api.

This commit is contained in:
Garret Rieger 2019-01-25 18:04:41 -08:00
parent 4af3be6ef8
commit 925be29223
2 changed files with 21 additions and 13 deletions

View File

@ -1222,7 +1222,7 @@ struct ClassDefFormat1
bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
const hb_set_t &glyphset = *c->plan->glyphset;
const hb_set_t &glyphset = *c->plan->glyphset ();
const hb_map_t &glyph_map = *c->plan->glyph_map;
hb_vector_t<GlyphID> glyphs;
hb_vector_t<HBUINT16> klasses;
@ -1369,7 +1369,7 @@ struct ClassDefFormat2
bool subset (hb_subset_context_t *c) const
{
TRACE_SUBSET (this);
const hb_set_t &glyphset = *c->plan->glyphset;
const hb_set_t &glyphset = *c->plan->glyphset ();
const hb_map_t &glyph_map = *c->plan->glyph_map;
hb_vector_t<GlyphID> glyphs;
hb_vector_t<HBUINT16> klasses;

View File

@ -110,21 +110,29 @@ struct VORG
/* count the number of glyphs to be included in the subset table */
hb_vector_t<VertOriginMetric> subset_metrics;
subset_metrics.init ();
unsigned int glyph = 0;
hb_codepoint_t old_glyph = HB_SET_VALUE_INVALID;
unsigned int i = 0;
while ((glyph < plan->glyphs.length) && (i < vertYOrigins.len))
while (i < vertYOrigins.len
&& plan->glyphset ()->next (&old_glyph))
{
if (plan->glyphs[glyph] > vertYOrigins[i].glyph)
i++;
else if (plan->glyphs[glyph] < vertYOrigins[i].glyph)
glyph++;
else
while (old_glyph > vertYOrigins[i].glyph)
{
VertOriginMetric *metrics = subset_metrics.push ();
metrics->glyph.set (glyph);
metrics->vertOriginY.set (vertYOrigins[i].vertOriginY);
glyph++;
i++;
if (i >= vertYOrigins.len)
break;
}
if (old_glyph == vertYOrigins[i].glyph)
{
hb_codepoint_t new_glyph;
if (plan->new_gid_for_old_gid (old_glyph, &new_glyph))
{
VertOriginMetric *metrics = subset_metrics.push ();
metrics->glyph.set (new_glyph);
metrics->vertOriginY.set (vertYOrigins[i].vertOriginY);
}
}
}