FlyZhy.Org logo Projects - GNU/Linux in Chinese

Before
HowTo
Preparing
Configuring
After

The first problem for Chinese users may be the ugly display of Chinese fonts in GNU/Linux. I have no more strict demand but just display the normal Chinese fonts in my Slackware Linux, so here gives the basic idea about the configuration for Chinese fonts. If you demand this strictly, please look for more documents about this field.

Before

HowTo

This is the simple localization for Chinese in GNU/Linux.

Preparing

Configuring

I divided the situation into the following two situations.

GTK1 program

config:

/etc/X11/XF86Config or /etc/X11/xorg.conf +2
The fonts of programs written by GTK1 depend on the "Section Files" segment of the file "/etc/X11/XF86Config" or "/etc/X11/xorg.conf". So insert a line like the following in this segment:
FontPath	"/path/to/fonts"
where the /path/to/ stands for the path to store the fonts directory as /usr/share/ for my configuration.1
/usr/share/fonts/fonts.scale and /usr/share/fonts/fonts.dir
To make the scale file and the dir file for the fonts you want to install, first go into the directory including the fonts, then use
#ttmkfdir
#cp fonts.scale fonts.dir
if you can use ttmkfdir or
#mkfontscale
#mkfontdir
if you cannot use ttmkfdir.
/etc/gtk/gtkrc.zh_CN +2
style "gtk-default-zh-cn" {
       fontset = "-bitstream-bitstream vera serif-medium-r-*-*-14-*-*-*-*-*-*-*,\
                -misc-*-medium-r-*-*-16-*-*-*-*-*-gbk-0"
}
class "GtkWidget" style "gtk-default-zh-cn"
Tips
To find some fonts you can use by command xlsfonts or xfontsel or you can directly find the one in the file "fonts.scale" and "fonts.dir".
Programs
XMMS, GIMP, etc.

up

GTK2 and QT program

config:

/etc/fonts/fonts.conf
The fonts of programs written by GTK2 or QT depend on the mechanism of FontConfig and the configuration file is "/etc/fonts/fonts.conf", so modify this file as follows +2:
<!-- Add the following code to the end -->
<!-- This expression is added by Akito Hirai<akito@kde.gr.jp> for convenience.-->
<!-- It can be used to make artificial bold versions in client libraries/applications.-->
<match target="font">
         <test name="weight">
                <const>medium</const>
         </test>
         <test target="pattern" name="weight" compare="more">
                <const>medium</const>
         </test>
         <edit name="weight" mode="assign">
         <if>
                 <more>
                         <name>spacing</name>
                         <const>proportional</const>
                 </more>
                 <const>demibold</const>
                 <const>bold</const>
         </if>
                 </edit>
</match>
<match target="font">
         <test name="pixelsize" compare="less_eq">
                 <double>16</double>
         </test>
         <test name="pixelsize" compare="more_eq">
                 <double>8</double>
         </test>
         <edit name="antialias" mode="assign">
                 <bool>f</bool>
         </edit>
</match>
<!-- added by Haiyong Zheng -->
<!-- set up the minimum font for SimSun to make little Chinese fonts good look -->
<match target="font" >
        <test qual="any" name="family" compare="eq" >
                <string>SimSun</string>
        </test>
        <test compare="more_eq" name="pixelsize" >
                <int>8</int>
        </test>
        <test compare="less_eq" name="pixelsize" >
                <int>12</int>
        </test>
        <edit mode="assign" name="pixelsize" >
                <int>12</int>
        </edit>
</match>
<!-- substitue bold SimSun by SimHei -->
<match target="pattern">
<test name="family"><string>SimSun</string></test>
<test name="weight" compare="more_eq"><const>bold</const></test>
<edit name="family" mode="assign"><string>SimHei</string></edit>
</match>
<!-- turn SimSun fonts AA off -->
<match target="font">
<test qual="any" name="family"><string>SimSun</string></test>
<edit name="antialias" mode="assign"><bool>false</bool></edit>
</match>
/etc/gtk-2.0/gtkrc +2
style "user-font" {
        font_name="Bitstream Vera Sans 9"
        font_name="simsun 14" }
class "*" style "user-font"
qtconfig
#qtconfig
Programs

up

After

Fonts

top


1. If something goes wrong, just have a try to uncomment the "Load xtt" line of the file "/etc/X11/XF86Config" or "/etc/X11/xorg.conf".

2. The symbol "+" stands for adding the following codes into the file in front of "+".