Simulating generic aliases with an empty font

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

 



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





Attachment: wqy-raysong.ttf
Description: application/font-ttf

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
       <alias>
                <family>WenQuanYi Ray Song</family>
                <default><family>serif</family></default>
       </alias>

       <match target="pattern">
           <test qual="any" compare="eq" name="family">
                   <string>WenQuanYi Ray Song</string>
                   <string>æ??æ³?é©¿é??å®?</string>
                   <string>æ??æ³?é©?é?³å®?</string>
           </test>
           <test compare="more" name="pixelsize">
                   <double>16</double>
           </test>
           <edit name="family" mode="prepend" binding="same">
                   <string>DejaVu Serif</string>
                   <string>AR PL UMing CN</string>
           </edit>
       </match>

       <match target="pattern">
           <test qual="any" compare="eq" name="family">
                   <string>WenQuanYi Ray Song</string>
                   <string>æ??æ³?é©¿é??å®?</string>
                   <string>æ??æ³?é©?é?³å®?</string>
           </test>
           <test compare="less" name="pixelsize">
                   <double>10</double>
           </test>
           <edit name="family" mode="prepend" binding="same">
                   <string>DejaVu Serif</string>
                   <string>AR PL UMing CN</string>
           </edit>
      </match>

       <match target="pattern">
           <test qual="any" compare="eq" name="family">
                   <string>WenQuanYi Ray Song</string>
                   <string>æ??æ³?é©¿é??å®?</string>
                   <string>æ??æ³?é©?é?³å®?</string>
           </test>
           <edit name="family" mode="prepend" binding="same">
                   <string>DejaVu Serif</string>
                   <string>WenQuanYi Bitmap Song</string>
           </edit>
       </match>

</fontconfig>

PNG image

_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig

[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux