[Fontconfig] Proposal to always add FC_LANG_OBJECT to the pattern

Behdad Esfahbod behdad at behdad.org
Sun Nov 22 16:33:43 PST 2009


On 11/20/2009 03:52 AM, Akira TAGOH wrote:

> is just skipped because no matches in the lang. this issue explains
> why LANG=mr_IN.UTF-8 fc-match and fc-match :lang=mr at
> http://bugs.freedesktop.org/show_bug.cgi?id=23419#c15 say made the
> different result.

Hi Akira,

You're correct that this problem exists.  I first found out about it in 2006 
Text Layout Summit.  However, it does not affect GTK+ applications since Pango 
always sets FC_LANG.  But I want to fix this.


> Why not adding FC_LANG_OBJECT anyway to the pattern for FcMatchPattern
> as well and ensure it in fontconfig to make all happy?

That doesn't fit in how fontconfig works.  Where would that happen?  In 
FcConfigSubstituter()?  That doesn't sound like a good idea to me.

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.

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.


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.

behdad


More information about the Fontconfig mailing list