ToxicFrog / Ligaturizer

Programming Fonts with Ligatures added (& a script to add them to other fonts)
GNU General Public License v3.0
2.19k stars 112 forks source link

Is there a way to handle Fira Code's style variants? (e.g. ss02, ss03, zero, etc.) #88

Open kshetline opened 4 years ago

kshetline commented 4 years ago

I'd like to be able to specify that I copy from Fira Code, for example, the versions of and which have a horizontal bar instead of an angular bar, which is what I get now.

There's also something new in Fira Code that turns the x in a hexadecimal number like 0xFF into a raised ×, like 0×FF. I don't know if that's done using sixteen different ligatures, from 0x0 through 0xF, or by some other font trick, but it would be great to be able to copy that feature into other fonts as well.

ToxicFrog commented 3 years ago

For the former, if they're published as different font files, you can probably just replace the one it uses as input to the patcher wth the variant you want. If they're all different styles embedded in the same font...I have no idea.

For the latter, I can investigate when I'm updating to a more recent Fira, but time to work on this has been short lately.

Cons-Cat commented 3 years ago

For the former, if they're published as different font files, you can probably just replace the one it uses as input to the patcher wth the variant you want. If they're all different styles embedded in the same font...I have no idea.

For the latter, I can investigate when I'm updating to a more recent Fira, but time to work on this has been short lately.

The way it basically works is you can replace "liga" with the alternate set you want.

{   # >=
    'chars': ['greater', 'equal'],
    'firacode_ligature_name': 'greater_equal.liga',
},

Turn it into:

{   # >=
    'chars': ['greater', 'equal'],
    'firacode_ligature_name': 'greater_equal.ss02',
},

This gives your fonts the alternate >= symbol when make is ran. Take a look at these:

Visual Legends: https://github.com/tonsky/FiraCode/blob/master/extras/stylistic_sets.png The Real Code: https://github.com/tonsky/FiraCode/tree/master/features

This isn't really porting the styles over tho, it's just selecting which style you want frozen onto the output fonts.

ToxicFrog commented 2 years ago

That seems like a decent workaround if you know up front what variants you want; I don't know enough about fonts to know how to make them runtime-selectable, though.