Skip to content

Commit 7fcb182

Browse files
moyogoDenis Moyogo Jacquerye
authored andcommitted
Raise OpenContourError on open contour
1 parent 35ccac1 commit 7fcb182

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

Lib/booleanOperations/exceptions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,9 @@ class InvalidClippingContourError(InvalidContourError):
1717
"""Rased when a 'clipping' contour is not valid"""
1818

1919

20+
class OpenContourError(BooleanOperationsError):
21+
"""Rased when any input contour is open"""
22+
23+
2024
class ExecutionError(BooleanOperationsError):
2125
"""Raised when clipping execution fails"""

Lib/booleanOperations/flatten.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from fontTools.misc import bezierTools
44
from fontTools.pens.basePen import decomposeQuadraticSegment
55
import pyclipper
6+
from .exceptions import OpenContourError
67

78
"""
89
To Do:
@@ -339,7 +340,8 @@ def endPath(self):
339340
pass
340341

341342
def addPoint(self, pt, segmentType=None, smooth=False, name=None, **kwargs):
342-
assert segmentType != "move"
343+
if segmentType == "move":
344+
raise OpenContourError("Unhandled open contour")
343345
if not self._foundStartingPoint and segmentType is not None:
344346
kwargs['startingPoint'] = self._foundStartingPoint = True
345347
data = InputPoint(

0 commit comments

Comments
 (0)