diff --git a/Lib/cu2qu/pens.py b/Lib/cu2qu/pens.py index 59147dfd9..4eeae3563 100644 --- a/Lib/cu2qu/pens.py +++ b/Lib/cu2qu/pens.py @@ -220,14 +220,13 @@ class Cu2QuPointPen(BasePointToSegmentPen): for (pt, smooth, name, kwargs) in offcurves: pen.addPoint(pt, None, smooth, name, **kwargs) pt, smooth, name, kwargs = points[-1] - if kwargs is None: - # ufoLib BasePointToSegmentPen incorrectly sets kwargs to - # None for the special quadratic contour with no on-curves: - # https://github.com/unified-font-object/ufoLib/ - # issues/11#issuecomment-429033328 - # TODO(anthrotype) remove workaround once fixed upstream - kwargs = {} - pen.addPoint(pt, segment_type, smooth, name, **kwargs) + if pt is None: + # special quadratic contour with no on-curve points: + # we need to skip the "None" point. See also the Pen + # protocol's qCurveTo() method and fontTools.pens.basePen + pass + else: + pen.addPoint(pt, segment_type, smooth, name, **kwargs) else: # 'curve' segments must have been converted to 'qcurve' by now raise AssertionError( diff --git a/tests/pens_test.py b/tests/pens_test.py index e84d120de..c86193420 100644 --- a/tests/pens_test.py +++ b/tests/pens_test.py @@ -351,13 +351,10 @@ pen.endPath()""".splitlines()) Cu2QuPointPen will treat it as a special quadratic contour whose first point has 'None' coordinates. """ - # Also see BasePointToSegmentPen bug: - # https://github.com/unified-font-object/ufoLib/issues/11 self.maxDiff = None pen = DummyPointPen() quadpen = Cu2QuPointPen(pen, MAX_ERR) quadpen.beginPath() - # quadpen.addPoint(None, segmentType="qcurve") quadpen.addPoint((1, 1)) quadpen.addPoint((2, 2)) quadpen.addPoint((3, 3)) @@ -368,7 +365,6 @@ pen.endPath()""".splitlines()) dedent( """\ pen.beginPath() - pen.addPoint(None, name=None, segmentType='qcurve', smooth=None) pen.addPoint((1, 1), name=None, segmentType=None, smooth=False) pen.addPoint((2, 2), name=None, segmentType=None, smooth=False) pen.addPoint((3, 3), name=None, segmentType=None, smooth=False)