[ttVarGlyphSet] Set glyph height

Untested
This commit is contained in:
Behdad Esfahbod 2022-08-13 15:39:13 -06:00
parent 617e6ff3c7
commit 226761c8ed

View File

@ -168,8 +168,9 @@ def setCoordinates(glyph, coord, glyfTable):
glyph.recalcBounds(glyfTable)
horizontalAdvanceWidth = rightSideX - leftSideX
verticalAdvanceWidth = topSideY - bottomSideY
leftSideBearing = glyph.xMin - leftSideX
return horizontalAdvanceWidth, leftSideBearing
return horizontalAdvanceWidth, leftSideBearing, verticalAdvanceWidth
class _TTVarGlyphGlyf(object):
@ -206,8 +207,8 @@ class _TTVarGlyphGlyf(object):
from copy import copy
glyph = copy(glyf[self._glyphName]) # Shallow copy
horizontalAdvanceWidth, leftSideBearing = setCoordinates(glyph, coordinates, glyf)
horizontalAdvanceWidth, leftSideBearing, verticalAdvanceWidth = setCoordinates(glyph, coordinates, glyf)
self.width = horizontalAdvanceWidth
# XXX height!
self.height = verticalAdvanceWidth
offset = leftSideBearing - glyph.xMin if hasattr(glyph, "xMin") else 0
glyph.draw(pen, glyf, offset)