Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
IIIMF and GTK+2.0 (incomplete)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
xkjyeah
n00b
n00b


Joined: 10 May 2003
Posts: 72

PostPosted: Thu May 13, 2004 2:01 pm    Post subject: IIIMF and GTK+2.0 (incomplete) Reply with quote

THIS PAGE IS NOT A SOLUTION TO IIIMF INPUT TO GTK-IMMODULE. IF YOU ARE SEARCHING FOR A SOLUTION, YOU HAVE COME TO THE WRONG PLACE. BUT FEEL FREE TO EXTEND IT

YOU NEED GNOME

What is IIIMF? It is a multi-language input method editor framework, and able to switch input methods on-the-fly.

Why am I interested in this? English is my first language. However, I would occasionally want to include Chinese in GAIM. And when I am unable to do so because I have not set up a XIM server, I get all flared up because I do not want to restart GAIM just to input one or two words of Chinese.

How is this applicable? GTK+ 2.0 supports multiple input methods for different languages running concurrently. This means that I can mix Tamil, Hindi, Chinese, Japanese, English, Thai etc. in one document, without restarting the program (e.g. gedit).
IIIMF makes use of GTK+ 2.0 to deliver its cross-platform and client-server model input method framework to GTK users. But the point is, apart from IIIMF, you can hardly find any other GTK-immodule-supporting Chinese input method editors. :( UIM works, but lacks the familiarity and usability (it does not even support _phrases_ out of the box) of MS Pinyin IME, and other commercial IMEs.
This is a guide to partially set up IIIMF.

1. Through portage, set up the basics
# emerge iiimcf iiimsf
....

2. i) Get IIIMF modules from http://apac.redhat.com/iiimftest/
Make sure that when you do the ./configure; make; make install, you make sure it installs to /usr/lib/im. Do "make install" as a normal user so you can see what would happen.
ii) Use the inpinyin module in the package. i.e
# tar xfj /usr/portage/distfiles/im-sdk.r11_4.1467.tar.bz2
# cd im-sdk-r11_4-1467/leif
# ./configure --prefix=/usr; make; make install

3. Start the server. Update gtk-immodules
# /etc/init.d/iiim start
# gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules

4. Start gedit and select, under input methods, Internet/Intranet Input Method.

5. Ctrl+Space and you should see "Xi Wen", if not "Yin Shu", or otherwise "Cang? Jie?", just below the gedit window. If you see it, great, you have come as far as I have succeeded.

6. How to input Chinese? Sorry, I have not come to understand how to get past this stage. I have xcin-iiimf, inpinyin and newpy installed, but cannot use them. I am stuck with a crappy "Yin Shu" (English & Numbers, ie ASCII) and "Cang Jie" which I do not know how to use.

------------------------------------------------------------------------

Now assuming you need to switch between xcin-iiimf, chinput-iiimf or other input methods, you have a problem: HOW?

You need the GIMLET. Through SVN, get the latest "trunk" of im-sdk from the svn.openi18n.org repository. Visit:

http://www.openi18n.org/modules.php?op=modload&name=Sections&file=index&req=viewarticle&artid=30&page=1

to find out how.

Go to the /im-sdk/gnome-im-switcher folder of the trunk. And ./configure --prefix=/usr; make; make install.

Please report all success with the gnome-im-switcher. Insert it into the panel through the Context Menu-> Add to Panel -> Utilities -> InputMethod Switcher. I have not been able to get past this, because it always fails with:

"Failed to resolve, or extend: ! prefs_key=/apps/......"

btw, I am using GNOME 2.6.1. IIIMF seems to work with Fedora Core, but I just cannot understand why it does not work, because Fedora Core (i think) uses GNOME 2.6 too... And of course, you might want to try and install EVERYTHING from the SNV repository.[/b]
Back to top
View user's profile Send private message
hiroki
Guru
Guru


Joined: 29 Jul 2003
Posts: 327
Location: @home in germany

PostPosted: Sat May 22, 2004 4:21 pm    Post subject: Reply with quote

Hi!

