-
-
Save weiweihuanghuang/4acf2c154640d2c1d697 to your computer and use it in GitHub Desktop.
Delete Selected BCPs
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
#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