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

Re: Request for review and advice on wqy-bitmap-fonts fontconfig settings

hi Nicolas

the syntax described in Fonts/Packaging/Fontconfig seems not sufficient
to accomplish the desired substitution rules.

First, we want to set wqy-bitmap-fonts as the default font for displaying Chinese characters (for example U4E00-U9FA5, and U3400-U4D86 and some punctuations), for all aliases (sans/serif/mono), and all locales (maybe except ja/ko), only at 10px to 16px. This can not be done with <alias><prefer></prefer></alias> syntax (I just tested, it used the Latin part in wqy-bitmap-fonts in mono, and can not use Uming/ukai for above/below 10-16px, both of these are bad).

Second, I want the system preferred Latin fonts to display the non-CJK part. The provided syntax, in my own opinion, can not do this either.

You mention "no business touching non CJK locales," I don't fully agree. The default fontconfig setup for rendering Chinese webpages under non-zh locales is terrible. You can test this using en or other non CJK locales, by browsing http://wenq.org , you will see a mixed text rendered by Japanese fonts, uming, ukai and some Japanese/Korean bitmap X core fonts. In my opinion, that is non-usable. To tell the truth, en_US is my default locale for both office and at home. I don't want my desktop looks non-legible by my colleagues. However, I do want it to process Chinese properly. Most my Chinese friends working in the US have the same set up for the same reason. The default en (or non CJK) Chinese rendering does need to be improved (it might be more appropriate to handle this with Fedora font committee or some sort, but improving the situation by installing an additional font package may not a bad solution either: those who don't like it just uninstall this font, and everything will back to the default way).

Last, the link that you mentioned does look promising:
However, my question is, how can I make sure that the preferred Latin fonts (not necessarily Vera/Dejavu, could be something that user chose as in Andreas's case in bug #381311) overrides the Latin part of wqy?

Thank you and I would be glad to hear further instructions.


On Nov 24, 2007 9:21 AM, Nicolas Mailhot <nicolas mailhot gmail com > wrote:

Le vendredi 23 novembre 2007 à 23:25 -0500, Qianqian Fang a écrit :

Hi Qianqian,

> 4. Questions
> That's all I want to learn from you: do you see a robust implementation
> of fontconfig font selection mechanism to achieve my goals above?
> if yes, how? if no, to whom should I file bug reports to?

I'm not sure if I've assimilated all your goals, but here are some
comments on your fontconfig file:

> <?xml version=" 1.0"?>
> <!DOCTYPE fontconfig SYSTEM "fonts.dtd">

You probably want ../fonts.dtd there but that's general XML fontconfig
brokenness most everyone is guilty of.

>     <match target="pattern">

I suppose this is protected by the selectfont pattern before but I'd
avoid playing any complex substitution games when the name of an
existing on-system font is given, and only substitute either fonts not
available at all or synthetic fonts like sans-serif and friends.

Also, please use a simple match with a test for family inside instead of
this pattern indirection, as documented on:

>         <test equal="any" compare="eq" name="lang">

>                 <string>en</string>
>                 <string>en-us</string>

You have no business touching non CJK locales, please remove this. If
for some reason an app does not tag text with the correct locale,
complain to its authors.


These two lines are probably responsible for most of your problem

>                 <string>zh-cn</string>
>                 <string>zh-tw</string>
>                 <string>zh-hk</string>
>                 <string>zh-sg</string>
>         </test>

>         <test compare="more_eq" name="pixelsize">
>                 <double>11</double>
>         </test>
>         <test compare="less_eq" name="pixelsize">
>                 <double>16</double>
>         </test>

Are you sure of the 11-16 pixel range?

>         <edit name="family" mode="prepend_first">
>                 <string>WenQuanYi Bitmap Song</string>
>         </edit>
>     </match>

>     <match target="pattern">


>         <test compare="more_eq" name="size">
>                 <double>8</double>
>         </test>
>         <test compare="less_eq" name="size">
>                 <double>12</double>
>         </test>

Point sizes have no meaning for bitmap fonts, unless you assume a fixed
point/pixel ratio, which is not hardware reality. Dump this match block
it's actively evil.

>         <edit name="family" mode="prepend_first">
>                 <string>WenQuanYi Bitmap Song</string>
>         </edit>
>    </match>

>     <match target="pattern">
>         <test equal="any" compare="eq" name="family">
>                 <string>WenQuanYi Bitmap Song</string>
>         </test>
>         <test equal="any" compare="eq" name="family">
>                 <string>monospace</string>
>         </test>
>         <edit name="family" mode="prepend">
>                 <string>Bitstream Vera Sans Mono</string>
>         </edit>
>         <edit name="family" mode="prepend" binding="strong">
>                 <string>DejaVu LGC Sans Mono</string>
>         </edit>
>     </match>

If you didn't touch non-CJK locales before you wouldn't need this
bandaid. Also you're assuming some other fonts are present on system
which may not be the case. Our default latin font list is dynamic and
changes from release to release, and depending on what font packages
users actually install.

If you really want Vera or DejaVu to override WenQuanYi Bitmap Song
contents, the override should be added to the fontconfig file those
fonts ship.

Wouldn't a simple
rule with additional pixel range restriction be sufficient for your


Nicolas Mailhot

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