summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRasmus Andersson <rasmus@notion.se>2018-01-24 06:05:54 +0300
committerRasmus Andersson <rasmus@notion.se>2018-01-24 06:05:54 +0300
commit0d7d370104a61ca831b8b04bba9348aed45ae6c5 (patch)
treef5cf0b78b7007eb9294175c3c0c4a46a9ff94a87
parent632609fc65203c5a345dc1be793e06181ca8b8ce (diff)
downloadinter-0d7d370104a61ca831b8b04bba9348aed45ae6c5.tar.xz
booleanOperations library: remove unreachable break and add exception instead of assertion, as done in upstream
-rw-r--r--misc/pylib/booleanOperations/exceptions.py4
-rw-r--r--misc/pylib/booleanOperations/flatten.pyx5
2 files changed, 7 insertions, 2 deletions
diff --git a/misc/pylib/booleanOperations/exceptions.py b/misc/pylib/booleanOperations/exceptions.py
index 23028b207..38b72e0b2 100644
--- a/misc/pylib/booleanOperations/exceptions.py
+++ b/misc/pylib/booleanOperations/exceptions.py
@@ -19,3 +19,7 @@ class InvalidClippingContourError(InvalidContourError):
class ExecutionError(BooleanOperationsError):
"""Raised when clipping execution fails"""
+
+
+class OpenContourError(BooleanOperationsError):
+ """Raised when any input contour is open"""
diff --git a/misc/pylib/booleanOperations/flatten.pyx b/misc/pylib/booleanOperations/flatten.pyx
index 85b54a03d..606b2005a 100644
--- a/misc/pylib/booleanOperations/flatten.pyx
+++ b/misc/pylib/booleanOperations/flatten.pyx
@@ -3,6 +3,7 @@ import math
from fontTools.misc import bezierTools
from fontTools.pens.basePen import decomposeQuadraticSegment
import pyclipper
+from .exceptions import OpenContourError
"""
To Do:
@@ -343,7 +344,8 @@ class ContourPointDataPen:
pass
def addPoint(self, pt, segmentType=None, smooth=False, name=None, **kwargs):
- assert segmentType != "move"
+ if segmentType == "move":
+ raise OpenContourError("Unhandled open contour")
if not self._foundStartingPoint and segmentType is not None:
kwargs['startingPoint'] = self._foundStartingPoint = True
data = InputPoint(
@@ -373,7 +375,6 @@ def _prepPointsForSegments(points):
point = points.pop()
points.insert(0, point)
continue
- break
def _copyPoints(points):