Saturday, August 4, 2007

Setting up Chinese in Slackware 12

Update: With Slackware 12.1, Chinese display works out-of-the-box with 文泉驿 (WenQuanYi) 正黑 font. IME packages like scim, skim and a lot more are included in 12.1, Chinese (and other language) input can be enabled easily by following instructions in CHANGES_AND_HINTS.TXT in the distribution.

- Allow displaying of Chinese characters in UTF-8 encoding while still having the normal English user interface.
- Allow inputing of Chinese characters using SCIM.

Slackware 12.0 full installation, default huge smp kernel.
文泉驿 (WenQuanYi) Bitmap Song font 0.8.1
scim 1.4.7, scim-pinyin-0.5.91, skim-1.4.5

Get 文泉驿 (WenQuanYi) Bitmap Song font from I use the PCF format of current version 0.8.1. Follow the instructions included in the downloaded file (run mkfontdir, vc-cache, etc). I copied all the pcf files into /usr/share/fonts/ folder, so that no change to /etc/X11/xorg.conf and /etc/fonts/fonts.conf is required. You can also copy the file 85-wqy-bitmapsong.conf into /etc/fonts/conf.avail/ and created a link in /etc/fonts/conf.d/, as suggested by the installation instructions but with slight variation in directory names. However, this config file will force WenQuanYi to be the chosen for all kinds of font requests, and make your English contents ugly. So if you want beautiful English fonts, don't use this one, and do your own font config instead.

As I still want to use English as my primary desktop language, I leave the LC_* environment variables untouched, and only changed LC_CTYPE=zh_CN.UTF-8 in my ~/.profile. (Note: I tried en_US.utf8 but it does not work, as all KDE applications will show squares for Chinese characters. This means fontconfig does not pick WenQuanYi font. I guess the reason is because WenQuanYi Bitmap Song font's lang attribute does not have "en" in the list so it does not get matched. )

After that restart X.

Download and compile scim, scim-pinyin, and skim, using root.
scim 1.4.7
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make -j3
make instal DESTDIR=/your/dest
makepkg scim-1.4.7-i686-1xc.tgz

scim-pinyin 0.5.91
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make -j3
make instal DESTDIR=/your/dest
makepkg scim-pinyin-0.5.91-i686-1xc.tgz
installpkg scim-pinyin-0.5.91-i686-1xc.tgz

skim 1.4.5
scons configure prefix=/usr
scons -j3
mkdir -p /usr/lib/pkgconfig
cp skim.pc /usr/lib/pkgconfig/
scons install DESTDIR=/your/dest
makepkg skim-1.4.5-i686-1xc.tgz

I also added the following lines to .profile:
export XIM=SCIM

After that restart X.

1 comment:

Anonymous said...

your blog post is fantastic! though I still haven't configured my scim or skim to be working but at least I know how to makepkg & installpkg. Thanks a lot.