BLFS‎ > ‎

8. Chinese Font

created : 2010-02-17   updated : 2010-02-17
 
In Linux, there exists two type of Font Systems :
 
  1. The original subsystem is referred to as the "core X font subsystem". Fonts rendered by this subsystem are not anti-aliased, are handled by the X server, and have names like:

    -misc-fixed-medium-r-normal--10-100-75-75-c-60-iso8859-1

  2. The newer font subsystem is known as "fontconfig", and allows applications direct access to the font files. Fontconfig is often used along with the Xft library, which allows applications to render fontconfig fonts to the screen with antialiasing. Fontconfig uses more human-friendly names like:

    Luxi Sans-10

 
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 :
 
 
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
Comments