I followed your instructions, but I now get an error when selecting IIIM under Gedit. Gedit then immediately crashes and a dialog appears (telling: "The Application gedit hast quit unexpectedly")

well, on the console the following is then written:

Code:
** Message: set_sc_client_window
** Message: locale C
** Message: lang id in_IN
** Message: lang id ja
** Message: lang id zh_CN
** Message: im_context_iiim_set_cursor_location
** Message: preedit_string context is not initialized
** Message: im_context_iiim_set_cursor_location
** Message: im_context_iiim_focus_in

(gnome_segv:3940): Gtk-WARNING **: Ignoring the separator setting


I would appreaciate any help :) I'd like to try this IIIM, just curious :)

hiroki
Back to top
View user's profile Send private message
xkjyeah
n00b
n00b


Joined: 10 May 2003
Posts: 72

PostPosted: Thu Jun 03, 2004 7:30 am    Post subject: Reply with quote

OK, now I have new instructions at hand.

Checkout IIIMF from svn.openi18n.org respository
Code:

svn co http://svn.openi18n.org:8081/repos/im-sdk/trunk

(instead of trunk, you could try branches/r12_0rc1)

Then download inpinyin-0.3-2 from
link

Copy these three files over (the first two are modified from Fedora's iiimf package, the second is a patch for inpinyin). When copying the patch DO NOT USE GEDIT because gedit will save the raw GB2312 characters as unicode. Use vi, then do the select-n-right-click thingy to copy it over:

Build.sh:
Code:


make update-acfiles

make config CONFIGDIRS="lib/EIMIL lib/iiimp lib/iiimcf iiimsf leif iiimxcf/xiiimp.so iiimxcf/htt_xbe"

export CFLAGS="$RPM_OPT_FLAGS"
cd lib/CSConv
./configure --prefix=/usr/lib/im
make
cd ../..

cd lib/EIMIL
./configure --prefix=/usr/lib/im
make
cd ../..

cd lib/iiimp
./configure --prefix=/usr/lib/im
make
cd ../..

cd lib/iiimcf
./configure --prefix=/usr/lib/im
make
cd ../..

cd iiimsf
automake-1.6
autoconf
./configure --prefix=/usr/lib/im --sysconfdir=/etc
make
cd ..

cd leif
./configure --prefix=/usr/lib/im
make
cd ..

cd iiimxcf/xiiimp.so
#sh ./autogen.sh --prefix=/usr/lib/im
./configure --prefix=/usr/lib/im
make
cd ../..

cd iiimxcf/htt_xbe
./configure --prefix=/usr/lib/im
make
cd ../..

cd iiimgcf
./autogen.sh --prefix=/usr/lib/im --sysconfdir=/etc
make
cd ..

cd gnome-im-switcher
./autogen.sh --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib
make
cd ..


Install.sh
Code:


cd lib/CSConv
make  install
cd ../..

cd lib/EIMIL
make  install
cd ../..

cd lib/iiimp
make  install
cd ../..

cd lib/iiimcf
make  install
cd ../..


cd iiimsf
make  install
mkdir -p /etc/rc.d/init.d/
cp sys/RedHat/IIim /etc/rc.d/init.d/
mkdir -p /usr/sbin
mv /usr/lib/im/htt $RPM_BUILD_ROOT/usr/sbin
mv /usr/lib/im/htt_server $RPM_BUILD_ROOT/usr/sbin
cd ..

cd leif
make  install
cd ..

cd iiimxcf/xiiimp.so
make  install
cd ../..

cd iiimxcf/htt_xbe
make  install
mkdir -p /usr/bin
mkdir -p /usr/sbin
mv /usr/lib/im/httx $RPM_BUILD_ROOT/usr/bin
mv /usr/lib/im/htt_xbe $RPM_BUILD_ROOT/usr/bin
cd ../..

cd iiimgcf
make  install
cd ..

cd gnome-im-switcher
export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1
make  install
unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
cd ..

# make sure dl modules are executable
chmod a+x /usr/lib/im/leif/*.so

# removing the unnecessary files
rm -rf /usr/lib/im/bin

/usr/bin/gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules

HOME=/root GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
gconftool-2  --makefile-install-rule /etc/gconf/schemas/gnome-im-switcher.schemas > /dev/null


Inpinyin-punctuation patch:
Code:

diff -urN test/iiimf-le-inpinyin/src/inpinyin.c pinyin/src/inpinyin.c
--- test/iiimf-le-inpinyin/src/inpinyin.c   2004-06-03 10:37:08.000000000 +0800
+++ pinyin/src/inpinyin.c   2004-06-03 13:55:48.000000000 +0800
@@ -1106,13 +1106,18 @@
     //imdata = (im_data *)IM_trans(session_data->session_id, kcode, kchar, modifier);
     //imdata = (im_data *)IM_trans(session_data->session_id, kcode,
     //                             session_data->keys_pressed, modifier);
+   
+#if 0
     if (((kcode >= IMXK_a) && (kcode <= IMXK_z)) ||
         ((strlen(session_data->keys_pressed)>0) &&
         (((kcode >= IMXK_0) && (kcode <= IMXK_9)) ||
         (kcode == IMXK_space) ||
         (kcode == IMXK_comma) ||
         (kcode == IMXK_BackSpace) ||
-        (kcode == IMXK_period )))) {
+        (kcode == IMXK_period )
+   ))) {
+#endif
+    if ( (kcode >= ' ' && kcode < '~') || (kcode == IMXK_BackSpace)) {
 
         result = IM_trans(imdata, session_data->session_id, kcode,
                       session_data->keys_pressed, modifier);
diff -urN test/iiimf-le-inpinyin/src/inputs/pinyin.map pinyin/src/inputs/pinyin.map
--- test/iiimf-le-inpinyin/src/inputs/pinyin.map   2003-08-07 07:37:11.000000000 +0800
+++ pinyin/src/inputs/pinyin.map   2004-06-03 13:00:08.000000000 +0800
@@ -59,7 +59,7 @@
 dang   µ±µ³µŽµµµ²ñÉîõåŽÛÊÝÐÚÔíž
 dao   µœµÀµŒµ¹µºµ¶µ¿µÁµžµ·µ»ß¶µŸâáàüë®ôî
 de   µÄµØµÃµÂïœ
-dei     µÃ
+dei   µÃ
 deng   µÈµÇµÆµËµÊµÉµÅàâíãê­ïëô£áØ
 di   µØµÄµÚÌáµ×µÍµÛµÜµÐµÖµÝµÎµÏµÙµÌµÑµÞµÓàÖÚ®ÚеÒÛ¡íûµÕµÔíÆæ·éŠÝ¶ôÆÛæèÜêë÷ŸØµç°ïáíÚÙá
 dia   àÇ
diff -urN test/iiimf-le-inpinyin/src/punctuation.h pinyin/src/punctuation.h
--- test/iiimf-le-inpinyin/src/punctuation.h   1970-01-01 07:30:00.000000000 +0730
+++ pinyin/src/punctuation.h   2004-06-03 13:46:29.000000000 +0800
@@ -0,0 +1,40 @@
+#ifndef PUNC_H
+#define PUNC_H
+
+/* Idea is to put under common keys only the common results so as not to cause user
+discomfort. Put all extras under easily identifiable keys. */
+
+
+const char *PUNCTUATIONS[]=
+{
+
+"~¡«","!£¡","@£À","#££","$¡ç","%£¥","^¡­","&£Š","*£ª","(£š",")£©","_©€","+£«"
+"`£à","1£±","2£²","3£³","4£Ž","5£µ","6£¶","7£·","8£ž","9£¹","0£°","-£­","=£œ",
+
+"Q","W","E¡ê","R¡²","T¡³","Y£€","U¡ð", "I£Þ","O¡®","P¡¯","{£û","}£ý","|£ü",
+                                                             "]£Ý","[£Û", "\\¡¢",
+
+"A¡º","S¡»","D£Œ","F£Ÿ","G¡Œ","H¡œ","J£Ü","K¡°","L¡±",":£º","\"£¢",
+                                                      ";£»","'£§",
+
+"Z¡ž","X¡¹","C¡é","V¡Ÿ","B¡¿","N¡¶","M¡·","<¡Ž",">¡µ","?£¿",
+                                          ".¡£",",£¬","/£¯",
+" ¡¡" /* Ideographic space */
+};
+
+void punc_for_key(char ch, char *buf) {
+   int x=0;
+   while (1) {
+      if ( ch == *(PUNCTUATIONS[x]) ) {
+         strcpy(buf, PUNCTUATIONS[x] + 1);
+         return;
+      }
+      if ( *(PUNCTUATIONS[x]) == ' ' ) {
+         strcpy(buf, "");
+         return;
+      }
+      x++;
+   }
+}
+
+#endif
diff -urN test/iiimf-le-inpinyin/src/xl_pinyin.c pinyin/src/xl_pinyin.c
--- test/iiimf-le-inpinyin/src/xl_pinyin.c   2004-02-18 10:46:24.000000000 +0800
+++ pinyin/src/xl_pinyin.c   2004-06-03 13:52:20.000000000 +0800
@@ -25,7 +25,7 @@
 
 /* Copyright (c) 2004 Yu Shao <yshao@redhat.com>*/
 /* Copyright (c) 1997-2004 Red Hat, Inc. All rights reserved. */
-
+
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -45,6 +45,7 @@
 // #include        <xl_hzfb.h>
 #include        <xl_pinyin.h>
 #include        <xl_hzinput.h>
+#include "punctuation.h"
 #define         fatal       printf
 #define         message     printf
 
@@ -819,7 +820,6 @@
 {
   /* parameter strbuf is the newly inputed pinyin, inbuf the
     is the whole inputed pinyin, inbuftmp is the unselected pinyin */
-
   char *inbuf=inmd->inbuf;
   char *pybuftmp=inmd->pybuftmp;
     /* already selected Hanzi buffer */
@@ -830,7 +830,6 @@
   int count;
   int i;
   char tmpbuf[128];
-
  /* \010 = Ctrl+H, \177 = BackSpace */
   if (ch == '\010' || ch == '\177')  // BackSpace
   {
@@ -907,12 +906,21 @@
 
 static int PinyinParseInput(InputModule *inmd, char ch, char *strbuf)
 {
+   int t;
+   FILE *f;
+   
 //  if ( (ch>='a' && ch<='z') || ch=='\''|| ch=='\010' || ch=='\177')
   if ( (ch>='a' && ch<='z') || (ch == '\'' && inmd->inbuf[0] != 0) || ch=='\010' || ch=='\177')
       return PinyinKeyPressed (inmd, ch, strbuf);
 
-  if (!strlen(inmd->inbuf))
-      return 0;
+  if (!strlen(inmd->inbuf)) {
+punc_for_key (ch, strbuf);
+ResetPinyinInput (inmd);
+if ( *strbuf == 0) {
+   return 0;
+}
+return 2;
+  }
 
   switch(ch)
   {
@@ -937,8 +945,10 @@
         }
         return 0;
      default:  // select some keys
-       if ( (ch>='1' && ch<='9') || ch=='0' || ch==' ' || ch=='\n')
-           return SelectKeyPressed (inmd, ch, strbuf);
+       if ( (ch>='1' && ch<='9') || ch=='0' || ch==' ' || ch=='\n') {
+           t= SelectKeyPressed (inmd, ch, strbuf);
+      return t;
+      }
        break;
   }
   return 0;
@@ -951,7 +961,6 @@
 {
   int len, ahead,i, total = 0;
   int offset = 0, count, valid;
-
   len = strlen(pybuf);
   if (len < 1 || len > MAX_PHRASE_LEN * (MAX_PY_LEN+1) ) return 0;
 


Suggestion: Create a working directory, because there are many files that will be created.

# cd workdir
# svn co http://svn.openi18n.org:8081/repos/im-sdk/trunk
< download inpinyin SRPM, build.sh, install.sh and the patch >
# cd im-sdk
# ../build.sh
# ../install.sh
# cd /usr/lib/im
# ln -s /usr/sbin/htt .
# ln -s /usr/sbin/htt_server .
# ln -s /usr/sbin/httx .
# ln -s /usr/sbin/htt_xbe .

<IIIMF complete>

# cd ..
# rpm2targz iiimf-le-inpinyin-*
# tar xfz iiimf-le-inpinyin-0.3-2.src.tar.gz
# tar xfj iiimf-le-inpinyin-0.3.tar.bz2
# cd iiimf-le-inpinyin
# patch -p1 < ../iiimf-le-inpinyin-commit.patch
# patch -p1 < ../inpinyin-punctuation.patch
# ./configure --prefix=/
# make; make install
# rm /usr/lib/im/leif/newpy.so

<Inpinyin complete>

This will also have installed GIMLET.

Testing:
Terminal one:
# sudo htt -d

Terminal two:
1. Start gedit and switch to IIIMF input method.
2. Control space. See the words ASCII and Latin switching around at the bottom of the gedit window everytime you press control-space? Good
3. Add the gnome-im-switcher to the panel
4. Play around by starting gnome-im-properties from a gnome-terminal, then changing the configuration from application window to desktop panel once or twice, then quit it.
5. Hopefully, you will finally see ASCII in big and bold letters on your panel. Now, add Simplified Chinese to the list. In gedit, try using Simplified Chinese. Good luck![/url]
6. Please post your results. And if there are any problems, tell me. If it's ok, then I'll edit the post#1.
Back to top
View user's profile Send private message
Antioch
n00b
n00b


Joined: 09 Feb 2004
Posts: 25

PostPosted: Wed Sep 29, 2004 9:20 pm    Post subject: Reply with quote

I installed iiiimf files using the ebuild in portage. I tried following your steps, but when I came to "sudo htt -d" I had to stop. There is no htt on my computer. I tried going into gedit anyways. (yes, I did start iiimf in init.d). I right clicked and switched input method to Internet/Intranet Input Method and.... gedit crashed.

Any help would be appreciated!!!
Back to top
View user's profile Send private message
hiroki
Guru
Guru


Joined: 29 Jul 2003
Posts: 327
Location: @home in germany

PostPosted: Thu Sep 30, 2004 8:34 pm    Post subject: Reply with quote

Antioch wrote:
I installed iiiimf files using the ebuild in portage. I tried following your steps, but when I came to "sudo htt -d" I had to stop. There is no htt on my computer. I tried going into gedit anyways. (yes, I did start iiimf in init.d). I right clicked and switched input method to Internet/Intranet Input Method and.... gedit crashed.

Any help would be appreciated!!!


exactly same problem here with gedit.. when i try to select IIIMF as input method with iiim started in init.d, gedit simply crashes....
Back to top
View user's profile Send private message
xkjyeah
n00b
n00b


Joined: 10 May 2003
Posts: 72

PostPosted: Sun Oct 03, 2004 5:59 am    Post subject: Reply with quote

Oops, please copy /usr/sbin/htt* to /usr/lib/im (if it is not there) and do /usr/lib/im/htt. Alternatively, try /usr/sbin/htt

修改:I got it to work! SVN co branches 12_0rc1 and 12_0_1.

Build (i.e. autogen.sh, make, make install) the following directories under 12_0_1:

lib/eimil
lib/iiimcf
lib/iiimp
iiimsf
leif
iiimgcf
gnome-im-switcher

And these under 12_0rc1:

leif/sun_le_asia (you might need to autogen twice)
leif/sun_le_korea (ditto)

I miss the revision (I think 1847) where I could change the language using Ctrl+Alt+S. Nevertheless, you install GIMLET on your panel, start /usr/lib/im/htt as root, /usr/lib/im/httx as user. Change your settings in gnome-im-properties. You're in luck if you see "OFF" in your panel.

This is good news for one reason: we are using fully-fledged (albeit RC) releases. The working versions will no longer disappear out of SVN.

Lastly, use the development versions of OpenOffice for IIIMF support. Add the line GTK_IM_MODULE=iiim in /etc/env.d/50gtk2 once you are clear how to make it work. 加油!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum