canonical / Ubuntu-Sans-fonts

Other
54 stars 4 forks source link

Extracting discrete font from variable font #111

Closed nteodosio closed 8 months ago

nteodosio commented 8 months ago

I want to extract discrete fonts from this new Ubuntu font to test for LP:2019045. The command

fonttools varLib.instancer -o /tmp/qUbuntu-B.ttf ./Ubuntu\[wdth\,wght\].ttf wdth=drop wght=700

does get one there, but the name of the font is still Ubuntu and the style is regular as far as fc-list and the consuming programs are concerned.

How can I extract the font to an arbitrary name and style?

nteodosio commented 8 months ago

Managed to do that with Fontforge: Element > Font Information.

djrrb commented 8 months ago

Glad you found a solution, @nteodosio !

If you prefer a command-line approach, you can also check out OT Feature Freezer which has a somewhat-straightforward --replacenames argument. This is built on FontTools, which can also be used to modify the font’s name table directly (this can be a bit complicated as it might involve modifying multiple name records).

And just in case you didn’t see, premade static fonts for the named instances (including Bold) are also available here: https://github.com/canonical/Ubuntu-fonts/tree/main/fonts/ttf