Returns False if no fonts found

https://bugs.freedesktop.org/show_bug.cgi?id=86950
This commit is contained in:
Akira TAGOH 2014-12-09 19:06:46 +09:00
parent b732bf057f
commit 32ac7c75e8
2 changed files with 19 additions and 14 deletions

View File

@ -219,8 +219,9 @@ If <parameter>config</parameter> is NULL, the current configuration is used.
@PURPOSE@ Add font file to font database @PURPOSE@ Add font file to font database
@DESC@ @DESC@
Adds an application-specific font to the configuration. Returns FcFalse Adds an application-specific font to the configuration. Returns FcFalse
if the fonts cannot be added (due to allocation failure). Otherwise returns FcTrue. if the fonts cannot be added (due to allocation failure or no fonts found).
If <parameter>config</parameter> is NULL, the current configuration is used. Otherwise returns FcTrue. If <parameter>config</parameter> is NULL,
the current configuration is used.
@@ @@
@RET@ FcBool @RET@ FcBool
@ -231,8 +232,9 @@ If <parameter>config</parameter> is NULL, the current configuration is used.
@DESC@ @DESC@
Scans the specified directory for fonts, adding each one found to the Scans the specified directory for fonts, adding each one found to the
application-specific set of fonts. Returns FcFalse application-specific set of fonts. Returns FcFalse
if the fonts cannot be added (due to allocation failure). Otherwise returns FcTrue. if the fonts cannot be added (due to allocation failure or no fonts found).
If <parameter>config</parameter> is NULL, the current configuration is used. Otherwise returns FcTrue. If <parameter>config</parameter> is NULL,
the current configuration is used.
@@ @@
@RET@ void @RET@ void

View File

@ -367,6 +367,7 @@ FcConfigAddDirList (FcConfig *config, FcSetName set, FcStrSet *dirSet)
FcStrList *dirlist; FcStrList *dirlist;
FcChar8 *dir; FcChar8 *dir;
FcCache *cache; FcCache *cache;
FcBool ret = FcFalse;
dirlist = FcStrListCreate (dirSet); dirlist = FcStrListCreate (dirSet);
if (!dirlist) if (!dirlist)
@ -381,9 +382,10 @@ FcConfigAddDirList (FcConfig *config, FcSetName set, FcStrSet *dirSet)
continue; continue;
FcConfigAddCache (config, cache, set, dirSet); FcConfigAddCache (config, cache, set, dirSet);
FcDirCacheUnload (cache); FcDirCacheUnload (cache);
ret = FcTrue;
} }
FcStrListDone (dirlist); FcStrListDone (dirlist);
return FcTrue; return ret;
} }
/* /*
@ -2185,6 +2187,7 @@ FcConfigAppFontAddFile (FcConfig *config,
FcStrSet *subdirs; FcStrSet *subdirs;
FcStrList *sublist; FcStrList *sublist;
FcChar8 *subdir; FcChar8 *subdir;
FcBool ret = FcFalse;
if (!config) if (!config)
{ {
@ -2218,12 +2221,13 @@ FcConfigAppFontAddFile (FcConfig *config,
{ {
while ((subdir = FcStrListNext (sublist))) while ((subdir = FcStrListNext (sublist)))
{ {
FcConfigAppFontAddDir (config, subdir); if (FcConfigAppFontAddDir (config, subdir))
ret = FcTrue;
} }
FcStrListDone (sublist); FcStrListDone (sublist);
} }
FcStrSetDestroy (subdirs); FcStrSetDestroy (subdirs);
return FcTrue; return ret;
} }
FcBool FcBool
@ -2232,6 +2236,7 @@ FcConfigAppFontAddDir (FcConfig *config,
{ {
FcFontSet *set; FcFontSet *set;
FcStrSet *dirs; FcStrSet *dirs;
FcBool ret = FcTrue;
if (!config) if (!config)
{ {
@ -2250,8 +2255,8 @@ FcConfigAppFontAddDir (FcConfig *config,
set = FcFontSetCreate (); set = FcFontSetCreate ();
if (!set) if (!set)
{ {
FcStrSetDestroy (dirs); ret = FcFalse;
return FcFalse; goto bail;
} }
FcConfigSetFonts (config, set, FcSetApplication); FcConfigSetFonts (config, set, FcSetApplication);
} }
@ -2259,12 +2264,10 @@ FcConfigAppFontAddDir (FcConfig *config,
FcStrSetAddFilename (dirs, dir); FcStrSetAddFilename (dirs, dir);
if (!FcConfigAddDirList (config, FcSetApplication, dirs)) if (!FcConfigAddDirList (config, FcSetApplication, dirs))
{ ret = FcFalse;
FcStrSetDestroy (dirs); bail:
return FcFalse;
}
FcStrSetDestroy (dirs); FcStrSetDestroy (dirs);
return FcTrue; return ret;
} }
void void