Created
October 1, 2019 16:21
-
-
Save okay-type/ac6f0bc3e51b3aa77464ebe8d28c9bfd to your computer and use it in GitHub Desktop.
quickly set start points in robofont
This file contains 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
# quick and dirty auto start points | |
# set a command+shift+t keyboard shortcut to match prepolator | |
def getKey1(item): return item[1] | |
def getKey0(item): return item[0] | |
g = glyph = CurrentGlyph() | |
g.prepareUndo("Lazy Startpoint") | |
for contour in g: | |
points = [] | |
for segment in contour: | |
segment.selected = False | |
for point in segment: | |
point.selected = False | |
points.append((point.x, point.y, point)) | |
points = sorted(points, key=getKey0) | |
points = sorted(points, key=getKey1) | |
p = points[0][2] | |
p.selected = True | |
for segment in contour: | |
for point in segment: | |
if point.selected == True: | |
startSegment = (segment.index + 1) % len(contour) | |
contour.setStartSegment(startSegment) | |
point.selected = False | |
g.performUndo() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment