Re: Trouble forcing rescanning of font dirs

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

 



Hi Behdad,

Thanks for your feedback, in fact the second version of my patch is much closer to yours :-) I was only missing the cache = NULL part.

As you may have noticed I have posted all the patches we are currently using on top of 2.6.0 to the mailing list. Some of them are already in your tree but not all.

BTW, is there any particular reason why the "official" fontconfig tree is inactive since the release of 2.6.0 and yours is getting all the commits? Is your tree to become the new "official" tree?

Best,

Diego

> -----Original Message-----
> From: Behdad Esfahbod [mailto:behdad.esfahbod@xxxxxxxxx] On Behalf Of
> Behdad Esfahbod
> Sent: 04 February 2009 03:38
> To: Diego Santa Cruz
> Cc: fontconfig@xxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  Trouble forcing rescanning of font dirs
> 
> Hi Diego,
> 
> I committed a modified version of your patch to my tree.
> 
> Thanks,
> behdad
> 
> PS. Here's the patch:
> 
> diff --git a/src/fccache.c b/src/fccache.c
> index 53df860..f35304a 100644
> --- a/src/fccache.c
> +++ b/src/fccache.c
> @@ -538,7 +538,13 @@ FcDirCacheMapFd (int fd, struct stat *fd_stat,
> struct stat
>         return NULL;
>      cache = FcCacheFindByStat (fd_stat);
>      if (cache)
> -       return cache;
> +    {
> +       if (FcCacheTimeValid (cache, dir_stat))
> +           return cache;
> +       FcDirCacheUnload (cache);
> +       cache = NULL;
> +    }
> +
>      /*
>       * Lage cache files are mmap'ed, smaller cache files are read.
> This
>       * balances the system cost of mmap against per-process memory
> usage.
> 
> 
> 
> Diego Santa Cruz wrote:
> > 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
_______________________________________________
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