generate_variable_webfonts.py 270 B

123456789
  1. import glob
  2. import os
  3. from fontTools.ttLib import TTFont
  4. for filepath in glob.iglob('fonts/variable/*.ttf'):
  5. f = TTFont(filepath)
  6. f.flavor = 'woff2'
  7. print('INFO:fontTools.ttLib.woff2:Building WOFF2 for ' + filepath)
  8. f.save(os.path.splitext(filepath)[0] + '.woff2')