Skip to content

Commit

Permalink
MS IME 호환 기능 추가: ㄳ 입력 기능 추가
Browse files Browse the repository at this point in the history
원래 이 글자들은 유니코드 초성에 없는 글자들이라서 입력 기능을
제공하지 않았지만, MS IME 호환 기능을 요구하는 경우가 많아서
libhangul 수준에서 제공하기로 결정한다.
그래서 ㄳ은 초성이 결합하여 종성이 되도록 combination table을
만든다.
  • Loading branch information
choehwanjin committed Feb 20, 2016
1 parent 78e9d89 commit d639086
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
10 changes: 10 additions & 0 deletions hangul/hangulinputcontext.c
Expand Up @@ -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;
Expand Down
11 changes: 11 additions & 0 deletions hangul/hangulkeyboard.h
Expand Up @@ -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 */
Expand Down
5 changes: 5 additions & 0 deletions test/test.c
Expand Up @@ -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

Expand Down

0 comments on commit d639086

Please sign in to comment.