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

Jjgod Jiang gzjjgod at gmail.com
Wed May 30 04:26:34 PDT 2012


On Wed, May 30, 2012 at 4:47 AM, Akira TAGOH <akira at tagoh.org> wrote:
> On Wed, May 30, 2012 at 7:02 AM, Raimund Steger <rs at mytum.de> wrote:
>> LANG (as opposed to FC_LANG) *is* already used to provide a default value
>> dynamically, provided programs use FcDefaultSubstitute which I think they
>> all do.
>> (BTW- Akira- is there a special reason why applying the new string set
>> needed to be done in FcConfigSubstituteWithPat in addition to
>> FcDefaultSubstitute?)
> Well, honestly I don't still even have the reasonable answer for that
> though, FcDefaultSubstitute() seems supposed to call after
> FcConfigSubstitute().
> https://bugs.freedesktop.org/show_bug.cgi?id=35482#c2
> I guess because it may affects too many things on building the
> pattern? Keith or Behdad?
> Anyway, so I did it separately to avoid dirty pattern.

I'm struggling to understand how to I specify a preferred font list for
certain languages. Let's say I want to make sure my preferred order for
"zh" font is like this:

   Hiragino Sans GB
   Adobe Heiti Std
   Droid Sans Fallback
   Microsoft YaHei

But I do *not* want to specify a hardcoded lang in my FcPattern, I'd
rather have FcDefaultSubstitue() to add the default lang for me based
on current environment. If I specify the preferred zh font list like

   <match target="pattern">
      <test name="lang"><string>zh</string></test>
      <edit name="family" mode="append" binding="same">
         <string>Hiragino Sans GB</string>…

then this will happen in FcConfigSubstitute() which is (normally)
earlier than FcDefaultSubstitute(), then I don't get the lang set
by FcDefaultSubstitute().

So what's the preferred way to do that?

There are similar questions like

- Jiang

More information about the Fontconfig mailing list