Setup Chinese TrueType fonts for RH8 

Strategy 

Strategy:

So, basically, all modification done in /etc/X11/XF86Config is enough.

Files 

Example: File /etc/X11/XF86Config:
Section "Files"
    RgbPath     "/usr/X11R6/lib/X11/rgb"
    FontPath   "/fonts/TrueType/win_zh_CN.0"
    FontPath   "/usr/share/fonts/zh_CN/TrueType"
    FontPath   "/usr/share/fonts/zh_TW/TrueType"
    FontPath   "unix/:7100"
EndSection

Section "Module"
        Load "dbe"      # Double-buffering
        Load "dri"      # Direct rendering infrastructure
        Load "GLcore"   # OpenGL support
        Load "glx"      # OpenGL X protocol interface
        Load "extmod"   # Misc. required extensions
        # Load "v4l"    # Video4Linux, not in default setting
        # Load "pex5"   # PHIGS for X 3D environment (obsolete)
        Load "record"   # X event recorder
        # Load "xie"    # X Image Extension (obsolete)
        # You only need the following two modules if you do not use xfs.
        Load "freetype" # TrueType font handler, can also use xtt
        Load "type1"    # Adobe Type 1 font handler, not in default setting
        Load "fbdevhw"
EndSection

Quit xwindow then start it gain. Note that restarting xwindow manager won't help.

xfd -fn -microsoft-simsun-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0 &
xfd -fn -microsoft-simsun-medium-r-normal--0-0-0-0-p-0-gb2312.1980-0 &

References 

http://www.tldp.org/HOWTO/mini/FDU/x-4x.html http://www.linuxaid.com.cn/articles/9/2/926447146.shtml http://www.linuxaid.com.cn/articles/5/5/554079777.shtml http://www.aucs.org/rpmcenter/RedHat_72_73_Chinese_mini-HOWTO.html

Chinese TrueType fonts trial and errors 

xmms fonts 

Xmms does not have a menu font configuration.

xmms fonts 

The actual environment variable that make the vital effect is LC_CTYPE. LC_CTYPE=zh_CN or not determines whether xmms can show Chinese characters or not. But there is an annoying side effect also. The xmms menu changed also. trying to affect xmms menu font by other environment variables won't work.

xmms fonts 

man locale

LC_CTYPE
        Character classification and case conversion.
LC_MESSAGES
        Formats of informative and diagnostic messages and
        interactive responses.

gb2312.1980 is not enough 

Error returned from xmms:

The font "-microsoft-simsun-medium-r-normal-*-*-100-*-*-c-*-gb2312.1980-0"
does not support all the required character sets for the current locale "C"
  (Missing character set "ISO8859-1")

adding "-microsoft-simsun-medium-r-normal—0-0-0-0-c-0-iso8859-1" into fonts.dir solved the problem.

xtt for xfs 

Goal 

Try to use xfs to render Chinese TrueType fonts through 'xtt for xfs'. Note this practice has been proved to be a failure to render Chinese TrueType fonts.

Status check, before the change 
FONTSERVER=unix/:7100 fslsfonts | grep sim

— empty at first

% xlsfonts | grep sim
-misc-simhei-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
-misc-simhei-medium-r-normal--0-0-0-0-p-0-gb2312.1980-0
-misc-simsun-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
-misc-simsun-medium-r-normal--0-0-0-0-p-0-gb2312.1980-0

— none-empty at first

Action: remove fonts from Xfree86 and add to xfs 
xset -fp /export/fonts/TrueType/win_zh_CN/
xlsfonts | grep sim

— empty now

chkfontpath --add /export/fonts/TrueType/win_zh_CN0/
Status check, after the change 
% FONTSERVER=unix/:7100 fslsfonts | grep microsoft
-microsoft-simhei-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
-microsoft-simhei-medium-r-normal--0-0-0-0-p-0-gb2312.1980-0
-microsoft-simsun-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
-microsoft-simsun-medium-r-normal--0-0-0-0-p-0-gb2312.1980-0
xfd -fn -microsoft-simsun-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0 &
xfd -fn -microsoft-simsun-medium-r-normal--0-0-0-0-p-0-gb2312.1980-0 &

Adding the /export/fonts/TrueType/win_zh_CN/ to xfs will not work, because xfs changes the file "fonts.dir" by all means.

Only gb2312.1980 works 

Tried to change the 'gb2312.1980' to 'gb18030', then rxvt failed to show Chinese any more.

Chinese TrueType fonts won't work with xfs 

xfs always rewrite the fonts.dir file 

