Bug 90148 - Don't warn if cachedir isn't specified

only warn when FONTCONFIG_FILE or FONTCONFIG_PATH is set.

Bug 90148 - Don't warn if cachedir isn't specified
This commit is contained in:
Akira TAGOH 2015-05-18 14:03:50 +09:00
parent 55ff841927
commit ead7275e05
1 changed files with 19 additions and 7 deletions

View File

@ -91,12 +91,23 @@ FcInitLoadOwnConfig (FcConfig *config)
{ {
FcChar8 *prefix, *p; FcChar8 *prefix, *p;
size_t plen; size_t plen;
FcBool have_own = FcFalse;
char *env_file, *env_path;
fprintf (stderr, env_file = getenv ("FONTCONFIG_FILE");
"Fontconfig warning: no <cachedir> elements found. Check configuration.\n"); env_path = getenv ("FONTCONFIG_PATH");
fprintf (stderr, if ((env_file != NULL && env_file[0] != 0) ||
"Fontconfig warning: adding <cachedir>%s</cachedir>\n", (env_path != NULL && env_path[0] != 0))
FC_CACHEDIR); have_own = FcTrue;
if (!have_own)
{
fprintf (stderr,
"Fontconfig warning: no <cachedir> elements found. Check configuration.\n");
fprintf (stderr,
"Fontconfig warning: adding <cachedir>%s</cachedir>\n",
FC_CACHEDIR);
}
prefix = FcConfigXdgCacheHome (); prefix = FcConfigXdgCacheHome ();
if (!prefix) if (!prefix)
goto bail; goto bail;
@ -107,8 +118,9 @@ FcInitLoadOwnConfig (FcConfig *config)
prefix = p; prefix = p;
memcpy (&prefix[plen], FC_DIR_SEPARATOR_S "fontconfig", 11); memcpy (&prefix[plen], FC_DIR_SEPARATOR_S "fontconfig", 11);
prefix[plen + 11] = 0; prefix[plen + 11] = 0;
fprintf (stderr, if (!have_own)
"Fontconfig warning: adding <cachedir prefix=\"xdg\">fontconfig</cachedir>\n"); fprintf (stderr,
"Fontconfig warning: adding <cachedir prefix=\"xdg\">fontconfig</cachedir>\n");
if (!FcConfigAddCacheDir (config, (FcChar8 *) FC_CACHEDIR) || if (!FcConfigAddCacheDir (config, (FcChar8 *) FC_CACHEDIR) ||
!FcConfigAddCacheDir (config, (FcChar8 *) prefix)) !FcConfigAddCacheDir (config, (FcChar8 *) prefix))