Font subsetting: Fix subsetting removing some needed ligatures when subsetting Arabic fonts

The GSUB table works by chaining substitution tables. That is later
tables in a Lookup can refer to glyphs output by earlier tables.

The old code did not take this behavior into account, fix that.
This commit is contained in:
Kovid Goyal 2015-06-07 09:47:15 +05:30
parent 22b3586e70
commit e612637282

View File

@ -171,10 +171,11 @@ class GSUBTable(UnknownTable):
self.lookuplist_offset)
def all_substitutions(self, glyph_ids):
ans = set()
glyph_ids = frozenset(glyph_ids)
ans = set(glyph_ids)
for lookup_table in self.lookup_list_table:
for subtable in lookup_table:
gids = subtable.all_substitutions(glyph_ids)
ans |= gids
return ans
glyphs = subtable.all_substitutions(ans)
if glyphs:
ans |= glyphs
return ans - {glyph_ids}