1X Input Methods
2===============
3
4For entering text in CJK languages, simple keyboard typing is not adequate.
5Instead there are programs that run and handle the conversion of keystrokes to
6characters these programs are called input methods.
7
8I have tested FontForge with two freely available input methods (as well as one
9can who speaks neither Chinese, Japanese nor Korean) kinput2 (for Japanese) and
10`xcin <http://xcin.linux.org.tw/>`__ (for Chinese).
11
12There is reasonably good (English) documentation on installing and using kinput2
13on the mozilla site, and at
14`suse <http://www.suse.de/~mfabian/suse-cjk/kinput2.html>`__, kinput2 has the
15interesting complexity that it requires yet another server to be running,
16generally either cannaserver or jserver. It looks to me as though it might be
17possible to use a chinese or korean jserver with kinput2 but I have not tried
18this.
19
20There is good Chinese and English documentation on xcin at the
21`xcin site in Taiwan <http://xcin.linux.org.tw/>`__ (english is not the default
22here, but it is available about 3 lines down).
23
24One of the most difficult problems I had in installing these was finding the
25appropriate locales. I could not find them in my RedHat 7.3 distribution, nor
26could I find any RedHad rpms containing them. There is a good supply of Mandrake
27locale rpms (named ``locales-zh*`` for chinese, ``locales-jp*`` for japanese,
28etc.) but Mandrake stores them in a different directory so after installing them
29I had to copy them from ``/usr/share/locales`` to ``/usr/lib/locales``. The SUSE
30docs imply that the current SUSE distribution ships with these locales.
31
32To start fontforge with an input method you must first insure that the input
33method itself is running. For kinput2 do the following:
34
35::
36
37   $ cannaserver &
38   $ kinput2 -canna -xim &
39
40While for xcin:
41
42::
43
44   $ setenv LC_CTYPE zh_TW.Big5             (or $ LC_CTYPE=zh_TW.Big5 ; export LC_CTYPE )
45   $ xcin &
46
47Beware: Different systems will have slightly different locale names (sometimes
48it's ``zh_TW.big5``, or something else) so if things don't work try something
49else.
50
51Once you've started your input method you must then start FontForge. You should
52set the LC_CTYPE environment variable (or LC_ALL or LANG) to the appropriate
53locale. You may (if you have multiple input methods running that support the
54same locale) need to set the XMODIFIERS environment variable to the name of your
55method (xcin can have multiple names, it prints out the one it is currently
56using on start-up).
57
58::
59
60   $ setenv LC_CTYPE ja_JP.eucJP
61   $ setenv XMODIFIERS "@im=kinput2"
62   $ fontforge -new
63
64FontForge will start up significantly more slowly when connecting to an IM, just
65be patient with it. FontForge supports OverTheSpot input in textfields and Root
66input in the font and outline character views. Not all textfields accept unicode
67input, but any that do should now accept input from an IM.
68
69.. note::
70
71   This only works if ``X_HAVE_UTF8_STRING`` is defined -- an XFree 4.0.2
72   extension (ie. not on solaris)
73
74--------------------------------------------------------------------------------
75
76If you are interested in the mechanics of XIM programming I refer you to
77O'Reilly's excellent
78`Programmers Reference Guide for X11 <http://capderec.udg.es:81/ebt-bin/nph-dweb/dynaweb/SGI_Developer/XLib_PG/@Generic__BookView>`__,
79chapter 11.