1 ;; th-tis820.mim -- Thai input method with TIS-820.2538 keyboard layout
2 ;; Copyright (C) 2006, 2007
3 ;; National Institute of Advanced Industrial Science and Technology (AIST)
4 ;; Registration Number H15PRO112
6 ;; This file is part of the m17n database; a sub-part of the m17n
9 ;; The m17n library is free software; you can redistribute it and/or
10 ;; modify it under the terms of the GNU Lesser General Public License
11 ;; as published by the Free Software Foundation; either version 2.1 of
12 ;; the License, or (at your option) any later version.
14 ;; The m17n library is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 ;; Lesser General Public License for more details.
19 ;; You should have received a copy of the GNU Lesser General Public
20 ;; License along with the m17n library; if not, write to the Free
21 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22 ;; Boston, MA 02110-1301, USA.
24 (input-method th tis820)
26 (description "Thai input method simulating the TIS-820.2538 keyboard
27 with WTT 2.0 input sequence correction.
28 The correction algorithm follows the one shown in the following
29 <http://linux.thai.net/~thep/th-xim/>
35 (level (_"Acceptance level
36 The level of character sequence acceptance defined in WTT 2.0.
37 0 accepts any key sequence. 2 accepts only orthographic ones.
38 1 is somewhere between.")
41 (include (th kesmanee) macro)
158 ((= ret 1)) ;; CP(y,z) succeeded.
162 ((= ret 1)) ;; AC(y,z) succeeded.
164 ;; WTT-based input sequence correction starts here.
198 ;; elif y is FV1 and z is TONE then
199 ((& (| (= y 0x0E30) (= y 0x0E32) (= y 0x0E33))
223 ;; Only Thai characters should be replaced.
224 (& (>= y 0x0E01) (<= y 0x0E5B))
225 (& (>= z 0x0E01) (<= z 0x0E5B)))
242 ;; Now we commit the preedit chars that are fixed.
245 ;; If surrounding text is supported, commit the only char in preedit.
249 ;; If the last char is CTRL or NON, we can commit everything.
250 ((| (& (>= w 0x0000) (<= w 0x0E00))
257 ;; If the last char is CONS, we can commit everything but the last
258 ;; unless the second last is FV3.
259 ((| (& (>= w 0x0E01) (<= w 0x0E23))
261 (& (>= w 0x0E27) (<= w 0x0E2E)))
263 ((| (= @-2 0x0E24) (= @-2 0x0E26))
271 ;; If the last char is LV, FV2 or FV3, we can commit
272 ;; everything but the last.
273 ((| (& (>= w 0x0E40) (<= w 0x0E45))
280 ;; If the last char is FV1 (excluding AM) and ...
281 ((| (= w 0x0E30) (= w 0x0E32))
286 ;; ... the before last is CONS, we can commit other than the
288 ((| (& (>= v 0x0E01) (<= v 0x0E23))
290 (& (>= v 0x0E27) (<= v 0x0E2E)))
296 ;; ... else if the before last is not CONS, we can commit
297 ;; everything but the last.