Created
June 26, 2019 01:41
-
-
Save mekkablue/4ec8bf951ec1666e75772ffcd60d1e03 to your computer and use it in GitHub Desktop.
Put in Macro Window and run after copying Excel columns (oldname, newname) in clipboard
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
from AppKit import NSPateboard, NSStringPboardType | |
myClipboard = NSPasteboard.generalPasteboard() | |
renameString = myClipboard.stringForType_(NSStringPboardType) | |
renameCount = 0 | |
print "Processing: %s" % Font.familyName | |
for renameLine in renameString.strip().splitlines(): | |
renameLine = renameLine.strip() | |
if "\t" in renameLine: | |
while "\t\t" in renameLine: | |
renameLine = renameLine.replace("\t\t","\t") | |
oldName,newName = renameLine.split("\t")[:] | |
glyph = Font.glyphs[oldName] | |
if not glyph: | |
print "WARNING: '%s' not found (->'%s')" % (oldName,newName) | |
else: | |
glyph.name = newName | |
renameCount += 1 | |
print "Done. Renamed %i glyphs." % renameCount |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment