[glyf] fix rounding of bbox for nested transformed components
when getCoordinates is asked to round, e.g. from recalcBounds, only round the simple glyphs' coordinates; don't do any rounding for the coordinates of component glyphs otherwise rounding errors would accummulate if a composite glyph contains transformed/nested components
This commit is contained in:
parent
e02349c7ce
commit
4ea10eb88f
@ -1258,7 +1258,11 @@ class Glyph(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
if self.numberOfContours > 0:
|
if self.numberOfContours > 0:
|
||||||
return self.coordinates, self.endPtsOfContours, self.flags
|
coordinates = self.coordinates
|
||||||
|
if round is not noRound:
|
||||||
|
coordinates = GlyphCoordinates(coordinates)
|
||||||
|
coordinates.toInt(round=round)
|
||||||
|
return coordinates, self.endPtsOfContours, self.flags
|
||||||
elif self.isComposite():
|
elif self.isComposite():
|
||||||
# it's a composite
|
# it's a composite
|
||||||
allCoords = GlyphCoordinates()
|
allCoords = GlyphCoordinates()
|
||||||
@ -1276,7 +1280,6 @@ class Glyph(object):
|
|||||||
% 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