Website of latouche

[home] [Computers and networks] [User guides]

Chinese support for Gentoo Linux

Abstract

This How-to is based on my experienced configuring my gentoo for chinese support (and also with japanese and korean fonts). Therefore, only the softwares I am using will be described.

The following subjects will be explored:

Fonts

Maybe the most complexe part is to have readable fonts. I needed time before achieving this point. The font which gave me the best impression is WenQuanYi Bitmap Song CJK Font (media-fonts/wqy-bitmapfont).

For all this section, you may have a look to the Gentoo HOWTO Xorg and Fonts for more information about Xorg and fonts management.

Installed fonts

Here are all the fonts I have installed:

$ eix -IcC media-fonts
[I] media-fonts/arphicfonts (0.1.20060928@09.02.2008): Chinese TrueType Arphic Fonts
[I] media-fonts/artwiz-aleczapka-en (1.3@09.02.2008): Artwiz Aleczapko fonts
[I] media-fonts/baekmuk-fonts (2.2-r2@09.02.2008): Korean Baekmuk Font
[I] media-fonts/corefonts (1-r4@25.01.2008): Microsoft's TrueType core fonts
[I] media-fonts/dejavu (2.21@09.02.2008): DejaVu fonts, bitstream vera with ISO-8859-2 characters
[I] media-fonts/encodings (1.0.2@06.10.2007): X.Org font encodings
[I] media-fonts/font-adobe-100dpi (1.0.0@17.11.2007): X.Org Adobe bitmap fonts
[I] media-fonts/font-adobe-75dpi (1.0.0@06.10.2007): X.Org Adobe bitmap fonts
[I] media-fonts/font-adobe-utopia-type1 (1.0.1@17.11.2007): X.Org Adobe Utopia Type 1 fonts
[I] media-fonts/font-alias (1.0.1@06.10.2007): X.Org font aliases
[I] media-fonts/font-bh-type1 (1.0.0@17.11.2007): X.Org Bigelow & Holmes Type 1 fonts
[I] media-fonts/font-cursor-misc (1.0.0@06.10.2007): X.Org cursor font
[I] media-fonts/font-daewoo-misc (1.0.0@09.02.2008): X.Org Daewoo fonts
[I] media-fonts/font-isas-misc (1.0.0@09.02.2008): X.Org the Institute of Software, Academia Sinica (chinese) fonts
[I] media-fonts/font-jis-misc (1.0.0@09.02.2008): X.Org JIS (japanese) fonts
[I] media-fonts/font-misc-misc (1.0.0@06.10.2007): X.Org miscellaneous fonts
[I] media-fonts/font-sony-misc (1.0.0@09.02.2008): X.Org Sony fonts
[I] media-fonts/font-util (1.0.1@06.10.2007): X.Org font utilities
[I] media-fonts/freefonts (0.10-r3@17.11.2007): A Collection of Free Type1 Fonts
[I] media-fonts/gnu-gs-fonts-std (8.11@17.11.2007): Ghostscript Standard Fonts
[I] media-fonts/hkscs-ming (1.0_pre20030919-r1@09.02.2008): Hong Kong SAR Government Official Reference Chinese Font that implements ISO10646 and HKSCS-2001
[I] media-fonts/intlfonts (1.2.1@09.02.2008): International X11 fixed fonts
[I] media-fonts/kochi-substitute (20030809-r3@09.02.2008): Kochi Japanese TrueType fonts with Wadalab Fonts
[I] media-fonts/sharefonts (0.10-r3@17.11.2007): A Collection of Postscript Type1 Fonts
[I] media-fonts/terminus-font (4.20@06.10.2007): A clean fixed font for the console and X11
[I] media-fonts/ttf-bitstream-vera (1.10-r3@06.10.2007): Bitstream Vera font family
[I] media-fonts/unifont (1.0-r4@25.01.2008): GNU Unifont - a Pan-Unicode X11 bitmap iso10646 font
[I] media-fonts/wqy-bitmapfont (0.9.9_p0@09.02.2008): WenQuanYi Bitmap Song CJK font
Found 28 matches.
Some are for japanese (media-fonts/font-jis-misc, media-fonts/font-sony-misc and media-fonts/kochi-substitut), others for korean (media-fonts/baekmuk-fonts and media-fonts/font-daewoo-misc). The ones for chinese are: media-fonts/arphicfonts, media-fonts/font-isas-misc, media-fonts/hkscs-ming and media-fonts/wqy-bitmapfont.
I have also installed the package media-fonts/intlfonts providing many international fonts.

