@web-alchemy/fonttools
Version:
This is the Node.js adapter of [python font tools](https://github.com/fonttools/fonttools) via [Pyodide](https://pyodide.org) without having to install python and its dependencies.
17 lines (14 loc) • 446 B
JavaScript
async function getPythonVariableFontFunction(pyodide) {
return pyodide.runPythonAsync(`
from fontTools import ttLib
from fontTools.varLib import instancer
def main_fn(file_options, options):
font = ttLib.TTFont(file_options['input-file'])
partial = instancer.instantiateVariableFont(font, options)
partial.save(file_options['output-file'])
main_fn
`)
}
module.exports = {
getPythonVariableFontFunction
}