Mike FABIAN <mfabian@xxxxxxx> さんは書きました: > Mike FABIAN <mfabian@xxxxxxx> さんは書きました: > >> No new cache file has been generated: >> >> mfabian@magellan:/usr/X11R6/lib/X11/fonts/Type1$ ls /var/cache/fontconfig/ >> d6867d8c7d183335b46263581b96fdc1.cache-2 stamp >> mfabian@magellan:/usr/X11R6/lib/X11/fonts/Type1$ >> >>>> -a similar problem happen when using : fc-cache /foo/bar and >>>> fc-cache /foo/bar/ : strings used to generate md5sum are not the same, >>>> resulting in different cache. >>>> >>>> The attached patch fixes the issue. >>> >>> I've committed my patch. >> >> Hmm, that problem seems to persist as well: >> [ ... description how to reproduce ...] > > I believe I can fix this with the attached patch: The last patch was buggy because it used FcConfigNormalizeFontDir() but failed to include fcint.h. I have fixed this (patch attached). *But*, I found that my patch has the following side effect: Because I replaced FcInitLoadConfig () by FcInitLoadConfigAndFonts (), "fc-cache /foo/bar" (called as root) may generate /root/.fonts.cache-2 first before creating the cache in /var/cache/fontconfig for the requested directory: root@magellan:~# rm .fonts.cache-2 root@magellan:~# rm /var/cache/fontconfig/*cache-2 root@magellan:~# time fc-cache -v /usr/X11R6/lib/X11/fonts/Type1 fc-cache: "/usr/X11R6/lib/X11/fonts/Type1": caching, 59 fonts, 0 dirs fc-cache: succeeded real 2m33.714s user 0m48.471s sys 0m2.532s root@magellan:~# ls -l --time-style=full-iso /var/cache/fontconfig/*cache-2 -rw-r--r-- 1 root root 81920 2006-01-12 17:28:35.000000000 +0100 /var/cache/fontconfig/57fddf4aeff95a0b98650bf3f13c26fe.cache-2 root@magellan:~# ls -l --time-style=full-iso .fonts.cache-2 -rw------- 1 root root 4698113 2006-01-12 17:28:33.000000000 +0100 .fonts.cache-2 root@magellan:~# This may cause "fc-cache" to be very slow, if neither /root/.fonts.cache-2 nor any cache in /var/cache/fontconfig exist, "fc-cache" will first cache *all* fonts in /root/.fonts.cache-2 (which takes a long time) and then generate the requested cache in /var/cache/fontconfig. I think this problem is caused because I used FcInitLoadConfigAndFonts (). But without calling this function, FcConfigNormalizeFontDir() cannot work right because after calling FcInitLoadConfig () the list of font directories in the "config" structure is only the list of directories configured in the *.conf files. Their subdirectories are still missing in the list, they are only added when calling FcInitLoadConfigAndFonts ().
diff -ru fontconfig-2.3.93.20060110.orig/fc-cache/Makefile.am fontconfig-2.3.93.20060110/fc-cache/Makefile.am --- fontconfig-2.3.93.20060110.orig/fc-cache/Makefile.am 2005-12-21 16:47:42.000000000 +0100 +++ fontconfig-2.3.93.20060110/fc-cache/Makefile.am 2006-01-12 16:18:30.000000000 +0100 @@ -42,7 +42,7 @@ stamp: touch $@ -INCLUDES=-I${top_srcdir} $(FREETYPE_CFLAGS) +INCLUDES=-I${top_srcdir}/src -I${top_srcdir} $(FREETYPE_CFLAGS) bin_PROGRAMS=fc-cache diff -ru fontconfig-2.3.93.20060110.orig/fc-cache/fc-cache.c fontconfig-2.3.93.20060110/fc-cache/fc-cache.c --- fontconfig-2.3.93.20060110.orig/fc-cache/fc-cache.c 2006-01-11 13:23:52.000000000 +0100 +++ fontconfig-2.3.93.20060110/fc-cache/fc-cache.c 2006-01-12 16:07:14.000000000 +0100 @@ -45,6 +45,8 @@ #define HAVE_GETOPT_LONG 0 #endif +#include "fcint.h" + #if HAVE_GETOPT_LONG #undef _GNU_SOURCE #define _GNU_SOURCE @@ -122,7 +124,7 @@ * Now scan all of the directories into separate databases * and write out the results */ - while ((dir = FcStrListNext (list))) + while ((dir = FcConfigNormalizeFontDir(config, FcStrListNext (list)))) { if (verbose) { @@ -275,7 +277,7 @@ if (systemOnly) FcConfigEnableHome (FcFalse); - config = FcInitLoadConfig (); + config = FcInitLoadConfigAndFonts (); if (!config) { fprintf (stderr, "%s: Can't init font config library\n", argv[0]);
-- Mike FABIAN <mfabian@xxxxxxx> http://www.suse.de/~mfabian 睡眠不足はいい仕事の敵だ。
_______________________________________________ Fontconfig mailing list Fontconfig@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/fontconfig