Created
February 2, 2021 20:32
-
-
Save typemytype/6cb71086f80db1df4ce8ac4c5fea32db to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get the current glyph | |
glyph = CurrentGlyph() | |
# get the point pen | |
pointPen = glyph.getPointPen() | |
# loop over all contours | |
# convert the glyph to a list first | |
# so we can remove the contour and alter the glyph | |
for contour in list(glyph): | |
# get all the points | |
points = contour.points | |
# remove the contour | |
glyph.removeContour(contour) | |
# use a point pen to add all points | |
# start a new contour | |
pointPen.beginPath() | |
# loop over all points | |
for point in points: | |
# add the point | |
pointPen.addPoint((point.x, point.y), "line") | |
# end the contour | |
pointPen.endPath() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment