-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
splitAndInsertPointAtSegmentAndT doesn't handle quadric curves #360
Comments
Hey @driehuis, thank you for filing an issue! edit: I was 100% wrong above (see below). Needed another cup of coffee before writing! |
I almost did file an issue against Trufont, but then it dawned on me that the exception is thrown from defcon/objects/contour.py:598, which reads:
I think that's solidly in defcon's yard, isn't it? |
@driehuis Right, my bad — I searched for that method and it didn't turn up on first search. This is a known issue with that code (see #2), it doesn't handle splitting quadratic curves currently. I'm changing the title of this issue to reflect that; though I don't know if this will get fixed anytime soon. Would be very happy to take a PR that does fix it, however. |
When editing glyphs in some fonts, trufont trips over "NotImplementedError: unknown segment type: qcurve".
Traceback (most recent call last):
File "/home/bert/.virtualenvs/trufont/lib/python3.8/site-packages/trufont/controls/glyphCanvasView.py", line 451, in mouseReleaseEvent
self._redirectEvent(event, self._currentTool.mouseReleaseEvent, True)
File "/home/bert/.virtualenvs/trufont/lib/python3.8/site-packages/trufont/controls/glyphCanvasView.py", line 527, in _redirectEvent
callback(event)
File "/home/bert/.virtualenvs/trufont/lib/python3.8/site-packages/trufont/drawingTools/knifeTool.py", line 135, in mouseReleaseEvent
contour.splitAndInsertPointAtSegmentAndT(index, t / prev)
File "/home/bert/.virtualenvs/trufont/lib/python3.8/site-packages/defcon/objects/contour.py", line 573, in splitAndInsertPointAtSegmentAndT
self._splitAndInsertAtSegmentAndT(segmentIndex, t, True)
File "/home/bert/.virtualenvs/trufont/lib/python3.8/site-packages/defcon/objects/contour.py", line 598, in _splitAndInsertAtSegmentAndT
raise NotImplementedError("unknown segment type: %s" % segmentType)
NotImplementedError: unknown segment type: qcurve.
The above crash can be reproduced reliably by opening https://github.com/playbeing/dinish/tree/master/sources/DinishCondensed/DinishCondensed-Regular.ufo with the v2.004 git tag, open small "o" in the glyph editor, selecting the knife tool, and cutting the "o" vertically to create a "c" out of the shape.
As a workaround, the font can be converted to OTF format, the glyph can then be edited in the OTF copy, then copied and pasted.
Using defcon 0.8.1 from pip, which seems to be up-to-date in git as far as this module is concerned.
I looked at contour.py, but I don't understand enough about quadratic and cubic curves to fill in the blanks. I was pretty good at math in high school, but every time I try to code with bezier curves my mind turns a blank :-)
The text was updated successfully, but these errors were encountered: