Running Gcin Chinese Input Framework and Chinese X11 on Mac OS X

1. Requirement

X11 for Mac OS X, X11 SDK, Xcode Tools and Fink are required.

You can install X11, X11 SDK and Xcode Tools with the Mac OS X
installation DVD/CD, or download them from
http://www.apple.com/macosx/features/x11/download/, select the file named
as X11User.dmg. The most recent version of Xcode Tools could be downloaded
from http://developer.apple.com/tools/download/,
and you must join a member of Apple Developer Connection first in order
to have the permission to download Xcode. Fink is available in
http://fink.sourceforge.net/, please download and install the binary
packages.

2. Rxvt, Gcin and Chinese fonts (Taipeifonts or KCfonts) Installation

2.1 Rxvt

If the installation of all of the softwares listed is done, please
launch Terminal.app or xterm in X11 environment, and type in such
commands:

$ sudo fink scanpackages ; sudo fink selfupdate ; sudo fink update-all
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install rxvt-ml

It will install the multi-linguistic version of rxvt. Rxvt is a
terminal application which supports Chinese display and input, and it
is a nice and commonly used replacement of xterm for Chinese X11 users.

2.2 Chinese Fonts

In a Chinese environment, Chinese fonts are required. Taipeifonts or KCfonts
are popular bitmap fonts for Chinese users and it is available from
http://cle.linux.org.tw/candyz/mac/. Unpack the tarball,
and copy all the .pcf.gz files, *.dir and *.alias into
/usr/X11R6/lib/X11/fonts/misc. and then change into that directory and
use such commands in order to add Chinese Fonts into the font settings
of X11:

For Taipeifonts:
$ sudo cat taipei.dir >> /usr/X11R6/lib/X11/fonts/misc/fonts.dir
$ sudo cat taipei.alias >> /usr/X11R6/lib/X11/fonts/misc/fonts.alias

For KCfonts:
$ sudo cat kc.dir >> /usr/X11R6/lib/X11/fonts/misc/fonts.dir
$ sudo cat kc.alias >> /usr/X11R6/lib/X11/fonts/misc/fonts.alias

2.3 Gcin

Gcin is developed with GTK libraries, so you need to install these
libraries :

$ sudo apt-get install gtk+2-dev glib2-dev pkgconfig pango1-xft2-dev atk1

Then, visit http://www.csie.nctu.edu.tw/~cp76/gcin/download/ to
download the most recent version of gcin, and unpack the tarball.

$ tar jxvf gcin-<version>.tar.bz2
$ cd gcin-<version>

Use your favorite text editor to edit the Makefile, please mark the
line 38 and line 39:

# $(MAKE) -C im-client
# $(MAKE) -C gtk-im

And you need to mark the line 83 and 84, too.

# $(MAKE) -C im-client instal
# $(MAKE) -C gtk-im install

Please edit config.mak, change the line 11 and add
"-L /usr/X11R6/lib -lX11 " after the LDFLAGS, then the line 11 will become:

LDFLAGS=-L /usr/X11R6/lib -lX11 -L /sw/lib -lgtk-x11-2.0 -lgdk-x11-2.0
-latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0
-lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl -liconv

Now, you can start to compile gcin, plaese use the commands below:

$ ./configure
$ make
$ sudo make install

3. Test Gcin and Rxvt

While the installation is done, you can test if gcin and rxvt can run
by using commands below:

$ export LANG=zh_TW.Big5
$ export XMODIFIERS=@im=gcin
$ export XIM=gcin
$ gcin &
$ gcin-setup (Launch gcin preference application, you can adjust the
settings here. However, I am sorry to say that the user interface is
totally in Chinese.)
$ rxvt -fn 8x16 -fm taipei16 (Launch rxvt with taipeifonts)
$ rxvt -fn 8x16 -fm kc15f (Launch rxvt with kcfonts)

4. Shell Script

You can use a shell script to launch gcin and rxvt automatically.
Please copy the commands below, and save them into a text file such as
"gcrxvt".

export LANG=zh_TW.Big5
export XMODIFIERS=@im=gcin
export XIM=gcin gcin &
sleep 3
/sw/bin/rxvt -sl 5000 -sr -bg black -fg lightgray -fn 8x16 -fm kc15f &
xmodmap /etc/X11/xinit/.Xmodmap
rm -rf /tmp/gcin-*

Next time you need to launch gcin and rxvt, just type "./gcrxvt" in the
terminal window. You can add gcrxvt into the menu of X11, too. Please
select "Application" -> "Customize..." from the menu.

You may doubt why we have to delete /tmp/gin-* files. That's because of
the design of gcin is somehow weird, it looks up if there is any lock
file generated by it's self, it the lock file exists and it will
terminate it's self. Linux can clean up the lock file while gcin is
terminated but Mac OS X can not. We must delete the lock file manually.

5. Use Command +Space to switch Roman and Chinese Input.

The default setting of gcin is to use Control+Space to switch from
Roman keyboard to Chinese input methods. However, the default behavior
of Classic OS and Mac OS X is to use Command+Space. You know, there are
no Command Key on PCs, and Gcin is developed for PCs but not for
Macintosh computers. We need to remap the keyboard layout and map the
Command Key to other keys in order to make gcin matching to our habits.

To remap the keyboard layout, please launch gcin-setup, and change the
key setting to enable or disable gcin (內定輸入法 開啟/關閉) into
"Alt + Space". Then, edit /etc/X11/xinit/.Xmodmap or ~/.Xmodmap, insert the
commands below:

clear mod1
clear mod2
add mod1 = Alt_L Meta_L
add mod2 = Mode_switch

6. Reference

http://developer.apple.com/darwin/runningx11.html
http://www.oreillynet.com/pub/wlg/3076

7. Special Thanks to Weizhong Yang(zonble) to help me to translate this
document into English.

 
arrow
arrow
    全站熱搜

    Bluelove1968 發表在 痞客邦 留言(0) 人氣()