Re: Font selection algorithm?



Allow me to pick up this thread again:

On 01/21/2010 03:17 AM, Behdad Esfahbod wrote:
On 01/19/2010 07:52 PM, Robert Siemer wrote:
On 01/19/2010 04:18 AM, Behdad Esfahbod wrote:
On 01/18/2010 12:50 AM, Robert Siemer wrote:

It is really hard to improve the configuration (through fontconfig),
without knowing which font request pattern to intercept. -- Even in a
specific app with FC_DEBUG set it is hard fish the right request chain.

Something like:

$ fc-match --sort "sans:lang=fa"

is all you need to check.

So Pango does at most one fontconfig request for each given text?

One per language.

Assume that the application gives no hints: What is the algorithm to derive “languages” from a text? (Just the current locale language, or something more?)

What happens when out-of-language characters pop up?

Is it like the following:  ?

1) Pango gets a (untagged, no language) text to layout
2) Pango launches a sans:lang=locale request and gets a list from fontconfig
3) every character covered in the first font from the result list is laid out 4a) if a character comes up that is i) not covered but ii) is considered the same language is tried to layout with the next font from the list (recursive) 4b) if a char is i) not covered and ii) is not considered the same language: that results in a new lookup like “sans:lang=new_language” and a covering font is searched in the new result list (*) 5) Pango falls back to the very first font from the original result list as soon a a character from the initial (locale derived) language is hit
...and so on...


(*) Does Pango still use the infamous lang=“xx” requests in case it can’t derive a language? Fontconfig has to be adapted to always return a “unicode-complete” font at the bottom of the list to avoid boxes to be drawn. (Pango does never ask for specific glyphs, but languages, right?)


Regards,
Robert



So to
avoid missing characters it requires a corresponding fontconfig
configuration, and does not launch adapted requests for e.g.
"sans:lang=someotherlang" or "sans:charset=..."?

It does for lang, not charset.


In the example above: is the "sans" the default in Pango if not
overwritten in the app? Or is the default the empty pattern?

I think sans is the default, yes.

In a standard gtk/gnome app, the ":lang=..." part comes from the current
locale or is it text driven?

Defaults to locale, but the app can override (eg, firefox passes the web page
language).

behdad


Thanks again,
Robert
_______________________________________________
gtk-i18n-list mailing list
gtk-i18n-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-i18n-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]