Re: improvement of font selection



On Tue, 28 Mar 2006, Kenichi Handa wrote:

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

This is not good.  When I run gedit in en_US but type Arabic,
lang=ar is passed to fontconfig, as expected.  I have no idea why
this is not working for you.

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

Indeed.


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

It's not quite always, but most of the time.  Search for
"bindings" in this page:

  http://www.fontconfig.org/fontconfig-user.html

> % 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.

Yes, that's the idea: if you specify a font and that font
supports Sinhala, you get it.

You can still override that by adding configuration like this for
example:

        <!-- Tahoma looks awful -->
        <match>
                <test name="family">
                        <string>Tahoma</string>
                </test>
                <edit name="family" mode="prepend" binding="same">
                        <string>Roya</string>
                </edit>
        </match>


> 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),

I didn't test this one, try something like this:

 <selectfont>
  <rejectfont>
   <pattern>
     <patelt name="family"><string>freesans</string></patelt>
   </pattern>
  </rejectfont>
 </selectfont>

wrapped in the <match> and test for the language.  Not sure if it
works.  If it doesn't, you may want to raise it on the fontconfig
list and we'll make it work there.


> but I think it's a big pain to list up all such fonts
> for many languages.

Well, yes, it's a big pain when people stuff (crappy) glyphs for
lots of different scripts in a font.  The solution is to not use
(or completely blacklist) FreeSans in the first place.


--behdad
http://behdad.org/

"Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill"
	-- Dan Bern, "New American Language"



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