[Fontconfig] Improving Latin font selection for CJK locales

Behdad Esfahbod behdad at behdad.org
Mon Jan 28 10:59:43 PST 2008


On Mon, 2008-01-28 at 12:24 -0500, Ed Trager wrote:
> Hi, everyone,
> 
> Behdad notes:
> 
> > It could be easier if we could match on scripts instead of languages,
> > but that's another issue.
> 
> ... and I agree completely :
> 
> REQUIREMENT: EXPAND DEFINITION OF LOCALE TO INCLUDE OPTIONAL ISO-15924
> SCRIPT CODE

No need to shout Ed.

> =============================================================================
> 
> First of all, the notion of "locale" needs to be re-defined as
> composed of *3* elements instead
> of *2* elements.
> 
> Currently, locales are composed of just two elements:
> 
>        (1) A "language" code (ISO-639-1, -2 : "en", "ja", "zh", "th", etc.)
> and (2) A "region" code ("US", "CA", "FR", "TW", "HK", "SG", etc. )
> 
> This concept is incomplete.  A THIRD ELEMENT, SCRIPT, NEEDS TO BE ADDED.  Using
> four-letter ISO-15924 (
> http://unicode.org/iso15924/iso15924-codes.html ) codes is the obvious
> answer:
> 
>        (3) "Script" code (ISO-15924 : "arab", "cyrl", "hans"
> (simplified Chinese), "hant" (traditional Chinese)

No, this is not what I meant.  And this doesn't solve the issues I want
to solve.

[...]
> Adding a four-letter script code to Locale is the obvious remedy.
> Perhaps the Pango and Fontconfig communities could take the lead in
> creating the minor changes in infrastructure needed to support this
> addition ?

That's what I've been wanting to do, but not in the format you suggest.

> Let's return to Behdad's Japanese example for a minute.  Recall that
> modern Japanese is, for all intents and purposes, really composed of
> four scripts ( Han, Katakana, Hiragana, Latin ).  So, for a Japanese
> locale, perhaps I ought really be able to specify a different font set
> each and every one of those four scripts independently, if I so
> desire.

Yes, and with my proposed syntax of having a separate "script" element
you can do that.  So you have a pattern of :lang="ja":script="han " for
example.

behdad

> Best Wishes -- Ed Trager
> 
> 
> On Jan 27, 2008 11:38 PM, Behdad Esfahbod <behdad at behdad.org> wrote:
> > 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
> >
> > _______________________________________________
> > Fontconfig mailing list
> > Fontconfig at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/fontconfig
> >
-- 
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