Created
March 11, 2022 21:57
-
-
Save connordavenport/9a1840eab5debc34bac360a43882371c to your computer and use it in GitHub Desktop.
A simply script to purge a font's groups of any glyphs that aren't in the font anymore.
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
for f in AllFonts(): | |
fix = [] | |
fixed = {} | |
todel = [] | |
for name,contents in f.groups.items(): | |
for gs in contents: | |
if gs not in f.keys(): | |
fix.append(name) | |
for n in list(set(fix)): | |
cs = tuple([gs for gs in f.groups[n] if gs in f.keys()]) | |
if cs: | |
fixed[n] = cs | |
else: | |
todel.append(n) | |
f.groups.update(fixed) | |
for gr in todel: | |
del f.groups[gr] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment