Re: fontconfig: FcConfigAppFontAddDir () doesn't work right

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

 



Patrick Lam <plam@xxxxxxx> さんは書きました:

> Mike FABIAN wrote:
>> See 
>> 
>> http://bugzilla.novell.com/show_bug.cgi?id=148693
>
> I'm kind of concerned about this patch potentially bringing back the
> issues we had a while back with 'fc-cache .' not doing the right thing,
> so I can't commit it until I check that issue out.  In particular, if we
> don't normalize before we add a directory, it seems like fc-cache .
> might do the wrong thing.

In the CVS checkout from today some hunks of Takashi's patch are included,
but not all. Without the missing hunks it still doesn't work,
my test program from 

http://bugzilla.novell.com/show_bug.cgi?id=148693

comment #3 still runs into an endless loop with the test-case
from comment #4 of that bug report.

The remaining hunks of Takashi's patch are attached.

Actually the very last hunk:

diff -ru fontconfig-2.3.93.20060210.orig/src/fcdir.c
fontconfig-2.3.93.20060210/src/fcdir.c
--- fontconfig-2.3.93.20060210.orig/src/fcdir.c 2006-02-10 13:06:08.000000000
+0100
+++ fontconfig-2.3.93.20060210/src/fcdir.c      2006-02-10 16:35:30.000000000
+0100
@@ -133,6 +133,8 @@
        d_can = FcConfigNormalizeFontDir (config, dir);
     if (d_can)
        dir = d_can;
+    else
+       FcConfigAddFontDir (config, dir);

     if (!force)
     {

is not necessary, it works without this hunk.

But this hunk seems logical to me, probably it is better to include
this as well.


diff -ru fontconfig-2.3.93.20060210.orig/src/fccfg.c fontconfig-2.3.93.20060210/src/fccfg.c
--- fontconfig-2.3.93.20060210.orig/src/fccfg.c	2006-02-07 16:04:03.000000000 +0100
+++ fontconfig-2.3.93.20060210/src/fccfg.c	2006-02-10 16:37:32.000000000 +0100
@@ -1879,9 +1876,10 @@
     return FcTrue;
 }
 
-FcBool
-FcConfigAppFontAddDir (FcConfig	    *config,
-		       const FcChar8   *dir)
+static FcBool
+FcConfigAppFontAddDirWithCheck (FcConfig	    *config,
+				const FcChar8   *dir,
+				FcStrSet *processed_dirs)
 {
     FcFontSet	*set;
     FcStrSet	*subdirs;
@@ -1915,11 +1913,17 @@
 	FcStrSetDestroy (subdirs);
 	return FcFalse;
     }
+    FcStrSetAdd (processed_dirs, dir);
     if ((sublist = FcStrListCreate (subdirs)))
     {
 	while ((subdir = FcStrListNext (sublist)))
 	{
-	    FcConfigAppFontAddDir (config, subdir);
+	    FcChar8 *name;
+	    name = FcConfigNormalizeFontDir (config, subdir);
+	    if (! name)
+		name = subdir;
+	    if (! FcStrSetMember (processed_dirs, name))
+		FcConfigAppFontAddDirWithCheck (config, name, processed_dirs);
 	}
 	FcStrListDone (sublist);
     }
@@ -1927,6 +1931,23 @@
     return FcTrue;
 }
 
+FcBool
+FcConfigAppFontAddDir (FcConfig	    *config,
+		       const FcChar8   *dir)
+{
+    FcStrSet *processed_dirs;
+    FcBool res;
+
+    processed_dirs = FcStrSetCreate ();
+    if (! processed_dirs)
+	return FcFalse;
+
+    res = FcConfigAppFontAddDirWithCheck (config, dir, processed_dirs);
+    FcStrSetDestroy (processed_dirs);
+
+    return res;
+}
+
 void
 FcConfigAppFontClear (FcConfig	    *config)
 {
diff -ru fontconfig-2.3.93.20060210.orig/src/fcdir.c fontconfig-2.3.93.20060210/src/fcdir.c
--- fontconfig-2.3.93.20060210.orig/src/fcdir.c	2006-02-10 13:06:08.000000000 +0100
+++ fontconfig-2.3.93.20060210/src/fcdir.c	2006-02-10 16:35:30.000000000 +0100
@@ -133,6 +133,8 @@
 	d_can = FcConfigNormalizeFontDir (config, dir);
     if (d_can)
 	dir = d_can;
+    else
+	FcConfigAddFontDir (config, dir);
 
     if (!force)
     {
-- 
Mike FABIAN   <mfabian@xxxxxxx>   http://www.suse.de/~mfabian
睡眠不足はいい仕事の敵だ。
_______________________________________________
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