old-www/HOWTO/Chinese-HOWTO-4.html

365 lines
19 KiB
HTML
Raw Permalink Blame History

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>Linux Chinese HOWTO English Version: Display and Input Chinese</TITLE>
<LINK HREF="Chinese-HOWTO-5.html" REL=next>
<LINK HREF="Chinese-HOWTO-3.html" REL=previous>
<LINK HREF="Chinese-HOWTO.html#toc4" REL=contents>
</HEAD>
<BODY>
<A HREF="Chinese-HOWTO-5.html">Next</A>
<A HREF="Chinese-HOWTO-3.html">Previous</A>
<A HREF="Chinese-HOWTO.html#toc4">Contents</A>
<HR>
<H2><A NAME="view"></A> <A NAME="s4">4. Display and Input Chinese</A></H2>
<P>For environments of Chinese system under DOS or of Windows 95 for Chinese that you have been always using to get through Linux hosts, there is no doubt that you don't need to take a good look at this section. However, when your local host is Linux-based system, configurations for Chinese system are definitely necessary.
<H2><A NAME="ss4.1">4.1 xcin+crxvt</A>
</H2>
<P>It is truly suggested that you can take the combinations of xcin and crxvt as a pathway to solve the problems of Chinese I/O if the X Window System is acquainted with you.
<P>Xcin, with a contraction of X Window Chinese INput, is a Chinese Input System executed under the X mode. Because xcin is utilizing the architecture of client/server, all you have to do is just to start one xcin window so that you can manipulate with many crxvt virtual terminals under the same window, which can exhaust much little resources.
Also, it offers some wise programs of input, like Wang-Hsing Input or Natural Input, which can select the matching phases by themselves. In the early age, in order to convert fonts and inputs table to fit with xcin, you need the ETen Chinese System mounted first before the installation of xcin. After the man, Tung-Han Hsieh, &lt;
<A HREF="mailto:thhsieh@twclx.phys.ntu.edu.tw">thhsieh@twclx.phys.ntu.edu.tw</A>&gt; became responsible for the voluntary maintenance of xcin, this terrible problem had been resolved!
<P>The newest version is 2.3.02 now. But this one is just a version of beta. For the more stable one, I advise you to fetch the xcin-2.1d for a suggestion in my mind.
<P>
<H3>Getting the software</H3>
<P>Download the sources of xcin from this ftp site below:
<BLOCKQUOTE>
<A HREF="ftp://linux.cis.nctu.edu.tw/packages/chinese/xcin/xcin-2.1d.tar.gz">ftp://linux.cis.nctu.edu.tw/packages/chinese/xcin/xcin-2.1d.tar.gz</A><BR>
<A HREF="ftp://linux.cis.nctu.edu.tw/packages/chinese/xcin/xcin-2.3.02.tar.gz">ftp://linux.cis.nctu.edu.tw/packages/chinese/xcin/xcin-2.3.02.tar.gz</A></BLOCKQUOTE>
<P>
<H3>Installation of xcin</H3>
<P>You need the xcin-2.3.02.tar.gz file at hand first to setup xcin of version 2.3.02 and untar and unzip it under any certain directory.
<BLOCKQUOTE><CODE>
<PRE>
# tar xzvf xcin-2.3.02.tar.gz
....
# cd xcin-2.3.02
# ./configure (Follow the instructions on screen to modify the options you picked up in turn.)
# make
# make install
</PRE>
</CODE></BLOCKQUOTE>
<P>So, you have finished the setup of xcin of version 2.3.02 from now on.
<P>You can also get the same sort of xcin, named xcin-2.3.02.i386.rpm, maintained by Cd Chen for RedHat Linux System.
<BLOCKQUOTE>
<A HREF="ftp://linux.ntcic.edu.tw/personal/cdchen/Chinese-RedHat-Packages/XCIN/RPMS/xcin-2.3.02-1.i386.rpm">ftp://linux.ntcic.edu.tw/personal/cdchen/Chinese-RedHat-Packages/XCIN/RPMS/xcin-2.3.02-1.i386.rpm</A></BLOCKQUOTE>
<P>Install it by
<BLOCKQUOTE><CODE>
<PRE>
# rpm -Uvv xcin-2.3.02-3.i386.rpm
</PRE>
</CODE></BLOCKQUOTE>
<P>
<H2><A NAME="ss4.2">4.2 yact</A>
</H2>
<P>yact is the system of displaying and inputing Chinese running under the terminal mode. The most different point from chdrv is that yact uses your computers' displaying card through svgalib library. Without the information of your video card contained in the svgalib, you may not probably make yact work on your Linux.
<P>The most admirable point for yact is that the fonts are scanned with 24x24 on the monitor and are more beautiful than other terminal Chinese input system. And it is more smooth than the others in dealing with scrolling pages. The newest version of yact is yact-p4 now.
<P>You can get yact here below,
<BLOCKQUOTE>
<A HREF="ftp://linux.cis.nctu.edu.tw/packages/chinese/yact/yactp4.tar.gz">ftp://linux.cis.nctu.edu.tw/packages/chinese/yact/yactp4.tar.gz</A></BLOCKQUOTE>
The ways to setup yact are simple, too. After getting the sources of yact, decompress it and examine whether the Makefile file is correct or not, then type make all install directly on shell prompt to complete the installation of bits files.
Read the README file for more detailed information.
<P>Next is the step of fonts' setup. yact uses the HBF fonts, but you can't find the fonts in the packages of yact, which means you need to take extra actions to make it available. Having ETen Chinese System mounted is an original recommendation from the founder for its fonts. Copy the HBF fonts' description file <CODE>et24.hbf</CODE> under the fonts directory of sources of yact to the directory <CODE>/usr/local/lib/yact</CODE> and rename it as <CODE>hzfont.hbf</CODE>. Then copy STDFONT.24, SPCFSUPP.24, SPCFONT.24 and ASCFONT.24 fonts files to the directory <CODE>/usr/local/lib/yact</CODE> and rename ASCFONT.24 as <CODE>12x24</CODE>.
<P>The free HBF fonts are available, too. Change names of these 256 ASCII fonts as <CODE>12x24</CODE> and names of the HBF fonts' description file as <CODE>hzfont.hbf</CODE>. Put both of description files and fonts files into <CODE>/usr/local/lib/yact</CODE>, then everything will be ok.
<P>
<H2><A NAME="ss4.3">4.3 bcs16</A>
</H2>
<P>Because yact needs the svgalib 1024x768 mode to work, many netters without ET4000 series cards cannot get well supports from it, causing their sickness of this excellent Chinese system.
The bcs16 is modified from yact according to this drawbacks. It needs only 640x480 and can work very well on most video cards.
<P>Get bcs16 from this site:
<BLOCKQUOTE>
<A HREF="ftp://linux.cis.nctu.edu.tw/packages/chinese/bcs/bcs007a.tgz">ftp://linux.cis.nctu.edu.tw/packages/chinese/bcs/bcs007a.tgz</A></BLOCKQUOTE>
<P>Installation
<UL>
<LI>Decompress and compile it to setup
<PRE>
# tar zxvf bcs007a.tgz
# cd bcs16
# make
# cp bcs16 /usr/local/bin
</PRE>
</LI>
<LI>bcs16 take yact's input table as default and this is the reason that you must setup yact first before bcs16 can work. However, version of v0.05 or laters have been emerged with the support of individual Boshiamy input, so if you don't need other inputs provided from yact, you don't need to install yact first.
Just fetch Boshiamy input table, <CODE>liubig5.tab</CODE>, of DOS version and put it into the directory
<CODE>/usr/local/lib/yact</CODE> .</LI>
<LI>Put files under directory <CODE>data</CODE> into <CODE>/usr/local/lib/yact</CODE> and all the legal fonts files, namely <CODE>spcfont.15</CODE>, <CODE>spcfsupp.15</CODE>, and<CODE>stdfont.15</CODE> , are need to put together in the same place, too.</LI>
<LI>If you want to see GB codes or Japanese or Korean, get fonts <CODE>cclib.16.gz cclib.16a.gz</CODE>, <CODE>jis.16.gz</CODE>, <CODE>ksc.16.gz</CODE> from the site below and decompress them into <CODE>/usr/local/lib/yact</CODE>.
<BLOCKQUOTE>
<A HREF="ftp://nctuccca.edu.tw/Chinese/ifcss/software/fonts/">ftp://nctuccca.edu.tw/Chinese/ifcss/software/fonts/</A></BLOCKQUOTE>
</LI>
<LI>If you have the files of creating fonts or sets of Sea-Fonts, you can copy them to the directory <CODE>/usr/local/lib/yact/usrfont.15m</CODE> too. </LI>
<LI>Execute <CODE>bcs16</CODE>. Pressing <CODE>Alt-H</CODE> can get more advanced explanations of instructions. </LI>
</UL>
<P>The founder of bcs16 is
<A HREF="mailto:cnoize.bbs@bbs.cis.nctu.edu.tw">cnoize.bbs@bbs.cis.nctu.edu.tw</A>.
<P>
<P>
<H2><A NAME="ss4.4">4.4 chdrv</A>
</H2>
<P>chdrv is a Chinese emulator program displaying and entering Chinese through console. Because chdrv access the tty device directly, it must be activated by the root. Now, chdrv is maintained by
<A HREF="http://formosa.iis.sinica.edu.tw/~wycc/">Yu-Chung Wang</A> &lt;
<A HREF="mailto:wycc@iis.sinica.edu.tw">wycc@iis.sinica.edu.tw</A>&gt; and the newest one is chdrv-1.0.10.
<P>
<H3>Getting chdrv</H3>
<P>You can get it from
<BLOCKQUOTE>
<A HREF="ftp://linux.cis.nctu.edu.tw/packages/chinese/chdrv/">ftp://linux.cis.nctu.edu.tw/packages/chinese/chdrv/</A></BLOCKQUOTE>
Get the source package, chdrv-1.0.10.tar.gz, binary package, chdrvbin-1.0.10.tar.gz, and fonts package, chdrvfont.tar.gz, respectively.
<P>
<H3>Installation of chdrv</H3>
<P>Unzip and untar the compressed binary file,
<BLOCKQUOTE><CODE>
<PRE>
# tar xvzf chdrvbin-1.0.10.tar.gz
# mv chdrvfont.tar.gz chdrv-1.0.10/
# cd chdrv-1.0.10
</PRE>
</CODE></BLOCKQUOTE>
Read the illustrations for installation in file <CODE>INSTALL.1.0</CODE> to modify file <CODE>install</CODE>. If you want your shadow password to works, you need to change the settings in <CODE>chinese.conf</CODE>. Erase the following comments off,
<PRE>
LOGINPROGRAM /bin/telnet
</PRE>
Freeze this line into remarks,
<PRE>
LOGINPROGRAM /bin/login
</PRE>
Now, you can execute the installation script.
<BLOCKQUOTE><CODE>
<PRE>
# ./installbin
</PRE>
</CODE></BLOCKQUOTE>
<P>
<P>
<H2><A NAME="ss4.5">4.5 cxterm</A>
</H2>
<P>cxterm is a Chinese virtual terminal running under X Window System, and is the oldest Chinese displaying and inputing virtual terminal, which is provided various codes for Chinese, including BIG5 codes, GB codes, HZ codes and so on.
Because each cxterm opened needs to load Chinese data into the main memory, system resources are exhausted quite largely for it.
<P>
<H3>Getting cxterm</H3>
<P>The newest one is version of 5.0.p3 named <CODE>cxterm5.0.p3.tar.gz</CODE>, which contains both of cxterm codes and Chinese fonts. You can get it from here below,
<BLOCKQUOTE>
<A HREF="ftp://ftp.ifcss.org/pub/software/x-win/cxterm/">ftp://ftp.ifcss.org/pub/software/x-win/cxterm/</A></BLOCKQUOTE>
Or the rpm at <CODE>ftp.redhat.com</CODE>: <CODE>cxterm-color-5.0p3-1.i386.rpm</CODE>, <CODE>cxterm-color-big5-5.0p3-1.i386.rpm</CODE>, <CODE>cxterm-color-gb-5.0p3-1.i386.rpm</CODE>.
<BLOCKQUOTE>
<A HREF="ftp://ftp.redhat.com/pub/contrib/hurricane/i386/">ftp://ftp.redhat.com/pub/contrib/hurricane/i386/</A></BLOCKQUOTE>
<P>
<H3>Installation of cxterm</H3>
<P>Decompress the packed,
<BLOCKQUOTE><CODE>
<PRE>
# tar -xvzf cxterm5.0.p3.tar.gz
</PRE>
</CODE></BLOCKQUOTE>
The upper instruction will produce a new directory <CODE>cxterm-5.0</CODE>, and then invoke instructions as follows:
<BLOCKQUOTE><CODE>
<PRE>
# cd cxterm-5.0
# ./config.sh
</PRE>
</CODE></BLOCKQUOTE>
You need login as root to execute ``<CODE>./config.sh</CODE>'' if you wish all users on your computer can use cxterm well, then you can finish the steps of setup following the descriptions below:
<PRE>
0. Read COPYRIGHT Notice
1. Compile, Install, and Configure "CXTERM 5.0" in One Step
2. Compile cxterm (not to install)
3. Install cxterm (after successful compilation in 2)
4. Install additional Chinese font(s) for your X window
5. Configure your account for using cxterm (after installation in 3)
x. Exit
Please choose (0/1/2/3/4/5/x) :
</PRE>
<P>If you wish all things going through automatically, please choose <CODE>1</CODE>, and then enter the name of directory where to store the cxterm. If asking me, I will suggest this place,
<CODE>/usr/local/chinese</CODE><EFBFBD>D
There are two kinds of Chinese fonts coming with the packed package, choosing <CODE>1</CODE> and <CODE>3</CODE> will make the procedure of installation all automatic.
In addition, you can select <CODE>4</CODE> to install some extra fonts, too. After achieving this setup, you need to put <CODE>cxterm</CODE> and <CODE>CXterm</CODE> into the path of searching directory.
<BLOCKQUOTE><CODE>
<PRE>
# export PATH=$PATH:/usr/local/chinese/bin
</PRE>
</CODE></BLOCKQUOTE>
<P><CODE>CXterm</CODE> is just a shell script to load the resources of X and cxterm in.
For using GB codes, invoke this following command,
<BLOCKQUOTE><CODE>
<PRE>
# CXterm -gb
</PRE>
</CODE></BLOCKQUOTE>
For BIG5 codes, invoke this following command,
<BLOCKQUOTE><CODE>
<PRE>
# CXterm -big5
</PRE>
</CODE></BLOCKQUOTE>
<P>
<H3>Color patch of CXterm</H3>
<P>On the website<CODE>
<A HREF="ftp://ftp.ifcss.org/pub/software/x-win/cxterm">ftp://ftp.ifcss.org/pub/software/x-win/cxterm</A></CODE>, there is a color patch for cxterm as well. Using this patch can make cxterm showing colors of ANSI.
Assuming that you put the original files of cxterm under the <CODE>/tmp/cxterm-5.0</CODE>, then
<BLOCKQUOTE><CODE>
<PRE>
# cp cxterm-5.0.p3-color.patch.gz /tmp
# gzip -d cxterm-5.0.p3-color.patch.gz
# patch &lt; cxterm-5.0.p3-color.patch
# cd cxterm-5.0
# ./config.sh
</PRE>
</CODE></BLOCKQUOTE>
<P>
<H2><A NAME="xa"></A> <A NAME="ss4.6">4.6 XA (Xcin Anywhere)</A>
</H2>
<P>XA is a small tool of an abbreviation for Xcin Anywhere, which can let you enter Chinese words with xcin under any common X-based softwares.
If making XA coordinating with CXWin(or XA+CV), you can get an environment of accessing Chinese for softwares not supported with Chinese. Thus, the xterm will become cxterm-like naturally. Cool, doesn't it?
XA is now extremely unstable as though, and you have to take charge of all risks if you want to explore it. As most things do, before working with XA, you must make xcin installed first. You can pick XA up into your pocket from here below:
<BLOCKQUOTE>
<A HREF="ftp://linux.cis.nctu.edu.tw/packages/chinese/xcin/XA/">ftp://linux.cis.nctu.edu.tw/packages/chinese/xcin/XA/</A></BLOCKQUOTE>
<P>Decompress the packed. Run <CODE>./configure</CODE> to produce <CODE>mk</CODE> and <CODE>config.h</CODE> on account for the compilation by using <CODE>./mk</CODE>.
If it works, key in <CODE>./mk test xterm</CODE> next to see if the xcin can be called out and enter Chinese under xterm to test.
If there is no problem, copy <CODE>wrap.so</CODE> to <CODE>/usr/local/lib/</CODE> following the syntax below:
<BLOCKQUOTE><CODE>
<PRE>
# LD_PRELOAD=/usr/local/lib/wrap.so netscape &amp;
</PRE>
</CODE></BLOCKQUOTE>
Then, just follow the general method of using xcin.
<P>Founder of XA is
<A HREF="mailto:weijr.bbs@bbs.ntu.edu.tw">weijr.bbs@bbs.ntu.edu.tw</A>.
<P>
<P>
<H2><A NAME="ss4.7">4.7 New Added Inputs</A>
</H2>
<P>At present, there are two common formats of input table, namely <CODE>tit</CODE> and <CODE>cin</CODE>, which both are plain text of formats. (That's means you can edit them directly from text editors.)
However, most Chinese Systems almost provide utilities for the purpose of exchanging pure text of formats into special binary of formats in order to speed up searching method.
Before you setup some certain input, you must own it's <CODE>tit</CODE> , <CODE>cin</CODE>, or formats after transformation first .
<P>I will take the Bo-Shia-My input as an example to show how to add it under each kind of Chinese system.
The input tables mentioned here can be found at<CODE>
<A HREF="ftp://ftp.cis.nctu.edu.tw/UNIX/Chinese/Boshiamy/">ftp://ftp.cis.nctu.edu.tw/UNIX/Chinese/Boshiamy/</A></CODE>.
<P>Other <CODE>tit</CODE> files are also available at <CODE>
<A HREF="ftp://ftp.ifcss.org/pub/software/x-win/cxterm/dict/">ftp://ftp.ifcss.org/pub/software/x-win/cxterm/dict/</A></CODE>.
<P>
<H3>xcin</H3>
<P>Make use of utility <CODE>cin2tab</CODE> provided from xcin to transform the <CODE>cin</CODE> table into <CODE>tab</CODE> one.
<BLOCKQUOTE><CODE>
<PRE>
# cin2tab boshiamy.cin
</PRE>
</CODE></BLOCKQUOTE>
It will produce the two files: <CODE>boshiamy.tab</CODE> and <CODE>boshiamy.tab.rev</CODE>. Put them into the directory of xcin and activate xcin next:
<BLOCKQUOTE><CODE>
<PRE>
# xcin -in9 boshiamy.tab
</PRE>
</CODE></BLOCKQUOTE>
To use Bo-Shia-My input, press the combination keys <CODE>CTRL-ALT-9</CODE>.
<P>
<H3>yact &amp; bcs16</H3>
<P>yact takes the use of cit of version 2, and the same as cxterm. You can use the tool <CODE>tit2cit</CODE> accompanied with yact to make transformation available between <CODE>boshiamy.tit</CODE> and <CODE>cit</CODE>.
<P>Move <CODE>boshiamy.cit</CODE> into <CODE>/usr/local/lib/yact</CODE> and establish a symbol link for it:
<BLOCKQUOTE><CODE>
<PRE>
# ln -s boshiamy.cit 9
</PRE>
</CODE></BLOCKQUOTE>
Like xcin does, Hit <CODE>CTRL-ALT-9</CODE> for calling Bo-Shia-My input.
<P>
<H3>chdrv</H3>
<P>At first, put <CODE>boshiamy.tbl</CODE> into <CODE>/usr/local/lib/chinese</CODE>.
Secondly, modify <CODE>/etc/chinese.conf</CODE>, adding the follow section <CODE>INPUT</CODE> into it.
<HR>
<PRE>
BEGIN INPUT
PHONETIC /usr/local/lib/chinese/phone.def
MULTI /usr/local/lib/chinese/boshiamy.tbl
END INPUT
</PRE>
<HR>
Finally, use utility <CODE>chconfig</CODE> of chdrv to make the contents of <CODE>/etc/chinese.conf</CODE> effective.
<P>
<H3>cxterm</H3>
<P>Change <CODE>boshiamy.tit</CODE> into <CODE>cit</CODE> or <CODE>citnf</CODE> with the utility <CODE>tit2cit</CODE> of cxterm, then modify <CODE>.Xdefaults</CODE> to set a combination key for acting Bo-Shia-My input. Please refer to the technical document coming with cxterm for more information about installation and implementation in detail.
<P>
<P>
<P>
<H2><A NAME="input"></A> <A NAME="ss4.8">4.8 Problems coming with input</A>
</H2>
<P>After you accomplished the establishments of Chinese System, you have already been able to display Chinese on your Linux through monitors.
However, as using a Chinese editor, you will find that the Linux system can only display Chinese but cannot accept the input of Chinese.
You have to modify two spots, by yourself, to make Linux system becoming acceptable with output and input of Chinese if you want to improve these problems
At beginning, you need to add the locale setting to the shell profile file (Referring to the locale mini-HOWTO when concerning with locale).
Additionally, adding sets about inputs for the <CODE>.inputrc</CODE> file under your home directory is necessary too. (Please create it yourself if <CODE>.inputrc</CODE> didn't ever exist.)
Here are the configurations concerning with shell profile file and <CODE>.inputrc</CODE> file which are distributing on public domain(just as a reference, though):
<P>Bash Shell:
Appending the following contents into <CODE>/etc/profile</CODE>, please.
<HR>
<PRE>
stty cs8 -istrip
stty pass8
export LANG=C
export LC_CTYPE=iso-8859-1
</PRE>
<HR>
<P>Tcsh Shell:
Appending the following contents into <CODE>/etc/csh.login</CODE> or in <CODE>/etc/csh.cshrc</CODE>, please.
<HR>
<PRE>
stty cs8 -istrip
stty pass8
setenv LANG C
setenv LC_CTYPE iso-8859-1
</PRE>
<HR>
<P><CODE>$HOME/.inputrc</CODE> file for setup lists as follows:
<HR>
<PRE>
set convert-meta off
set output-meta on
</PRE>
<HR>
<P>Eventually, prepare a text file contained with Chinese words by yourself, and use tool <CODE>grep</CODE> to search it. If it can find something exact, this means that your Linux system can work with Chinese words already.
<P>
<P>
<HR>
<A HREF="Chinese-HOWTO-5.html">Next</A>
<A HREF="Chinese-HOWTO-3.html">Previous</A>
<A HREF="Chinese-HOWTO.html#toc4">Contents</A>
</BODY>
</HTML>