[ttVarGlyphSet] Set glyph height
Untested
This commit is contained in:
parent
617e6ff3c7
commit
226761c8ed
@ -168,8 +168,9 @@ def setCoordinates(glyph, coord, glyfTable):
|
|||||||
glyph.recalcBounds(glyfTable)
|
glyph.recalcBounds(glyfTable)
|
||||||
|
|
||||||
horizontalAdvanceWidth = rightSideX - leftSideX
|
horizontalAdvanceWidth = rightSideX - leftSideX
|
||||||
|
verticalAdvanceWidth = topSideY - bottomSideY
|
||||||
leftSideBearing = glyph.xMin - leftSideX
|
leftSideBearing = glyph.xMin - leftSideX
|
||||||
return horizontalAdvanceWidth, leftSideBearing
|
return horizontalAdvanceWidth, leftSideBearing, verticalAdvanceWidth
|
||||||
|
|
||||||
|
|
||||||
class _TTVarGlyphGlyf(object):
|
class _TTVarGlyphGlyf(object):
|
||||||
@ -206,8 +207,8 @@ class _TTVarGlyphGlyf(object):
|
|||||||
|
|
||||||
from copy import copy
|
from copy import copy
|
||||||
glyph = copy(glyf[self._glyphName]) # Shallow copy
|
glyph = copy(glyf[self._glyphName]) # Shallow copy
|
||||||
horizontalAdvanceWidth, leftSideBearing = setCoordinates(glyph, coordinates, glyf)
|
horizontalAdvanceWidth, leftSideBearing, verticalAdvanceWidth = setCoordinates(glyph, coordinates, glyf)
|
||||||
self.width = horizontalAdvanceWidth
|
self.width = horizontalAdvanceWidth
|
||||||
# XXX height!
|
self.height = verticalAdvanceWidth
|
||||||
offset = leftSideBearing - glyph.xMin if hasattr(glyph, "xMin") else 0
|
offset = leftSideBearing - glyph.xMin if hasattr(glyph, "xMin") else 0
|
||||||
glyph.draw(pen, glyf, offset)
|
glyph.draw(pen, glyf, offset)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user