[gvar] Avoid decompiling glyphs that don't have variations

This commit is contained in:
Behdad Esfahbod 2022-12-07 14:50:15 -07:00
parent 5a0dc4bc8d
commit 3a258573af

View File

@ -95,9 +95,12 @@ class table__g_v_a_r(DefaultTable.DefaultTable):
result = [] result = []
glyf = ttFont['glyf'] glyf = ttFont['glyf']
for glyphName in ttFont.getGlyphOrder(): for glyphName in ttFont.getGlyphOrder():
variations = self.variations.get(glyphName, [])
if not variations:
result.append(b"")
continue
glyph = glyf[glyphName] glyph = glyf[glyphName]
pointCount = self.getNumPoints_(glyph) pointCount = self.getNumPoints_(glyph)
variations = self.variations.get(glyphName, [])
result.append(compileGlyph_(variations, pointCount, result.append(compileGlyph_(variations, pointCount,
axisTags, sharedCoordIndices)) axisTags, sharedCoordIndices))
return result return result