opentypejs / opentype.js

Read and write OpenType fonts using JavaScript.
https://opentype.js.org/
MIT License
4.46k stars 476 forks source link

[question] How to write single Files from each style within a variable font #483

Closed BURROO closed 2 years ago

BURROO commented 3 years ago

I am curious if it is possible to load a variable font file and generate all its associated styles as a buffer and eventually create files (otf, woff2, etc) from them. Since all the information from each of those styles is already available in the variable font this should easily be possible, right? What would be the best approach to approach this or is there a function included that helps for example with creating the dataset for each glyph of the associated style?

yne commented 2 years ago

Variable font are not supported by opentype.js

BURROO commented 2 years ago

Thank you! Seeing that you are involved in the project, do you know if there is support for variable planed eventually or could you point me to any other tools/resources that could parse/write variable fonts in a similar matter as opentype.js?

yne commented 2 years ago

I was personally interested in the matter, so I started reading the OTF spec and tried to implement it but I got overwhelmed but the number of table needed.

Also OpentypeJS use the CFF table for defining it glyph shape. But the spec explicitly state that:

variations for outlines using the (Compact Font Format version 1.0 ('CFF ') table are not supported.

So it would also require OpentypeJS to migrate to CFF2 or some less-compact table declaration to be able to use font variation feature.

But anybody could do send a PR to change that. So no ETA for now :)

No idea about other tools, but I use ttx to help me dump OTF to XML in order to understand them.

yne commented 2 years ago

Closing, as it's not going to be implemented anytime soon :/