Make Debian support Chinese (eng)

FlossDoc,自由中文開源知識庫

Standard Article
Author: Roy Chan
Translator: Descender, Xingmu
Coauthor: Zero0w
Verifier: Archx, Jaux
Share it:

[Chinese Version]

This is the English version of Make Debian 3.1 support Chinese adapted from Make your Debian Sid support chinese by DebianHK and the notes of Perfect Linux Chinese Desktop Installation Workshop organized by LinuxHall. It discusses how to setup a fully functional Chinese desktop environment with Debian GNU/Linux 3.1 + GNOME. It is also one of the few English articles in FlossDoc because a lot of people asked for an English version. (I'm happy to see many foreigners learn Chinese! :-) )


目录

Generating Locale Data

First, you need to generate the data of the following locales:

  • en_US ISO-8859-1
  • zh_TW BIG5
  • zh_TW.UTF-8 UTF-8
  • zh_CN GB2312
  • zh_CN.GBK GBK
  • zh_CN.UTF-8 UTF-8

To do this, you need to enter "dpkg-reconfigure locales" or use Synaptic to reconfigure packages locales (You need to install libgnome2-perl first) :

  1. Select Application > System Tools > Synaptic Package Manager 。
  2. Start the Synaptic Package Manager, select package locales, and choose Packages > Configure to reconfigure the package locales.

Select the locale (hold down the Ctrl key to select more then one locale in Synaptic). Choose "None" for the default locale.

The command "locale -a" will list the locales that the system currently supports. You can type the following command to double check if any locale is missing:

$ locale -a
C
POSIX
en_US
en_US.iso88591
zh_CN
zh_CN.gb2312
zh_CN.gbk
zh_CN.utf8
zh_TW
zh_TW.big5
zh_TW.utf8
$

It is best to reboot the whole system after generating locales.

Notice: We don't include the locale zh_HK because its support on X Window is still limited. zh_TW.UTF-8 is a better choice for traditional chinese and zh_CN for simplified chinese.

Installing Fonts

There are few differences between the Chinese characters in China mainland, Hong Kong and Taiwan. Most fonts that can be downloaded legally follow the standards of mainland China and Taiwan. Currently, only the ISO 10646 Version of HKSCS-2001 Reference Font and the DynaLab Hong Kong Song Style Reference Font follow the Hong Kong standard.

Installing Free Chinese Fonts

Install the following Chinese TrueType fonts:

  • ttf-arphic-bsmi00lp - AR PL Mingti2L Big5 [文鼎PL上海宋], including about 13,000 traditional chinese characters in Big5.
  • ttf-arphic-bkai00mp - AR PL KaitiM Big5 [文鼎PL中楷], including about 13,000 traditional chinese characters in Big5.
  • ttf-arphic-gbsn00lp - AR PL SungtiL GB [文鼎PL简报宋], including more then 7,000 simplified chinese characters in GB2312.
  • ttf-arphic-gkai00mp - AR PL KaitiM GB [文鼎PL简中楷], including more then 7,000 simplified chinese characters in GB2312.
  • ttf-arphic-uming - AR PL ShanHeiSun Uni, including more then 20,000 chinese characters in GB2312, BIG5 and some of HKSCS.
  • ttf-arphic-ukai - AR PL ZenKai, including more then 20,000 chinese characters in GB2312 and some of HKSCS.

This means typing the following command in the root account:

apt-get install ttf-arphic-ukai ttf-arphic-uming ttf-arphic-gbsn00lp ttf-arphic-bkai00mp ttf-arphic-bsmi00lp

Installing FireFly Bitmap Fonts (Recommended)

Arphic PL fonts (left) and FireFly Bitmap fonts (right)
Enlarge
Arphic PL fonts (left) and FireFly Bitmap fonts (right)

The quality of the 4 Arphic Chinese fonts are good and the results after enlargement or printing are decent. However, the strokes in Chinese characters are too complex and become hard to read in small size and antialiasing-enabled.Firefly from Taiwan combined the traditional and simplified Chinese fonts of Arphic PL Shan Hei Sun Light and Arphic PL Bousung Light, non-full-width English numbers, and full-width punctuation then added 9pt, 10pt, 11pt, and 12pt (the four most common sizes) bitmaps and create a new font AR PL New Sung (fireflysung.ttf). This font displayed much clearer on GNU/Linux and achieve the similar result on Microsoft Windows.

In /etc/apt/sources.list, add the APT package repository "deb http://apt.debian.org.tw/ unstable main/ttf-arphic-newsung" or in Synaptic Package Manager Settings > Repositories, click on "New" and fill in the following information:

Click "Reload" to update the APT repositories information (this is the same as "apt-get update"). Then install the package by apt-get install ttf-arphic-newsung.

  • Note ttf-arphic-newsung is apparently the new name for ttf-firefly.

Installing Non-Chinese Fonts (Optional)

The following non-Chinese True Type font packages are listed below for you to browse. You can install them as you like:

  • msttcorefonts - This suite will help you download and install 11 Microsoft English fonts, including Andal Mono, Arial Black, Arial, Comic Sans MS, Georgia, Impact, Times New Roman, Trebuchet, Verdana and Webdings.
  • ttf-kochi-gothic - Japanese font Kochi Gothic, similar to Gothic。
  • ttf-kochi-mincho - Japanese font Kochi Mincho, similar to MingLiu.
  • ttf-baekmuk - Includes three sets of Korean fonts: batung.ttf (Baekmuk Batung, similar to MingLiu), dotum.ttf (Baekmuk Dotum, similar to Gothic) and gulim.ttf (Baekmuk Gulim,similar to Yuen).

Installing Other Fonts (Optional)

There are some reference Chinese fonts in the Internet which cannot be distributed freely, including HKSCS-2001 Reference Font (includes more than 4000 regional Hong Kong characters). You can download and install them by yourself:

  1. Download font to the directory /usr/share/fonts/truetype.
  2. Type "fc-cache -f -v" to update the FontConfig cache.
  3. You can use "fc-list" to list all of the fonts of the FontConfig manager and examine whether the new fonts have been installed successfully. (The name of the HKSCS-2001 Reference Font is "Ming(for ISO10646)".)

Please also see:

Fontconfig Settings

After you have installed the fonts, you must setup the system to use them. Of course you can set up each application one by one, but simply using Fontconfig will be a lot more convenient. You can put the following settings in the /etc/fonts/local.conf file according to your individual needs (remember to put this before the </fontconfig> tag).

Disable anti-aliasing for Chinese fonts 16px or under:

<!-- Disable font alias for Chinese <= 16px -->
  <match target="font">
    <test qual="any" name="family" compare="eq">
      <string>AR PL Mingti2L Big5</string>
      <string>AR PL SungtiL Big5</string>
      <string>AR PL New Sung</string>
      <string>AR PL ShanHeiSun Uni</string>
      <string>AR PL ZenKai Uni</string>
      <string>Ming(ISO10646)</string>
      <string>MingLiu</string>
      <string>PMingLiu</string>
      <string>Kochi Mincho</string>
      <string>Baekmuk Dotum</string>
    </test>
    <test name="pixelsize" compare="less_eq">
      <double>16</double>
    </test>
    <edit name="antialias">
      <bool>false</bool>
    </edit>
    <edit name="hinting">
      <bool>true</bool>
    </edit>
  </match>

Reset display order of serif fonts:

  <alias>
      <family>serif</family>
      <prefer>
         <family>Bitstream Vera Serif</family>
         <family>Times New Roman</family>
         <family>Times</family>
	  <family>AR PL New Sung</family>
         <family>AR PL ShanHeiSun Uni</family>
	  <family>AR PL Mingti2L Big5</family>
	  <family>AR PL SungtiL GB</family>
	  <family>Ming(ISO10646)</family>
	  <family>SimSun</family>
	  <family>Kochi Mincho</family>
	  <family>Baekmuk Batung</family>
      </prefer>
  </alias>

Bitstream's Vera Serif quality and number of glyphs is quite good, so put it first. FireFly bitmap fonts are rather clear and crisp, so put it in the first position for Chinese scripts. For Hong Kong regional characters, Sino-Japanese characters, and Sino-Korean characters, you can add Ming(ISO10646), Kochi Mincho, Baekmuk Batung, and other fonts.

Reset display order of sans-serif fonts:

  <alias>
      <family>sans-serif</family>
      <prefer>
         <family>Bitstream Vera Sans</family>
	  <family>Arial</family>
	  <family>Verdana</family>
	  <family>Helvetica</family>
	  <family>AR PL New Sung</family>
         <family>AR PL ShanHeiSun Uni</family>
	  <family>Ming(ISO10646)</family>
	  <family>AR PL kaitiM Big5</family>
	  <family>AR PL kaitiM GB</family>
	  <family>Kochi Gothic</family>
	  <family>Baekmuk Dotum</family>
      </prefer>
  </alias>

The default install of Gnome GUI uses sans font style. Fontconfig takes sans and sets it as an alias for sans-serif. So defining sans-serif will control the font style for the GUI. Like before, Bitstream Vera Sans' quality and number of glyphs is quite good, so put it first. Although FireFly bitmap fonts are serif, they are much clearer and crispier than the Arphic fonts, so again put it in the first position for Chinese scripts. For Hong Kong regional characters, Sino-Japanese characters, and Sino-Korean characters, you can add Ming(ISO10646), Kochi Gothic, Baekmuk Dotum, and other fonts.

Reset display order of the monospace font:

  <alias>
      <family>monospace</family>
      <prefer>
         <family>Bitstream Vera Sans Mono</family>
	  <family>Courier New</family>
	  <family>Courier</family>
	  <family>AR PL New Sung</family>
         <family>AR PL ShanHeiSun Uni</family>
	  <family>Ming(ISO10646)</family>
	  <family>Kochi Mincho</family>
	  <family>Baekmuk Batung</family>
      </prefer>
  </alias>

Input Engine Installation

You cannot enter Chinese characters without chinese input engine. The popular ones include:

  • SCIM (Smart Common Input Method platform)
  • iiimf-xcin - The IIIMF version Xcin, the default Chinese input method engine of Fedora Core 2 and above, but unstable (glee's Debian package is in http://www.debian.org.hk/~glee/deb/iiimf-xcin/ )
  • Fcitx (Fcitx input method)
  • Xcin - The default input method engine under most GNU/Linux traditional Chinese environments
  • chinput - The default input method engine under most GNU/Linux simplified Chinese environments
  • gCin - The GTK+ version of Xcin

While SCIM provides full features and has a bright future, we will only mention its installation and usage here. Indeed, you can setup most input method engines with only 3 steps.:

  • Install the relevant Debian package or software.
  • Tell X Window to use the input method engine by setting the value of the environmental variable XMODIFIERS.
  • Run the input method engine.

If you still enjoy Xcin ,please refer to its documentation.

Installing SCIM

Install the following packages:

Which mean typing "apt-get install scim scim-tables-zh".

The shell scripts under the directory /etc/X11/Xsession.d will be executed every time you enter an X Window in Debian. Therefore, we can set the vaule of XMODIFIERS and run SCIM there. Create a new file /etc/X11/Xsession.d/95xinput with the following lines:

case "$LANG" in
zh_TW*)
    /usr/bin/scim -d
    XMODIFIERS="@im=SCIM"
    ;;
zh_HK*)
    /usr/bin/scim -d
    XMODIFIERS="@im=SCIM"
    ;;
