In calcIntBounds(), round values
The glyph coordinates in glyf table are going to be rounded when writing out, so we should use the same mode of conversion to integers. Otherwise the xMin of a glyph might end up being different from its actual minimum X.
This commit is contained in:
parent
d1424e9d5a
commit
e53764a16d
@ -21,13 +21,9 @@ def calcBounds(array):
|
|||||||
def calcIntBounds(array):
|
def calcIntBounds(array):
|
||||||
"""Return the integer bounding rectangle of a 2D points array as a
|
"""Return the integer bounding rectangle of a 2D points array as a
|
||||||
tuple: (xMin, yMin, xMax, yMax)
|
tuple: (xMin, yMin, xMax, yMax)
|
||||||
|
Values are rounded to closest integer.
|
||||||
"""
|
"""
|
||||||
xMin, yMin, xMax, yMax = calcBounds(array)
|
return tuple(int(round(v)) for v in calcBounds(array))
|
||||||
xMin = int(math.floor(xMin))
|
|
||||||
xMax = int(math.ceil(xMax))
|
|
||||||
yMin = int(math.floor(yMin))
|
|
||||||
yMax = int(math.ceil(yMax))
|
|
||||||
return xMin, yMin, xMax, yMax
|
|
||||||
|
|
||||||
|
|
||||||
def updateBounds(bounds, p, min=min, max=max):
|
def updateBounds(bounds, p, min=min, max=max):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user