made calculating bounding box handle empty coordinate arrays gracefully
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@117 4cde692c-a291-49d1-8350-778aa11640f8
This commit is contained in:
parent
f6b1563e0d
commit
d5b65a4ed1
@ -543,8 +543,11 @@ class Glyph:
|
||||
|
||||
def recalcBounds(self, glyfTable):
|
||||
coordinates, endPts, flags = self.getCoordinates(glyfTable)
|
||||
if len(coordinates) > 0:
|
||||
self.xMin, self.yMin = Numeric.minimum.reduce(coordinates)
|
||||
self.xMax, self.yMax = Numeric.maximum.reduce(coordinates)
|
||||
else:
|
||||
self.xMin, self.yMin, self.xMax, self.yMax = (0, 0, 0, 0)
|
||||
|
||||
def isComposite(self):
|
||||
return self.numberOfContours == -1
|
||||
@ -660,7 +663,7 @@ class GlyphComponent:
|
||||
if self.flags & ARGS_ARE_XY_VALUES:
|
||||
self.x, self.y = struct.unpack(">bb", data[:2])
|
||||
else:
|
||||
x, y = struct.unpack(">BB", data[:4])
|
||||
x, y = struct.unpack(">BB", data[:2])
|
||||
self.firstPt, self.secondPt = int(x), int(y)
|
||||
data = data[2:]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user