Skip to content

Instantly share code, notes, and snippets.

@okay-type
Created October 1, 2019 16:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save okay-type/ac6f0bc3e51b3aa77464ebe8d28c9bfd to your computer and use it in GitHub Desktop.
Save okay-type/ac6f0bc3e51b3aa77464ebe8d28c9bfd to your computer and use it in GitHub Desktop.
quickly set start points in robofont
# 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