zh_CN*)
    /usr/bin/scim -d
    XMODIFIERS="@im=SCIM"
    ;;
esac

export XMODIFIERS

Installing Quick input method under SCIM (Optional)

The Simplex (簡易, also known as Quick[速成] in Windows) input method provided by SCIM is operated differently from the one most people from Hong Kong use. The character order is When totally different from Windows' or xcin's while listing the characters with same input code. Follow the instructions below to install a corrected version:

  1. Download SCIM Quick input table (Quick.bin) and icon(Quick.png).
  2. Copy the table into /usr/share/scim/tables (Type cp Quick.bin /usr/share/scim/tables)
  3. Copy the icon into /usr/share/scim/icons (Type cp Quick.png /usr/share/scim/icons)
  4. Logout and login again.

This Quick input method table was converted from the Simplex input method of Xcin, with the following changes:

  1. Characters with the same input code are ordered by its Big5 code in the new table which is the same as the one in Eten/Windows. The selection keys have been changed from 0-9 to 1-9 (Same as Windows).
  2. Switch the "Dynamic Adjust" to make the order of characters same as Windows.
  3. Changed the setting to make the operation similar to Window XP.
  4. Renamed as "速成" (Quick). In the past, many people complained that GNU/Linux does not support Quick because they don't know that "簡易" (Simplex) is actually "速成" (Quick).

The input table has been submitted to the SCIM project. You probably needn't install it separately.

Installing Cangjie 3 under SCIM (Optional)

Although SCIM provides the Cangjie input method, it is of version 5 (Windows, xcin, etc. still uses version 3) and some of the input codes are different from those on Windows, etc. The good thing is that it allows you to enter over 29,000 Han characters from traditional/simplified Chinese, Japanese and Korean. But if you still prefer the old Cangjie, follow the instructions below to install it:

  1. Download SCIM Cangjie 3 input table (CangJie3.bin) and icon (CangJie3.png)。
  2. Copy the input table into /usr/share/scim/tables (Type cp CangJie3.bin /usr/share/scim/tables)
  3. Copy the icon into /usr/share/scim/icons (Type cp CangJie3.png /usr/share/scim/icons)
  4. Logout and log into your account again

This table has been submitted to the SCIM project. You probably needn't install it separately for the next version of SCIM.

Installing Hong Kong Style Cantonese phonetic under SCIM (Optional)

The Cantonese and Jyutping input methods provided by SCIM are totally differently from the cantonese phonetic system used by common Hong Kong people. While the Cantonese and Jyutping of SCIM use the formal, systemic and academic cantonese phonetic system, most people's name and place name in Hong Kong is using an informal and ad hoc phonetic system which derived in long history of being colonized by UK and trading between west and china. If you like to the Hong Kong's traditional ad hoc phonetic system, you can used the Hong Kong Style Cantonese phonetic input method which prepared by Mr. King-Man Leung (梁敬文) and released in GNU GPL. The input method was ported to SCIM by Mr. Roy Chan (陳曉陽) of HKLUG. You can install the input method with the following instruction:

  1. Download SCIM Hong Kong Style Cantonese phonetic input table (CantonHK.bin) and its icon (CantonHK.png)。
  2. Copy the input table into /usr/share/scim/tables (Type cp CantonHK.bin /usr/share/scim/tables)
  3. Copy the icon into /usr/share/scim/icons (Type cp CantonHK.png /usr/share/scim/icons)
  4. Logout and log into your account again

