1
1
mirror of https://github.com/rsms/inter.git synced 2024-12-27 09:33:19 +03:00

booleanOperations library: remove unreachable break and add exception instead of assertion, as done in upstream

This commit is contained in:
Rasmus Andersson 2018-01-23 19:05:54 -08:00
parent 632609fc65
commit 0d7d370104
2 changed files with 7 additions and 2 deletions

View File

@ -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"""

View File

@ -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):