rust-fontconfig icon indicating copy to clipboard operation
rust-fontconfig copied to clipboard

Monospace search doesn't work

Open l4l opened this issue 3 years ago • 3 comments

The following code fails at the second assertion:

let cache = FcFontCache::build();

assert!(cache
    .query(&FcPattern {
        name: Some("DejaVu Sans Mono".into()),
        ..Default::default()
    })
    .is_none());

assert!(cache
    .query(&FcPattern {
        monospace: PatternMatch::True,
        ..Default::default()
    })
    .is_some());

Is it an expected behavior?

Also seems the issue related to #3

l4l avatar Dec 04 '21 11:12 l4l

It's not expected behaviour, but then again, this entire library is ~400 lines of code, so it's not really advanced. The feature detection isn't very good. I should not have used "fontconfig" in the title, people now think it's a 1:1 replacement for fontconfig, while it's more or less just one single file.

Maybe use font-kit or fontdb instead for now.

fschutt avatar Dec 04 '21 13:12 fschutt

Quiet funny that fontdb also fails for the same query. And font-kit is overkill for me, my case is to find a font by its name or otherwise provide a reasonable default (i.e. any monospace). And I never used fontconfig, tbh.

I guess I could look into the sources then, you're open to patches like this, right?

Also, fontsearch/font-search seems unused at crates.io, maybe switch to one of these instead?

l4l avatar Dec 04 '21 13:12 l4l

Maybe try again with 1.0.7, some font search issues have been fixed

fschutt avatar Jan 18 '24 15:01 fschutt