Fedora notes

Tuesday, July 12, 2005

Install fonts to be available to XMMS

linux font/encoding is always a haunting issue, especially for asian language users. i've been using linux for one or two years, but still have no idea what's exactly going on about chinese fonts tweaking sometimes ...

x windows usually have two font subsystems: core x font system and fontconfig/xft. those fonts installed by drag&drop in gnome or fc-cache are for fontconfig/xft system, which is only accessible by new apps based on qt3 and gtk2. some old apps using gtk1 such as xmms will not be aware of those fonts. to make your fonts available to xmms like old apps, you have to install it in core x font system.

steps:
1. create the folder where you wanna store your new font. in this example, i use "/usr/share/fonts/local/"
mkdir /usr/share/fonts/local/
2. update font info.
cd /usr/share/fonts/local/
mkfontscale
mkfontdir
3. add font path
chkfontpath --add /usr/share/fonts/local/
4. restart x server.

a little bit notes about font/encoding in XMMS:
1. xmms interface font(in menu, dialog,etc.) is determined by your LANG setting and the corresponding file /etc/gtk/gtkrc.LANG, or you can create a file .gtkrc.mine under your home folder to overwriting the default settings.
2. xmms list/display font is determined by your settings in its preference for fonts. you have to enable multi-byte encoding option to correctly display asian languages. another important thing to remember is, the encoding name used in the font you specified to display non-asci characters has to be matched with that of LC_CTYPE's value.

for example, i use simsun to display chinese characters, and i specify a font in XMMS:
-misc-simsun-medium-r-normal-*-*-120-*-*-p-*-gb2312.1980-0
in this case, the encoding name is gb2312. this requires my LC_CTYPE to be set to zh_CN instead of zh_CN.utf-8 or zh_CN.gbk, etc. if you don't have LC_CTYPE=zh_CN, the chinese display in xmms is likely to be incorrect, at least in my tests of FC4. from this, we can see actually xmms is trying to use the encoding specified in LC_CTYPE, and display characters with the matched encoding font. if LC_CTYPE=zh_CN.gbk, xmms will not be able to find a font handling gbk, unless you have a font named:
-misc-simsun-medium-r-normal-*-*-120-*-*-p-*-gbk-0
to find out what encodings are available in a certain font, you can check the file fonts.dir created by mkfontdir under your font path. in my case, there is no gbk available for simsun. i don't know if it makes sense here to add lines for support gbk since simsun obviously should support gbk.

0 Comments:

Post a Comment

<< Home