[Fontconfig] Re: fc-cache sometimes looses fonts

Patrick Lam plam at MIT.EDU
Wed Oct 26 08:29:22 EST 2005

Keith Packard wrote:
> On Tue, 2005-10-25 at 17:07 -0400, Patrick Lam wrote:
>>James Cloos wrote:
>>>when I ran 'fc-cache -fv .' in /usr/local/share/fonts.  Re-running
>>>with 'fc-cache -fv /usr/local/share/fonts' got the correct results.
>>The responsible code is at fcfreetype.c:1290.  However, I'm not quite
>>sure how to fix it: it seems difficult to get a full pathname from a
>>filename.  Or I could just store the filename without any pathname
>>whatsoever.  Opinions?
> As cache files are per-directory, you need only store the local filename
> itself.

I've just committed this patch.  Let me know if you see any problems
with it.  It ought to fix JimC's issue, but not the more general
losing-fonts issue.

Index: src/fcfreetype.c
RCS file: /cvs/fontconfig/fontconfig/src/fcfreetype.c,v
retrieving revision
diff -u -r1.60.2.4 fcfreetype.c
--- src/fcfreetype.c    22 Oct 2005 15:12:05 -0000
+++ src/fcfreetype.c    25 Oct 2005 22:28:33 -0000
@@ -47,6 +47,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include <libgen.h>
 #include "fcint.h"
 #include <ft2build.h>
 #include FT_FREETYPE_H
@@ -1287,7 +1288,7 @@
                printf ("Saving unique fullname %s\n", full);

-    if (!FcPatternAddString (pat, FC_FILE, file))
+    if (!FcPatternAddString (pat, FC_FILE, (FcChar8 *)basename((char
        goto bail1;

     if (!FcPatternAddInteger (pat, FC_INDEX, id))


More information about the Fontconfig mailing list