Open nonetrix opened 2 years ago
This is probably completely unrelated but I'm running NVIDIA proprietary driver and that's only just now started working on other compositors that are not GNOME or KDE
If default font (DejaVu Sans Mono
) is not installed/found then yofi will panic with the corresponding message. The issue seems rendering related (perhaps related #46 & #82). Do you use pre-built 0.1.5 version or another one?
How about using the system-ui
family name as a fallback font?
It's a special family name that maps to the font configured for system ui elements (usually Cantarell
by default on Linux).
Out of the box with no config I get this very unusual choice of a font:
What's the system-ui
you are talking about? Tried both fontconfig and rust-fontconfig and the family name isn't found. I'm thinking about either providing a hardcoded list of well-known fonts, or simply embedding one into the final binary.
Also I figured out that the default font is not really Deja Vu Sans for fontdue (default backend), but just the first found font without any filter.
What's the system-ui you are talking about?
It's a family name. It resolves to whatever font is configured for system ui elements on the local setup. It's kinda like monospace
, which is not an actual font, but actually resolves to the default monospace font on the system.
My bad though there's no dash in it, it's actually system ui
:
$ fc-match "monospace"
FantasqueSansMono-Regular.otf: "Fantasque Sans Mono" "Regular"
$ fc-match "system-ui" # Wrong name
OpenSans-Regular.ttf: "Open Sans" "Regular"
$ fc-match "system ui" # Actual system ui font
Cantarell-VF.otf: "Cantarell" "Regular"
It's a pretty safe fallback because rather than providing a font and expecting the user to have that installed, it picks something that's locally installed.
This one unfortunately doesn't work for rust-fontconfig, you may try it with smth like this:
fn main() {
use rust_fontconfig::*;
let path = FcFontCache::build().query(&FcPattern {
familiy: Some("monospace".into()),
..Default::default()
}).unwrap();
dbg!(path);
}
or either via yofi:
diff --git a/src/font/fdue.rs b/src/font/fdue.rs
index 3b19c35..86f1853 100644
--- a/src/font/fdue.rs
+++ b/src/font/fdue.rs
@@ -96,7 +96,10 @@ impl Font {
impl FontBackend for Font {
fn default() -> Self {
FONTCONFIG_CACHE
- .query(&FcPattern::default())
+ .query(&FcPattern {
+ family: Some("system ui".into()),
+ ..Default::default()
+ })
.map(Font::from_fc_path)
.unwrap()
.unwrap()
I had the same issue (AUR yofi-bin package). Now that I've read that rust-fontconfig
got dropped, it would be great if this could be addressed again.
Also thanks for your efforts, l4l!
If you run yofi and do not have the default font installed it does this After changing font in config with
font = "/usr/share/fonts/noto/NotoSansDisplay-Thin.ttf"