touchup_for_cros.py 671 B

123456789101112131415161718192021222324252627
  1. import sys
  2. import os
  3. from fontTools.ttLib import TTFont
  4. from nototools import font_data
  5. from scripts import *
  6. def main(font_path):
  7. font = TTFont(font_path, recalcBBoxes=False)
  8. # Update vertical metrics to match v2.138
  9. update_attribs(
  10. font,
  11. **android_and_cros_vert_metrics
  12. )
  13. update_psname_and_fullname(font)
  14. update_font_version(font)
  15. disable_oblique_bits(font)
  16. # Enable Bold bits for Black fonts
  17. if "Black" in os.path.basename(font_path):
  18. font['head'].macStyle |= (1 << 0)
  19. font['OS/2'].fsSelection |= (1 << 5)
  20. font['OS/2'].fsSelection &= ~(1 << 6)
  21. font.save(font_path)
  22. main(sys.argv[1])