Hello, We are using fontconfig in our project for font matching and
it works well. However at certain times we need to check if the user has
installed new fonts or removed others and make sure that fontconfig stays
current with those changes. Thus we try to force fontconfig to validate all its caches
and we do this by doing something like if
( ! FcConfigUptoDate (0) ) FcInitReinitialize
(); at appropriate times (i.e. just before reloading content). Although FcConfigUptoDate() correctly reports a change when
something is added or removed from the font directories FcInitReinitialize()
does not produce the intended effect (revalidating the font directories). We tracked a bit the code in fontconfig and when the
list of fonts is being rebuilt via FcConfigBuildFonts() the function FcDirCacheRead()
is called but with its force argument to false (which appears correct to me). Thus
the call chain to load the cache file is FcDirCacheRead() ->
FcDirCacheLoad() -> FcDirCacheProcess() -> FcDirCacheMapHelper() ->
FcDirCacheMapFd(). But when FcDirCacheMapFd() finds the cache file already
loaded through FcCacheFindByStat() it does not verify that the font directory stat
data matches the one in the cache file, happily returning an outdated cache. I think that FcDirCacheMapFd() should call FcCacheTimeValid()
if FcCacheFindByStat() returns a cache. Would this be the correct fix or
should I go through some other mechanism to force fontconfig to validate all
its caches? I would greatly appreciate some feedback on this. Sincerely, Diego -- |
_______________________________________________ Fontconfig mailing list Fontconfig@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/fontconfig