% cat fonts.dir
6
simhei.ttf -microsoft-SimHei-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
simkai.ttf -microsoft-KaiTi_GB2312-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
simsun.ttf -microsoft-SimSun-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
simhei.ttf -microsoft-SimHei-medium-r-normal--0-0-0-0-p-0-gb2312.1980-0
simkai.ttf -microsoft-KaiTi_GB2312-medium-r-normal--0-0-0-0-p-0-gb2312.1980-0
simsun.ttf -microsoft-SimSun-medium-r-normal--0-0-0-0-p-0-gb2312.1980-0

chmod 444 fonts.dir

% dirdir . fonts.*
dr-xr-xr-x    2 root     root         4096 Nov  3 15:42 ./
-r--r--r--    1 root     root          422 Nov  3 16:01 fonts.dir
lrwxrwxrwx    1 root     root            9 Nov  3 15:39 fonts.scale -> fonts.dir

/etc/rc.d/init.d/xfs restart

% dirdir . fonts.*
dr-xr-xr-x    2 root     root         4096 Nov  3 16:02 ./
-rw-r--r--    1 root     root          641 Nov  3 16:02 fonts.dir
lrwxrwxrwx    1 root     root            9 Nov  3 15:39 fonts.scale -> fonts.dir

— xfs writes over the readonly file "fonts.dir" in the readonly directory!

Chinese TrueType fonts reconized by xfs can't be used 

Try to use whatever fonts reconized by xfs, as long as we know it is the one.

% xlsfonts | grep sim
-misc-simhei-medium-r-normal--0-0-0-0-c-0-ascii-0
-misc-simhei-medium-r-normal--0-0-0-0-c-0-iso10646-1
-misc-simsun-medium-r-normal--0-0-0-0-c-0-ascii-0
-misc-simsun-medium-r-normal--0-0-0-0-c-0-fcd8859-15
-misc-simsun-medium-r-normal--0-0-0-0-c-0-iso10646-1
-misc-simsun-medium-r-normal--0-0-0-0-c-0-iso8859-1
-misc-simsun-medium-r-normal--0-0-0-0-c-0-iso8859-15
-misc-simsun-medium-r-normal--0-0-0-0-c-0-koi8-r
% LANG=zh_CN rxvt -sl 1500 -bg black -fg gray75 -fn 7x14 -km gb -fm -misc-simsun-medium-r-normal--0-0-0-0-c-0-iso10646-1

'date' result is wrong.

% LANG=zh_CN rxvt -sl 1500 -bg black -fg gray75 -fn 7x14 -km gb -fm -misc-simsun-medium-r-normal--0-0-0-0-c-0-iso8859-1

— not cc fonts at all for 'date'

Niether the iso10646, nor the iso8859 can be use by rxvt to show Chinese.

It's all about the fonts 

https://listman.redhat.com/pipermail/limbo-list/2002-August/003192.html

20 Aug 2002 23:14:11 +0100

> I ran 'chkfontpath' and /usr/share/fonts/default/TrueType was NOT listed
> as a font path.... Should it be by default?

I could be completely wrong, but that is only there for backward compatibility for say Gnome 1.4 stuff.

add it to you're XF86Config path as well.

But all you have to do to make TrueType fonts available to Gnome 2 is:

First Make a directory say `/usr/X11R6/lib/X11/fonts/TTFONTS'

This is where we will add our true Type Fonts

Then you want to copy the fonts into this directory:

cd (where fonts are located)
cp *.ttf /usr/X11R6/lib/X11/fonts/TTFONTS

(Make sure they are all lower case)

Now we want to make a list of all the fonts and they weight, class & description:

cd /usr/X11R6/lib/X11/fonts/TTFONTS
ttmkfdir -o fonts.scale
mkfontdir

Then edit /etc/fonts/fonts.conf and add the paths like so:

<dir>/usr/X11R6/lib/X11/fonts/TTFONTS</dir>

Logout and back in (this may not be imperative)

Voila

Mark

It's all about the fonts 

> > I ran 'chkfontpath' and /usr/share/fonts/default/TrueType was NOT
> > listed as a font path.... Should it be by default?
>
> I could be completely wrong, but that is only there for
> backward compatibility for say Gnome 1.4 stuff.
>
> [...]
>
> Then edit /etc/fonts/fonts.conf and add the paths like so:
>
> <dir>/usr/X11R6/lib/X11/fonts/TTFONTS</dir>

I have my fonts working without modifying fonts.conf like that.. Instead I used the chkfontpath tool which modifies /etc/X11/fs/config

But we may not be on the same page here. I am not trying to change the gnome fonts.. I just want mozilla to load the correct fonts. Also the gimp. OpenOffice detects the fonts through the way I did it as well.

Is /etc/fonts/fonts.conf gnome specific?

Hugh Buchanan