Skip to content

Instantly share code, notes, and snippets.

@ryanbugden
Created August 24, 2020 21:43
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 ryanbugden/6ead302721ad0a4cb48950eae24879cd to your computer and use it in GitHub Desktop.
Save ryanbugden/6ead302721ad0a4cb48950eae24879cd to your computer and use it in GitHub Desktop.
Copy the text sample you'd like to fulfill to your clipboard. Run this script. Font overview will add more template glyphs for the glyphs you still need to draw.
# menuTitle: Add Missing Characters from Clipboard Text
import collections
from glyphNameFormatter import GlyphName
from AppKit import NSPasteboard, NSPasteboardTypeString
f = CurrentFont()
templ_gs = f.templateGlyphOrder
pasteboard = NSPasteboard.generalPasteboard()
text = pasteboard.stringForType_(NSPasteboardTypeString)
text = text.replace("\t", "").replace("\n", "")
counter=collections.Counter(text)
letters = "".join(sorted(counter.keys()))
for letter in letters:
gn = GlyphName(ord(letter)).getName()
if not gn in f.glyphOrder:
templ_gs.append(gn)
f.templateGlyphOrder = templ_gs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment