2016-03-09 17:15:17 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
from __future__ import print_function, division, absolute_import
|
|
|
|
from fontTools.misc.py23 import *
|
|
|
|
import fontTools.feaLib.builder as feaLibBuilder
|
|
|
|
from fontTools.ttLib import TTFont
|
2016-04-09 18:13:42 +01:00
|
|
|
from fontTools import configLogger
|
2016-03-09 17:15:17 +01:00
|
|
|
import sys
|
2016-04-09 18:13:42 +01:00
|
|
|
import argparse
|
2016-03-09 17:15:17 +01:00
|
|
|
|
|
|
|
|
2016-04-09 18:13:42 +01:00
|
|
|
parser = argparse.ArgumentParser(
|
|
|
|
description="Use fontTools to compile OpenType features.")
|
|
|
|
parser.add_argument("input_fea", metavar="FEATURES",
|
|
|
|
help="Path to the feature file")
|
|
|
|
parser.add_argument("input_font", metavar="INPUT",
|
|
|
|
help="Path to the input font")
|
|
|
|
parser.add_argument("output_font", metavar="OUTPUT",
|
|
|
|
help="Path to the output font")
|
|
|
|
parser.add_argument("-v", "--verbose", help="increase the logger verbosity. "
|
|
|
|
"Multiple -v options are allowed.", action="count",
|
|
|
|
default=0)
|
|
|
|
options = parser.parse_args(sys.argv[1:])
|
2016-03-09 17:15:17 +01:00
|
|
|
|
2016-04-09 18:13:42 +01:00
|
|
|
levels = ["WARNING", "INFO", "DEBUG"]
|
|
|
|
configLogger(level=levels[min(len(levels) - 1, options.verbose)])
|
|
|
|
|
|
|
|
|
|
|
|
font = TTFont(options.input_font)
|
|
|
|
feaLibBuilder.addOpenTypeFeatures(font, options.input_fea)
|
|
|
|
font.save(options.output_font)
|