I want to create a static instance of a variable font that I have (Recursive.ttf), so I can use it in my video editor, which does not support variable fonts.
The font variations that I want to fix in place are: slnt, wght, MONO, CASL, CRSV, ss02, ss03, ss04, ss05, ss08 and ss11.
I’ve found this post that led me to discovering the program fonttools. So far, I have successfully instantiated the variation axes (slnt, wght, etc.), but now I want to enable the stylistic variants, such as a single-storey ‘g’, which is encoded as ss02.
I’ve spent about two hours in the documentation, and I tried a lot of stuff out in the terminal, but to no avail. I thought the section ‘subset’ would be useful, but the only thing it does, is strip the font of the other things – it still doesn’t enable the alternates. The ‘instancer’ section also doesn’t help much, it seems; only the axes can be fixed, not the stylistic sets. Maybe tweaking with ‘GSUB’ would work, but I had no idea what that was and I couldn’t figure out what I had to do.
So my question is: how do you instantiate stylistic alternates of a font in fonttools? Or any other program for that matter, but I think it must be doable within fonttools.
Comments
Here is a simple example of how to do this in FontTools too. This is probably very convoluted and not the best way if you want the script to be flexible but it works for this specific example with Recursive. I didn't include it in this example but you can also reverse the dictionary from the ```Subtable.mapping``` to swap the GSUB.
Many thanks for your swift replies! It works!
+: Oh, only partially, apparently. It doesn’t change ss04 for some weird reason, but it does do the rest. Am I doing something wrong? I tried isolating the problem:
… but it doesn’t change the ‘i’, which it’s supposed to do.
Connor’s script has the same issue. The problem can’t be the font itself, since I regularly use ss04 without problems in Inkscape. What could it be? Does anyone have a hunch?
It works! Thanks for being so helpful, @Connor Davenport!
+: Thanks for the explanations too – I learnt a lot.