Skip to content

Instantly share code, notes, and snippets.

@arialcrime
Created September 2, 2018 12:02
Show Gist options
  • Select an option

  • Save arialcrime/23b744afd9da8e05b660331640b2b507 to your computer and use it in GitHub Desktop.

Select an option

Save arialcrime/23b744afd9da8e05b660331640b2b507 to your computer and use it in GitHub Desktop.
Quick script to check glyph sets of fonts against each other
from mojo.UI import GetFile
font_paths = GetFile(allowsMultipleSelection=True)
fonts = FontsList()
for font_path in font_paths:
f = OpenFont(font_path, showInterface=False)
fonts.append(f)
glyph_set_dict = {}
for i, this_font in enumerate(fonts):
for glyphName in this_font.glyphOrder:
if glyphName not in glyph_set_dict.keys():
glyph_set_dict[glyphName] = [i]
else:
glyph_set_dict[glyphName].append(i)
for key in glyph_set_dict.keys():
missing = [font_index for font_index in list(range(len(fonts))) if font_index not in glyph_set_dict[key]]
for item in missing:
print ('{0} is missing in {1} {2}'.format(str(key), fonts[item].info.familyName, fonts[item].info.styleName))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment