tweaks reflecting review
This commit is contained in:
parent
f028c75d2a
commit
6ca384fecd
@ -1790,11 +1790,14 @@ def subset_glyphs(self, s):
|
|||||||
return bool(self.variations)
|
return bool(self.variations)
|
||||||
|
|
||||||
def _remap_index_map(s, varidx_map, table_map):
|
def _remap_index_map(s, varidx_map, table_map):
|
||||||
map = {k:varidx_map[v] for k,v in table_map.mapping.items()}
|
map_ = {k:varidx_map[v] for k,v in table_map.mapping.items()}
|
||||||
|
# Emptied glyphs are remapped to:
|
||||||
|
# if GID <= last retained GID, 0/0: delta set for 0/0 is expected to exist & zeros compress well
|
||||||
|
# if GID > last retained GID, major/minor of the last retained glyph: will be optimized out by table compiler
|
||||||
last_idx = varidx_map[table_map.mapping[s.last_retained_glyph]]
|
last_idx = varidx_map[table_map.mapping[s.last_retained_glyph]]
|
||||||
for g,i in s.reverseEmptiedGlyphMap.items():
|
for g,i in s.reverseEmptiedGlyphMap.items():
|
||||||
map[g] = last_idx if i > s.last_retained_order else 0
|
map_[g] = last_idx if i > s.last_retained_order else 0
|
||||||
return map
|
return map_
|
||||||
|
|
||||||
@_add_method(ttLib.getTableClass('HVAR'))
|
@_add_method(ttLib.getTableClass('HVAR'))
|
||||||
def subset_glyphs(self, s):
|
def subset_glyphs(self, s):
|
||||||
|
@ -218,9 +218,8 @@ def VarStore_subset_varidxes(self, varIdxes, optimize=True, retainFirstMap=False
|
|||||||
items = data.Item
|
items = data.Item
|
||||||
newItems = []
|
newItems = []
|
||||||
if major == 0 and retainFirstMap:
|
if major == 0 and retainFirstMap:
|
||||||
zeros = [0] * len(items[0])
|
|
||||||
for minor in range(len(items)):
|
for minor in range(len(items)):
|
||||||
newItems.append(items[minor] if minor in usedMinors else zeros)
|
newItems.append(items[minor] if minor in usedMinors else [0] * len(items[minor]))
|
||||||
varDataMap[minor] = minor
|
varDataMap[minor] = minor
|
||||||
else:
|
else:
|
||||||
for minor in sorted(usedMinors):
|
for minor in sorted(usedMinors):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user