HOWTO display sharp Chinese in Gentoo Linux?

gentoo cjk

It has been the biggest headache to configure Linux desktop environment to display sharp Chinese glyphs. Personally, I would rather trace the segmentation errors rather than setup the Chinese font. For years, I was satisfied with the bottom line, i.e to browse the Chinese web page using Firefox, input Chinese when necessary.

It is quite embarrassing to stick to the ugly Chinese display as a geek, I would summarize my efforts to configure the Chinese fonts.

Get Chinese TrueType font

Copy simsun.ttc from Microsoft Windows system, put somewhere, for example, /usr/share/fonts/ttf.

cp simsun.ttc /usr/share/fonts/ttf/simsun.ttf
cd /usr/share/fonts/ttf
sudo chmod 644 simsun.ttf
sudo mkfontdir
sudo mkfontscale

Add the path to the /etc/X11/xorg.conf:

Section "Files"
 ...
 FontPath "/usr/share/fonts/TTF"
 ...
EndSection

Refresh the fontconfig cache

sudo fc-cache -fv

Restart X server, then use xlsfonts and fc-list to check whether the font has been installed. Firefox renders Chinese perfectly without bold/Italic effect, I am quite satisfied with the output:

Firefox rendering Chinese font
Firefox rendering Chinese font

Existed problems

All KDE application could not render Chinese pages, for unknown reason, kochi is preferred instead of simsun although I configure the SimSun as the first substitution font for all English fonts.

Konqueror rendering Chinese font
Konqueror rendering Chinese font

I prefer the lightweight rxvt-unicode terminal using monospace font, it can display Chinese, but quite ugly. It looks like the font engine uses two different fonts to render Chinese.

URXVT rendering Chinese font
URXVT rendering Chinese font

Update: with introspect of the character map used by rxvt-unicode:

grep font /proc/`pidof urxvt`/maps

I found that the 12x13ja.pcf is used to render the CJK characters. URXVT would use the Japanese font first then fall back to Simsun for missing character, remove the font and restart urxvt, everything is fine as the below screenshot:

URXVT rendering Chinese font
URXVT rendering Chinese font

FVWM has the problem to render the Chinese in the title bar using xft:Verdana:bold

FVWM title rendering Chinese font
FVWM title rendering Chinese font

Update: I am back to KDE 3.5.7, sacrificing a little bit performance and memory for better user experience. The easiest way to get sharp Chinese font in LCD display is to use Microsoft Yahei font, released with Microsoft Windows Vista. This font supports crispy English and Chinese.

Konsole:

Konsole rendering Chinese font
Konsole rendering Chinese font

Amarok:

Amarok rendering Chinese font
Amarok rendering Chinese font

Configure all the fonts in Kopete, and don’t forget to setup the font in chat window:

Kopete rendering Chinese font
Kopete rendering Chinese font

However, Konqueror still has the problem to render Chinese, especially specific size. The left is the shrunk font, we see only some characters are missing, while we increase the font, all the fonts are missing, refer to the bottom.

Koqueror rendering shrunk Chinese font
Koqueror rendering shrunk Chinese font
Kopete rendering normal Chinese font
Kopete rendering normal Chinese font