[Fontconfig] Proposal to always add FC_LANG_OBJECT to the pattern

Akira TAGOH akira at tagoh.org
Tue Nov 24 23:00:48 PST 2009


On Mon, Nov 23, 2009 at 9:33 AM, Behdad Esfahbod <behdad at behdad.org> wrote:
> That doesn't fit in how fontconfig works.  Where would that happen?  In
> FcConfigSubstituter()?  That doesn't sound like a good idea to me.

I see.

> Here's one way I can think of fixing this:
>
>  - Expand env vars in the configuration (so you can use $LANG in your
> configuration file),
>
>  - In the default configuration, very early, add $LANG to "lang" if there is
> no "lang" set.

That sounds promising.

> The problem with this is that $LANG needs a slight conversion (replacing _
> with -) before it can be used for FC_LANG.  Not sure how to fix that.

Can't it deal with _ and - similarly in fontconfig, but not replacing
it? is it too much cost than the outcome?
Otherwise I guess you could replace _ with - when it's set something
to the "lang" regardless of the source of the env vars?

> While fixing this I also want to fix this bug:
>
> Add a FC_LOCALE_LANG element
> https://bugs.freedesktop.org/show_bug.cgi?id=17311
>
> """
> This would be quite similar to FC_LANG, except that it holds the default
> language of the locale, not the language we are looking for fonts for.
>
> The idea is that an application (Pango) looking for a font to render English
> always passes en as lang.  However, in CJK locales, it may be desirable to
> select the same font for Latin as well as CJK.  With the proposed element, a
> conf file can check whether FC_LOCALE_LANG is CJK and in that case, add the
> CJK font as the single preferred font.  All this without affecting the case
> of not running under a CJK locale.
> """
>
> That also can be fixed similarly.

Fantastic. I'd love to see that :)

-- 
Akira TAGOH


More information about the Fontconfig mailing list