Re: fontconfig cache problems with `FcConfigAppFontAddDir`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Werner,

I don't have time yet to reproduce it. so I'm writing down some ideas
to dig this down. I'd recommend trying the latest version of
fontconfig though.

First, can you see some difference with fc-query between old font and
new? This tool doesn't affect caches. so if you don't see any
difference in output, something might be wrong in a font or code to
pull it.

If that's good, would you mind checking if the cache wasn't really
updated/created? no files updated in the cache directory?

If no cache files were updated, does it work after running fc-cache -f
? please make sure if the targeted directory is aware of fontconfig in
default config. fontconfig has the ability to update caches at the
runtime when mtime of directories are updated though, it won't work if
it can't be detected.

Alright, the cache was updated. then, fontconfig may look at it from a
different place. There are some ways to put the order under control
though, bumping up the font revision would be better.

Please let me know if it didn't help.

On Sat, Jun 11, 2022 at 5:38 PM Werner LEMBERG <wl@xxxxxxx> wrote:
> I can imagine two work-arounds.
>
> 1. Make LilyPond disable FontConfig caching of its own fonts.  I'm not
>    sure, however, whether FontConfig provides an interface for that:
>    Looking into the documentation I see that `FcConfigAppFontAddDir`
>    (which we use) can't control cache usage.  However, there exists
>    `FcConfigAppFontClear` to uninstall LilyPond fonts after use – I
>    guess this function also removes the corresponding fonts from
>    FontConfig's cache.

Those APIs are just to let fontconfig know non-default font
directories to query. creating/updating caches just happens during
reading metadata in fonts. it isn't to manage cache lifetime.

> 2. At installation time, make FontConfig scan LilyPond's font
>    directory and add a cache file to this directory.  AFAICS,
>    FontConfig is able to read cache files from multiple directories.
>    At execution time of LilyPond, with some new code, its font
>    directory could be then added as another cache directory.

This way is usually recommended and most distributions do. when
installing fonts, they run fc-cache to make sure caches are being
updated. Speaking of Win32, say, if fonts are rarely installed on the
system, running fc-cache at the installation time of application may
help to reduce time to update caches at the runtime of course.

>
> I favour option 2 since it would avoid the abovementioned problem with
> FontConfig (i.e., not rescanning a directory added with
> `FcConfigAppFontAddDir`).
>
> Of course, there is also option
>
> 3. Do nothing.  Expect developers to manually clear the font cache if
>    they are meddling with LilyPond fonts.
>
> Comments?  Recommendations?
>
>
>     Werner


Hope this helps,
-- 
Akira TAGOH




[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux