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