-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support writing the final autogenerated feature file somewhere #353
Comments
I was wondering how the feature generator could be used as a separate package. The mark and kern feature generators are very useful. Also the way ufo2ft uses subsetting to infer pseudo unicodes could be used elsewhere in designing fonts. |
You can call into ufo2ft directly. See e.g. the tests for what to do. |
@typoman you can do like this from ufo2ft.featureCompiler import parseLayoutFeatures
from ufo2ft.featureWriters import KernFeatureWriter
from ufoLib2 import Font
# if you want to append to an existing features.fea, you must parse it first
font = Font.open("MyFont.ufo")
featureFile = parseLayoutFeatures(font)
# alternatively you can pass a new empty FeatureFile object
# from fontTools.feaLib.ast import FeatureFile
# featureFile = FeatureFile()
kernWriter = KernFeatureWriter() # you may select the mode or pass options here
kernWriter.write(font, featureFile)
feaText = featureFile.asFea()
print(feaText) |
Thank you very much! |
@typoman I updated the code, the first iteration was incorrect |
and forward it from all the other compile* functions. It dumps the content of the features to a TextIO for debugging. Fixes googlefonts#353
and forward it from all the other compile* functions. It dumps the content of the features to a TextIO for debugging. Fixes googlefonts#353
Useful for debugging. Maybe a new parameter on all
compile*
functions that is a IOBuffer that the feature file is written to. Then fontmake can be wired up to pass something in.The text was updated successfully, but these errors were encountered: