[GX] Fix phantom points in interpolate.py

This commit is contained in:
Behdad Esfahbod 2015-06-27 19:15:18 -07:00
parent e05db5c75f
commit 63a6b1c747

View File

@ -110,15 +110,21 @@ def GetCoordinates(font, glyphName):
coord = [c.getComponentInfo()[1][-2:] for c in glyph.components] coord = [c.getComponentInfo()[1][-2:] for c in glyph.components]
else: else:
coord = [c for c in glyph.getCoordinates(glyphTable)[0]] coord = [c for c in glyph.getCoordinates(glyphTable)[0]]
# Add phantom points for (left, right, top, bottom) side bearing. # Add phantom points for (left, right, top, bottom) positions.
horizontalAdvanceWidth, leftSideBearing = font["hmtx"].metrics[glyphName] horizontalAdvanceWidth, leftSideBearing = font["hmtx"].metrics[glyphName]
rightSideBearing = (
horizontalAdvanceWidth - leftSideBearing - (glyph.xMax - glyph.xMin))
# TODO: Not sure if top and bottom side bearing are correct. leftSideX = glyph.xMin - leftSideBearing
topSideBearing = glyph.yMax rightSideX = leftSideX + horizontalAdvanceWidth
bottomSideBearing = -glyph.yMin
coord.extend([(leftSideBearing, 0), (rightSideBearing, 0), # XXX these are incorrect. Load vmtx and fix.
(0, topSideBearing), (0, bottomSideBearing)]) topSideY = glyph.yMax
bottomSideY = -glyph.yMin
coord.extend([(leftSideX, 0),
(rightSideX, 0),
(0, topSideY),
(0, bottomSideY)])
return coord return coord