Fixed getCoordinates() so it works correctly with "empty" components.
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@108 4cde692c-a291-49d1-8350-778aa11640f8
This commit is contained in:
parent
cb317bfad3
commit
e0433b907d
@ -570,7 +570,8 @@ class Glyph:
|
|||||||
move = compo.x, compo.y
|
move = compo.x, compo.y
|
||||||
|
|
||||||
if not hasattr(compo, "transform"):
|
if not hasattr(compo, "transform"):
|
||||||
coordinates = coordinates + move # I love NumPy!
|
if len(coordinates) > 0:
|
||||||
|
coordinates = coordinates + move # I love NumPy!
|
||||||
else:
|
else:
|
||||||
apple_way = compo.flags & SCALED_COMPONENT_OFFSET
|
apple_way = compo.flags & SCALED_COMPONENT_OFFSET
|
||||||
ms_way = compo.flags & UNSCALED_COMPONENT_OFFSET
|
ms_way = compo.flags & UNSCALED_COMPONENT_OFFSET
|
||||||
@ -590,14 +591,15 @@ class Glyph:
|
|||||||
# due to the transformation the coords. are now floats;
|
# due to the transformation the coords. are now floats;
|
||||||
# round them off nicely, and cast to short
|
# round them off nicely, and cast to short
|
||||||
coordinates = Numeric.floor(coordinates + 0.5).astype(Numeric.Int16)
|
coordinates = Numeric.floor(coordinates + 0.5).astype(Numeric.Int16)
|
||||||
if allCoords is None:
|
if allCoords is None or len(allCoords) == 0:
|
||||||
allCoords = coordinates
|
allCoords = coordinates
|
||||||
allEndPts = endPts
|
allEndPts = endPts
|
||||||
allFlags = flags
|
allFlags = flags
|
||||||
else:
|
else:
|
||||||
allEndPts = allEndPts + (Numeric.array(endPts) + len(allCoords)).tolist()
|
allEndPts = allEndPts + (Numeric.array(endPts) + len(allCoords)).tolist()
|
||||||
allCoords = Numeric.concatenate((allCoords, coordinates))
|
if len(coordinates) > 0:
|
||||||
allFlags = Numeric.concatenate((allFlags, flags))
|
allCoords = Numeric.concatenate((allCoords, coordinates))
|
||||||
|
allFlags = Numeric.concatenate((allFlags, flags))
|
||||||
return allCoords, allEndPts, allFlags
|
return allCoords, allEndPts, allFlags
|
||||||
else:
|
else:
|
||||||
return Numeric.array([], Numeric.Int16), [], Numeric.array([], Numeric.Int8)
|
return Numeric.array([], Numeric.Int16), [], Numeric.array([], Numeric.Int8)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user