metrics_fix.py 665 B

12345678910111213141516171819202122
  1. import defcon
  2. from glob import glob
  3. sources = glob('/Users/marcfoley/Type/upstream_families/Roboto/sources/*.ufo')
  4. for source in sources:
  5. font = defcon.Font(source)
  6. if font.info.openTypeOS2Selection == [7, 7]:
  7. font.info.openTypeOS2Selection = [7]
  8. elif font.info.openTypeOS2Selection == [9, 7, 7]:
  9. font.info.openTypeOS2Selection = [9, 7]
  10. # fix vertical metrics
  11. font.info.openTypeOS2TypoAscender = 2146
  12. font.info.openTypeOS2TypoDescender = -555
  13. font.info.openTypeOS2TypoLineGap = 0
  14. font.info.openTypeOS2WinAscent = 2146
  15. font.info.openTypeOS2WinDescent = 555
  16. print(f"Saving {source}")
  17. font.save(source)