Hello everyone. I apologize if this is the wrong place for this post, but I see that many people here are knowledgeable regarding variable fonts and I've been struggling for a couple days to achieve what I am after.
I own a handful of variable fonts, however not all software supports them, and the predefined instances are a little too bold and wide for me. My goal is to be able to generate static cuts from the original variable font with my own axis parameters. This way, I can use the font with all my software, and have complete control over the font's appearance.
For example, I have a variable font ("ExampleVF") with variable width and weight axes. I want to generate the following cuts:
- ExampleVF Light (wdth=85, wght=250)
- ExampleVF Regular (wdth=85, wght=350)
- ExampleVF Medium (wdth=85, wght=450)
- ExampleVF Semi Bold (wdth=85, wght=550)
- ExampleVF Bold (wdth=85, wght=650)
- ExampleVF Extended Light (wdth=110, wght=350)
- ExampleVF Extended Regular (wdth=110, wght=350)
- ExampleVF Extended Medium (wdth=110, wght=450)
- ExampleVF Extended Semi Bold (wdth=110, wght=550)
- ExampleVF Extended Bold (wdth=110, wght=650)
I first turned to fonttools, but the built in fonttools varLib.instancer can only handle generating the static cuts, and can't rename the fonts so that I can install all of them and have them appear correctly under Microsoft Word, for example.
Is this doable with fonttools? Can anyone suggest how I could achieve this?
I'm a programmer first, type enthusiast second. If someone can simply tell me what tables I need to modify with fonttools, I can do the rest. One thing I did notice is that fonttools exports TTFs, which as far as I understand have a limited number of subfamilies on Windows, so I'm not sure if I also need to add OTF into the mix somewhere.
Sorry for the long post. I would really appreciate some advice on this. If someone can point me in the right direction, I will report back here once I've written the program and publish it on GitHub!
Comments
MS Word supports 4 styles per font: regular, bold, italic and bold italic. So if you have more styles, you should split it into subfamilies. Also you may need to modify fsSelection for Bold/Italic styles.
The input to my program is a variable font in TTF format, and the output is static TTFs. Converting these static TTFs to OTFs via an online tool, then installing them makes them work as expected.
Is there a way I can export as OTF from fonttools? I have searched around but cannot find any answers. Is there a workaround to make the TTF format work?
Try to export them to ttx and compare tables data.
Despite this, when I install the TTFs I generated, they look like this in Windows settings, clearly indicating something is wrong:
When I convert to OTF and then install, it looks as you would expect, with different names and weights.
Is there any way I can convert from TTF to OTF inside of fonttools? It seems like that could be the solution.
- it would be nice to provide implicit defaults, so no config is needed, or
- provide only a desired font family and axis values via CLI options
- you can use an existing STAT table to deduct at least a partial name—it won't be unique "enough" but could work for the above in conjunction with the selected axis values
For anybody wondering, apart from the name table updates, the couple of relevant code sample lines for doing this with fontTools are in the documentation.I'll definitely think about expanding the configuration system or adding defaults in the future. I'm content with where the program is at right now for my use case at least. As far as I am aware, there are no other users, but if others are interested in the program and desire more features, I would happily consider adding them.
For you or anyone who is reading this in the future, feel free to open a GitHub issue for a feature request.