Created
August 8, 2013 13:55
-
-
Save david-hodgetts/6184788 to your computer and use it in GitHub Desktop.
robofont script function. creates a dictionary mapping unicode values to glyphNames
This file contains hidden or 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
import vanilla | |
import mojo | |
from mojo.UI import getDefaultCharacterSet, getCharacterSets | |
def buildDictFromUnicodeToGlyphname(): | |
"HACK: builds a dict from unicode to glyphnames" | |
defaultCharSet = getCharacterSets()[getDefaultCharacterSet()] | |
font = NewFont() | |
result = {} | |
for glyphName in defaultCharSet: | |
glyph = font.getGlyph(glyphName) | |
result[glyph.unicode] = glyphName | |
font.close(False) | |
return result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment