Drawing open contour

11 views
Skip to first unread message

Frank Grießhammer

unread,
Apr 25, 2016, 3:33:18 AM4/25/16
to rob...@googlegroups.com
I am looking for a way to draw an open contour in a non-UI workflow.

It seems that pen.endPath() always closes the contour.
contour.removeSegment(-1) also results in a closed contour.

I am aware I likely need to write a new pen, but where to start?
Any pointers, code examples, etc. much appreciated!

Thank you!
Frank

Cosimo Lupo

unread,
Apr 25, 2016, 4:08:39 AM4/25/16
to rob...@googlegroups.com

Tal Leming

unread,
Apr 25, 2016, 7:32:50 AM4/25/16
to rob...@googlegroups.com
You can do this in defcon:

###

from defcon import Font
font = Font()
font.newGlyph("A")
glyph = font["A"]
pen = glyph.getPen()
pen.moveTo((0, 0))
pen.lineTo((100, 100))
pen.endPath()
contour = glyph[0]
for point in contour:
print point.segmentType
> --
> --
> You received this message because you are subscribed to the Google Groups "RoboFab" group.
> To post to this group, send email to rob...@googlegroups.com
> To unsubscribe from this group, send email to robofab-u...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/robofab?hl=en
>
> Messages from newly joined members are subject to moderation.
> Download RoboFab and documentation at http://robofab.com
> ---
> You received this message because you are subscribed to the Google Groups "RoboFab" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to robofab+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Frank Grießhammer

unread,
Apr 25, 2016, 3:51:49 PM4/25/16
to rob...@googlegroups.com
Perfect! Easier than I thought!
Thank you Tal!
Reply all
Reply to author
Forward
0 new messages