-
-
Save m4rc1e/999669c69fe8e7c16997bbdd21ed89af to your computer and use it in GitHub Desktop.
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
font = Glyphs.font | |
glyph_id_to_name = {g.id: g.name for g in font.glyphs} | |
# Find all kerns in the source file | |
seen = set() | |
for master_kerns in font.kerning: | |
for first in master_kerns.keys(): | |
for second in master_kerns[first].keys(): | |
first = glyph_id_to_name.get(first, first) | |
second = glyph_id_to_name.get(second, second) | |
seen.add((first, second)) | |
print(len(seen)) | |
# Add missing kerns to each master | |
for master in font.masters: | |
for first, second in seen: | |
try: | |
kern = font.kerningForPair(master.id, first, second) | |
if kern == None: | |
font.setKerningForPair(master.id, first, second, -1) | |
except: | |
all | |
print("Done") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment