[Fontconfig] fontconfig: Branch 'master'

Akira TAGOH tagoh at kemper.freedesktop.org
Tue Dec 9 02:07:12 PST 2014


 doc/fcconfig.fncs |   10 ++++++----
 src/fccfg.c       |   23 +++++++++++++----------
 2 files changed, 19 insertions(+), 14 deletions(-)

New commits:
commit 32ac7c75e8db0135ef37cf86f92d8b9be000c8bb
Author: Akira TAGOH <akira at tagoh.org>
Date:   Tue Dec 9 19:06:46 2014 +0900

    Returns False if no fonts found
    
    https://bugs.freedesktop.org/show_bug.cgi?id=86950

diff --git a/doc/fcconfig.fncs b/doc/fcconfig.fncs
index 10f5afc..af328fc 100644
--- a/doc/fcconfig.fncs
+++ b/doc/fcconfig.fncs
@@ -219,8 +219,9 @@ If <parameter>config</parameter> is NULL, the current configuration is used.
 @PURPOSE@	Add font file to font database
 @DESC@
 Adds an application-specific font to the configuration. Returns FcFalse
-if the fonts cannot be added (due to allocation failure). Otherwise returns FcTrue.
-If <parameter>config</parameter> is NULL, the current configuration is used.
+if the fonts cannot be added (due to allocation failure or no fonts found).
+Otherwise returns FcTrue. If <parameter>config</parameter> is NULL,
+the current configuration is used.
 @@
 
 @RET@           FcBool
@@ -231,8 +232,9 @@ If <parameter>config</parameter> is NULL, the current configuration is used.
 @DESC@
 Scans the specified directory for fonts, adding each one found to the
 application-specific set of fonts. Returns FcFalse
-if the fonts cannot be added (due to allocation failure). Otherwise returns FcTrue.
-If <parameter>config</parameter> is NULL, the current configuration is used.
+if the fonts cannot be added (due to allocation failure or no fonts found).
+Otherwise returns FcTrue. If <parameter>config</parameter> is NULL,
+the current configuration is used.
 @@
 
 @RET@           void
diff --git a/src/fccfg.c b/src/fccfg.c
index 55cb297..b27ab0b 100644
--- a/src/fccfg.c
+++ b/src/fccfg.c
@@ -367,6 +367,7 @@ FcConfigAddDirList (FcConfig *config, FcSetName set, FcStrSet *dirSet)
     FcStrList	    *dirlist;
     FcChar8	    *dir;
     FcCache	    *cache;
+    FcBool	     ret = FcFalse;
 
     dirlist = FcStrListCreate (dirSet);
     if (!dirlist)
@@ -381,9 +382,10 @@ FcConfigAddDirList (FcConfig *config, FcSetName set, FcStrSet *dirSet)
 	    continue;
 	FcConfigAddCache (config, cache, set, dirSet);
 	FcDirCacheUnload (cache);
+	ret = FcTrue;
     }
     FcStrListDone (dirlist);
-    return FcTrue;
+    return ret;
 }
 
 /*
@@ -2185,6 +2187,7 @@ FcConfigAppFontAddFile (FcConfig    *config,
     FcStrSet	*subdirs;
     FcStrList	*sublist;
     FcChar8	*subdir;
+    FcBool	 ret = FcFalse;
 
     if (!config)
     {
@@ -2218,12 +2221,13 @@ FcConfigAppFontAddFile (FcConfig    *config,
     {
 	while ((subdir = FcStrListNext (sublist)))
 	{
-	    FcConfigAppFontAddDir (config, subdir);
+	    if (FcConfigAppFontAddDir (config, subdir))
+		ret = FcTrue;
 	}
 	FcStrListDone (sublist);
     }
     FcStrSetDestroy (subdirs);
-    return FcTrue;
+    return ret;
 }
 
 FcBool
@@ -2232,6 +2236,7 @@ FcConfigAppFontAddDir (FcConfig	    *config,
 {
     FcFontSet	*set;
     FcStrSet	*dirs;
+    FcBool	 ret = FcTrue;
 
     if (!config)
     {
@@ -2250,8 +2255,8 @@ FcConfigAppFontAddDir (FcConfig	    *config,
 	set = FcFontSetCreate ();
 	if (!set)
 	{
-	    FcStrSetDestroy (dirs);
-	    return FcFalse;
+	    ret = FcFalse;
+	    goto bail;
 	}
 	FcConfigSetFonts (config, set, FcSetApplication);
     }
@@ -2259,12 +2264,10 @@ FcConfigAppFontAddDir (FcConfig	    *config,
     FcStrSetAddFilename (dirs, dir);
 
     if (!FcConfigAddDirList (config, FcSetApplication, dirs))
-    {
-	FcStrSetDestroy (dirs);
-	return FcFalse;
-    }
+	ret = FcFalse;
+bail:
     FcStrSetDestroy (dirs);
-    return FcTrue;
+    return ret;
 }
 
 void


More information about the Fontconfig mailing list