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

fontconfig default cache location is build-system specific #9497

Open
Ede123 opened this issue Aug 30, 2021 · 7 comments
Open

fontconfig default cache location is build-system specific #9497

Ede123 opened this issue Aug 30, 2021 · 7 comments
Labels

Comments

@Ede123
Copy link
Contributor

Ede123 commented Aug 30, 2021

For CI we use a minimal fonts.conf to reduce the time it takes to execute fc-cache.

It looks like the following:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig><dir>C:\builds\fonts</dir></fontconfig>

Recently I noticed fc-cache uses a nonsensical font cache location in this case which seems to be build-system specific:

$ fc-cache -rv
Font directories:
        C:\builds\fonts
C:\builds\fonts: caching, new cache contents: 22 fonts, 0 dirs
D:/a/_temp/msys/msys64/var/cache/fontconfig: cleaning cache directory
C:/msys64/home/Patrick/.cache/fontconfig: not cleaning non-existent cache directory
C:\msys64\mingw64\bin\fc-cache.exe: succeeded

(I'm refering to "D:/a/_temp/msys/msys64/var/cache/fontconfig")

Adding a <cachedir> entry to the above fonts.conf allows to workaround the issue, but a better default would be preferable for obvious reasons.

@Ede123
Copy link
Contributor Author

Ede123 commented Aug 30, 2021

(P.S. This might obviously be an upstream issue, but I suspect it has better chances to be picked up by capable hands here. I'd have a stab at it myself but am currently limited on time)

@Biswa96
Copy link
Member

Biswa96 commented Aug 30, 2021

In my setup, the output looks like this

Click here to show the output
$ fc-cache.exe -rv
Font directories:
        C:/Windows/fonts
        F:/msys64/home/x/.local/share/fonts
        F:/msys64/home/x/F/fonts
        F:/msys64/mingw64/share/;F/fonts
        F:/msys64/usr/local/share/;F/fonts
        F:/msys64/usr/share/fonts
        F:/msys64/home/x/.fonts
C:/Windows/fonts: caching, new cache contents: 838 fonts, 0 dirs
F:/msys64/home/x/.local/share/fonts: skipping, no such directory
F:/msys64/home/x/F/fonts: skipping, no such directory
F:/msys64/mingw64/share/;F/fonts: skipping, no such directory
F:/msys64/usr/local/share/;F/fonts: skipping, no such directory
F:/msys64/usr/share/fonts: skipping, no such directory
F:/msys64/home/x/.fonts: skipping, no such directory
F:/msys64/mingw64/var/cache/fontconfig: cleaning cache directory
F:/msys64/home/x/.cache/fontconfig: not cleaning non-existent cache directory
F:/msys64/home/x/.fontconfig: not cleaning non-existent cache directory
F:\msys64\mingw64\bin\fc-cache.exe: succeeded

@Ede123
Copy link
Contributor Author

Ede123 commented Aug 30, 2021

You need to copy above fonts.conf and make sure it's used, e.g. using FONTCONFIG_FILE environment variable.

@Biswa96
Copy link
Member

Biswa96 commented Aug 30, 2021

This might obviously be an upstream issue

This does not looks like upstream issue. In my opinion, this is another candidate for pathtools to relocate *nix style path to actual Windows path (like cygpath tool). BTW, there is a meson file in fontconfig tarball. Don't know if replacing autoconf with meson works.

The issue in src/fcinit.c file.

@MichelReims
Copy link

MichelReims commented Jan 24, 2022

I have the same problem with xournalpp compiled with msys64.
I have a directory (D:/a/_temp/msys/msys64/var/cache/fontconfig) created when I open xournalpp,
How solve the problem ?

@Biswa96
Copy link
Member

Biswa96 commented Jan 30, 2022

I have tried to build fontconfig with meson. It may fix the issue and the binaries do not have the absolute build directory. But fc-cache creates and searches for another out-of-tree directory. e.g.

  • Correct path should be C:\mssy64\mingw64\var\cache\fontconfig
  • But it also creates C:\mingw64\var\cache\fontconfig folder

I was also thinking about pathtools (see curl, ffmpeg etc.). But the cache directory path (FC_CACHEDIR) and config directory path (CONFIGDIR) is stored as default in fontconfig library. So, path relocation at runtime may be not too easy.

@mirh
Copy link

mirh commented Oct 22, 2022

#9411 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants