[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Debian Chinese FAQ




On Wednesday, June 5, 2002, at 05:00  PM, Yu Guanghui wrote:

Hi
If anyone can do that, I will be glad to put it to FAQ packages and the website. ;-)

Ask and you shall receive.  ;)  I'm too lazy to format this in HTML,
so somebody else can do that.


Debian Chinese FAQ
Version 1.5

Original:  Yu Guanghui (ygh@debian.org)
English translation:  Steven Huang (szuwen.huang@attbi.com)


This document presents some frequently asked questions from users of Chinese
software in Debian.  Most of the contents of this FAQ list were collected
from the two Debian Chinese project mailing lists debian-chinese-big5@lists.
debian.org
and debian-chinese-gb@lists.debian.org.  For more details on using Debian,
consult "The Debian Linux User's Guide".

You can also send problems you've encountered and their solutions to
ygh@debian.org, preferably in the format below:

  \Question{This is a sample question}
    \contributor{Yu Guanghui}{ygh}{debian.org}{2000/11/19}
    \contributor{foo}{foo}{foo.com}{2000/11/19}
    Please use this format when submitting

The newest version of the FAQ is available at http://www.debian.org/intl/zh/
faq.


1  Chinese Language Environment and Software in Debian

1.1  Summary of Chinese Support in Debian

Chinese language processing under Debian takes advantage of standard internationalization (i18n) and localization (l10n) efforts, rather than adding external Chinese platforms.
This results in applications that have more integrated Chinese support.  The
i18n framework allows Debian to support multiple languages just by changing some
environment variables and localized program messages.

1.2  Debian Software with Chinese Support

Chinese Environment Control Panel
  - zhcon
  - CCE
  - YH
  - Chdrv
  - Kon2
Fonts
  - Arphic Truetype fonts
  - xfonts-intl-chinese, xfonts-cjk
  - unifont
Terminal Emulators
  - rxvt-ml
  - cxterm
  - jfbterm
Chinese Input Platforms
  - xcin
  - xcingb, xa+cv
  - chinput
Word Processor
  - cjk-latex
Documentation Translation
  - debian-guide-zh-t, debian-guide-zh-s
  - doc-linux-zh, doc-linux-zh-s
  - zh-trans (obsolete)
Internal Code Converter
  - zh-autoconvert
Dictionaries
  - cedict
  - stardic
  - pydict

1.3  Internationalized Debian Software

GNOME
KDE2
Mozilla
Netscape

2  Setting Up a Chinese Environment

2.1 I am installing Debian, and would like to use Chinese. What do I need to do?

It's not very different from a normal installation of Debian.  Just select
task-chinese-s for simplified Chinese support, or task-chinese-t for traditional Chinese support during installation. Note that Debian Potato does not correctly install all selected packages, so you may have to manually execute dselect and
directly choose the Install option from the menu.

2.2  I am already running Debian.  How do I add Chinese support?

Ensure that your /etc/apt/sources.list is correct, and run:

  apt-get install task-chinese-s

for simplified Chinese support, or:

  apt-get install task-chinese-t

for traditional Chinese support.

2.3  How do I generate locale files for libc6 2.2?

Starting from libc6 2.2, locale files are no longer automatically generated.
  Edit
/etc/locale.gen to remove locales that you do not need, and run the locale-gen
program as root.

2.4  I installed Chinese support.  What else do I need to do?

Set up your environment variables. For bash users, the following sets up a
simplified Chinese environment:

  # $(HOME)/.bashrc
  alias ls=``ls -show-control-chars''
  export LC_ALL=zh_CN.GB23122
  export LC_CTYPE=zh_CN.GB2312
  export LANG=zh_CN.GB2312
  export XMODIFIERS=``@im=Chinput''3
  stty cs8 -istrip
  stty pass8

  # $(HOME)/.inputrc
  set meta-flag on
  set convert-meta off
  set output-meta on

2.5  Why doesn't the Debian Chinese Panel accept any input?

The panel currently only supports the vt100 terminal. Execute the following:

  export TERM=vt100

before running it, or include the setting in $(HOME)/.bashrc.

2.6  How do I use TrueType fonts in XFree86 3.3.6?

Make sure that you have installed the xfs-xtt font server package, and then add
the following:

  FontPath "unix/localhost:7100"

into your /etc/X11/XF86Config file under the "Files" section.

2.7  How do I use TrueType fonts in XFree86 4.0?

XFree86 4.0.2 uses the xtt module to support TrueType fonts in the GB or Big5
encodings, and does not require xfs-xtt.  Just add:

  FontPath "/usr/lib/X11/fonts/TrueType"

to the "Files" section of your /etc/X11/XF86Config-4 file, and replace:

  Load "freetype"

with:

  Load "xtt"

You can probably also remove the line:

  FontPath "unix/:7100"

If you are running Woody or Sid, and your x-ttcidfont-conf is version 3.5 or above,
please add the following:

  FontPath "/usr/lib/X11/fonts/defoma/TrueType/"
  FontPath "/usr/lib/X11/fonts/defoma/CID/"

to the "Files" section of your /etc/X11/XF86Config-4.

If you are running version 8 or above of x-ttcidfont-conf, add the following lines
instead:

  FontPath "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/"
  FontPath "/var/lib/defoma/x-ttcidfont-conf.d/dirs/CID/"

to the "Files" section of your /etc/X11/XF86Config-4.

It's a good idea to upgrade to version 7 or above of x-ttcidfont-conf, which fixes the problem of only having bold and italic fonts available when using the xtt font server.

2.8  Why did X become so slow after using xfs-xtt's scalable fonts?

If you did not use the option "-deferglyphs 16" when starting X, xfs-xtt will attempt to
load all characters into memory.  You can use the following:

  startx -- -deferglyphs 16

to start X, or if you are using xdm, add "-deferglyphs 16" to the /etc/X11/
xdm/Xserver
file.

2.9  How do I use xcin to enter Chinese characters?

Xcin uses the XIM protocol, so only applications that support XIM will accept xcin
input.  Before running the application, you should start xcin, and set:

  export XMODIFIERS="@im=xcin-zh_CN.GB2312"

at the command line or in your $(HOME)/.bashrc to select simplified Chinese support. After starting the application, you can use ctrl-space to toggle input methods.

To use traditional Chinese, set XMODIFIERS to "@im=xcin".  Adding "-zh_TW.
Big5"
will not work.

An easier method is to upgrade to xcin 2.5.2 in Debian 2.2r2, or xcin 2.5.
2.2 in
unstable. You can then select "XCINterm (Big5)" or "XCINterm (GB2312)" from the "XShell" menu, or run xcinterm-big5 or xcinterm-gb from a shell. The system will
automatically start the xcin server and a terminal emulator.

2.10  How do I use chinput to enter Chinese characters?

Chinput has not been formally accepted into Debian, because it uses the UNICON input method, which has not yet been fully tested. You can download experimental
debs for chinput and unicon from:

  http://master.debian.org/~ygh/unicon-im_3.0-1_i386.deb
  http://master.debian.org/~ygh/chinput_3.0.1-1_i386.deb

Chinput also uses the XIM protocol, so only applications that support XIM will
accept input from Chinput.  Just set the XMODIFIERS environment variable to
"@im=Chinput" in the shell or in $(HOME)/.bashrc, and use ctrl-space to toggle
input methods.  Note that the default chinput package uses TrueType fonts.

Addendum: chinput and unicon-im have made it into Debian unstable, so if you
use unstable you can just issue:

   apt-get install chinput unicon-im

Note that chinput only supports 16-pixel fonts.

2.11  Why does icewm's window title bar become very large after installing
      Chinese?

You need to manually configure icewm to reset the size of the font.  First,
copy /etc/X11/icewm/preferences to $(HOME)/.icewm/preferences.  Look for the
line:

  #TitleFontName="-adobe-helvetica-bold-r-*-*-*-120-*-*-*-*-*-*

and change it to one of the following:

  TitleFontName="-default-song-bold-r-
normal--16-160-72-72-c-160-gb2312.1980-0"
  TitleFontName="-default-ming-bold-r-normal--16-160-72-72-c-160-big5-0"

2.12  cce, crxvt

[blank]

3  Word Processing in Chinese

3.1  CJK

[blank]

3.2  How do I use latex2html to generate Chinese HTML pages?

Latex2html already supports CJK languages.  Just add:

  charset='gb2312';

to $(HOME)/.latex2html-init, and run:

  latex2html -iso CN foo

to generate the HTML file.

3.3  Why does vim only delete half a Chinese character each time?

First, set up your environment variables according to FAQ 2.4. Next, add the
following:

  set fe=prc

to $(HOME)/.vimrc.  This is no longer necessary in vim 6.0.

3.4  How can I display Chinese in xpdf?

The correct fonts are only available in Woody (testing) and Sid (unstable)
.
You will also need to add the following in to your $(HOME)/.Xresources file:

  xpdf.t1TimesRoman: /usr/share/fonts/type1/gsfonts/n021003l.pfb
  xpdf.t1TimesItalic: /usr/share/fonts/type1/gsfonts/n021023l.pfb
  xpdf.t1TimesBold: /usr/share/fonts/type1/gsfonts/n021004l.pfb
  xpdf.t1TimesBoldItalic: /usr/share/fonts/type1/gsfonts/n021024l.pfb
  xpdf.t1Helvetica: /usr/share/fonts/type1/gsfonts/n019003l.pfb
  xpdf.t1HelveticaOblique: /usr/share/fonts/type1/gsfonts/n019023l.pfb
  xpdf.t1HelveticaBold: /usr/share/fonts/type1/gsfonts/n019004l.pfb
  xpdf.t1HelveticaBoldOblique: /usr/share/fonts/type1/gsfonts/n019024l.pfb
  xpdf.t1Courier: /usr/share/fonts/type1/gsfonts/n022003l.pfb
  xpdf.t1CourierOblique: /usr/share/fonts/type1/gsfonts/n022023l.pfb
  xpdf.t1CourierBold: /usr/share/fonts/type1/gsfonts/n022004l.pfb
  xpdf.t1CourierBoldOblique: /usr/share/fonts/type1/gsfonts/n022024l.pfb
  xpdf.t1Symbol: /usr/share/fonts/type1/gsfonts/s050000l.pfb
  xpdf.t1ZapfDingbats: /usr/share/fonts/type1/gsfonts/d050000l.pfb
  xpdf.chineseGBFont: -*-song-medium-r-normal-*-%s-*-*-*-*-*-gb2312.1980-0
  xpdf.chineseCNSFont: -*-ming-medium-r-normal-*-%s-*-*-*-*-*-big5-0

After reloading the X resources, xpdf should be able to display Chinese
characters.

4  Applications

4.1  How can I display Chinese in Netscape?

First,

  apt-get install netscape-zh-resource-476

Then, launch Control Center. Under Look and Feel->Style, disable "apply fonts to
non-KDE apps".  Alternatively, edit Netscape.ad.

4.2 Why can't I enter Chinese in xchat, even though the menu is already in Chinese?

You still have to set the font for the chat window.  First, enable
"use gtk_fontset_load instead of gtk_font_load" in the Setup->Chat Window menu,
and ensure that the fonts include the following:

  -b&h-lucidatypewriter-medium-r-normal-*-*-120-*-*-m-*-*-*
  -default-*ng-medium-r-normal-*-*-140-*-*-c-*-*-*

4.3  How can I use Chinese in KDE2 and KOffice?

First, set up your environment variables as instructed in FAQ 2.4. Then, create
the $(HOME)/.fontguess file as follows:

  [big5-0][gb2312.1980-0]
  helvetica ming song
  courier kai kai
  times ming song
  lucida ming song

Run Control Center, select "cn,zh_CN.GB2312,set-gbk" under Personalization->
Nationality and Language, and restart KDE.

If you use kdm, modify $(HOME)/.xsession to:

  export LANG=zh_CN.GB2312
  export LC_ALL=zh_CN.GB2312
  export LC_CTYPE=zh_CN.GB2312
  export KDE_LANG=zh_CN.GB2312
  export XMODIFIERS=@im=Chinput
  chinput
  exec kde2

4.4  Why can't I display Chinese in stardic under KDE2?

By default, KDE imposes its fonts and color settings to non-KDE applications.
There are two solutions:

1. In Control Center->Look and Feel->Style, disable "apply fonts and colors
      to non-KDE apps".
  2.  Run stardic as:

/usr/bin/stardic -xrm '*fontList:9x15bold=English, hz16=Chinese, yb10x20=YB'

4.5 I receive email in GB, Big5, and HZ encodings. Can I convert them to one
     particular encoding?

You can use zh-autoconvert in concert with procmail to accomplish this.
zh-autoconvert automatically detects and converts Chinese encodings, and comes
with a sample program called convmail.pl under /usr/doc/zh-
autoconvert/examples.
You can copy that to $(HOME)/bin, and create a $(HOME)/mimemail directory.
Consult /usr/doc/zh-autoconvert/examples/procmail.example for instructions on
building your own $(HOME)/.procmail configuration file.

4.6  How can I display Chinese in Abiword?

It uses X's font for display and type1 for printing. It actually uses ttf for CJK printing, thanks to hj's work on this part.

To display Chinese, you have to:

- put a fonts.dir in your ${abisuite}/fonts/locale-spec/ where locale-spec is
    lang-territory.encoding, lang-territory, or encoding.

    Please note it uses '-' instead of underscore '_'. Debian's AbiSuite is
    /usr/share/abisuite.

