[Fontconfig] Simulating generic aliases with an empty font

Qianqian Fang
2009-12-30T04:57:45Z

hi

Fontconfig only provides a limited number of generic aliases.
I am experimenting simulating a "generic alias" using an
empty font and a set of fontconfig rules.

Here is what I have done: I created an empty font using fontforge,
containing only a few invisible glyphs such as .notdef. The font
family name is set to "WenQuanYi Ray Song". I want to use
3 fonts to synthesize this font: Dejavu Serif, WenQuanYi Bitmap Song
and AR PL UMing CN. I created a fontconfig file to combine
these fonts so that 1) when rendering glyphs in the range of 11px~16px,
Dejavu Serif will be used for non-CJK and WQY Bitmap Song will
be used for CJK; 2) out of that range, vector glyphs in AR PL
UMing CN will be selected for CJK. The font file and the config
are attached.

I used the following command to test the rules, and it worked fine:

pango-view --font=''WenQuanYi Ray Song'' --text=''?????
Ray Song''
--waterfall --dpi=32

However, I am seeing some wield stuff when I tried to set this
font in the system appearance dialog. Under en_US locale, when
I select "WenQuanYi Ray Song" from the gtk font selection dialog
and click "regular" and "OK", "DejaVu Serif Book"
will be shown
as the font name instead. Because the font name is changed,
the previous defined rules for Ray Song is no longer used.

When I select this font under Chinese locale, the first available
font style is not "Regular" anymore, it became the traditional
Chinese family name of this font! (see attachment 3) Selecting
it will also fall back to "DejaVu Serif Book".

Finally, if you select the italic/bold/italicbold style, gtk font
dialog is able to use "WenQuanYi Ray Song" as the font name.

I am not sure which went wrong. The wrong font style may linked
to fontconfig, while the font name changing may be related to
gtk.

Anyone want to comment on this? do you see a possible bug from
these tests?

Qianqian





-------------- next part --------------
A non-text attachment was scrubbed...
Name: wqy-raysong.ttf
Type: application/x-font-ttf
Size: 1896 bytes
Desc: not available
Url :
http://lists.freedesktop.org/archives/fontconfig/attachments/20091229/acd95884/attachment-0002.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 66-wqy-raysong.conf
Type: text/xml
Size: 1847 bytes
Desc: not available
Url :
http://lists.freedesktop.org/archives/fontconfig/attachments/20091229/acd95884/attachment-0003.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wrong_font_style.png
Type: image/png
Size: 27958 bytes
Desc: not available