-
Notifications
You must be signed in to change notification settings - Fork 646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failure to detect sans-serif font #1240
Comments
Interesting! In this environment, what do you get as output when you run |
|
I also tried copying a font into '~/.local/share/fonts` and cleaning the cache, but that did not help. |
Darn, that looks correct. Would it be possible for you to share your nix config in a way that I could try to reproduce this? |
I think I know what the issue might be. We do find the font that aliases sans-serif, but the fontdb implementation fails to locate the files. |
Could you try this patch? diff --git a/internal/backends/gl/Cargo.toml b/internal/backends/gl/Cargo.toml
index 93f941e2f..f9842412a 100644
--- a/internal/backends/gl/Cargo.toml
+++ b/internal/backends/gl/Cargo.toml
@@ -60,7 +60,7 @@ web-sys = { version = "0.3", features=["console", "WebGlContextAttributes", "Can
wasm-bindgen = { version = "0.2" }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
-fontdb = { version = "0.9.0", features = ["memmap"] }
+fontdb = { version = "0.9.0", features = ["memmap", "fontconfig"] }
glutin = { version = "0.28", default-features = false }
usvg = { version= "0.22", optional = true, default-features = false, features = ["text", "memmap-fonts"] }
diff --git a/internal/compiler/Cargo.toml b/internal/compiler/Cargo.toml
index 27237c94c..f908a05a1 100644
--- a/internal/compiler/Cargo.toml
+++ b/internal/compiler/Cargo.toml
@@ -49,7 +49,7 @@ once_cell = "1"
url = "2.2.1"
dunce = "1.0.1"
linked_hash_set = "0.1.4"
-fontdb = { version = "0.9.0" }
+fontdb = { version = "0.9.0", features = ["fontconfig"] }
fontdue = { version = "0.7.1" }
# for processing and embedding the rendered image (texture) |
Yes, that did indeed do the trick. |
As a point of reference, here is the Maybe it will help out others (and could be included somewhere in the docs). {
description = "app";
inputs = {
flakeutils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flakeutils }:
flakeutils.lib.eachDefaultSystem (system:
let
NAME = "app";
VERSION = "0.1";
pkgs = import nixpkgs {
inherit system;
};
in
rec {
packages.${NAME} = pkgs.stdenv.mkDerivation {
pname = NAME;
version = VERSION;
buildPhase = "echo 'no-build'";
};
defaultPackage = packages.${NAME};
# For `nix run`.
apps.${NAME} = flakeutils.lib.mkApp {
drv = packages.${NAME};
};
defaultApp = apps.${NAME};
devShell = pkgs.stdenv.mkDerivation {
name = NAME;
src = self;
buildInputs = with pkgs; [
pkgconfig
cmake
xorg.libxcb
xorg.libXfixes
libxkbcommon
fontconfig
wayland
libGL
# egl-wayland
];
runtimeDependencies = with pkgs; [ ];
shellHook = ''
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.lib.makeLibraryPath (with pkgs; [
xorg.libxcb
xorg.libXfixes
libxkbcommon
fontconfig
wayland
libGL
])}";
'';
};
}
);
} |
…nments Enable fontdb's fontconfig feature to parse fontconfig files to locate the directories where truetype fonts are located. This helps in system setups that differ from the defaults that fontdb uses otherwise. Fixes #1240
…nments Enable fontdb's fontconfig feature to parse fontconfig files to locate the directories where truetype fonts are located. This helps in system setups that differ from the defaults that fontdb uses otherwise. Fixes #1240
Thanks for checking! |
Slint apparently fails to detect fonts on my system, even though there are definitely
sans-serif
fonts installed.Error:
thread 'main' panicked at 'there must be a sans-serif font face registered', /home/theduke/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-backend-gl-0.2.2/fonts.rs:273:14
Backtrace
I have a custom fontconfig at
~/.config/fontconfig/conf.d/10-hm-fonts.conf
.Maybe
servo-fontconfig
fails to parse that?Environment
Linux / NixOS
(WM: Sway / Wayland)
The text was updated successfully, but these errors were encountered: