Skip to content
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

~/.fonts/ is deprecated for user fonts; fnt should use the proper XDG directory #15

Open
janc13 opened this issue Mar 4, 2021 · 5 comments

Comments

@janc13
Copy link

janc13 commented Mar 4, 2021

the default /etc/fonts/fonts.conf has:

<!-- Font directory list -->

        <dir>/usr/share/fonts</dir>
        <dir>/usr/local/share/fonts</dir>
        <dir prefix="xdg">fonts</dir>
        <!-- the following element will be removed in the future -->
        <dir>~/.fonts</dir>

As you can see, ~/.fonts/ is deprecated now, and it should be whatever XDG environment variables point to (or ~/.local/share/fonts/ by default).

@alexmyczko
Copy link
Owner

that /etc/fonts/fonts.conf comes with https://tracker.debian.org/pkg/fontconfig, looking at the version in sid, and then at the versions from archive.d.o: https://sid.ethz.ch/debian/fnt/fc/ around 2014 with version 2.11 that warning as comment was added. it'll take how many more decades of year to happen? is there plan timeline somewhere?

@alexmyczko
Copy link
Owner

alexmyczko commented Mar 7, 2021

what's that XDG variable called exactly? i'm having trouble finding it...

grep ".local/share" -ri /etc 2>/dev/null |grep font
/etc/apparmor.d/abstractions/fonts: owner @{HOME}/.local/share/fonts/ r,
/etc/apparmor.d/abstractions/fonts: owner @{HOME}/.local/share/fonts/** r,
/etc/apparmor.d/abstractions/fonts: /usr/local/share/fonts/ r,
/etc/apparmor.d/abstractions/fonts: /usr/local/share/fonts/** r,
/etc/fonts/fonts.conf:

/usr/local/share/fonts

env |grep XDG
XDG_SESSION_ID=123
XDG_RUNTIME_DIR=/run/user/1234
XDG_SESSION_TYPE=tty
XDG_SESSION_CLASS=user

horrible!
so i'll check env if there's anything with XDG, then use
the default named, unless there is XDG_DATA_HOME which i would use then, fallback
to what already exists.

@janc13
Copy link
Author

janc13 commented Jun 5, 2021

The variable to use is indeed XDG_DATA_HOME (or assume it’s $HOME/.local/share if that doesn't exist).

So ${XDG_DATA_HOME:-$HOME/.local/share}/fonts

(And sorry for answering this late.)

@alexmyczko
Copy link
Owner

if XDG_DATA_HOME does not exist, does macOS or any BSD or non-linux system propose .local/share instead of a .dir directly?

@Tachi107
Copy link

if XDG_DATA_HOME does not exist, does macOS or any BSD or non-linux system propose .local/share instead of a .dir directly?

I doubt this is relevant for macOS, as fnt doesn't use $HOME/.fonts on that platform.

FreeBSD uses the XDG directory too

image

And looking at the fonts-conf(5) man page this also seems true for OpenBSD

crpb added a commit to crpb/fnt that referenced this issue Sep 6, 2024
search: make sure indexes are available!
install: google-fonts didn't create something in our fnt/index!
add default XDG_CACHE_HOME dir in place for fonts and fnt!
  ~/.fonts -> $XDG_CACHE_HOME/fonts
  ~/.fnt -> $XDG_CACHE_HOME/fnt
  Closes alexmyczko#6 alexmyczko#15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants