Trouble forcing rescanning of font dirs

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

 



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

--
Diego Santa Cruz, PhD
Technology Architect
_________________________________
SpinetiX S.A.
Rue des Terreaux 17
1003, Lausanne, Switzerland
T +41 21 341 15 50
F +41 21 311 19 56
diego.santacruz@xxxxxxxxxxxx

http://www.spinetix.com
_________________________________

 

_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig

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

  Powered by Linux