created : 2010-02-17 updated : 2010-02-17
In Linux, there exists two type of Font Systems :
Applications using the Qt 4 or GTK 2 toolkits (which would include KDE and GNOME applications) use the fontconfig and Xft font subsystem; most everything else uses the core X fonts.
Chinese Font in FireFox
Firefox is a GTK application and therefore it use the xft font system. To make Firefox display Chinese, we need to download the corresponding Chinese fonts :
wget http://us.archive.ubuntu.com/ubuntu/pool/main/t/ttf-arphic-uming/ttf-arphic-uming_0.2.20080216.1.orig.tar.gz
wget http://us.archive.ubuntu.com/ubuntu/pool/main/t/ttf-arphic-ukai/ttf-arphic-ukai_0.2.20080216.1.orig.tar.gz These two tar balls are not properly packaged with folder information, it is suggested to make a new folder before unpacking :
mkdir uming cd uming tar xvf ../ttf-arphic-uming_0.2.20080216.1.orig.tar.gz Installation instruction are in the INSTALL file :
cat INSTALL Follow the instruction to install the uming font :
install -v -d -m755 /usr/share/fonts/truetype/uming cp *.ttc fonts.* /usr/share/fonts/truetype/uming cp *.conf /etc/fonts/conf.avail/ cd /etc/fonts/conf.d ln -s ../conf.avail/*-ttf-arphic-uming-*.conf . fc-cache -fv xset fp rehash Now go back to the folder storing the ukai tar ball, do similar thing as above :
Unpack :
mkdir ukai cd ukai tar xvf ../ ttf-arphic-ukai/ttf-arphic-ukai_0.2.20080216.1.orig.tar.gz Install :
install -v -d -m755 /usr/share/fonts/truetype/ukai cp *.ttc fonts.* /usr/share/fonts/truetype/ukai cp *.conf /etc/fonts/conf.avail/ cd /etc/fonts/conf.d ln -s ../conf.avail/*-ttf-arphic-ukai-*.conf . fc-cache -fv xset fp rehash Now firefox should be able to display Chinese.
Chinese Font in XTerm
Append the following config to the file ~/.Xresources :
cat >>~/.Xresources <<"EOF" xterm*faceName:AR PL Uming CN xterm*faceSize:12 EOF Check the file content, you should see the above lines at the end of file
cat ~/.Xresources Reload the resource file :
xrdb -load ~/.Xresources Start XTerm, and execute the following inside XTerm :
export LANG=zh_TW.utf8 ls apple_orange_banana You should see the error message in Chinese : (Note for English readers : Chinese message below)
ls: 無法存取 apple_orange_banana: 沒有此一檔案或目錄 The above message in English is :
ls: cannot access apple_orange_banana: No such file or directory A better approach
1. Edit the fluxbox startup script :
vi ~/.fluxbox/ startup 2. Add the following line before the line exec fluxbox :
xrdb -load ~/.Xresources 3. Modify ~/.Xresources such that cxterm is used instead of xterm :
cxterm*faceName:AR RL Uming CN cxterm*faceSize:12 cxterm*.Geometry:80x24 4. Create an alais in ~/.bashrc (using vi ~/.bashrc) :
alias cxterm="LANG=zh_TW.utf8 xterm -name cxterm" Now, you have xterm and cxterm ready. You may start a cxterm inside xterm using the following command :
cxterm & End |
BLFS >