1#!/usr/bin/env python 2 3from __future__ import print_function, division, absolute_import 4from fontTools.misc.py23 import * 5from fontTools.ttLib import TTFont 6from fontTools.ttx import makeOutputFileName 7import sys 8import os 9 10 11def main(args=None): 12 if args is None: 13 args = sys.argv[1:] 14 if len(args) < 1: 15 print("One argument, the input filename, must be provided.", file=sys.stderr) 16 return 1 17 18 filename = args[0] 19 outfilename = makeOutputFileName(filename, outputDir=None, extension='.woff2') 20 21 print("Processing %s => %s" % (filename, outfilename)) 22 23 font = TTFont(filename, recalcBBoxes=False, recalcTimestamp=False) 24 font.flavor = "woff2" 25 font.save(outfilename, reorderTables=False) 26 27 28if __name__ == '__main__': 29 sys.exit(main()) 30