[subset] Work around OTS bug with FDSelect format 0

a049b98c88
https://github.com/khaledhosny/ots/pull/31

Fixes https://github.com/behdad/fonttools/issues/138
This commit is contained in:
Behdad Esfahbod 2014-07-23 00:01:28 -04:00
parent 3a10a6546c
commit 3c4b5e0a09

View File

@ -1372,7 +1372,14 @@ def subset_glyphs(self, s):
del csi.file, csi.offsets
if hasattr(font, "FDSelect"):
sel = font.FDSelect
sel.format = None
# XXX We want to set sel.format to None, such that the most compact
# format is selected. However, OTS was broken and couldn't parse
# a FDSelect format 0 that happened before CharStrings. As such,
# always force format 3 until we fix cffLib to always generate
# FDSelect after CharStrings.
# https://github.com/khaledhosny/ots/pull/31
#sel.format = None
sel.format = 3
sel.gidArray = [sel.gidArray[i] for i in indices]
cs.charStrings = dict((g,indices.index(v))
for g,v in cs.charStrings.items()