[Fontconfig] Is there a way to set the cache directory using environment variables?

Jean Abou Samra jean at abou-samra.fr
Thu Aug 10 16:48:56 UTC 2023


Le jeudi 10 août 2023 à 18:30 +0200, Andreas Falkenhahn a écrit :
> On 10.08.2023 at 17:07 Jean Abou Samra wrote:
> 
> > In vanilla Fontconfig builds, you can set the XDG_CACHE_HOME variable to
> > modify
> > the cache location. 
> 
> Doesn't work. Looking at the code it seems like XDG_CACHE_HOME is only handled
> if
> there are no cache dirs in the config:
> 
>     if (config->cacheDirs && config->cacheDirs->num == 0) { 
>          ...
>          prefix = FcConfigXdgCacheHome ();
>          ...
>     }
> 
> The above if statement likely evaluates to FALSE for the MSYS2 build because
> MSYS2 does define a cache directory but of course I don't want to use that
> because
> it relies on the MSYS2 infrastructure...


Looking into the MSYS2 package code at
https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-fontconfig/PKGBUILD#L67
I see that this is indeed correct.

If you add <cachedir> elements to the config file, does that make a difference?

Not sure about the details of your setup, but if you create a "vanilla" FcConfig
with FcConfigCreate(), it shouldn't have any of the default settings so you
should be able to have complete control over it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/fontconfig/attachments/20230810/ca5d6977/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/fontconfig/attachments/20230810/ca5d6977/attachment.sig>


More information about the Fontconfig mailing list