Last active
June 21, 2022 15:00
-
-
Save mathieureguer/f68c68a7eddc1f3572e51117b0b3fd07 to your computer and use it in GitHub Desktop.
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
#menuTitle: flag USWin table cropped glyphs | |
for font in AllFonts(): | |
y_min_flags = [] | |
y_max_flags = [] | |
for g in font: | |
if g.bounds: | |
_, _, y_min, y_max = g.bounds | |
if y_max > font.info.openTypeOS2WinAscent: | |
y_max_flags.append(g.name) | |
elif y_min < -font.info.openTypeOS2WinDescent: | |
y_min_flags.append(g.name) | |
flags = y_max_flags + y_min_flags | |
w = font.document().vanillaWindowController | |
w.setGlyphNamesAsSet(flags) | |
print(f"-- Found {len(flags)} cropped glyph(s) for {font.info.familyName}-{font.info.styleName}") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment