Created
August 24, 2020 21:43
-
-
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.
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: 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