Mike FABIAN <mfabian@xxxxxxx> さんは書きました: > Patrick Lam <plam@xxxxxxx> さんは書きました: > >> Patrick Lam wrote: >>> * fc-cat <dirname> should produce a fonts.cache-1-style listing for the >>> directory. >> >> Ok, I've implemented this feature. I wish I could say where fontconfig >> was getting this information (e.g. potentially which cache file >> corresponds to the direcotry), but that would require some more >> cutting and pasting, and I didn't feel like doing that. In any case, >> e.g. >> >> fc-cat /usr/share/fonts/truetype/ttf-bitstream-vera >> >> should produce the same output as the fonts.cache-1 file in that >> directory, as generated by old fontconfig. > > Well, it doesn't: > > mfabian@magellan:~$ fc-cat /usr/X11R6/lib/X11/fonts/truetype > セグメンテーション違反です (core dumped) > mfabian@magellan:~$ fc-cat /usr/X11R6/lib/X11/fonts/Type1 > セグメンテーション違反です (core dumped) > mfabian@magellan:~$ > > (with today's CVS snapshot). The attached patch seems to fix it. See also: http://bugzilla.novell.com/show_bug.cgi?id=152453
diff -ru fontconfig-2.3.93.20060220.orig/fc-cat/fc-cat.c fontconfig-2.3.93.20060220/fc-cat/fc-cat.c --- fontconfig-2.3.93.20060220.orig/fc-cat/fc-cat.c 2006-02-17 16:43:53.000000000 +0100 +++ fontconfig-2.3.93.20060220/fc-cat/fc-cat.c 2006-02-21 12:18:02.000000000 +0100 @@ -396,6 +396,7 @@ FcFontSet *fs = FcFontSetCreate(); FcStrSet *dirs = FcStrSetCreate(); char *name_buf; + FcConfig *config; #if HAVE_GETOPT_LONG while ((c = getopt_long (argc, argv, "fsVv?", longopts, NULL)) != -1) @@ -417,6 +418,14 @@ i = 1; #endif + config = FcInitLoadConfig (); + if (!config) + { + fprintf (stderr, "%s: Can't init font config library\n", argv[0]); + return 1; + } + FcConfigSetCurrent (config); + if (i >= argc) usage (argv[0]); @@ -425,7 +434,7 @@ char * dummy_name = (char *)FcStrPlus ((FcChar8 *)argv[i], (FcChar8 *)"/dummy"); if (!FcDirScanConfig (fs, dirs, 0, 0, - (const FcChar8 *)argv[i], FcFalse, 0)) + (const FcChar8 *)argv[i], FcFalse, config)) fprintf (stderr, "couldn't load font dir %s\n", argv[i]); else {
-- Mike FABIAN <mfabian@xxxxxxx> http://www.suse.de/~mfabian 睡眠不足はいい仕事の敵だ。
_______________________________________________ Fontconfig mailing list Fontconfig@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/fontconfig