Skip to content

Instantly share code, notes, and snippets.

@mekkablue
Created July 27, 2019 16:50
Show Gist options
  • Save mekkablue/b8361b5e579c09166153e436847d30b0 to your computer and use it in GitHub Desktop.
Save mekkablue/b8361b5e579c09166153e436847d30b0 to your computer and use it in GitHub Desktop.
Close open paths
#MenuTitle: Close open paths
# -*- coding: utf-8 -*-
__doc__="""
Close all paths in visible layers of selected glyphs.
"""
Font = Glyphs.font
selectedLayers = Font.selectedLayers
def process( thisLayer ):
pathCount = 0
for thisPath in thisLayer.paths:
if not thisPath.closed:
thisPath.closed = True
pathCount += 1
return pathCount
Font.disableUpdateInterface()
print "Closing paths in %i glyphs:" % len( selectedLayers )
for thisLayer in selectedLayers:
print "-- %s: closed %i path(s)." % ( thisLayer.parent.name, process( thisLayer ) )
Font.enableUpdateInterface()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment