Snippet for applying a feature file to a font
It would be nice to also handle MTI feature files, and to process TTX in addition to binary fonts, and and and... but it's a start. https://github.com/behdad/fonttools/issues/527
This commit is contained in:
parent
5794f9f6a2
commit
c3e2d37299
19
Snippets/apply-feature-file.py
Executable file
19
Snippets/apply-feature-file.py
Executable file
@ -0,0 +1,19 @@
|
||||
#!/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
|
||||
import sys
|
||||
|
||||
if len(sys.argv) != 4:
|
||||
print("usage: apply-feature-file.py features.fea in.ttf out.ttf")
|
||||
sys.exit(1)
|
||||
|
||||
inputFeaturePath = sys.argv[1]
|
||||
inputFontPath = sys.argv[2]
|
||||
outputFontPath = sys.argv[3]
|
||||
|
||||
font = TTFont(inputFontPath)
|
||||
feaLibBuilder.addOpenTypeFeatures(inputFeaturePath, font)
|
||||
font.save(outputFontPath)
|
Loading…
x
Reference in New Issue
Block a user