summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChoe Hwanjin <choe.hwanjin@gmail.com>2016-02-20 20:34:57 +0900
committerChoe Hwanjin <choe.hwanjin@gmail.com>2016-02-20 20:34:57 +0900
commitd639086a61acbe0e067c45194d6d96275f953f04 (patch)
tree9e077ef3f0a0f33261babdb2d0d96180b9e39003
parent78e9d8926262db423b4cf9181e1c2cb06a120a9b (diff)
downloadlibhangul-d639086a61acbe0e067c45194d6d96275f953f04.tar.gz
MS IME 호환 기능 추가: ㄳ 입력 기능 추가
원래 이 글자들은 유니코드 초성에 없는 글자들이라서 입력 기능을 제공하지 않았지만, MS IME 호환 기능을 요구하는 경우가 많아서 libhangul 수준에서 제공하기로 결정한다. 그래서 ㄳ은 초성이 결합하여 종성이 되도록 combination table을 만든다.
-rw-r--r--hangul/hangulinputcontext.c10
-rw-r--r--hangul/hangulkeyboard.h11
-rw-r--r--test/test.c5
3 files changed, 26 insertions, 0 deletions
diff --git a/hangul/hangulinputcontext.c b/hangul/hangulinputcontext.c
index 8621065..2728302 100644
--- a/hangul/hangulinputcontext.c
+++ b/hangul/hangulinputcontext.c
@@ -954,6 +954,16 @@ hangul_ic_process_jamo(HangulInputContext *hic, ucschar ch)
if (hangul_is_choseong(ch)) {
combined = hangul_combination_combine(hic->keyboard->combination,
hic->buffer.choseong, ch);
+ /* 초성을 입력한 combine 함수에서 종성이 나오게 된다면
+ * 이전 초성도 종성으로 바꿔 주는 편이 나머지 처리에 편리하다.
+ * 이 기능은 MS IME 호환기능으로 ㄳ을 입력하는데 사용한다. */
+ if (hangul_is_jongseong(combined)) {
+ hic->buffer.choseong = 0;
+ ucschar pop = hangul_ic_pop(hic);
+ ucschar jong = hangul_choseong_to_jongseong(pop);
+ hangul_ic_push(hic, jong);
+ }
+
if (!hangul_ic_push(hic, combined)) {
if (!hangul_ic_push(hic, ch)) {
return false;
diff --git a/hangul/hangulkeyboard.h b/hangul/hangulkeyboard.h
index 7bdc27a..128c430 100644
--- a/hangul/hangulkeyboard.h
+++ b/hangul/hangulkeyboard.h
@@ -1179,8 +1179,19 @@ static const ucschar hangul_keyboard_table_ahn[] = {
static const HangulCombinationItem hangul_combination_table_default[] = {
{ 0x11001100, 0x1101 }, /* choseong kiyeok + kiyeok = ssangkiyeok */
+ { 0x11001109, 0x11aa }, /* choseong kiyeok + sios = kiyeok-sios(jong) */
+ { 0x1102110c, 0x11ac }, /* choseong nieun + cieuc = nieun-cieuc(jong) */
+ { 0x11021112, 0x11ad }, /* choseong nieun + hieuh = nieun-hieuh(jong) */
{ 0x11031103, 0x1104 }, /* choseong tikeut + tikeut = ssangtikeut */
+ { 0x11051100, 0x11b0 }, /* choseong rieul + kiyeok = rieul-kiyeok(jong) */
+ { 0x11051106, 0x11b1 }, /* choseong rieul + mieum = rieul-mieum(jong) */
+ { 0x11051107, 0x11b2 }, /* choseong rieul + pieup = rieul-pieup(jong) */
+ { 0x11051109, 0x11b3 }, /* choseong rieul + sios = rieul-sios(jong) */
+ { 0x11051110, 0x11b4 }, /* choseong rieul + thieuth = rieul-thieuth(jong) */
+ { 0x11051111, 0x11b5 }, /* choseong rieul + phieuph = rieul-phieuph(jong) */
+ { 0x11051112, 0x11b6 }, /* choseong rieul + hieuh = rieul-hieuh(jong) */
{ 0x11071107, 0x1108 }, /* choseong pieup + pieup = ssangpieup */
+ { 0x11071109, 0x11b9 }, /* choseong pieup + sios = pieup-sios(jong) */
{ 0x11091109, 0x110a }, /* choseong sios + sios = ssangsios */
{ 0x110c110c, 0x110d }, /* choseong cieuc + cieuc = ssangcieuc */
{ 0x11691161, 0x116a }, /* jungseong o + a = wa */
diff --git a/test/test.c b/test/test.c
index ecf092d..28b4509 100644
--- a/test/test.c
+++ b/test/test.c
@@ -72,6 +72,11 @@ START_TEST(test_hangul_ic_process_2)
fail_unless(check_preedit("2", "akfr", L"맑"));
fail_unless(check_commit("2", "akfrh", L"말"));
fail_unless(check_preedit("2", "akfrh", L"고"));
+
+ /* ㄱㅅㅏ*/
+ fail_unless(check_preedit("2", "rt", L"ㄳ"));
+ fail_unless(check_commit("2", "rtk", L"ㄱ"));
+ fail_unless(check_preedit("2", "rtk", L"사"));
}
END_TEST