Skip to content

Instantly share code, notes, and snippets.

@mathieureguer
Last active June 21, 2022 15:00
Show Gist options
  • Save mathieureguer/f68c68a7eddc1f3572e51117b0b3fd07 to your computer and use it in GitHub Desktop.
Save mathieureguer/f68c68a7eddc1f3572e51117b0b3fd07 to your computer and use it in GitHub Desktop.
#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