1 ;; ko-romaja.mim -- Input method for Korean Hangul with Romaja keys.
2 ;; Copyright (C) 2004, 2005
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., 59 Temple Place, Suite 330, Boston, MA
24 ;;; Input method for Korean Hangul using Romaja keys. The
25 ;;; roman-transliteration rules follows that of IIIMF shown in this
26 ;;; page: http://www3.sympatico.ca/d.moser/hangul.html
28 (input-method ko romaja)
31 "Hangul input method with romaja keys.
32 The roman-transliteration rules follows that of IIIMF shown in
33 the page <http://www3.sympatico.ca/d.moser/hangul.html>.
35 Common to CHOSEONG and JONGSEONG:
36 ㄱ(g) ㄲ(gg,kk,qq,c) ㄴ(n) ㄷ(d) ㄹ(l) ㄹ(r) ㅁ(m) ㅂ(b,v) ㅅ(s)
37 ㅆ(ss) ㅇ(ng) ㅇ(x) ㅈ(j) ㅊ(ch) ㅋ(k,q) ㅌ(t) ㅍ(p,f) ㅎ(h)
40 ㄸ(dd,tt) ㅃ(bb,vv) ㅉ(jj)
43 ㄳ(gs) ㄵ(nj) ㄶ(nh) ㄺ(lg) ㄻ(lm) ㄼ(lb) ㄽ(ls) ㄾ(lt) ㄿ(lp) ㅀ(lh) ㅄ(bs)
46 ㅏ(a) ㅐ(ai,ae) ㅑ (ya,ia) ㅒ(yai,yae,iae) ㅓ(eo) ㅔ(e,eoi) ㅕ(yeo,ieo)
47 ㅖ(ye,ie,yeoi) ㅗ(o) ㅘ(oa,wa,ua) ㅙ(oai,wae,uae,oae) ㅚ(oi,woe,uoe,oe)
48 ㅛ(yo,io) ㅜ(u,w,oo) ㅝ(ueo,wo,uo) ㅞ(ue,we) ㅟ(wi) ㅠ(yu,iu) ㅡ(eu)
52 Type uppercase letter to specify CHOSEONG explicitly.
53 Type \"I\" to toggle the composed-syllable mode and isolated-jamo mode.
54 Type \">>\" to fullwidth ASCII letter mode, \"<<\" to shift out the mode.
55 Type \"Z\" and a key to input fullwidth version of the key.
62 ;; Convert Jamo sequence LVT to a precomposed character.
63 ;; See the Unicode Standard Version 3.0, Section 3.11.
65 ((set LIndex L) (sub LIndex 0x1100)
66 (set VIndex V) (sub VIndex 0x1161)
67 (set TIndex T) (sub TIndex 0x11A7)
68 ;; S = (LIndex * VCount + Vindex) * TCount + TIndex + SBase
74 (add S 0xAC00) ;; SBase
78 ;; If L is not negative, convert Jame sequence LV to a precomposed
79 ;; character while assuming T is 0x11A7. If L is 0 (i.e. missing),
84 ((= L 0 ((set L 0x110B)))
91 ;; This map is used only in init state, which means typing these
92 ;; uppercase letters in any other states causes shifting to init
93 ;; state, and they are re-handled in init state.
95 ("B" (pushback "b")) ("C" (pushback "c")) ("D" (pushback "d"))
96 ("F" (pushback "f")) ("G" (pushback "g")) ("H" (pushback "h"))
97 ("J" (pushback "j")) ("K" (pushback "k")) ("L" (pushback "l"))
98 ("M" (pushback "m")) ("N" (pushback "n")) ("P" (pushback "p"))
99 ("Q" (pushback "q")) ("R" (pushback "r")) ("S" (pushback "s"))
100 ("T" (pushback "t")) ("V" (pushback "v")) ("X" (pushback "x")))
102 ;; Keys common to CHOSEONG and JONGSEONG. Set L1 to CHOSEONG, T to
103 ;; JONGSEONG, insert a Compatibility Jamo. When this map is used in
104 ;; init state, L is still 0, thus compose macro does nothing.
105 ;; Otherwise, L is already set to a CHOSEONG, thus compose macro
106 ;; composes LVT into a syllable.
108 ("g" (set L1 0x1100) (set T 0x11A8) ?ㄱ (compose))
109 ("gg" (set L1 0x1101) (set T 0x11A9) ?ㄲ (compose))
110 ("kk" (set L1 0x1101) (set T 0x11A9) ?ㄲ (compose))
111 ("qq" (set L1 0x1101) (set T 0x11A9) ?ㄲ (compose))
112 ("c" (set L1 0x1101) (set T 0x11A9) ?ㄲ (compose))
113 ("n" (set L1 0x1102) (set T 0x11AB) ?ㄴ (compose))
114 ("d" (set L1 0x1103) (set T 0x11AE) ?ㄷ (compose))
115 ("l" (set L1 0x1105) (set T 0x11AF) ?ㄹ (compose))
116 ("r" (set L1 0x1105) (set T 0x11AF) ?ㄹ (compose))
117 ("m" (set L1 0x1106) (set T 0x11B7) ?ㅁ (compose))
118 ("b" (set L1 0x1107) (set T 0x11B8) ?ㅂ (compose))
119 ("v" (set L1 0x1107) (set T 0x11B8) ?ㅂ (compose))
120 ("s" (set L1 0x1109) (set T 0x11BA) ?ㅅ (compose))
121 ("ss" (set L1 0x110A) (set T 0x11BB) ?ㅆ (compose))
122 ("ng" (set L1 0x110B) (set T 0x11BC) ?ㅇ (compose))
123 ("x" (set L1 0x110B) (set T 0x11BC) ?ㅇ (compose))
124 ("j" (set L1 0x110C) (set T 0x11BD) ?ㅈ (compose))
125 ("ch" (set L1 0x110E) (set T 0x11BE) ?ㅊ (compose))
126 ("k" (set L1 0x110F) (set T 0x11BF) ?ㅋ (compose))
127 ("q" (set L1 0x110F) (set T 0x11BF) ?ㅋ (compose))
128 ("t" (set L1 0x1110) (set T 0x11C0) ?ㅌ (compose))
129 ("p" (set L1 0x1111) (set T 0x11C1) ?ㅍ (compose))
130 ("f" (set L1 0x1111) (set T 0x11C1) ?ㅍ (compose))
131 ("h" (set L1 0x1112) (set T 0x11C2) ?ㅎ (compose)))
133 ;; Keys only for CHOSEONG.
134 ;; Set L to CHOSEONG, insert a Compatibility Jamo.
136 ("dd" (set L 0x1104) ?ㄸ)
137 ("tt" (set L 0x1104) ?ㄸ)
138 ("bb" (set L 0x1108) ?ㅃ)
139 ("vv" (set L 0x1108) ?ㅃ)
140 ("jj" (set L 0x110D) ?ㅉ))
142 ;; Keys only for JONGSEONG.
143 ;; Set T to JONGSEONG, insert a Compatibility Jamo.
145 ("gs" (set T 0x11AA) ?ㄳ (compose))
146 ("nj" (set T 0x11AC) ?ㄵ (compose))
147 ("nh" (set T 0x11AD) ?ㄶ (compose))
148 ("lg" (set T 0x11B0) ?ㄺ (compose))
149 ("lm" (set T 0x11B1) ?ㄻ (compose))
150 ("lb" (set T 0x11B2) ?ㄼ (compose))
151 ("ls" (set T 0x11B3) ?ㄽ (compose))
152 ("lt" (set T 0x11B4) ?ㄾ (compose))
153 ("lp" (set T 0x11B5) ?ㄿ (compose))
154 ("lh" (set T 0x11B6) ?ㅀ (compose))
155 ("bs" (set T 0x11B9) ?ㅄ (compose)))
157 ;; Keys only for JUNGSEONG.
158 ;; Set V to JUNGSEONG, insert a Compatibility Jamo.
160 ("a" (set V 0x1161) ?ㅏ (compose-vowel))
161 ("ai" (set V 0x1162) ?ㅐ (compose-vowel))
162 ("ae" (set V 0x1162) ?ㅐ (compose-vowel))
163 ("ya" (set V 0x1163) ?ㅑ (compose-vowel))
164 ("ia" (set V 0x1163) ?ㅑ (compose-vowel))
165 ("yai" (set V 0x1164) ?ㅒ (compose-vowel))
166 ("yae" (set V 0x1164) ?ㅒ (compose-vowel))
167 ("iae" (set V 0x1164) ?ㅒ (compose-vowel))
168 ("eo" (set V 0x1165) ?ㅓ (compose-vowel))
169 ("e" (set V 0x1166) ?ㅔ (compose-vowel))
170 ("eoi" (set V 0x1166) ?ㅔ (compose-vowel))
171 ("yeo" (set V 0x1167) ?ㅕ (compose-vowel))
172 ("ieo" (set V 0x1167) ?ㅕ (compose-vowel))
173 ("ye" (set V 0x1168) ?ㅖ (compose-vowel))
174 ("ie" (set V 0x1168) ?ㅖ (compose-vowel))
175 ("yeoi"(set V 0x1168) ?ㅖ (compose-vowel))
176 ("o" (set V 0x1169) ?ㅗ (compose-vowel))
177 ("oa" (set V 0x116A) ?ㅘ (compose-vowel))
178 ("wa" (set V 0x116A) ?ㅘ (compose-vowel))
179 ("ua" (set V 0x116A) ?ㅘ (compose-vowel))
180 ("oai" (set V 0x116B) ?ㅙ (compose-vowel))
181 ("wae" (set V 0x116B) ?ㅙ (compose-vowel))
182 ("uae" (set V 0x116B) ?ㅙ (compose-vowel))
183 ("oae" (set V 0x116B) ?ㅙ (compose-vowel))
184 ("oi" (set V 0x116C) ?ㅚ (compose-vowel))
185 ("woe" (set V 0x116C) ?ㅚ (compose-vowel))
186 ("uoe" (set V 0x116C) ?ㅚ (compose-vowel))
187 ("oe" (set V 0x116C) ?ㅚ (compose-vowel))
188 ("yo" (set V 0x116D) ?ㅛ (compose-vowel))
189 ("io" (set V 0x116D) ?ㅛ (compose-vowel))
190 ("u" (set V 0x116E) ?ㅜ (compose-vowel))
191 ("w" (set V 0x116E) ?ㅜ (compose-vowel))
192 ("oo" (set V 0x116E) ?ㅜ (compose-vowel))
193 ("ueo" (set V 0x116F) ?ㅝ (compose-vowel))
194 ("wo" (set V 0x116F) ?ㅝ (compose-vowel))
195 ("uo" (set V 0x116F) ?ㅝ (compose-vowel))
196 ("ue" (set V 0x1170) ?ㅞ (compose-vowel))
197 ("we" (set V 0x1170) ?ㅞ (compose-vowel))
198 ("wi" (set V 0x1171) ?ㅟ (compose-vowel))
199 ("yu" (set V 0x1172) ?ㅠ (compose-vowel))
200 ("iu" (set V 0x1172) ?ㅠ (compose-vowel))
201 ("eu" (set V 0x1173) ?ㅡ (compose-vowel))
202 ("eui" (set V 0x1174) ?ㅢ (compose-vowel))
203 ("ui" (set V 0x1174) ?ㅢ (compose-vowel))
204 ("i" (set V 0x1175) ?ㅣ (compose-vowel))
205 ("y" (set V 0x1175) ?ㅣ (compose-vowel))
206 ("ee" (set V 0x1175) ?ㅣ (compose-vowel)))
210 ("a") ("y") ("e") ("o") ("w") ("u") ("i"))
212 ;; Input fullwidth punction characters by typing a punction twice.
224 ((BackSpace) (undo)))
226 ;; Toggle normal syllable mode and isolated jamo mode.
228 ("I" (= ISOLATED 0 ((set ISOLATED 1)) ((set ISOLATED 0)))))
234 (include (t nil cjk-util) map)
239 ;; This is to suppress compose action.
241 ;; Uppercase keys are translated to the corresponding lowercase keys.
243 (X (set L L1) (shift after-L))
249 (enter-fullwidth-mode)
250 (enter-single-fullwidth-mode)
251 (toggle-mode (shift isolated-jamo-mode)))
255 (commit-preedit (shift init))
258 (X (shift after-LVX))
260 (commit-preedit (shift init))
263 (V-head (delete @<) (pushback 0) (shift fix-LV-redo-L))
264 (commit-preedit (shift init))
269 (X (set L L1) (shift fix-LV-redo-V))
270 (L (shift fix-LV-redo-V))
271 (V (set L 0x110B) (set T 0x11A7) (compose) (shift init)))
273 (V (set T 0x11A7) (compose) (shift init)))
277 ;; Suppress both compose and compose-vowel action.
280 (L (set L -1) (commit))
283 (commit-preedit (commit))
284 (enter-fullwidth-mode)
285 (enter-single-fullwidth-mode)
286 (toggle-mode (shift init))
289 (include (t nil cjk-util) state fullwidth-mode single-fullwidth-mode)