Various buglets revealed by test cases.
git-svn-id: http://svn.robofab.com/branches/ufo3k@347 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
This commit is contained in:
parent
f5326ae801
commit
dfdbe61945
@ -862,12 +862,16 @@ def _buildOutlineContour(pen, (attrs, children), formatVersion, identifiers):
|
|||||||
identifiers.add(identifier)
|
identifiers.add(identifier)
|
||||||
# try to pass the identifier attribute
|
# try to pass the identifier attribute
|
||||||
try:
|
try:
|
||||||
pen.beginPath(identifier)
|
pen.beginPath(identifier=identifier)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
pen.beginPath()
|
pen.beginPath()
|
||||||
raise DeprecationWarning("The beginPath method needs an identifier kwarg. The contour's identifier value has been discarded.")
|
raise DeprecationWarning("The beginPath method needs an identifier kwarg. The contour's identifier value has been discarded.")
|
||||||
# points
|
# points
|
||||||
if children:
|
if children:
|
||||||
|
# make sure that only points are here
|
||||||
|
for e, d, c in children:
|
||||||
|
if e != "point":
|
||||||
|
raise GlifLibError("The contour element contains an unknown element: %s" % e)
|
||||||
# loop through the points very quickly to make sure that the number of off-curves is correct
|
# loop through the points very quickly to make sure that the number of off-curves is correct
|
||||||
_validateSegmentStructures(children)
|
_validateSegmentStructures(children)
|
||||||
# interpret the points
|
# interpret the points
|
||||||
@ -977,6 +981,8 @@ def _buildOutlinePoints(pen, children, formatVersion, identifiers):
|
|||||||
if smooth not in pointSmoothOptions:
|
if smooth not in pointSmoothOptions:
|
||||||
raise GlifLibError("Unknown point smooth value: %s" % smooth)
|
raise GlifLibError("Unknown point smooth value: %s" % smooth)
|
||||||
smooth = smooth == "yes"
|
smooth = smooth == "yes"
|
||||||
|
if smooth and segmentType not in ["curve"]:
|
||||||
|
raise GlifLibError("smooth attribute set in a %s point." % segmentType)
|
||||||
# name is not required
|
# name is not required
|
||||||
name = attrs.get("name")
|
name = attrs.get("name")
|
||||||
# identifier is not required but it is not part of format 1
|
# identifier is not required but it is not part of format 1
|
||||||
@ -1152,6 +1158,8 @@ class GLIFPointPen(AbstractPointPen):
|
|||||||
if segmentType is not None:
|
if segmentType is not None:
|
||||||
attrs.append(("type", segmentType))
|
attrs.append(("type", segmentType))
|
||||||
if smooth:
|
if smooth:
|
||||||
|
if segmentType not in ["curve"]:
|
||||||
|
raise GlifLibError("can't set smooth in a %s point." % segmentType)
|
||||||
attrs.append(("smooth", "yes"))
|
attrs.append(("smooth", "yes"))
|
||||||
if name is not None:
|
if name is not None:
|
||||||
attrs.append(("name", name))
|
attrs.append(("name", name))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user