- set your LANG environment to your preferred locale. If you want English menu, you can set LC_MESSAGES to C. This can be set manually or done inside your
    'abiword' script which will call the actual binary.

  - Sit back and enjoy.

The fonts.dir format is just like native X fonts.dir except it has trailing numbers
for font ascend, descend and width.

This is my GB2312/fonts.dir

# GB2312/fonts.dir
8
Song-Medium-GBK-H, -default-song-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0,
 880, 120, 1000
Song-Medium-GBK-H, -default-song-bold-r-normal--0-0-0-0-c-0-gb2312.1980-0,
 880, 120, 1000
Song-Medium-GBK-H, -default-song-medium-i-normal--0-0-0-0-c-0-gb2312.1980-0,
 880, 120, 1000
Song-Medium-GBK-H, -default-song-bold-i-normal--0-0-0-0-c-0-gb2312.1980-0,
 880, 120, 1000
Kai-Medium, -default-kai-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0, 880, 120, 1000
Kai-Medium, -default-kai-bold-r-normal--0-0-0-0-c-0-gb2312.1980-0, 880, 120,
 1000
Kai-Medium, -default-kai-medium-i-normal--0-0-0-0-c-0-gb2312.1980-0, 880, 120, 1000
Kai-Medium, -default-kai-bold-i-normal--0-0-0-0-c-0-gb2312.1980-0, 880, 120,
 1000

This is my Big5/fonts.dir

# Big5/fonts.dir
8
Ming-Medium-GBK-H, -default-ming-medium-r-normal--0-0-0-0-c-0-big5-0, 880,
 120, 1000
Ming-Medium-GBK-H, -default-ming-bold-r-normal--0-0-0-0-c-0-big5-0, 880, 120, 1000
Ming-Medium-GBK-H, -default-ming-medium-i-normal--0-0-0-0-c-0-big5-0, 880,
 120, 1000
Ming-Medium-GBK-H, -default-ming-bold-i-normal--0-0-0-0-c-0-big5-0, 880, 120, 1000
Kai-Medium, -default-kai-medium-r-normal--0-0-0-0-c-0-big5-0, 880, 120, 1000
Kai-Medium, -default-kai-bold-r-normal--0-0-0-0-c-0-big5-0, 880, 120, 1000
Kai-Medium, -default-kai-medium-i-normal--0-0-0-0-c-0-big5-0, 880, 120, 1000
Kai-Medium, -default-kai-bold-i-normal--0-0-0-0-c-0-big5-0, 880, 120, 1000

Alternatively, install abiword_0.7.13-0.1 in Debian unstable. We hope to include
the Chinese font settings above into the package in the near future.  Also,
 the
fonts.dir settings in CLE differ slightly, as follows:

# /usr/share/abisuite/fonts/zh-CN/fonts.dir:
8
Arphic-MingGB-GB-EUC-H, -Arphic-AR PL SungtiL GB-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0, 880, 120, 1000 Arphic-MingGB-Bold-GB-H, -Arphic-AR PL SungtiL GB-bold-r-normal--0-0-0-0-c-0-gb2312.1980-0, 880, 120, 1000 Arphic-MingGB-Slant-GB-H, -Arphic-AR PL SungtiL GB-medium-i-normal--0-0-0-0-c-0-gb2312.1980-0, 880, 120, 1000 Arphic-MingGB-Slant-GB-H, -Arphic-AR PL SungtiL GB-bold-i-normal--0-0-0-0-c-0-gb2312.1980-0, 880, 120, 1000 Arphic-KaiGB-GB-EUC-H, -Arphic-AR PL KaitiM GB-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0, 880, 120, 1000 Arphic-KaiGB-Bold-GB-H, -Arphic-AR PL KaitiM GB-bold-r-normal--0-0-0-0-c-0-gb2312.1980-0, 880, 120, 1000 Arphic-KaiGB-Slant-GB-H, -Arphic-AR PL KaitiM GB-medium-i-normal--0-0-0-0-c-0-gb2312.1980-0, 880, 120, 1000 Arphic-KaiGB-Slant-GB-H, -Arphic-AR PL KaitiM GB-bold-i-normal--0-0-0-0-c-0-gb2312.1980-0, 880, 120, 1000

