[glyf] fix recalcBounds of transformed components with unrounded coordinates
Fixes https://github.com/googlefonts/fontc/issues/1206
This commit is contained in:
parent
6ea7f5e2a6
commit
ec5d41929f
@ -1187,7 +1187,7 @@ class Glyph(object):
|
|||||||
):
|
):
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
coords, endPts, flags = self.getCoordinates(glyfTable)
|
coords, endPts, flags = self.getCoordinates(glyfTable, round=otRound)
|
||||||
self.xMin, self.yMin, self.xMax, self.yMax = coords.calcIntBounds()
|
self.xMin, self.yMin, self.xMax, self.yMax = coords.calcIntBounds()
|
||||||
except NotImplementedError:
|
except NotImplementedError:
|
||||||
pass
|
pass
|
||||||
@ -1241,7 +1241,7 @@ class Glyph(object):
|
|||||||
else:
|
else:
|
||||||
return self.numberOfContours == -1
|
return self.numberOfContours == -1
|
||||||
|
|
||||||
def getCoordinates(self, glyfTable):
|
def getCoordinates(self, glyfTable, round=noRound):
|
||||||
"""Return the coordinates, end points and flags
|
"""Return the coordinates, end points and flags
|
||||||
|
|
||||||
This method returns three values: A :py:class:`GlyphCoordinates` object,
|
This method returns three values: A :py:class:`GlyphCoordinates` object,
|
||||||
@ -1267,13 +1267,16 @@ class Glyph(object):
|
|||||||
for compo in self.components:
|
for compo in self.components:
|
||||||
g = glyfTable[compo.glyphName]
|
g = glyfTable[compo.glyphName]
|
||||||
try:
|
try:
|
||||||
coordinates, endPts, flags = g.getCoordinates(glyfTable)
|
coordinates, endPts, flags = g.getCoordinates(
|
||||||
|
glyfTable, round=round
|
||||||
|
)
|
||||||
except RecursionError:
|
except RecursionError:
|
||||||
raise ttLib.TTLibError(
|
raise ttLib.TTLibError(
|
||||||
"glyph '%s' contains a recursive component reference"
|
"glyph '%s' contains a recursive component reference"
|
||||||
% compo.glyphName
|
% compo.glyphName
|
||||||
)
|
)
|
||||||
coordinates = GlyphCoordinates(coordinates)
|
coordinates = GlyphCoordinates(coordinates)
|
||||||
|
coordinates.toInt(round=round)
|
||||||
if hasattr(compo, "firstPt"):
|
if hasattr(compo, "firstPt"):
|
||||||
# component uses two reference points: we apply the transform _before_
|
# component uses two reference points: we apply the transform _before_
|
||||||
# computing the offset between the points
|
# computing the offset between the points
|
||||||
|
Loading…
x
Reference in New Issue
Block a user