[ttVarGlyphSet-CFF] Handle font without advance variation

This commit is contained in:
Behdad Esfahbod 2022-08-26 21:24:24 -06:00
parent a949380b4a
commit f5a1d0ba10

View File

@ -205,13 +205,14 @@ class _TTVarGlyphCFF(_TTVarGlyph):
self._glyph.draw(pen, blender)
self.width = self._ttFont['hmtx'][self._glyphName][0]
hvar = self._ttFont['HVAR'].table
varidx = self._ttFont.getGlyphID(self._glyphName)
if hvar.AdvWidthMap is not None:
varidx = hvar.AdvWidthMap.mapping[self._glyphName]
vsInstancer = VarStoreInstancer(hvar.VarStore, self._ttFont['fvar'].axes, self._location)
delta = vsInstancer[varidx]
self.width += otRound(delta)
if 'HVAR' in self._ttFont:
hvar = self._ttFont['HVAR'].table
varidx = self._ttFont.getGlyphID(self._glyphName)
if hvar.AdvWidthMap is not None:
varidx = hvar.AdvWidthMap.mapping[self._glyphName]
vsInstancer = VarStoreInstancer(hvar.VarStore, self._ttFont['fvar'].axes, self._location)
delta = vsInstancer[varidx]
self.width += otRound(delta)
class _TTVarGlyphGlyf(_TTVarGlyph):