Re: improvement of font selection



In article <Pine LNX 4 58 0603280125190 21196 epoch cs>, Behdad Esfahbod <behdad cs toronto edu> writes:

>> The fonts selected are these (I got this information by
>> adding printf() in pango/modules/indic/indic-fc.c).
>> 
>> U+0D86 -> LKLUG
>> U+0DBA U+0DD4 U+0DB6 -> FreeSerif
>> U+0DDD -> LKLUG
>> U+0DC0 U+0DB1 U+0DCA -> FreeSerif
>> 
>> lklug contains all corresponding glyphs, but glyphs for
>> U+0D86 and U+0DDD are missing in freeserif.  Of course the
>> resulting rendering is incorrect.

> This doesn't look good.  Can you put a FcPatternPrint in
> pango/pangofc-fontmap.c just before the FcFontSort call to print
> out the pattern, and then see what pattern is searched for when
> you open the Sinhala text in gedit?  It should have lang=si.  You
> are using latest Pango, right?  Not that it makes any different,
> just to make sure we are looking at the same code.

Yes, I'm now testing the latest CVS code.  FcPatternPrint
printed:
	lang: "c"(s)
and
	lang: "en"(s)

But, when I start gedit as this:

% LANG=sl_SI.UTF-8 gedit FILENAME

FcPatternPrint prints these:
	lang: "si"(s)
	lang: "sl-si"(s)
and only lklug is used, thus the text is rendered correctly.

But, it's not good to require locale change just for having
a correct rendering.

By the way, it seems that fontconfig always put higher
priority to "family" than "lang".  So, I get this result.

% fc-match --sort freeserif:lang=si
FreeSerif.ttf: "FreeSerif" "Medium"
FreeSerifBold.ttf: "FreeSerif" "Bold"
FreeSerifItalic.ttf: "FreeSerif" "Italic"
FreeSerifBoldItalic.ttf: "FreeSerif" "BoldItalic"
lklug.otf: "LKLUG" "Regular"
[...]

Doesn't it mean that if a user prefer freeserif in general
in some application, Pango puts freeserif in pattern, thus
lklug doesn't come first even for rendering Sinhala in that
application.  This is just my guess.  I don't know exactly
how Pango builds up pattern.  But, at least, when I select
freeserif in gedit->Edit->Preferences->Font&Colors, even in
sl_SI.UTF-8 locale, gedit again tries to use freeserif.

You wrote:
> Anyway, combining the language test with rejectfont allows for
> per-language blacklisting.

That technique will solve this problem (I don't know how to
write it in .fonts.conf, could you teach me so that I can
try), but I think it's a big pain to list up all such fonts
for many languages.

---
Kenichi Handa
handa m17n org



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