# /usr/share/abisuite/fonts/zh-TW/fonts.dir:
8
Arphic-MingB5-B5-H, -Arphic-AR PL Mingti2L Big5-medium-r-normal--0-0-0-0-c-0-big5-0, 880, 120, 1000 Arphic-MingB5-Bold-B5-H, -Arphic-AR PL Mingti2L Big5-bold-r-normal--0-0-0-0-c-0-big5-0, 880, 120, 1000 Arphic-MingB5-Slant-B5-H, -Arphic-AR PL Mingti2L Big5-medium-i-normal--0-0-0-0-c-0-big5-0, 880, 120, 1000 Arphic-MingB5-Slant-B5-H, -Arphic-AR PL Mingti2L Big5-bold-i-normal--0-0-0-0-c-0-big5-0, 880, 120, 1000 Arphic-KaiB5-B5-H, -Arphic-AR PL KaitiM Big5-medium-r-normal--0-0-0-0-c-0-big5-0, 880, 120, 1000 Arphic-KaiB5-Bold-B5-H, -Arphic-AR PL KaitiM Big5-bold-r-normal--0-0-0-0-c-0-big5-0, 880, 120, 1000 Arphic-KaiB5-Slant-B5-H, -Arphic-AR PL KaitiM Big5-medium-i-normal--0-0-0-0-c-0-big5-0, 880, 120, 1000 Arphic-KaiB5-Slant-B5-H, -Arphic-AR PL KaitiM Big5-bold-i-normal--0-0-0-0-c-0-big5-0, 880, 120, 1000

Abiword accepts both.  I don't know which is more correct.

4.7  How can I use Chinese in mutt?

First, ensure that you are using version 1.3.12 or above.  Next, follow the
instructions on environment variables in FAQ 2.4. Lastly, edit $(HOME)/.muttrc
as follows:

  # $(HOME)/.muttrc
  set charset=big5
  set send_charset=us-ascii:iso-8859-1:big5:gb2312:utf-8

4.8  How can I use Chinese in X/Emacs?

Add the following to $(HOME)/.emacs

  # $(HOME)/.emacs
  (setup-chinese-gb-environment)
(set-face-font 'default '("-isas-*-16-*-gb2312.1980-0" "-eten-*-16-*-big5-0")
  'global   '(mule-fonts) 'prepend)

If you encounter problems with this while using FSF Emacs or XEmacs, please report them to debian-chinese-big5@lists.debian.org. X/Emacs is a large and complex
software, so please help us improve thsi FQ.

In newer versions of Debian, XEmacs supports XIM, so you can use XIM servers like
xcin or chinput to enter Chinese.  Refer to the relevant FAQs for details.

When locale setting LC_ALL is set to zh_CN or zh_TW, the buffer of Emacs and
XEmacs under dired mode cannot be correctly decoded.  According to various
contributors, including Fumitoshi Ukai, you can add the following:

  # $(HOME)/.emacs
  ;; To ensure proper functioning under the dired mode
  ;; with zh_CN/zh_TW locale settings
  (load "ls-lisp")

XEmacs21 does not contain the ls-lisp program, so you need to copy s-lisp.
el from
Emacs20. We suggest you copy it into $(HOME)/.xemacs, and add the above into
$(HOME)/.xemacs/init.el.

4.9  How can I use Chinese in xmms?

You need to set the proper font by hitting the right mouse button at the upper
left corner of the xmms window.  Select Settings->Fonts->use fontsets, and
make sure that it contains the following:

  -default-ming-medium-r-normal-*-*-120-*-*-c-*-big5-0

Also select "Use X font", and ensure it contains the same.

4.10  How can I use Chinese in eterm?

Eterm 0.9.1 in Debian unstable already contains some Big5 patches, but the fonts are incorrect and the character set is Unicode, so it does not support Chinese
by default.

You will need taipeifonts and xcin to support Chinese in eterm. Refer to other
FAQs for details.

  - Create a directory $(HOME)/.Eterm
  - Create a file $(HOME)/.Eterm/user.cfg, as follows:

    <Eterm-0.9.1>
    begin attributes
    font 1 8x16
    font 2 12x24
    end attributes

    begin multichar
    font 1 -*-fixed-medium-r-normal--16-*-*-*-*-*-big5.eten-0
    font 2 -*-fixed-medium-r-normal--24-*-*-*-*-*-big5.eten-0
    encoding big5
    end multichar

    begin xim
    input_method xcin
    preedit_type OverTheSpot
    end xim

You may have to change the line with <Eterm-0.9.1>. If you are using Eterm 0.9, you will need to remove the trailing ".1", or the file will not be read properly. Note that by default font 2 will be read. You can also use the "font default 1" directive to select another default, or set it inside Eterm. Refer to the Eterm
manual for details.


Contributors

[omitted]

About this document...

[omitted]


--
To UNSUBSCRIBE, email to debian-chinese-big5-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: