[Fontconfig] any possible trouble by adding lang to the pattern by default

Akira TAGOH akira at tagoh.org
Mon May 21 22:34:47 PDT 2012

For the reference of what I want to address:

$ LANG=ja ./fc-match/fc-match
VL-PGothic-Regular.ttf: "VL Pゴシック" "regular"
$ LANG=zh_CN ./fc-match/fc-match
wqy-zenhei.ttc: "文泉驿正黑" "Regular"
$ LANG=en_US ./fc-match/fc-match
DejaVuSans.ttf: "DejaVu Sans" "Book"
$ FC_DEBUG=4 FC_LANG=ja:zh-cn LANG=en_US ./fc-match/fc-match
FcConfigSubstitute Pattern has 1 elts (size 16)
        lang: "ja"(w) "zh-cn"(w)
VL-PGothic-Regular.ttf: "VL Pゴシック" "regular"
$ FC_DEBUG=4 FC_LANG=ja:zh-cn LANG=en_US ./fc-match/fc-match :lang=en
FcConfigSubstitute Pattern has 1 elts (size 16)
        lang: en(s) "ja"(w) "zh-cn"(w)
DejaVuSans.ttf: "DejaVu Sans" "Book"

On Tue, May 22, 2012 at 1:54 PM, Akira TAGOH <akira at tagoh.org> wrote:
> On Tue, May 22, 2012 at 12:14 PM, Keith Packard <keithp at keithp.com> wrote:
>> Are you trying to make fontconfig select an appropriate font without any
>> language hints at all, based solely on the codepoints within the text?
> No, not really. that way takes too much cost to estimate. my
> suggestion is simple. the complaint what I've ever seen about this was
> it from the users who prefer to see only strings in English. i.e. set
> $LANG to any English locale and $LC_CTYPE to the native one say.
> So it could be used to guess from it or anything else what languages
> they prefer/are expecting to use the font for when any codepoints
> conflicts to other languages, and they might obtain the better font by
> applying it to the pattern in fontconfig side.
>> If so, then what I do myself is to configure a *set* of languages
>> instead of a single one in my fontconfig setup. This effectively creates
>> a multi-lingual "locale" for the purposes of font selection, guiding
>> fontconfig to prefer fonts for my favored languages.
> Yes, the concept of the FC_LANG environment variable that I wrote as a
> reference from bugzilla in the previous mail is the same with it. and
> applying it to the pattern prior to do something with
> FcConfigSubstitute() may be a bit aggressive here.
> --
> Akira TAGOH


More information about the Fontconfig mailing list