servo / font-kit

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

Load system UI font #216

Open colinmarc opened 9 months ago

colinmarc commented 9 months ago

In Webkit, I can use the system-ui family to grab, for example, the San Francisco font on mac.

Is there a way to do that with this library? It would be nice to match the font to the OS, when available.

I tried the following:

select_best_match(
    &[font_kit::family_name::FamilyName::Title(
        "system-ui".to_string(),
    )],
    &font_kit::properties::Properties::new(),
)

But no dice.

colinmarc commented 9 months ago

Looks like on mac, this is available in a newer version of core-text than is currently pinned by this library:

https://github.com/servo/core-foundation-rs/blob/master/core-text/src/font.rs#L240

jayvdb commented 2 weeks ago

https://github.com/servo/font-kit/pull/234 has updated core-text to the latest.