[subset/GSUB/GPOS] Use more intersected_coverage_glyphs()

This commit is contained in:
Behdad Esfahbod 2022-07-21 11:24:56 -06:00
parent 450d834679
commit d0eb273791
2 changed files with 6 additions and 34 deletions

View File

@ -104,9 +104,11 @@ struct SinglePosFormat1
const hb_set_t &glyphset = *c->plan->glyphset_gsub ();
const hb_map_t &glyph_map = *c->plan->glyph_map;
hb_set_t intersection;
(this+coverage).intersected_coverage_glyphs (&glyphset, &intersection);
auto it =
+ hb_iter (glyphset)
| hb_filter (this+coverage)
+ hb_iter (intersection)
| hb_map_retains_sorting (glyph_map)
| hb_zip (hb_repeat (values.as_array (valueFormat.get_len ())))
;

View File

@ -135,38 +135,8 @@ struct SingleSubstFormat1_3
hb_codepoint_t d = deltaGlyphID;
hb_codepoint_t mask = get_mask ();
hb_sorted_vector_t<hb_codepoint_t> intersection;
if (1)
{
/* Walk the coverage and set together, to bail out when the
* coverage iterator runs over the end of glyphset. Otherwise,
* the coverage may cover many glyphs and we spend a lot of
* time here. Other subtables don't have this problem because
* they zip coverage iterator with some array... */
auto c_iter = hb_iter (this+coverage);
auto s_iter = hb_iter (glyphset);
while (c_iter && s_iter)
{
hb_codepoint_t cv = *c_iter;
hb_codepoint_t sv = *s_iter;
if (cv == sv)
{
intersection.push (cv);
c_iter++;
s_iter++;
}
else if (cv < sv)
c_iter++;
else
s_iter++;
}
}
else
{
+ hb_iter (this+coverage)
| hb_filter (glyphset)
| hb_sink (intersection);
}
hb_set_t intersection;
(this+coverage).intersected_coverage_glyphs (&glyphset, &intersection);
auto it =
+ hb_iter (intersection)