Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #MenuTitle: Check glyph names
- # encoding: utf-8
- """Goes through all glyph names and looks for illegal characters."""
- import GlyphsApp
- Font = Glyphs.font
- firstChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
- restChars = "0123456789._-"
- legalChars = firstChars + restChars
- def process( thisName ):
- thisFirstChar = thisName[0]
- if thisFirstChar not in firstChars and thisName not in [".notdef", ".null"]:
- if thisFirstChar in restChars:
- print "'%s': potentially problematic first character" % thisName
- else:
- print "'%s': illegal first character" % thisName
- for thisChar in thisName[1:]:
- if thisChar not in legalChars:
- print "'%s': illegal character '%s'" % ( thisName, thisChar )
- for thisGlyph in Font.glyphs:
- process( thisGlyph.name.replace("\U","\u").decode('unicode-escape') )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement