From 00eaaa848b99038b1c6a2ef26cfadcaff709039f Mon Sep 17 00:00:00 2001 From: Changwoo Ryu Date: Wed, 30 Oct 2002 17:12:48 +0000 Subject: Added U+AC00- coverage (hangul_engine_shape): Renders U+AC00 Hangul 2002-10-31 Changwoo Ryu * modules/hangul/hangul-xft.c (hangul_engine_get_coverage): Added U+AC00- coverage (hangul_engine_shape): Renders U+AC00 Hangul Syllables. --- ChangeLog | 6 ++++++ ChangeLog.pre-1-10 | 6 ++++++ ChangeLog.pre-1-2 | 6 ++++++ ChangeLog.pre-1-4 | 6 ++++++ ChangeLog.pre-1-6 | 6 ++++++ ChangeLog.pre-1-8 | 6 ++++++ modules/hangul/hangul-defs.h | 3 +++ modules/hangul/hangul-fc.c | 31 ++++++++++++++++++++++--------- modules/hangul/hangul-xft.c | 31 ++++++++++++++++++++++--------- 9 files changed, 83 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 86b76178..d8313f6f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-10-31 Changwoo Ryu + + * modules/hangul/hangul-xft.c (hangul_engine_get_coverage): + Added U+AC00- coverage + (hangul_engine_shape): Renders U+AC00 Hangul Syllables. + 2002-10-24 Tor Lillqvist * modules/basic/basic-win32.c: Update the non-Uniscribe ranges to diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10 index 86b76178..d8313f6f 100644 --- a/ChangeLog.pre-1-10 +++ b/ChangeLog.pre-1-10 @@ -1,3 +1,9 @@ +2002-10-31 Changwoo Ryu + + * modules/hangul/hangul-xft.c (hangul_engine_get_coverage): + Added U+AC00- coverage + (hangul_engine_shape): Renders U+AC00 Hangul Syllables. + 2002-10-24 Tor Lillqvist * modules/basic/basic-win32.c: Update the non-Uniscribe ranges to diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2 index 86b76178..d8313f6f 100644 --- a/ChangeLog.pre-1-2 +++ b/ChangeLog.pre-1-2 @@ -1,3 +1,9 @@ +2002-10-31 Changwoo Ryu + + * modules/hangul/hangul-xft.c (hangul_engine_get_coverage): + Added U+AC00- coverage + (hangul_engine_shape): Renders U+AC00 Hangul Syllables. + 2002-10-24 Tor Lillqvist * modules/basic/basic-win32.c: Update the non-Uniscribe ranges to diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4 index 86b76178..d8313f6f 100644 --- a/ChangeLog.pre-1-4 +++ b/ChangeLog.pre-1-4 @@ -1,3 +1,9 @@ +2002-10-31 Changwoo Ryu + + * modules/hangul/hangul-xft.c (hangul_engine_get_coverage): + Added U+AC00- coverage + (hangul_engine_shape): Renders U+AC00 Hangul Syllables. + 2002-10-24 Tor Lillqvist * modules/basic/basic-win32.c: Update the non-Uniscribe ranges to diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6 index 86b76178..d8313f6f 100644 --- a/ChangeLog.pre-1-6 +++ b/ChangeLog.pre-1-6 @@ -1,3 +1,9 @@ +2002-10-31 Changwoo Ryu + + * modules/hangul/hangul-xft.c (hangul_engine_get_coverage): + Added U+AC00- coverage + (hangul_engine_shape): Renders U+AC00 Hangul Syllables. + 2002-10-24 Tor Lillqvist * modules/basic/basic-win32.c: Update the non-Uniscribe ranges to diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8 index 86b76178..d8313f6f 100644 --- a/ChangeLog.pre-1-8 +++ b/ChangeLog.pre-1-8 @@ -1,3 +1,9 @@ +2002-10-31 Changwoo Ryu + + * modules/hangul/hangul-xft.c (hangul_engine_get_coverage): + Added U+AC00- coverage + (hangul_engine_shape): Renders U+AC00 Hangul Syllables. + 2002-10-24 Tor Lillqvist * modules/basic/basic-win32.c: Update the non-Uniscribe ranges to diff --git a/modules/hangul/hangul-defs.h b/modules/hangul/hangul-defs.h index 53fcf3f9..e3e2a20f 100644 --- a/modules/hangul/hangul-defs.h +++ b/modules/hangul/hangul-defs.h @@ -60,3 +60,6 @@ #define L_FROM_S(s) (LBASE + (((s) - SBASE) / NCOUNT)) #define V_FROM_S(s) (VBASE + (((s) - SBASE) % NCOUNT) / TCOUNT) #define T_FROM_S(s) (TBASE + (((s) - SBASE) % TCOUNT)) + +#define IS_S(wc) (SBASE <= (wc) && (wc) <= SCOUNT) +#define S_HAS_T(s) (((s) - SBASE) % TCOUNT) diff --git a/modules/hangul/hangul-fc.c b/modules/hangul/hangul-fc.c index ec26d4d0..20aedd37 100644 --- a/modules/hangul/hangul-fc.c +++ b/modules/hangul/hangul-fc.c @@ -33,7 +33,8 @@ static PangoEngineRange hangul_ranges[] = { /* Language characters */ - { 0x1100, 0x11FF, "*" }, /* Hangul Jamo */ + { 0x1100, 0x11ff, "*" }, /* Hangul Jamo */ + { 0xac00, 0xd7a3, "*" }, /* Hangul Syllables */ }; static PangoEngineInfo script_engines[] = { @@ -137,7 +138,7 @@ hangul_engine_shape (PangoFont *font, int i; const char *p, *start; - gunichar jamos_static[3]; + gunichar jamos_static[8]; guint max_jamos = G_N_ELEMENTS (jamos_static); gunichar *jamos = jamos_static; int n_jamos; @@ -149,15 +150,17 @@ hangul_engine_shape (PangoFont *font, for (i = 0; i < n_chars; i++) { + gunichar prev = jamos[n_jamos - 1]; gunichar wc; wc = g_utf8_get_char (p); /* Check syllable boundaries. */ if (n_jamos != 0 && - ((IS_T (jamos[n_jamos - 1]) && IS_L (wc)) || - (IS_V (jamos[n_jamos - 1]) && IS_L (wc)) || - (IS_T (jamos[n_jamos - 1]) && IS_V (wc)))) + ((!IS_L (prev) && IS_S (wc)) || + (IS_T (prev) && IS_L (wc)) || + (IS_V (prev) && IS_L (wc)) || + (IS_T (prev) && IS_V (wc)))) { /* Draw a syllable. */ render_syllable (font, jamos, n_jamos, glyphs, @@ -168,17 +171,25 @@ hangul_engine_shape (PangoFont *font, if (n_jamos == max_jamos) { - max_jamos++; + max_jamos += 3; /* at most 3 for each syllable code (L+V+T) */ if (jamos == jamos_static) { jamos = g_new (gunichar, max_jamos); - memcpy(jamos, jamos_static, n_jamos*sizeof(gunichar)); + memcpy (jamos, jamos_static, n_jamos*sizeof(gunichar)); } else jamos = g_renew (gunichar, jamos, max_jamos); } - jamos[n_jamos++] = wc; + if (IS_S (wc)) + { + jamos[n_jamos++] = L_FROM_S (wc); + jamos[n_jamos++] = V_FROM_S (wc); + if (S_HAS_T (wc)) + jamos[n_jamos++] = T_FROM_S (wc); + } + else + jamos[n_jamos++] = wc; p = g_utf8_next_char (p); } @@ -199,8 +210,10 @@ hangul_engine_get_coverage (PangoFont *font, /* Well, no unicode rendering engine could render Hangul Jamo area _exactly_, I sure. */ - for (i = 0x1100; i <= 0x11FF; i++) + for (i = 0x1100; i <= 0x11ff; i++) pango_coverage_set (result, i, PANGO_COVERAGE_FALLBACK); + for (i = 0xac00; i <= 0xd7a3; i++) + pango_coverage_set (result, i, PANGO_COVERAGE_EXACT); return result; } diff --git a/modules/hangul/hangul-xft.c b/modules/hangul/hangul-xft.c index ec26d4d0..20aedd37 100644 --- a/modules/hangul/hangul-xft.c +++ b/modules/hangul/hangul-xft.c @@ -33,7 +33,8 @@ static PangoEngineRange hangul_ranges[] = { /* Language characters */ - { 0x1100, 0x11FF, "*" }, /* Hangul Jamo */ + { 0x1100, 0x11ff, "*" }, /* Hangul Jamo */ + { 0xac00, 0xd7a3, "*" }, /* Hangul Syllables */ }; static PangoEngineInfo script_engines[] = { @@ -137,7 +138,7 @@ hangul_engine_shape (PangoFont *font, int i; const char *p, *start; - gunichar jamos_static[3]; + gunichar jamos_static[8]; guint max_jamos = G_N_ELEMENTS (jamos_static); gunichar *jamos = jamos_static; int n_jamos; @@ -149,15 +150,17 @@ hangul_engine_shape (PangoFont *font, for (i = 0; i < n_chars; i++) { + gunichar prev = jamos[n_jamos - 1]; gunichar wc; wc = g_utf8_get_char (p); /* Check syllable boundaries. */ if (n_jamos != 0 && - ((IS_T (jamos[n_jamos - 1]) && IS_L (wc)) || - (IS_V (jamos[n_jamos - 1]) && IS_L (wc)) || - (IS_T (jamos[n_jamos - 1]) && IS_V (wc)))) + ((!IS_L (prev) && IS_S (wc)) || + (IS_T (prev) && IS_L (wc)) || + (IS_V (prev) && IS_L (wc)) || + (IS_T (prev) && IS_V (wc)))) { /* Draw a syllable. */ render_syllable (font, jamos, n_jamos, glyphs, @@ -168,17 +171,25 @@ hangul_engine_shape (PangoFont *font, if (n_jamos == max_jamos) { - max_jamos++; + max_jamos += 3; /* at most 3 for each syllable code (L+V+T) */ if (jamos == jamos_static) { jamos = g_new (gunichar, max_jamos); - memcpy(jamos, jamos_static, n_jamos*sizeof(gunichar)); + memcpy (jamos, jamos_static, n_jamos*sizeof(gunichar)); } else jamos = g_renew (gunichar, jamos, max_jamos); } - jamos[n_jamos++] = wc; + if (IS_S (wc)) + { + jamos[n_jamos++] = L_FROM_S (wc); + jamos[n_jamos++] = V_FROM_S (wc); + if (S_HAS_T (wc)) + jamos[n_jamos++] = T_FROM_S (wc); + } + else + jamos[n_jamos++] = wc; p = g_utf8_next_char (p); } @@ -199,8 +210,10 @@ hangul_engine_get_coverage (PangoFont *font, /* Well, no unicode rendering engine could render Hangul Jamo area _exactly_, I sure. */ - for (i = 0x1100; i <= 0x11FF; i++) + for (i = 0x1100; i <= 0x11ff; i++) pango_coverage_set (result, i, PANGO_COVERAGE_FALLBACK); + for (i = 0xac00; i <= 0xd7a3; i++) + pango_coverage_set (result, i, PANGO_COVERAGE_EXACT); return result; } -- cgit v1.2.1