Friday, November 17, 2006

Chinese on Linux (Slackware 11)


This is the last piece that I need before I can ditch Windows completely: Displaying Chinese fonts on my Linux platform. Now reasons I boot into Windows will be to open MS Office documents or play games.

I will document the steps. Hopefully this will be of use to all others.

My system is running X Windows System version 6.9.0 on Slackware 11.

To start, you need to download the true-type fonts, can be downloaded from the following websites (one of them will do), I tried the first one wqy and it works:

http://wqy.sourceforge.net/cgi-bin/enindex.cgi (English)
http://unifont.freedesktop.org/wiki/Software_2fCJKUnifonts_2fDownload (English)
http://sourceforge.net/projects/freeunifont/

I downloaded some true-type fonts (they should have the .ttf extension) and dumped them into /usr/X11/lib/fonts/TTF.

Update the /etc/X11/xorg.conf, search for FontPath, you will see a 'Files' section. Add one more line pointing to the TTF directory, as shown below in blue.

Section "Files"

# The location of the RGB database. Note, this is the name of the
# file minus the extension (like ".txt" or ".db"). There is normally
# no need to change the default.
# Multiple FontPath entries are allowed (which are concatenated together),
# as well as specifying multiple comma-separated entries in one FontPath
# command (or a combination of both methods)
#
# If you don't have a floating point coprocessor and emacs, Mosaic or other
# programs take long to start up, try moving the Type1 and Speedo directory
# to the end of this list (or comment them out).
#
# ModulePath can be used to set a search path for the X server modules.
# The default path is shown here.
# ModulePath "/usr/X11R6/lib/modules"
RgbPath "/usr/X11R6/lib/X11/rgb"
FontPath "/usr/X11R6/lib/X11/fonts/local/"
FontPath "/usr/X11R6/lib/X11/fonts/misc/"
FontPath "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
FontPath "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
FontPath "/usr/X11R6/lib/X11/fonts/Type1/"
FontPath "/usr/X11R6/lib/X11/fonts/CID/"
FontPath "/usr/X11R6/lib/X11/fonts/Speedo/"
FontPath "/usr/X11R6/lib/X11/fonts/75dpi/"
FontPath "/usr/X11R6/lib/X11/fonts/100dpi/"
FontPath "/usr/X11R6/lib/X11/fonts/cyrillic/"
FontPath "/usr/X11R6/lib/X11/fonts/TTF/"
EndSection

Restart X-Windows.

If you are in runlevel 4 which only logs you off and show the login screen without quitting the X-Windows, you may need to restart Linux (not necessary, but easiest). Should you want Linux login to land on command prompt instead of windows manager, you can edit /etc/inittab and change the initdefault from 4 to 3. The next logon you will land on the command prompt. To start X-Windows, type 'startx'.


4 comments:

Jimmy L. said...

Do the fonts look ok?

The last time i tried, chinese fonts on linux ... em... sux. Some characters cannot translate, they became gibberish. :(

The Soothsayer said...

YC: Looks fine on my Fedora.

Freechai: What input method are you using?

Cuppa Chai said...

The chinese fonts are pretty decent, the gibberish characters problem may due to the fonts are incomplete or the article you are viewing uses some other encodings. My solution is to install fonts from 2 to 3 different sources. So far so good.

For input method, I installed scim, but until now don't have time to set it up yet.

The Soothsayer said...

SCIM is the best. I was using IIIM but switched to SCIM.