Fix for subsetting HVAR tables that have an AdvanceWidthMap when the --retain-gid option is used. Needed to make subset_test.py::test_retain_gids_cff2 tests pass.

This commit is contained in:
ReadRoberts 2019-02-20 15:33:45 -08:00 committed by Cosimo Lupo
parent 1cb9b81861
commit 635537604d

View File

@ -1798,17 +1798,20 @@ def subset_glyphs(self, s):
used = set()
if table.AdvWidthMap:
table.AdvWidthMap.mapping = _dict_subset(table.AdvWidthMap.mapping, s.glyphs)
if not s.options.retain_gids:
table.AdvWidthMap.mapping = _dict_subset(table.AdvWidthMap.mapping, s.glyphs)
used.update(table.AdvWidthMap.mapping.values())
else:
assert table.LsbMap is None and table.RsbMap is None, "File a bug."
used.update(s.reverseOrigGlyphMap.values())
if table.LsbMap:
table.LsbMap.mapping = _dict_subset(table.LsbMap.mapping, s.glyphs)
if not s.options.retain_gids:
table.LsbMap.mapping = _dict_subset(table.LsbMap.mapping, s.glyphs)
used.update(table.LsbMap.mapping.values())
if table.RsbMap:
table.RsbMap.mapping = _dict_subset(table.RsbMap.mapping, s.glyphs)
if not s.options.retain_gids:
table.RsbMap.mapping = _dict_subset(table.RsbMap.mapping, s.glyphs)
used.update(table.RsbMap.mapping.values())
varidx_map = varStore.VarStore_subset_varidxes(table.VarStore, used)