Skip to content

Instantly share code, notes, and snippets.

@moyogo
Created February 16, 2024 15:36
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 moyogo/2aa8cb90401e1e1cca6fb5f00101b815 to your computer and use it in GitHub Desktop.
Save moyogo/2aa8cb90401e1e1cca6fb5f00101b815 to your computer and use it in GitHub Desktop.
Generate a text file with oldname=newname for Glyphs.app
# Generate a file with "oldname=newname" per glyph to rename with nice names.
# To use with https://github.com/mekkablue/Glyphs-Scripts to rename glyphs
for font in Glyphs.fonts:
renames = dict()
for glyph in font.glyphs:
new = Glyphs.niceGlyphName(glyph.name)
if new != glyph.name and new not in font.glyphs:
renames[glyph.name] = new
print(len(renames))
dirname = "/".join(font.filepath.split("/")[:-1])
filename = font.filepath.split("/")[-1]
with open(dirname + "/" + filename + ".txt", "w") as fp:
fp.write("\n".join(f"{k}={v}" for k, v in renames.items()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment