Fontconfig does not find fonts in non-default profiles

  • Done
  • quality assurance status badge
Details
6 participants
  • Alex Kost
  • Bengt Richter
  • Ludovic Courtès
  • Pierre Neidhardt
  • Maxim Cournoyer
  • zimoun
Owner
unassigned
Submitted by
Pierre Neidhardt
Severity
normal
P
P
Pierre Neidhardt wrote on 5 Dec 2019 11:43
(address . bug-guix@gnu.org)
871rtjm4rt.fsf@ambrevar.xyz
The fontconfig package has this bit:

Toggle snippet (5 lines)
(string-append "--with-add-fonts="
"~/.guix-profile/share/fonts,"
"/run/current-system/profile/share/fonts")

If I understand correctly, fonts can only be installed at the system
level or in ~/.guix-profile.

Is there a way to install fonts in a non-default profile?
If not, it would be nice to implement it. Can we use an environment variable?

--
Pierre Neidhardt
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAl3o31YACgkQm9z0l6S7
zH++YAf8CtKgVxKHG1p+eYpbx6MRoMNNdBknY7mKgXKvijClAaHEgBOS7w6aV30C
NXgLJ4cs7qrJwVzt/CQxUALyMsD3M8+IUnjOKeCduogC8TbhWY3LO2NXJgHe+upE
ViQLPmEXKgUz3wFwKc7EHUAapGWT1aoJe/ukBJ8h1KuChHH9U0iTmrPMc2Bm03wM
f75TN8Ax2o1Dd6dN2g+pM9lXU/v35jV132NmIDn1fkIzzYfmL94a4rJknQkqbxrx
G+vwsbqbxDELc2w2W2z6sfvySEFpnz22ejIbpfa7zjFM4B9+X0UB3Zjp8uNEpyWB
txIvcvPVuij6dA56QbsnuWyWuTmVhQ==
=tPIT
-----END PGP SIGNATURE-----

P
P
Pierre Neidhardt wrote on 5 Dec 2019 11:47
Re: bug#38498: Acknowledgement (Fontconfig does not find fonts in non-default profiles)
(address . 38498@debbugs.gnu.org)
87y2vrkq0p.fsf@ambrevar.xyz
This issue overlaps with #31403.

--
Pierre Neidhardt
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAl3o4EYACgkQm9z0l6S7
zH8DGQf+Ku7bHLq5EFkE4TnA7EEoU5o0Hn5ONKRP8b7HD0DIGh4KdeOe9SGL+0A9
jE37lITb2x2QtAyqdgsRUkH6bhnNpecYZJKOYh+WSGTfvFYDC/jh3uYPSjpLWr6x
mm0mrXfCNmt9CG7410slCrJzAeGMLBDxzgFa+vaPyzeDx0Kr/QLTDaM5MjVMp9Kr
e2XgLzqttFsc/LCsA5d+WQmYZ+5hl8PcMn0aFKO1BNpbxC5PXWPjr2NLaTir9AjP
5EgbcgrSudqo7SKwDleL/k1DaCE13fqTwwoJuiWW629/LFkKsPy//iqj3JMD5k9Z
qFKgPX+K1cy6NG3TicZ4WEXPyD414w==
=Ma42
-----END PGP SIGNATURE-----

A
A
Alex Kost wrote on 5 Dec 2019 18:06
Re: bug#38498: Fontconfig does not find fonts in non-default profiles
(name . Pierre Neidhardt)(address . mail@ambrevar.xyz)(address . 38498@debbugs.gnu.org)
87o8wm66sd.fsf@gmail.com
Pierre Neidhardt (2019-12-05 11:43 +0100) wrote:

Toggle quote (10 lines)
> The fontconfig package has this bit:
>
> (string-append "--with-add-fonts="
> "~/.guix-profile/share/fonts,"
> "/run/current-system/profile/share/fonts")
>
> If I understand correctly, fonts can only be installed at the system
> level or in ~/.guix-profile.
> Is there a way to install fonts in a non-default profile?

I install fonts into a special profile. All you need to do is edit your
"~/.config/fontconfig/fonts.conf" file. Mine looks like this:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<dir>~/.guix-profiles/fonts/fonts/share/fonts</dir>
</fontconfig>
This allows ‘fc-cache’ and similar commands to find fonts from a
non-standard directory.

--
Alex
P
P
Pierre Neidhardt wrote on 5 Dec 2019 18:52
(name . Alex Kost)(address . alezost@gmail.com)(address . 38498@debbugs.gnu.org)
87fthylkw4.fsf@ambrevar.xyz
Thank you Alex, that's what I did and it works.

That said, I think it'd be nice if Guix would automatically do this for
us. After all, it already handles multiple-profiles properly for so
many other things! :)

--
Pierre Neidhardt
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAl3pQ/sACgkQm9z0l6S7
zH9u4wf5AXm93xe/mGPlESoYDy96AfNeGL10PNcmLINf0a5kruqdCcvSSnMl8mG2
NeyV/TnCRLtHcY6e+BKzSNOfpVajrYLZ8L6VUSiHeRFujvALeRk7hl0Pe/OrQq6i
7V3GI55xdALA4hNOCZ1YEwMv59ebr9syaM808rNpG5Ry4o5SwjIYS65h5VZYeXrY
HXuC0L8Eay5fULJ6UGdqtQLFbC1Y9ArFw66KLK61Shz7+oN18LLHh9OlwZZJNgzo
9HELMFNuP/v5nlMUdz8C0smStPuogFPLUDLGXTI0ocGGDktkVLOiC2FGER0qg2Mg
hbxtPEeHS8m0cF3hMElzG5/35sMBZg==
=lygP
-----END PGP SIGNATURE-----

A
A
Alex Kost wrote on 6 Dec 2019 18:45
(name . Pierre Neidhardt)(address . mail@ambrevar.xyz)(address . 38498@debbugs.gnu.org)
87immtuz3s.fsf@gmail.com
Pierre Neidhardt (2019-12-05 18:52 +0100) wrote:

Toggle quote (6 lines)
> Thank you Alex, that's what I did and it works.
>
> That said, I think it'd be nice if Guix would automatically do this for
> us. After all, it already handles multiple-profiles properly for so
> many other things! :)

TBH I don't understand all the problems related to multiple-profiles
that were discussed and "solved" recently. I have been using multiple
profiles for at least 5 years (I don't even have ~/.guix-profile on my
disk) and I have not had any serious problems, just some small obstacles
that can be easily overpassed.

Anyway, what I have written is not related to the bug, sorry for the
noise :-)

--
Alex
P
P
Pierre Neidhardt wrote on 6 Dec 2019 19:01
(name . Alex Kost)(address . alezost@gmail.com)(address . 38498@debbugs.gnu.org)
87blslgwp2.fsf@ambrevar.xyz
Alex Kost <alezost@gmail.com> writes:

Toggle quote (6 lines)
> TBH I don't understand all the problems related to multiple-profiles
> that were discussed and "solved" recently. I have been using multiple
> profiles for at least 5 years (I don't even have ~/.guix-profile on my
> disk) and I have not had any serious problems, just some small obstacles
> that can be easily overpassed.

The point of multi-profile support is to:

- behave in the most expected way;
- factor the work upstream.

The less time individual users spend on their ad-hoc multi-profile
support, the more time they can spend on other (more productive) things :)

We lose generality in making ~/.guix-profile special.

--
Pierre Neidhardt
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAl3ql3kACgkQm9z0l6S7
zH/b6ggAsQdLL8Qt29KLEmT6JAzYyYonC9aGGmzjL5Jog9o69oiVQphpOlBymdVM
48RHwu4PLENtm+0oVt2vu4U5H6k7bvYykBIUdnwSbNkDgRsFI0T4dgva9pMG/fRm
5wZBoNw2WWRjM7SeYOJY+1p51polMbT7XNZvzrDMvVFsm8kumUgmpXM1uIrAlmJ8
mqzOXkD1AGx4L3s1I7L9KPqwzdORfDXdsMATWAz0kzkvh6uMIEnQmAcIX2LZFrOQ
pQtbK2H3VM+oR8TkK7mlLxKuBLW3MFMLWQUVUSRjMu7a7xuY+QqxfCL62k/ahfXE
EP4vHUB7FnpEYhNiwqwZZMyDojMqKQ==
=56Of
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 10 Dec 2019 17:53
(name . Pierre Neidhardt)(address . mail@ambrevar.xyz)
87o8wgm8au.fsf@gnu.org
Hello!

Pierre Neidhardt <mail@ambrevar.xyz> skribis:

Toggle quote (2 lines)
> We lose generality in making ~/.guix-profile special.

I think we all agree on that. Fontconfig is one of the very few cases
where we ended up resorting to that. The reason I think is simply that
Fontconfig honors ~/.config/fontconfig/fonts.xml but does not honor a
search path environment variable as is customary.

We could fix that by adding a patch so that Fontconfig would honor
$FONTCONFIG_FONT_PATH or similar.

WDYT?

Thanks,
Ludo’.
P
P
Pierre Neidhardt wrote on 10 Dec 2019 18:11
(name . Ludovic Courtès)(address . ludo@gnu.org)
875ziods13.fsf@ambrevar.xyz
Hi!

Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (3 lines)
> We could fix that by adding a patch so that Fontconfig would honor
> $FONTCONFIG_FONT_PATH or similar.

Have we ever asked upstream? Maybe they would consider adding it.
If they don't, I'm in favour of a patch! :)

--
Pierre Neidhardt
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAl3v0dgACgkQm9z0l6S7
zH8g0Qf+LoL/nxXR2FfiQQAI9EwuZMJowKGfUeGm31D+E3189fG3tx1xZl8u0v17
FpyAIWOnrXyuxhn0pIOz/8lgA0CPjgCNvgXIT7QJzXVGTMri3e7dwnJTrNkwtePA
SF2gzS1a2LRtYGkmzfMnIiYcEZscDizZpMlx+EjoN32K1uVGbJiTtOa80Qt8Sl2w
ygHR0fdJLsbkPuuhl/N+OgbOP/KfK+3crc/mIVpZvSVBqccHkJ+FCsuCmDA9LFdN
YcawsGge5twTZnXrm2Q3ZijUPtZPtzDZmHQcpIUxD6vSneVQ5RxHKZlgqxThPjs/
ZM/NgA3J6LD5EbF0lJiQZ5U+y5CPFA==
=tVs2
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 12 Dec 2019 14:04
(name . Pierre Neidhardt)(address . mail@ambrevar.xyz)
87zhfx8zl4.fsf@gnu.org
Hi!

Pierre Neidhardt <mail@ambrevar.xyz> skribis:

Toggle quote (8 lines)
> Ludovic Courtès <ludo@gnu.org> writes:
>
>> We could fix that by adding a patch so that Fontconfig would honor
>> $FONTCONFIG_FONT_PATH or similar.
>
> Have we ever asked upstream? Maybe they would consider adding it.
> If they don't, I'm in favour of a patch! :)

I don’t think anyone asked upstream and I agree that we should! It
could help to have a patch ready to get the discussion started anyway.

Thanks,
Ludo’.
P
P
Pierre Neidhardt wrote on 13 Dec 2019 14:11
(name . Ludovic Courtès)(address . ludo@gnu.org)
87fthobcb2.fsf@ambrevar.xyz
Just read this:

Could we do the following: use a profile hook to generate a config file
and set the environment variable FONTCONFIG_FILE to this file?

(I feel that we can't do that because the path of the hook-generated
cannot be known in advance.)


I looked at what NixOS does in
nixpkgs/pkgs/development/libraries/fontconfig/default.nix:

Toggle quote (3 lines)
> - NixOS creates /etc/fonts/${configVersion}/fonts.conf link to $out/etc/fonts/fonts.conf,
> and other modifications should go to /etc/fonts/${configVersion}/conf.d

We don't have a global font folder and we probably don't want to have
one, so I guess this is not ideal.

The <dir> fontconfig setting in Nix is

Toggle snippet (8 lines)
<!-- nix user profile -->
<dir>~/.nix-profile/lib/X11/fonts</dir>
<dir>~/.nix-profile/share/fonts</dir>
<!-- nix default profile -->
<dir>/nix/var/nix/profiles/default/lib/X11/fonts</dir>
<dir>/nix/var/nix/profiles/default/share/fonts</dir>

so it probably suffers from the same issue.

--
Pierre Neidhardt
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAl3zjfEACgkQm9z0l6S7
zH+QbwgAqJTw89PdsUFAnV0151Sak2ZNUDIx9qjR+obyTGbfiQp7HnYoapH5HkFx
3HLfVxt1Q+vH4/r0M7LW6I53iqgPhaPrQK5QErsGpsydnv147s5bf2KeVvxgVUY9
peQhsorrJlZPFXVMALUyTBqxgTOgdXT/lFWOg7icLCBtQb5WKGu45cQUz6ULT/Ta
SkEsgrPUfe/CELPPqXW9po6nRIgjAuRP0OrZPIzKgciHq+1dQaCfi0/yNqrZJmMh
F//FhwM2oWUYIJjskJeivZnAOE3mHY14ORYOxp1Ex1yjYhXBaclsQQZamMgdP58c
8J/wjBZ+r45VuzPnqZKcfbiZVs5mlQ==
=y3yi
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 14 Dec 2019 15:08
(name . Pierre Neidhardt)(address . mail@ambrevar.xyz)
87r217yp8c.fsf@gnu.org
Hello,

Pierre Neidhardt <mail@ambrevar.xyz> skribis:

Toggle quote (6 lines)
> Just read this:
> https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/126
>
> Could we do the following: use a profile hook to generate a config file
> and set the environment variable FONTCONFIG_FILE to this file?

I guess that would work.

Toggle quote (3 lines)
> (I feel that we can't do that because the path of the hook-generated
> cannot be known in advance.)

‘FONTCONFIG_FILE’ could be a search path of ‘fontconfig’ (the usual
way), but then we’d hit https://issues.guix.gnu.org/issue/22138,
meaning that it would not be set automatically.

Thoughts?

Ludo’.
B
B
Bengt Richter wrote on 15 Dec 2019 23:14
(name . Pierre Neidhardt)(address . mail@ambrevar.xyz)
20191215221406.GA1010@PhantoNv4ArchGx.localdomain
Attachment: file
Z
Z
zimoun wrote on 16 Dec 2019 16:25
(name . Bengt Richter)(address . bokr@bokr.com)
CAJ3okZ3KYRW3mZPMsumD_ZhL9GvXFfuLVahJ6Ft6oc=VR1ZimA@mail.gmail.com
Hi Bengt,

On Sun, 15 Dec 2019 at 23:15, Bengt Richter <bokr@bokr.com> wrote:

Toggle quote (2 lines)
> How about an interplanetary font folder? cf. IPLD[1] :-)

I am not sure it is related to the issue discussed here, IMHO.

However, if you are interested in IPFS stuff, give a look at this
patch [#] because it still needs some love to be merged...



All the best,
simon
M
M
Maxim Cournoyer wrote on 19 Aug 2022 16:26
(name . Pierre Neidhardt)(address . mail@ambrevar.xyz)(address . 38498-done@debbugs.gnu.org)
875yioz4ve.fsf@gmail.com
Hi Pierre,

Pierre Neidhardt <mail@ambrevar.xyz> writes:

Toggle quote (9 lines)
> The fontconfig package has this bit:
>
> (string-append "--with-add-fonts="
> "~/.guix-profile/share/fonts,"
> "/run/current-system/profile/share/fonts")
>
> If I understand correctly, fonts can only be installed at the system
> level or in ~/.guix-profile.

This is no longer true, since commit
c738a054cac00441a4f697f0b40705d0b3f4a7a7, which allowed fontconfig to
find fonts via a search path specification using XDG_DATA_DIRS.

Closing.

Maxim
Closed
?