[Fontconfig] Re: fc-cache sometimes looses fonts

sunmoon1997 sunmoon1997 at gmail.com
Wed Nov 2 21:41:56 EST 2005

   After updating fontconfig, apps which use fontconfig are going to
crash:(, then I found FcPatternGetString(pattern, FC_FILE,... only
returns basename instread of full path name sometimes that make cairo
return NULL font face then app crashes. Then follow to fontconfig,
I think problem is here.
FcPatternDestroy (FcPattern *p)
    int             i;

    if (FcPatternFindFullFname (p))
        FcPatternAddFullFname (p, 0);
why every call to FcPatternDestroy want to reset font full name, maybe
this object is still hold by others.  Removing these two lines,
everything works fine now.:D

Patrick Lam wrote:
> James Cloos wrote:
>>>>>>> "Patrick" == Patrick Lam <plam at MIT.EDU> writes:
>> Patrick> So I was suggesting this slightly evil thing.  If you call
>> Patrick> FcPatternGetString for an FC_FILE, then fontconfig will
>> Patrick> silently append the path of the cache file to the path of the
>> Patrick> file. ... ... ...  The result is that no changes are visible
>> Patrick> from the outside; no version number bumping or recompilation
>> Patrick> required.
>> OK.  I get it now.  Looks perfect.
> I've implemented this now.  It was kind of messy, I guess, because I had
> to also copy the full pathname whenever I was duplicating an FcPattern
> (and this happens a number of times).  It would be nice if I could think
> of a simpler solution, but this seems to work.
> So, we have basenames in caches; these basenames are relative to the
> cache file's (conceptual) location.  (Even if we stuff them all in /var,
> we know what directory the cache file belongs to.)  So you can move your
> directories all around the drive, or mount them in different places, and
> things should continue working.
> pat

More information about the Fontconfig mailing list