Skip to content

Instantly share code, notes, and snippets.

@weiweihuanghuang
Created September 4, 2015 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weiweihuanghuang/4acf2c154640d2c1d697 to your computer and use it in GitHub Desktop.
Save weiweihuanghuang/4acf2c154640d2c1d697 to your computer and use it in GitHub Desktop.
Delete Selected BCPs
#MenuTitle: Retract BCPs
# -*- coding: utf-8 -*-
__doc__="""
Retracts all BCPs (off-curve points) in selected glyphs, so all curves will be turned into straight lines.
"""
Font = Glyphs.font
selectedLayers = Font.selectedLayers
def process( thisLayer ):
for thisPath in thisLayer.paths:
for x in reversed( range( len( thisPath.nodes ))):
thisNode = thisPath.nodes[x]
if thisNode.type == GSOFFCURVE:
del thisPath.nodes[x]
else:
thisNode.type = GSLINE
thisPath.checkConnections()
for thisLayer in selectedLayers:
thisGlyph = thisLayer.parent
print "Processing", thisGlyph.name
thisLayer.setDisableUpdates()
thisGlyph.beginUndo()
process( thisLayer )
thisGlyph.endUndo()
thisLayer.setEnableUpdates()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment