Last active
June 19, 2022 21:57
-
-
Save typesupply/f0c965bb50f5625ec032c957279eb7cd to your computer and use it in GitHub Desktop.
Auto Denominators
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 = CurrentFont() | |
figures = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"] | |
bottom1 = font["one"].bounds[1] | |
bottom2 = font["one.num"].bounds[1] | |
shift = bottom1 - bottom2 | |
isItalic = font.info.italicAngle != 0 | |
for glyphName in figures: | |
if len(font[glyphName + ".num"].contours) != 0: | |
newGlyph = font.newGlyph(glyphName + ".den", clear=True) | |
newGlyph.appendComponent(glyphName + ".num", offset=(0, shift)) | |
source = font[glyphName + ".num"] | |
if isItalic: | |
newGlyph.angledLeftMargin = source.angledLeftMargin | |
newGlyph.width = source.width |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment