Open
Description
Calling AngledMarginPen with a round shape (see example) causes a traceback.
This is a short script that gets to the problem right away. First self._start
and self.currentPoint
to are initialised to None.
Then _moveTo
sets self._start
and self.currentPoint
to a point. Off to a good start!
Let's add a curve point with _curveToOne
.
So_curveToOne
calls _addMoveTo
which sets self.currentPoint
back to None. Oh no!
Following _curveToOne
calls getCubicPoint
with currentPoint as argument and getCubicPoint tries to split it.
I'm not sure what the _addMoveTo
mechanism tries to achieve?
amp = AngledMarginPen({}, 685, -20)
amp._moveTo((320, 742))
amp._curveToOne((345, 742), (358, 725), (352, 696))
Traceback (most recent call last):
File "angledMarginPen.py", line 166, in <module>
File "angledMarginPen.py", line 164, in testCurveIssue
File "angledMarginPen.py", line 59, in _curveToOne
File "angledMarginPen.py", line 28, in _getAngled
TypeError: 'NoneType' object is not subscriptable
If you don't trust the example calling private methods, this is a longer version if you want to see curveTo rather than _curveTo.
from fontParts.fontshell import RGlyph
testGlyph = RGlyph()
testGlyph.name = "testGlyph"
testGlyph.width = 685
pen = testGlyph.getPen()
pen.moveTo((320, 742))
pen.curveTo((345, 742), (358, 725), (352, 696))
pen.curveTo((347, 673), (328, 665), (310, 665))
pen.curveTo((287, 665), (273, 684), (280, 709))
pen.curveTo((285, 731), (303, 742), (320, 742))
pen.closePath()
amp = AngledMarginPen({}, 685, -20)
testGlyph.draw(amp)
Traceback (most recent call last):
File "angledMarginPen.py", line 171, in <module>
File "angledMarginPen.py", line 166, in testCurveIssue
File "/Users/erik/code/fontParts/Lib/fontParts/base/glyph.py", line 630, in draw
File "/Users/erik/code/fontParts/Lib/fontParts/base/contour.py", line 172, in draw
File "/Users/erik/code/fontParts/Lib/fontParts/base/contour.py", line 180, in _draw
File "/Users/erik/code/fontParts/Lib/fontParts/base/contour.py", line 188, in drawPoints
File "/Users/erik/code/fontParts/Lib/fontParts/base/contour.py", line 213, in _drawPoints
File "/Applications/RoboFont_4.5b.app/Contents/Resources/lib/python3.12/fontTools/pens/pointPen.py", line 173, in endPath
File "/Applications/RoboFont_4.5b.app/Contents/Resources/lib/python3.12/fontTools/pens/pointPen.py", line 250, in _flushContour
File "/Applications/RoboFont_4.5b.app/Contents/Resources/lib/python3.12/fontTools/pens/basePen.py", line 339, in curveTo
File "angledMarginPen.py", line 59, in _curveToOne
File "angledMarginPen.py", line 28, in _getAngled
TypeError: 'NoneType' object is not subscriptable
Metadata
Metadata
Assignees
Labels
No labels