diff options
author | Akira TAGOH <akira@tagoh.org> | 2015-05-18 14:03:50 +0900 |
---|---|---|
committer | Akira TAGOH <akira@tagoh.org> | 2015-05-18 14:03:50 +0900 |
commit | ead7275e05966eca19f530712f8e5c738a61cf4f (patch) | |
tree | e99071b05c38109fd3ea72f85ca70588449e3c08 /src | |
parent | 55ff8419274fd5ce59675f220b85035a3986d6cf (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/fcinit.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/fcinit.c b/src/fcinit.c index 6134ed40..0f13ec30 100644 --- a/src/fcinit.c +++ b/src/fcinit.c @@ -91,12 +91,23 @@ FcInitLoadOwnConfig (FcConfig *config) { FcChar8 *prefix, *p; size_t plen; + FcBool have_own = FcFalse; + char *env_file, *env_path; - fprintf (stderr, - "Fontconfig warning: no <cachedir> elements found. Check configuration.\n"); - fprintf (stderr, - "Fontconfig warning: adding <cachedir>%s</cachedir>\n", - FC_CACHEDIR); + env_file = getenv ("FONTCONFIG_FILE"); + env_path = getenv ("FONTCONFIG_PATH"); + if ((env_file != NULL && env_file[0] != 0) || + (env_path != NULL && env_path[0] != 0)) + 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 (); if (!prefix) goto bail; @@ -107,8 +118,9 @@ FcInitLoadOwnConfig (FcConfig *config) prefix = p; memcpy (&prefix[plen], FC_DIR_SEPARATOR_S "fontconfig", 11); prefix[plen + 11] = 0; - fprintf (stderr, - "Fontconfig warning: adding <cachedir prefix=\"xdg\">fontconfig</cachedir>\n"); + if (!have_own) + fprintf (stderr, + "Fontconfig warning: adding <cachedir prefix=\"xdg\">fontconfig</cachedir>\n"); if (!FcConfigAddCacheDir (config, (FcChar8 *) FC_CACHEDIR) || !FcConfigAddCacheDir (config, (FcChar8 *) prefix)) |