Skip to content

Instantly share code, notes, and snippets.

@gferreira
Last active March 16, 2018 13:33
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save gferreira/9e578fda838cd3220a47 to your computer and use it in GitHub Desktop.
Compare glyphsets of two .ufo fonts (in RoboFont)
# compare glyphsets of two ufos
f1_path = u"/path/to/font1.ufo"
f2_path = u"/path/to/font2.ufo"
f1 = OpenFont(f1_path, showUI=False)
f2 = OpenFont(f2_path, showUI=False)
f1_glyphset = set(f1.keys())
f2_glyphset = set(f2.keys())
print 'only in f1:'
print ' '.join(f1_glyphset.difference(f2_glyphset))
print
print 'only in f2:'
print ' '.join(f2_glyphset.difference(f1_glyphset))
print
print 'common glyphs:'
print ' '.join(f1_glyphset.intersection(f2_glyphset))
print
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment