servo / font-kit

A cross-platform font loading library written in Rust
Apache License 2.0
685 stars 103 forks source link

Looking up fallback/generic versions of fonts (e.g. Times New Roman) #226

Open evilpie opened 10 months ago

evilpie commented 10 months ago

At least on Linux looking up the font "Times New Roman" with select_family_by_name doesn't find the fallback font "Tinos".

On the other hand:

Is that an intentional limitation? It seems like the method select_generic_font would be able to find it just fine, but isn't exposed.

jdm commented 10 months ago

This is unlikely to be an intentional choice for this library.

evilpie commented 9 months ago

I tried to implement this, but it actually results in a kind of opposite problem: select_family_by_name will now always match something, even for nonsense family names. This will kind of break the font-kit internal (CSS) font-selection algorithm used for select_best_match when specifying multiple family names.