nanogui: Announce: Chinese Input Method Editor for nanoX
Subject:
Announce: Chinese Input Method Editor for nanoX
From:
"Hsien-Li Lin" ####@####.####
Date:
4 Apr 2001 17:22:17 -0000
Message-Id: <005a01c0bd2b$c6e5db90$0100000a@CMLAB.CSIE.NTU.EDU.TW>
Hi all,
I forgot the README about the tradition Chinese Input Mehtod
Editor before. I attach the file with this mail. I hope it is helpful.
Regards,
Chanlee
================================================================
Traditional Chinese Input Method Editor (IME) version beta 1
for Nano-X API of Micriowindows
================================================================
Installation guide
This traditional Chinese Input Method Editor is for Nano-X API of
Microwindows-0.89 pre7. In current version, it supports two input
methods: Phone and ChangJei, in Big-5 codes. You can download
this patch file from
ftp://ftp.setabox.com/pub/chinese/ime/ime-beta-1.patch
==============
Prerequirement
==============
You must have following files to build your own Nano-X with
Chinese display ability:
microwindows-0.89pre7.tar.gz
micorwindows-fonts-chinese-0.89pre2.tar.gz
If you don't have such files, you can download these two files from
ftp://ftp.microwindows.org/
=============
Quick Install
=============
1) Untar the necessary files.
tar zxvf microwindows-0.89pre7.tar.gz
tar zxvf micorwindows-fonts-chinese-0.89pre2.tar.gz
2) Modify the line in microwin/src/config with
HAVE_BIG5_SUPPORT = N
to
HAVE_BIG5_SUPPORT = Y
in order to enable traditional Chinese fonts display.
3) Save ime-beta-1.patch in the parent directory of 'your microwin directory'.
Then type
patch -p0 < ime-beta-1.patch
to apply IME patch.
4) Change directory to microwin/src/ and finish the installation in the following
steps:
make
make install
5) Set NANOX_IME_PATH environment variable which will be used by IME:
In bash:
export NANOX_IME_PATH='your microwin directory'/src/bin/ime
In csh:
setenv NANOX_IME_PATH 'your microwin directory'/src/bin/ime
ps: You can put this line in .bash_profile or .login, so that you don't
need to set this environment variable every time you login.
=======
Testing
=======
If you want to see if your system can work correctly, you can execute
microwin/src/demos/kbd/demo1 or microwin/src/demos/kbd/demo2.
./demo1
or
./demo2
In demo1, if you can see a new window when you press Ctrl-Space, your installation
is successful. In demo2, you can see a terminal window. When you move your mouse
into this window and press Ctrl-Space, you can have a Chinese input editor, and
you can type Chinese word in this terminal window.
===============================================
Modify Your Application to Accept Chinese Input
===============================================
Because a Chinese character is double-byte encoded, something special must be done
to handle these Chinese characters. During the input process, the first byte of
Chinese characters must be buffered, and a complete Chinese character can not be
composed correctly until the arrival of the second byte. In our system, whenever
the keystroke event, GR_EVENT_KEYSTROKE, occurs, The 'ch' field of the keystroke
event must be checked to see if this value becomes MWKEY_BIG5. If 'ch' field
becomes MWKEY_BIG5, the value of field 'scancode' will be a part of a Chinese
character.
Sample:
void writeChinese(char ch)
{
static char ChineseChar[2] = {'\0', '\0'};
/* support BIG5 */
if ( ChineseChar[0] != '\0')
{
ChineseChar[1] = ch;
GrText(w, gc, 10, 10, ChineseChar, 2, GR_TFTOP);
ChineseChar[0] = '\0';
return;
}
if ( (unsigned char)ch >= 0xA1 && (unsigned char)ch <= 0xFE ) {
ChineseChar[0] = ch;
return;
}
}
void Handler(void)
{
GR_EVENT wevent;
GR_EVENT_KEYSTROKE *kp;
unsigned char buf[LARGEBUFFER];
GrGetNextEvent(&wevent);
switch(wevent.type) {
...
case GR_EVENT_TYPE_KEY_DOWN:
kp=(GR_EVENT_KEYSTROKE *)&wevent;
/* toss all special keys*/
if (kp->ch == MWKEY_BIG5)
{
writeChinese(kp->scancode);
}
else
{
if (kp->ch & MWKEY_NONASCII_MASK)
break;
*buf = kp->ch & 0xff;
write(pipeh, buf,1);
break;
}
...
}
}
=========
Todo List
=========
1. Add a resource file to record some environment settings.
2. Modify the UI of our programs.
3. Improve IME API.
=====================
Supporting Institutes
=====================
Many thanks to go to Setabox Co., Ltd. and CML (Communication and
Multimedia Laboratory, http://www.cmlab.csie.ntu.edu.tw/) in the
Department of Computer Science and Information Engineering of
National Taiwan University for supporting this porting project.
===================
Contact Information
===================
If there is any suggestion or bug report, welcome to send mails to the following
E-mail addresses:
Hsien-Li Lin ####@####.#### or
####@####.####
I-Chieh Hsu ####@####.#### or
####@####.####