Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

How to input chinese characters with Debian Etch

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Post Reply
Message
Author
Rodolfo Medina
Posts: 35
Joined: 2006-05-06 10:39

How to input chinese characters with Debian Etch

#1 Post by Rodolfo Medina »

Operating system: Debian Etch 4.0 r0

Choose between the different procedures reported below.

======================
Procedure 1: with Scim
======================
During the installation I had chosen the manual package installation and
installed the following packages:

x-window-system-core gnome-core ppp mozilla-browser evolution

. I did:

# apt-get install scim scim-pinyin scim-gtk2-immodule ttf-arphic-bkai00mp ttf-arphic-bsmi00lp ttf-arphic-gbsn00lp


-------------
Procedure 1.1
-------------
To start Mozilla I did:

$ GTK_IM_MODULE="scim" mozilla

, then within Mozilla `C-space' and the scim bar appeared. I mouse-clicked on
the bar and selected simplified chinese. I could now input chinese characters:
try `z h 2 g u o 1'. `C-space' again and the bar disappeared.
Similarly, to start Evolution:

$ GTK_IM_MODULE="scim" evolution

. You can create aliases to be more comfortable.

Similarly, to start gedit I did:

$ GTK_IM_MODULE="scim" gedit

. If I wanted to input chinese characters also within oowriter, I had to
install the package openoffice.org-gtk:

# apt-get install openoffice.org-gtk

, then launch oowriter with

$ GTK_IM_MODULE="scim" oowriter

and do C-space. Alternatively, with gedit I can do:

$ scim

and, in another terminal,

$ gedit

, then right click in gedit buffer and go to:

Input Methods > SCIM Input Method

, then `C-space' etc. `C-c' to stop scim. (Actually, starting scim with `$
scim' is not necessary: it is automatically started when right clicking in
gedit buffer.) This alternative procedure, which I prefer, is not possible
with Mozilla nor with Evolution: when you right click in Mozilla buffer , no
`Input Methods' item appears.
-------------------------------------------------------------------------------


-------------
Procedure 1.2
-------------
At the end of /etc/profile put the following lines:

export XMODIFIERS=@im=SCIM
export GTK_IM_MODULE=scim
export QT_IM_MODULE=scim

. Then start gedit and mozilla normally, with `$ gedit' and `$ mozilla' and
`C-space' to input chinese characters. Note that you can do C-space and input
chinese characters also in the terminal, without launching any application. If
you want to input chinese characters also within oowriter, you have to install
the package openoffice.org-gtk:

# apt-get install openoffice.org-gtk

, then launch oowriter with `$ oowriter' and do C-space.
-------------------------------------------------------------------------------




When printing a gedit document including chinese characters, to set font size:

File > Page Setup > Fonts > Body

; to set page margins,

File > Print > Paper > Paper size: Custom

, and adjust at your pleasure Width and Height.
===============================================================================



=======================
Procedure 2: with Emacs
=======================

After the Debian base installation, I had chosen the manual
packages selection and installed the following packages:

x-window-system-core gnome-core alsa-utils less gcc autotools-dev build-essential bzip2 debhelper diffstat exim4 exim4-base exim4-config exim4-daemon-light g++ g++-4.1 gawk gettext gettext-base html2text intltool-debian libc6-dev libice-dev libjpeg62-dev liblockfile-dev liblockfile1 libncurses5-dev libpcre3 libpng12-dev libsm-dev libstdc++6-4.1-dev libtiff4-dev libtiffxx0c2 libungif4-dev libungif4g libx11-dev libxau-dev libxaw-headers libxaw7-dev libxdmcp-dev libxext-dev libxmu-dev libxmu-headers libxpm-dev libxt-dev linux-kernel-headers mailx po-debconf quilt sharutils texinfo x11proto-core-dev x11proto-input-dev x11proto-kb-dev x11proto-xext-dev xaw3dg xaw3dg-dev xtrans-dev zlib1g-dev rsync autoconf bluez-utils obexpushd ussp-push pkg-config libdbus-1-dev ppp mozilla-browser xpdf-reader tetex-bin tetex-base tetex-extra gs mplayer gv cdrdao cdrecord dvd+rw-tools star openoffice.org

. From:

http://ftp.cdaan.com/sy/light/simsun.ttf

I downloaded the file simsun.ttf and put it into the directory
`/usr/share/fonts/X11/Type1', then added the following lines to the files
`/usr/share/fonts/X11/Type1/fonts.dir' and
`/usr/share/fonts/X11/Type1/fonts.scale':

simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-ascii-0
simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-gbk-0
simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-ibm-cp850
simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-iso10646-1
simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-iso8859-1
simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-iso8859-15
simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-koi8-r
simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-big5.eten-0

. I added the following lines to the file ~/.Xresources:

Emacs.Font: fontset-song
Emacs.Fontset-0:-*-fixed-medium-r-*-*-16-*-*-*-*-*-fontset-song,\
chinese-gb2312:-misc-simsun-medium-r-*--16-*-*-*-*-*-gb2312*-*,\
chinese-big5-1:-misc-simsun-medium-r-*--16-*-*-*-*-*-big5*-*,\
chinese-big5-2:-misc-simsun-medium-r-*--16-*-*-*-*-*-big5*-*,\
japanese-jisx0208:-misc-simsun-medium-r-*--16-*-*-*-*-*-jis0201*-0,\
mule-unicode-0100-24ff:-*-fixed-medium-r-normal--16-*-*-*-*-*-iso10646-1,\
mule-unicode-e000-ffff:-*-fixed-medium-r-normal--16-*-*-*-*-*-iso10646-1,\
mule-unicode-2500-33ff:-*-fixed-medium-r-normal--16-*-*-*-*-*-iso10646-1,\
chinese-cns11643-5:-misc-simsun-medium-r-*--16-*-*-*-*-*-gbk-0,\
chinese-cns11643-6:-misc-simsun-medium-r-*--16-*-*-*-*-*-gbk-0,\
chinese-cns11643-7:-misc-simsun-medium-r-*--16-*-*-*-*-*-gbk-0

. I installed Emacs CVS 22.0.50.1. Typing simplified Chinese: put in .emacs
the following:

(set-language-environment "Chinese-GB")
(set-selection-coding-system 'cn-gb-2312)
(set-clipboard-coding-system 'cn-gb-2312)
;; (set-keyboard-coding-system 'cn-gb-2312)
(setq locale-coding-system 'cn-gb-2312)
(set-terminal-coding-system 'chinese-iso-8bit)
(setq default-input-method 'chinese-py-punct)

, then close emacs and open it again. Do C-\ to switch to the 'chinese-py'
input method. To type 'Hallo', I just did:

'n' 'i' '1' 'h' 'a' 'o' '1'

. Besides, I could easily switch from chinese to european input method and
vice versa just tiping 'C-\'. Typing Traditional Chinese: within Emacs, `C-u
C-\', then TAB and select chinese-py-b5. Type:

z h o n g TAB 1 1 g u o TAB 2

, you will get the expression `China'.


===============
Third: printing
===============

With the settings described in procedure 2, I copied the file

http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el

into ~/lib/emacs directory and put in my .emacs the following code:

(add-to-list 'load-path (expand-file-name "~/lib/emacs"))
(require 'htmlize)

, then loaded in Emacs the file containing chinese characters. In Emacs I did:
`M-x htmlize-file'. This way an html file was created, that could be printed.
To convert it into pdf or ps format, Debian testing's version of Firefox: in
testing/unstable I did:

# aptitude install icweasel

(and maybe also scim scim-pinyin scim-gtk2-immodule, or maybe just the settings
described in the second procedure), then

$ firefox

, and there File > Print ecc.

Post Reply