<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Don't warn if cachedir isn't specified"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=90148#c6">Comment # 6</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Don't warn if cachedir isn't specified"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=90148">bug 90148</a>
              from <span class="vcard"><a class="email" href="mailto:freedesktop@behdad.org" title="Behdad Esfahbod <freedesktop@behdad.org>"> <span class="fn">Behdad Esfahbod</span></a>
</span></b>
        <pre>(In reply to Akira TAGOH from <a href="show_bug.cgi?id=90148#c5">comment #5</a>)
<span class="quote">> (In reply to Behdad Esfahbod from <a href="show_bug.cgi?id=90148#c4">comment #4</a>)
> > 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?</span >

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

<span class="quote">> doing something with API sounds better than settings env vars and would be
> sane though.</span >

Both are useful.

Thanks.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>