Closed jeandudey closed 11 months ago
Thanks for reporting your issue. Looks like one of our dependencies does not respect XDG_DATA_DIRS then.
Does font-config know about that font? Does it show up in fc-list
?
@hunger Yes it shows:
Thanks! That's unfortunately all I can do, I'll leave this for the guys that know that part of the codebase on Friday. Sorry for the delay.
I can't run the command unfortunately :-(. Somehow it picks a really old version 1.60 of cargo/rust for me, which fails to parse our Cargo.toml files. If I remove the --pure
and pick up my local rust/cargo, I get linking errors.
I was able to create an interactive guix-shell though to inspect the environment. I'm afraid our hands are a little tied here: At the heart of the problem is that while libfontconfig is built to look in Guix specific places for fonts, we're not using fontconfig directly but we're merely looking in standard locations such as /etc/fonts/fonts.conf and a few other places. The code in question is here:
https://github.com/RazrFalcon/fontdb/blob/c3274d016cad92fac744d76a91e4554fe51c5745/src/lib.rs#L425
If Guix was setting XDG_CONFIG_HOME
then we'd find the right fonts.conf perhaps. Alternatively, perhaps you could point FONTCONFIG_FILE
in your environment to the Guix path? (for me that's for example /gnu/store/1vxl2hcqdpr4n359addyq0iai3bd2cr7-fontconfig-2.13.94/etc/fonts/fonts.conf
, but obviously that's not a generic path :)
On second thought, I think this is best fixed in Guix if the fontconfig package would set the FONTCONFIG_FILE
environment variable (documented upstream at https://www.freedesktop.org/software/fontconfig/fontconfig-user.html )
@tronical
Somehow it picks a really old version 1.60 of cargo/rust for me, which fails to parse our Cargo.toml files.
After installing Guix you should update it to latest version, e.g.: guix pull
and it will update your user's Guix to latest commit which has Rust 1.73.0 at the time of writing.
If Guix was setting XDG_CONFIG_HOME then we'd find the right fonts.conf perhaps. Alternatively, perhaps you could point FONTCONFIG_FILE in your environment to the Guix path? (for me that's for example /gnu/store/1vxl2hcqdpr4n359addyq0iai3bd2cr7-fontconfig-2.13.94/etc/fonts/fonts.conf, but obviously that's not a generic path :)
Guix only set environment variables when packages that use them are specified, for example:
guix shell font-dejavu --search-paths --pure
Yields nothing as no program in the shell needs to find the dejavu font, however it will be still available on the profile.
On the other hand, when programs that depend on fontconfig are specified (or fontconfig itself):
$ guix shell font-dejavu fontconfig --search-paths --pure
[env] $ export
export PATH="/gnu/store/6qy21kvk0dz8zsjpv79r94ky0yn0l66j-profile/bin"
export XDG_DATA_DIRS="/gnu/store/6qy21kvk0dz8zsjpv79r94ky0yn0l66j-profile/share"
So, Guix's version of fontconfig relies on XDG_DATA_DIRS to find fonts.
That environment variable is also used by Flatpak's so in theory if user point's XDG_DATA_DIRS to their Flatpak install location they will also not find Flatpak fonts too. Not that a lot of people distribute fonts with Flatpak but just that it is not only a Guix problem 👀 .
An example of this:
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share"
export XDG_DATA_DIRS="$XDG_DATA_DIRS:/var/lib/flatpak/exports/share"
As of fontconfig 2.13.94 it supports this environment variable:
https://gitlab.freedesktop.org/fontconfig/fontconfig/-/blob/main/src/fccfg.c?ref_type=heads#L2592
On second thought, I think this is best fixed in Guix if the fontconfig package would set the FONTCONFIG_FILE environment variable (documented upstream at https://www.freedesktop.org/software/fontconfig/fontconfig-user.html )
I don't think that's an option since there's multiple profiles in a Guix system, including the system profile, the user's one, home's one and others. Instead all of those are aggregated on XDG_DATA_DIRS
.
Thanks for the explanations. This makes sense to me. I do agree with your analysis and I think that fontdb ideally should support XDG_DATA_DIRS
then.
I'm using Slint with Rust 1.70 on GNU Guix.
When trying to run
examples/todo/rust
it panics on startup because Slint is not able to find the DejaVu fonts on the system (installed).This error can be reproduced on a GNU Guix system as follows:
And shows the following output:
The
XDG_DATA_DIRS
environment variables inside of the guix shell:Which contains the DejaVu fonts at
/gnu/store/3722lq2qa7wwqpzphn22xngvfbd3ci5p-profile/share/fonts/truetype
:When running with
export SLINT_DEFAULT_FONT=/gnu/store/3722lq2qa7wwqpzphn22xngvfbd3ci5p-profile/share/fonts
it works fine though.