[Fontconfig] Improving Latin font selection for CJK locales

Behdad Esfahbod behdad at behdad.org
Sun Jan 27 20:38:03 PST 2008


Hi,

This keeps coming up again and again: CJK users want Pango to choose
Latin fonts differently under a CJK locale than it does under a non-CJK
locale.

Making that work is currently impossible in Pango+fontconfig.  The
reason being that Pango passes a Latin "lang" to fontconfig for Latin
runs, and fontconfig and font configurations have no way to
differentiate the Latin in CJK locale from Latin in Latin locale cases.

I'd like to propose adding a new element named "locale" that holds the
original locale language.  Fontconfig needs not know about this at all
except that filling it in in FcDefaultSubstitute() like it does for
"lang".  Then users can write configuration that is sensitive to locale.

Pango then can pass PangoContext language as "locale".  PangoContext
language defaults to the locale, so this is all consistent.

I can do this all in Pango only, but given that I want to encourage CJK
font developer/packagers to write such configuration for their fonts,
would be nice to have it upstreamed.

As an example, one would write:

        <match>
                <test name="lang">
                        <string>en</string>
                </test>
                <test name="locale">
                        <string>ja</string>
                </test>
                <edit name="family" mode="prepend" binding="same">
                        <string>SomeJapaneseFontWithGoodLatin</string>
                </edit>
        </match>

It could be easier if we could match on scripts instead of languages,
but that's another issue.

Keith, what do you think?

-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759



More information about the Fontconfig mailing list