@@ -235,6 +235,7 @@ struct _HangulInputContext {
235235
236236 unsigned int use_jamo_mode_only : 1 ;
237237 unsigned int option_auto_reorder : 1 ;
238+ unsigned int option_combi_on_double_stroke : 1 ;
238239};
239240
240241#include "hangulkeyboard.h"
@@ -851,6 +852,27 @@ hangul_ic_choseong_to_jongseong(HangulInputContext* hic, ucschar cho)
851852 return 0 ;
852853}
853854
855+ static ucschar
856+ hangul_ic_combine (HangulInputContext * hic , ucschar first , ucschar second )
857+ {
858+ if (!hic -> option_combi_on_double_stroke ) {
859+ if (hangul_keyboard_get_type (hic -> keyboard ) == HANGUL_KEYBOARD_TYPE_JAMO ) {
860+ /* 옛한글은 아래 규칙을 적용하지 않아야 입력가능한 글자가 있으므로
861+ * 적용하지 않는다. */
862+ if (first == second &&
863+ hangul_is_jamo_conjoinable (first )) {
864+ return 0 ;
865+ }
866+ }
867+ }
868+
869+ ucschar combined = 0 ;
870+ combined = hangul_combination_combine (hic -> keyboard -> combination ,
871+ first , second );
872+
873+ return combined ;
874+ }
875+
854876static bool
855877hangul_ic_process_jamo (HangulInputContext * hic , ucschar ch )
856878{
@@ -866,8 +888,7 @@ hangul_ic_process_jamo(HangulInputContext *hic, ucschar ch)
866888 if (hic -> buffer .jongseong ) {
867889 if (hangul_is_choseong (ch )) {
868890 jong = hangul_ic_choseong_to_jongseong (hic , ch );
869- combined = hangul_combination_combine (hic -> keyboard -> combination ,
870- hic -> buffer .jongseong , jong );
891+ combined = hangul_ic_combine (hic , hic -> buffer .jongseong , jong );
871892 if (hangul_is_jongseong (combined )) {
872893 if (!hangul_ic_push (hic , combined )) {
873894 if (!hangul_ic_push (hic , ch )) {
@@ -944,8 +965,7 @@ hangul_ic_process_jamo(HangulInputContext *hic, ucschar ch)
944965 }
945966 }
946967 } else if (hangul_is_jungseong (ch )) {
947- combined = hangul_combination_combine (hic -> keyboard -> combination ,
948- hic -> buffer .jungseong , ch );
968+ combined = hangul_ic_combine (hic , hic -> buffer .jungseong , ch );
949969 if (hangul_is_jungseong (combined )) {
950970 if (!hangul_ic_push (hic , combined )) {
951971 return false;
@@ -961,8 +981,7 @@ hangul_ic_process_jamo(HangulInputContext *hic, ucschar ch)
961981 }
962982 } else if (hic -> buffer .choseong ) {
963983 if (hangul_is_choseong (ch )) {
964- combined = hangul_combination_combine (hic -> keyboard -> combination ,
965- hic -> buffer .choseong , ch );
984+ combined = hangul_ic_combine (hic , hic -> buffer .choseong , ch );
966985 /* 초성을 입력한 combine 함수에서 종성이 나오게 된다면
967986 * 이전 초성도 종성으로 바꿔 주는 편이 나머지 처리에 편리하다.
968987 * 이 기능은 MS IME 호환기능으로 ㄳ을 입력하는데 사용한다. */
@@ -1027,8 +1046,7 @@ hangul_ic_process_jaso(HangulInputContext *hic, ucschar ch)
10271046 } else {
10281047 ucschar choseong = 0 ;
10291048 if (hangul_is_choseong (hangul_ic_peek (hic ))) {
1030- choseong = hangul_combination_combine (hic -> keyboard -> combination ,
1031- hic -> buffer .choseong , ch );
1049+ choseong = hangul_ic_combine (hic , hic -> buffer .choseong , ch );
10321050 }
10331051 if (choseong ) {
10341052 if (!hangul_ic_push (hic , choseong )) {
@@ -1068,8 +1086,7 @@ hangul_ic_process_jaso(HangulInputContext *hic, ucschar ch)
10681086 } else {
10691087 ucschar jungseong = 0 ;
10701088 if (hangul_is_jungseong (hangul_ic_peek (hic ))) {
1071- jungseong = hangul_combination_combine (hic -> keyboard -> combination ,
1072- hic -> buffer .jungseong , ch );
1089+ jungseong = hangul_ic_combine (hic , hic -> buffer .jungseong , ch );
10731090 }
10741091 if (jungseong ) {
10751092 if (!hangul_ic_push (hic , jungseong )) {
@@ -1096,8 +1113,7 @@ hangul_ic_process_jaso(HangulInputContext *hic, ucschar ch)
10961113 } else {
10971114 ucschar jongseong = 0 ;
10981115 if (hangul_is_jongseong (hangul_ic_peek (hic ))) {
1099- jongseong = hangul_combination_combine (hic -> keyboard -> combination ,
1100- hic -> buffer .jongseong , ch );
1116+ jongseong = hangul_ic_combine (hic , hic -> buffer .jongseong , ch );
11011117 }
11021118 if (jongseong ) {
11031119 if (!hangul_ic_push (hic , jongseong )) {
@@ -1154,8 +1170,7 @@ hangul_ic_process_romaja(HangulInputContext *hic, int ascii, ucschar ch)
11541170 jong = ch ;
11551171 else
11561172 jong = hangul_ic_choseong_to_jongseong (hic , ch );
1157- combined = hangul_combination_combine (hic -> keyboard -> combination ,
1158- hic -> buffer .jongseong , jong );
1173+ combined = hangul_ic_combine (hic , hic -> buffer .jongseong , jong );
11591174 if (hangul_is_jongseong (combined )) {
11601175 if (!hangul_ic_push (hic , combined )) {
11611176 if (!hangul_ic_push (hic , ch )) {
@@ -1229,8 +1244,7 @@ hangul_ic_process_romaja(HangulInputContext *hic, int ascii, ucschar ch)
12291244 }
12301245 }
12311246 } else if (hangul_is_jungseong (ch )) {
1232- combined = hangul_combination_combine (hic -> keyboard -> combination ,
1233- hic -> buffer .jungseong , ch );
1247+ combined = hangul_ic_combine (hic , hic -> buffer .jungseong , ch );
12341248 if (hangul_is_jungseong (combined )) {
12351249 if (!hangul_ic_push (hic , combined )) {
12361250 return false;
@@ -1253,8 +1267,7 @@ hangul_ic_process_romaja(HangulInputContext *hic, int ascii, ucschar ch)
12531267 }
12541268 } else if (hic -> buffer .choseong ) {
12551269 if (hangul_is_choseong (ch )) {
1256- combined = hangul_combination_combine (hic -> keyboard -> combination ,
1257- hic -> buffer .choseong , ch );
1270+ combined = hangul_ic_combine (hic , hic -> buffer .choseong , ch );
12581271 if (combined == 0 ) {
12591272 hic -> buffer .jungseong = 0x1173 ;
12601273 hangul_ic_flush_internal (hic );
@@ -1574,6 +1587,8 @@ hangul_ic_get_option(HangulInputContext* hic, int option)
15741587 switch (option ) {
15751588 case HANGUL_IC_OPTION_AUTO_REORDER :
15761589 return hic -> option_auto_reorder ;
1590+ case HANGUL_IC_OPTION_COMBI_ON_DOUBLE_STROKE :
1591+ return hic -> option_combi_on_double_stroke ;
15771592 }
15781593
15791594 return false;
@@ -1586,6 +1601,9 @@ hangul_ic_set_option(HangulInputContext* hic, int option, bool value)
15861601 case HANGUL_IC_OPTION_AUTO_REORDER :
15871602 hic -> option_auto_reorder = value ;
15881603 break ;
1604+ case HANGUL_IC_OPTION_COMBI_ON_DOUBLE_STROKE :
1605+ hic -> option_combi_on_double_stroke = value ;
1606+ break ;
15891607 }
15901608}
15911609
@@ -1746,6 +1764,7 @@ hangul_ic_new(const char* keyboard)
17461764 hic -> use_jamo_mode_only = FALSE;
17471765
17481766 hic -> option_auto_reorder = false;
1767+ hic -> option_combi_on_double_stroke = false;
17491768
17501769 hangul_ic_set_output_mode (hic , HANGUL_OUTPUT_SYLLABLE );
17511770 hangul_ic_select_keyboard (hic , keyboard );
0 commit comments