This table has been submitted to the SCIM project. You will probably needn't to install it separately for the next version of SCIM.

Installing Stroke 5 input method under SCIM (Optional)

Stroke 5 is a Chinese input method developed by a group of seniors from Hong Kong Seniors IT Advocates and released under the GNU GPL. It is designed for seniors and children without a full understanding on the structure of Chinese characters and allows them to input Chinese freely on GNU/Linux and other computer platforms for simple communication. You can install the input method with following instructions:

  1. Download SCIM Stroke 5 input table (Stroke5.bin) and its icon. (Stroke5.png)
  2. Copy the input table into /usr/share/scim/tables (Type cp Stroke5.bin /usr/share/scim/tables)
  3. Copy the icon into /usr/share/scim/icons (Type cp Stroke5.png /usr/share/scim/icons)
  4. Logout and login again

This table has been submitted to the SCIM project. You probably needn't install it separately for the next version of SCIM.

Setting Locale

  • If you are using GDM, you can select the language (like "Chinese(...)") directly at the login screen and then login to your account.
  • If you are using other X Display Managers where you cannot directly select the language (like xdm, kdm, and so forth), then you need to add the line "export LANG=zh_TW.UTF-8" in the beginning of the /etc/X11/Xsession.d/95input file to set the locale you wish to use.
  • If you use startx to load X Window directly, then you should type "export LANG=zh_TW.UTF-8" before loading or put this entire statement into your ~/.bash_profile file.

Installing the FireFly Chinese Patch (Optional)

Comparison of the FireFly Chinese Patch (Left)
Enlarge
Comparison of the FireFly Chinese Patch (Left)

The Chinese platform of GNU/Linux itself has many problems. The character display is not clear enough and still cannot display the bold-formatting of characters. This means, for one thing, understanding a message that uses Chinese characters is difficult. And secondly, it is easy for the users who read Chinese on the computer for long periods of time to suffer eye fatigue. Forunately, Mr. Firefly from Taiwan took the improved technology of Japan and put it into the GNU/Linux System. It fixes the Chinese display problems in software like freetype, fontconfig, Mozilla, OpenOffice.org, etc., thereby making GNU/Linux able to display bold-formatted Chinese characters and manage Chinese font names. This has greatly improved the display aspects of a Chinese Linux desktop.

Since this technology would interfere with the displays of other languages like Russian, it cannot be formally adopted by the relevant programs yet. So for the time being, it can only be applied to every version of relevant programs every time by patches, which is a little time-consuming. You can add the FireFly Chinese Patch into Debian packages yourself. Or you can follow the steps below to install Debian packages that other people have created with the FireFly Chinese Patch already built in. But remember that the release schedule of patches for some programs is quite slow (like Mozilla and Mozilla Firefox). You might need to make a decision between the having the features of new software releases and these Chinese patches.

Main Software Repositories for Installing Packages with the FireFly Chinese Patch

  1. In /etc/apt/sources.list add the APT resource "deb ftp://ftp.hk.debian.org/unofficial/firefly/binary-i386 ./" or in the menu of Synaptic Package Manager select Settings > Repositories,then click "New" and fill in the following information:
  2. Other APT sites with FireFly Chinese Patch Debian packages
  3. Press "Reload" to update the APT Repositories information (same as the command "apt-get update").
  4. Press "Mark All Upgrades" to mark the upgrades of all upgradable packages (same as the command "apt-get upgrade"). This action should upgrade the following packages:
    • fontconfig
    • libfontconfig1
    • libxft2

Installing FireFly Chinese Patch for OpenOffice.org (Optional)

Like other FireFly Chinese patches, a patched OpenOffice.org will take care of bold and italic formatting in Chinese. But there is no Debian packages for it, you must install it by hand. Debian officials have made some patches for OpenOffice.org (part of the Ximian patch) to make it open faster in Gnome. But also because the DFSG relationship, it eliminates the connections with the Java features. Both have pluses and minuses. But if you often use OpenOffice.org to type Chinese documents, installing the OpenOffice.org Firefly Chinese patch will be quite a good choice.

Setting up Chinese Interface in OpenOffice.org

If you use the version of OpenOffice.org with the Firefly Chinese patch, then you do NOT need to do the following steps:

Setting up font replacement for traditional Chinese characters
Enlarge
Setting up font replacement for traditional Chinese characters
  1. Open OpenOffice.org
  2. In the Tools menu, select Options. An Options dialog box will pop up.
  3. Select the Fonts category under OpenOffice.org.
  4. Check "Apply replacement table". Click on the following fonts below and set them to use AR Pl New Sung or AR Pl Mingti2L Big5 as the font replacement.
    • MSung Light TC - Pre-installed Chinese font of OpenOffice
    • PMingLiu - Pre-installed Chinese font of Microsoft Office
    • FZMingTi
    • MingLiu
    • Baekmuk Dotum - OpenOffice.org uses this font for the Chinese interface display. Because Baekmuk is a Korean font, the interface will end up having many blank spaces. To fix this, you must setup OpenOffice.org to use AR PL New Sung, AR PL Mingti2L Big5, or another font which has a complete set of traditional Chinese characters.
  5. Install the package openoffice.org-l10n-zh-tw, by typing "apt-get install openoffice.org-l10n-zh-tw".

Setting up Chinese Interface in Mozilla Firefox (Optional)

Install the mozilla-firefox-locale-zh-tw or mozilla-firefox-locale-zh-cn packages.

Basic Usage

Inputting Chinese

After installed SCIM, press Ctrl-Space when you want to input Chinese. It will allow you to toggle between Chinese and English input. You can change the input methods with pressing Ctrl-Shift. SCIM provides a number of Chinese input methods (package scim-tables-zh):

  • Traditional Chinese
    • CangJie 5 - There are some differences between this input method and the CangJie 3 that Hong Kong people usually use. Some CangJie codes of a few characters are different. Nevertheless, this input method can input over 29,000 characters including simplified and traditional Chinese characters, Sino-Japanese and Sino-Korean characters, and Hong Kong regional characters.
    • Simplex - also known as the Quick[速成] input method,you only need to use the first and last number of the CangJie code to input a Chinese character.
    • EZ
    • Array30
    • Jyutping - This is actually the best the Cantonese romanization system nowadays developed by the Linguistic Society of Hong Kong.
    • ZhuYin - An input method using the national romanization of Taiwan (also known as BoPoMoFo).
    • Dayi3
  • Simplified Chinese
    • Smart Pinyin - Intelligent Hanyu Pinyin (standard romanization of Mandarin in PRC).
    • Erbi
    • Cantonese Pinyin
    • Ziranma
    • Wubi

IME Punctuation Symbols

You can input some punctuation under SCIM Cangjie. Here is some commonly used punctuation symbols:

Punctuation CangJie 5 Simplex / 速成 Full-width Punctuation
Comma (,) ZXAB ZB ,
Comma for lists (、) ZXAC ZC \
Period (。) ZXAD ZD .
Space (.) ZXAE ZE
Ellipsis (…) ZXAL or YYYCH ZL ^
Wavy underline (﹏) ZXBB ZB
Open square bracket (【) ZXBQ or YYYAM ZQ
Close square bracket (】) ZXBR or YYYAN ZR
Open double bracket (《) ZXBU or YYYAG ZU
Close double bracket (》) ZXBV or YYYAH ZV
Open single bracket (〈) ZXBY or YYYAE ZY
Close single bracket (〉) ZXCA or YYYAF ZA
Open quote (「) ZXCD or YYYAA ZD
Close quote (」) ZXCE or YYYAB ZE
Open double quote (『) ZXCH or YYYAC ZH
Close double quote (』) ZXCI or YYYAD ZI

For more details you can refer to Friends of CangJie: Malaysia.

If you are using the Smart Pinyin method, you can input the following i- prefixed special punctuation codes:

Punctuation Symbols ibdfh / ifuhao / isymbol §,¨,°,±
Paragraph isection / iduanluo / idl §
Current Date idate / iriqi / irq 2004年11月19日, 二〇〇四年十一月十九日, 二零零四年十一月十九日
Current Time ishijian / itime / isj 16点24分, 16點24分, 下午4点24分, 下午4點24分
Current Day of the Week ixingqi / idian / iday / ixq 星期五, 礼拜五

See Also

TODO

  • This document
    • Setting up Fontconfig
    • Add pictures
    • Printing issues
  • Debian Chinese Support
    • Creating an installation package for Hong Kong SAR Governement's ISO10646 Ming Uni Reference Font
    • Creating Debian package for Wang Han Zong's free fonts
    • m17n-env
Personal tools
其它语言
廣告橫額