Skip to content

Instantly share code, notes, and snippets.

@typesupply
Last active June 19, 2022 21:57
Show Gist options
  • Save typesupply/f0c965bb50f5625ec032c957279eb7cd to your computer and use it in GitHub Desktop.
Save typesupply/f0c965bb50f5625ec032c957279eb7cd to your computer and use it in GitHub Desktop.
Auto Denominators
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