Open
Description
The harfbuzz subsetter is a compiled C++ lib that supports variable to static font instantiation. This appears to be exposed through the uharfbuzz Python bindings and it should be significantly faster.
so, I think that we could do something along the lines of the following:
import uharfbuzz
with open(fontpath, "rb") as fontbin:
hb_face = uharfbuzz.Face(fontbin.read())
hb_font = uharfbuzz.Font(hb_face)
variation_axis_defs = {
"opsz": "10",
"wght": "700",
"GRAD": "-25",
}
hb_font.set_variations(variation_axis_defs)
# TODO
# how do you write binary back to disk?
It isn't clear to me based on a quick read through of the hb source what level of feature support it has relative to the pure Python varLib.mutator and varLib.instancer libs.
Questions
- What are the differences (if any) relative to fontTools.varLib.mutator? Difference between fonttools and harfbuzz subsettter fonttools/fonttools#2248 (reply in thread)
Metadata
Metadata
Assignees
Labels
No labels