diff --git a/src/OT/Layout/GPOS/SinglePosFormat1.hh b/src/OT/Layout/GPOS/SinglePosFormat1.hh index 2ae692831..1de8a36c4 100644 --- a/src/OT/Layout/GPOS/SinglePosFormat1.hh +++ b/src/OT/Layout/GPOS/SinglePosFormat1.hh @@ -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 ()))) ; diff --git a/src/OT/Layout/GSUB/SingleSubstFormat1.hh b/src/OT/Layout/GSUB/SingleSubstFormat1.hh index cef19cf91..b57be0ad1 100644 --- a/src/OT/Layout/GSUB/SingleSubstFormat1.hh +++ b/src/OT/Layout/GSUB/SingleSubstFormat1.hh @@ -135,38 +135,8 @@ struct SingleSubstFormat1_3 hb_codepoint_t d = deltaGlyphID; hb_codepoint_t mask = get_mask (); - hb_sorted_vector_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)