ToxicFrog / Ligaturizer

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

Match fonts based on weight rather than on name #83

Open ToxicFrog opened 4 years ago

ToxicFrog commented 4 years ago

At the moment, get_ligature_source tries to match a font based on the filename, assuming that if it exactly matches the suffix on one of the Fira Code names, it should use that, otherwise it should use "bold" for "bold" or "heavy" fonts and "regular" for everything else.

Instead, it should match based on weight, stored in the os2_weight field. The weights for Fira Code are:

300 Light
400 Regular
450 Retina
500 Medium
700 Bold

It should pick the closest weight; in the case of a tie, it's probably best to select the lighter weight, but I'm not sure.