[subset] in SingleSubst subsetting, check for substitute in glyphset

That matches what fonttools does and allows for specifying exact
glyphset for subset.
This commit is contained in:
Behdad Esfahbod 2019-08-29 13:40:46 -07:00
parent 499029644f
commit 38f95baf6b
1 changed files with 6 additions and 2 deletions

View File

@ -111,8 +111,11 @@ struct SingleSubstFormat1
+ hb_iter (this+coverage)
| hb_filter (glyphset)
| hb_map_retains_sorting ([&] (hb_codepoint_t g) {
return hb_codepoint_pair_t (glyph_map[g],
glyph_map[(g + delta) & 0xFFFF]); })
return hb_codepoint_pair_t (g,
(g + delta) & 0xFFFF); })
| hb_filter (glyphset, hb_second)
| hb_map_retains_sorting ([&] (hb_codepoint_pair_t p) -> hb_codepoint_pair_t
{ return hb_pair (glyph_map[p.first], glyph_map[p.second]); })
;
bool ret = bool (it);
@ -208,6 +211,7 @@ struct SingleSubstFormat2
auto it =
+ hb_zip (this+coverage, substitute)
| hb_filter (glyphset, hb_first)
| hb_filter (glyphset, hb_second)
| hb_map_retains_sorting ([&] (hb_pair_t<hb_codepoint_t, const GlyphID &> p) -> hb_codepoint_pair_t
{ return hb_pair (glyph_map[p.first], glyph_map[p.second]); })
;