[woff2] make dummy glyphOrder based on gids when decompiling glyf table
Using TTFont.getGlyphOrder() would also require to decompile post and cmap tables. But we don't need the actual glyph names in order to apply the WOFF2 glyf transform.
This commit is contained in:
parent
07458f62dd
commit
ed03d57170
@ -226,7 +226,14 @@ class WOFF2Writer(SFNTWriter):
|
||||
"""
|
||||
if self.sfntVersion == "OTTO":
|
||||
return
|
||||
for tag in ('maxp', 'head', 'loca', 'glyf'):
|
||||
|
||||
# make up glyph names required to decompile glyf table
|
||||
self._decompileTable('maxp')
|
||||
numGlyphs = self.ttFont['maxp'].numGlyphs
|
||||
glyphOrder = ['.notdef'] + ["glyph%.5d" % i for i in range(1, numGlyphs)]
|
||||
self.ttFont.setGlyphOrder(glyphOrder)
|
||||
|
||||
for tag in ('head', 'loca', 'glyf'):
|
||||
self._decompileTable(tag)
|
||||
self.ttFont['glyf'].padding = padding
|
||||
for tag in ('glyf', 'loca'):
|
||||
|
@ -611,9 +611,11 @@ class WOFF2GlyfTableTest(unittest.TestCase):
|
||||
reader = WOFF2Reader(infile)
|
||||
cls.transformedGlyfData = reader.tables['glyf'].loadData(
|
||||
reader.transformBuffer)
|
||||
cls.glyphOrder = ['.notdef'] + ["glyph%.5d" % i for i in range(1, font['maxp'].numGlyphs)]
|
||||
|
||||
def setUp(self):
|
||||
self.font = font = ttLib.TTFont(recalcBBoxes=False, recalcTimestamp=False)
|
||||
font.setGlyphOrder(self.glyphOrder)
|
||||
font['head'] = ttLib.getTableClass('head')()
|
||||
font['maxp'] = ttLib.getTableClass('maxp')()
|
||||
font['loca'] = WOFF2LocaTable()
|
||||
|
Loading…
x
Reference in New Issue
Block a user