Once fonts have been installed, running fc-cache -fv will rebuild the font cache.

Xorg

I am using the following options in my xorg.conf:

FontPath    "/usr/share/fonts/misc"
FontPath    "/usr/share/fonts/Type1/"
FontPath    "/usr/share/fonts/TTF"
FontPath    "/usr/share/fonts/corefonts"
FontPath    "/usr/share/fonts/freefonts"
FontPath    "/usr/share/fonts/sharefonts"
FontPath    "/usr/share/fonts/wenquanyi/wqy-bitmapfont"
FontPath    "/usr/share/fonts/arphicfonts"
FontPath    "/usr/share/fonts/hkscs-ming"
FontPath    "/usr/share/fonts/dejavu"
FontPath    "/usr/share/fonts/intlfonts"
FontPath    "/usr/share/fonts/terminus"
FontPath    "/usr/share/fonts/ttf-bitstream-vera"
FontPath    "/usr/share/fonts/unifont"
FontPath    "/usr/share/fonts/75dpi:unscaled"
FontPath    "/usr/share/fonts/100dpi:unscaled"
FontPath    "/usr/share/fonts/artwiz-aleczapka-en"
wqy-bitmapfont is placed before other asian fonts to be used first.

It is also usefull to uncomment the option Load "freetype" in xorg.conf.

Fontconfig

Most modern applications are using fontconfig to choose their fonts, thus it is important to specifiy that wqy-bitmapfont should be used first.

I first activated the wqy-bitmapfont configuration file for fontconfig (/etc/fonts/conf.avail/85-wqy-bitmapsong.conf) by setting a symlink to /etc/fonts/conf.d:

eselect fontconfig enable 85-wqy-bitmapsong.con
or for something else than Gentoo:
/etc/fonts/conf.d # ln -s ../conf.avail/85-wqy-bitmapsong.conf .

Because I didn't see any difference (fontconfig looks quite hazardous for me ...), I modified the following files to prioritize wqy-bitmapsong : 40-nonlatin.conf and 65-nonlatin.conf. To do that, I added WenQuanYi Bitmap Song at the begining of the aliases for serif and sans-serif.

Input method

For typing chinese, I am using scim. It works nearly out of the box.

First install app-i18n/scim-pinyin

For non US people using UTF-8, change your ~/.scim/global to add your locale, for exemple for french people:

$ cat .scim/global 
/SupportedUnicodeLocales = fr_FR.UTF-8

To start scim in deamon mode, simply use

scim -d

Virtual Terminal: urxvt

I am using urxvt as my virtual terminal because it is light and it has a good support of unicode caracters.

The only trouble with urxvt is that it looks for japanese fonts before chinese fonts, thus if a hanzi is present in the japanese fonts, it will be first used resulting in a mix of japanese and chinese fonts. To revert this, a chinese font should be specified before a japanes one in the fonts urxvt will use. To have correct latin fonts, I also specify a latin font (terminus) as the first argument:

urxvt -fn "xft:terminus,xft:WenQuanYi Bitmap Song"

Here is the result:

Urxvt with chinese font

It is also possible to specify arguments to the fonts. The following will disable the antialiasing for WenQuanYi Bitmap Song and set the font size to 15:

xft:WenQuanYi Bitmap Song:antialias=false:pixelsize=15

Windows Manager: fluxbox

There is nearly nothing to change to have fluxbox working with chinese. Juste modify the fonts (yes, it is always a question of fonts ...) so that they can display chinese symbols.

First, copy the theme you are using into ~/.fluxbox/styles/ and edit the configuration file of this theme. Remplace the fonts by chinese compliant fonts.

After some tests, I chosed to use the following:

*Font:                          -*-*-*-*-*-*-*-*-*-*-*-*-iso10646-1

Final result

Everything is not yet perfect, but it is now usable

gentoo and chinese support
2008/03/11 - Initial release
2008/05/16 - Enable wqy-bitmapsong.conf with eselect
Last update: 2008/05/16