[Fontconfig-bugs] [Bug 90148] Don't warn if cachedir isn't specified

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sun May 17 20:34:34 PDT 2015


https://bugs.freedesktop.org/show_bug.cgi?id=90148

--- Comment #6 from Behdad Esfahbod <freedesktop at behdad.org> ---
(In reply to Akira TAGOH from comment #5)
> (In reply to Behdad Esfahbod from comment #4)
> > It kinda is.  If FONTCONFIG_FILE / FONTCONFIG_PATH are not set, and we were
> > initializing default config, we should warn.
> 
> "and" ? is it the only way to load the custom config right? even though one
> can load the default config that way as well, we have no idea to see if it's
> the default config or not. just to check these env vars:
> 
> diff --git a/src/fcinit.c b/src/fcinit.c
> index 6134ed4..0f13ec3 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))
> 
> > My current thinking is that for most use cases, reading full config (but not
> > fonts) might be what user wants.  The major exception would be font viewers,
> > which probably can do without any config.
> 
> As you explained on your blog, it can be done without this change right?

I mean, people can include a cachedir.  It just made more sense to not warn.

> doing something with API sounds better than settings env vars and would be
> sane though.

Both are useful.

Thanks.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/fontconfig-bugs/attachments/20150518/a78878c2/attachment.html>


More information about the Fontconfig-bugs mailing list