summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-07-31 19:08:14 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-07-31 19:08:14 +0000
commit9f790d57b0cea4fafc70a43acc7ee98b23f09f8d (patch)
tree05a2cd4e54efe4a56fcc8b088712f51ad0e2e914 /modules
parentc506f17f0155956d90a506be3cc1b33f3618af64 (diff)
downloadpango-9f790d57b0cea4fafc70a43acc7ee98b23f09f8d.tar.gz
Patch from Changwoo Ryu <cwryu@debian.org> (#86591)
Sat Jul 27 18:18:20 2002 Owen Taylor <otaylor@redhat.com> Patch from Changwoo Ryu <cwryu@debian.org> (#86591) * configure.in, modules/hangul/Makefile.am: : Added hangul-xft module. * modules/hangul/hangul-xft.c: New file, shaping Hangul Jamos (U+1100-U+11FF) with Xft. * modules/hangul/hangul-x.c (JOHAB_COMMON): Render any prefix of uncommposable Hangul syllable as a syllable, and render remains as uncomposed form. This looks better than completely uncomposed jamo glyphs. (render_syllable_with_iso10646): Likewise. (render_syllable_with_ksc5601): Likewise. (hangul_engine_shape): Fixed memory leak on shaping a syllable with >= 6 jamos. * modules/hangul/tables-jamos.i, modules/hangul/tables-ksc5601.i: Separated Hangul Jamo mapping table from ksx1001 <=> unicode table. * modules/hangul/hangul-defs.h: New file with some common defines and macros. * modules/hangul/hangul-x.c (render_syllable_with_johabs): Fixed wrong font index around fallback display with johabs. (find_subfont): Uses "johabsh-1" (johabs-1 font with Hanja) in the same way with "johabs-1".
Diffstat (limited to 'modules')
-rw-r--r--modules/hangul/Makefile.am55
-rw-r--r--modules/hangul/hangul-defs.h62
-rw-r--r--modules/hangul/hangul-fc.c269
-rw-r--r--modules/hangul/hangul-x.c350
-rw-r--r--modules/hangul/hangul-xft.c269
-rw-r--r--modules/hangul/tables-jamos.i401
-rw-r--r--modules/hangul/tables-johabfont.i6
-rw-r--r--modules/hangul/tables-ksc5601.i397
8 files changed, 1230 insertions, 579 deletions
diff --git a/modules/hangul/Makefile.am b/modules/hangul/Makefile.am
index dd1490a0..32bea6a5 100644
--- a/modules/hangul/Makefile.am
+++ b/modules/hangul/Makefile.am
@@ -1,30 +1,65 @@
## Process this file with automake to create Makefile.in.
-sources = hangul-x.c
-
pangolibs = $(top_builddir)/pango/libpango-$(PANGO_API_VERSION).la $(FRIBIDI_LIBS) $(GLIB_LIBS)
pangoxlibs = $(top_builddir)/pango/libpangox-$(PANGO_API_VERSION).la $(X_LIBS) $(pangolibs)
pangoxftlibs = $(top_builddir)/pango/libpangoxft-$(PANGO_API_VERSION).la $(XFT_LIBS) $(pangolibs)
pangoft2libs = $(top_builddir)/pango/libpangoft2-$(PANGO_API_VERSION).la $(FREETYPE_LIBS) $(pangolibs)
+x_sources = hangul-x.c
+xft_sources = hangul-xft.c
+
+if HAVE_XFT
+if INCLUDE_HANGUL_XFT
+XFT_INCLUDED=libpango-hangul-xft.la
+XFT_MODULES=
+XFT_PREFIX=-DXFT_MODULE_PREFIX
+else
+XFT_MODULES=pango-hangul-xft.la
+XFT_INCLUDED=
+XFT_PREFIX=
+hangul_xft_libadd=$(pangoxftlibs)
+endif
+else
+XFT_MODULES=
+XFT_INCLUDED=
+XFT_PREFIX=
+endif
+
if HAVE_X
if INCLUDE_HANGUL_X
-noinst_LTLIBRARIES = libpango-hangul-x.la
-moddefine = -DX_MODULE_PREFIX
+X_MODULES=
+X_INCLUDED=libpango-hangul-x.la
+X_PREFIX=-DX_MODULE_PREFIX
else
-moduledir = $(libdir)/pango/$(PANGO_MODULE_VERSION)/modules
-module_LTLIBRARIES = pango-hangul-x.la
-hangul_x_libadd = $(pangoxlibs)
+X_MODULES=pango-hangul-x.la
+X_INCLUDED=
+X_PREFIX=
+hangul_x_libadd=$(pangoxlibs)
endif
+else
+X_MODULES=
+X_INCLUDED=
+X_PREFIX=
endif
-INCLUDES = -DPANGO_ENABLE_ENGINE -DG_DISABLE_DEPRECATED -I$(top_srcdir) -I$(top_srcdir)/pango/ $(moddefine) $(X_CFLAGS)
+noinst_LTLIBRARIES = $(X_INCLUDED) $(XFT_INCLUDED)
+module_LTLIBRARIES = $(X_MODULES) $(XFT_MODULES)
+moddefine = $(X_PREFIX) $(XFT_PREFIX)
+moduledir = $(libdir)/pango/$(PANGO_MODULE_VERSION)/modules
+
+INCLUDES = -DPANGO_ENABLE_ENGINE -DG_DISABLE_DEPRECATED -I$(top_srcdir) -I$(top_srcdir)/pango/ $(moddefine) $(X_CFLAGS) $(FREETYPE_CFLAGS)
pango_hangul_x_la_LDFLAGS = -export-dynamic -avoid-version -module
-pango_hangul_x_la_SOURCES = $(sources)
+pango_hangul_x_la_SOURCES = $(x_sources)
pango_hangul_x_la_LIBADD = $(hangul_x_libadd)
-libpango_hangul_x_la_SOURCES = $(sources)
+libpango_hangul_x_la_SOURCES = $(xft_sources)
+
+pango_hangul_xft_la_LDFLAGS = -export-dynamic -avoid-version -module
+pango_hangul_xft_la_LIBADD = $(hangul_xft_libadd)
+pango_hangul_xft_la_SOURCES = $(xft_sources)
+
+libpango_hangul_xft_la_SOURCES = $(xft_sources)
EXTRA_DIST = \
tables-ksc5601.i \
diff --git a/modules/hangul/hangul-defs.h b/modules/hangul/hangul-defs.h
new file mode 100644
index 00000000..53fcf3f9
--- /dev/null
+++ b/modules/hangul/hangul-defs.h
@@ -0,0 +1,62 @@
+/* Pango
+ * hangul-defs.h:
+ *
+ * Copyright (C) 2002 Changwoo Ryu
+ * Author: Changwoo Ryu <cwryu@debian.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * From 3.10 of the Unicode 2.0 Book; used for combining Jamos.
+ */
+#define SBASE 0xAC00
+#define LBASE 0x1100
+#define VBASE 0x1161
+#define TBASE 0x11A7
+
+#define LEND 0x115F
+#define VEND 0x11A6
+#define TEND 0x11FF
+
+#define SCOUNT 11172
+#define LCOUNT 19
+#define VCOUNT 21
+#define TCOUNT 28
+#define NCOUNT (VCOUNT * TCOUNT)
+
+/*
+ * Unicode 2.0 doesn't define the fill for trailing consonants, but
+ * I'll use 0x11A7 as that purpose internally.
+ */
+#define LFILL 0x115F
+#define VFILL 0x1160
+#define TFILL 0x11A7
+
+#define IS_L(wc) (wc >= LBASE && wc <= LEND)
+#define IS_V(wc) (wc >= VFILL && wc <= VEND)
+#define IS_T(wc) (wc >= TBASE && wc <= TEND)
+
+/* jamo which can be composited as a Hangul syllable */
+#define IS_L_S(wc) (wc >= LBASE && wc < LBASE + LCOUNT)
+#define IS_V_S(wc) (wc >= VBASE && wc < VBASE + VCOUNT)
+#define IS_T_S(wc) (wc >= TBASE && wc < TBASE + TCOUNT)
+
+#define S_FROM_LVT(l,v,t) (SBASE + (((l) - LBASE) * VCOUNT + ((v) - VBASE)) * TCOUNT + ((t) - TBASE))
+#define S_FROM_LV(l,v) (SBASE + (((l) - LBASE) * VCOUNT + ((v) - VBASE)) * TCOUNT)
+#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))
diff --git a/modules/hangul/hangul-fc.c b/modules/hangul/hangul-fc.c
new file mode 100644
index 00000000..13ff5fba
--- /dev/null
+++ b/modules/hangul/hangul-fc.c
@@ -0,0 +1,269 @@
+/* Pango
+ * hangul-xft.c:
+ *
+ * Copyright (C) 2002 Changwoo Ryu
+ * Author: Changwoo Ryu <cwryu@debian.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <string.h>
+
+#include "pangoxft.h"
+#include "pango-engine.h"
+#include "pango-utils.h"
+
+#include "hangul-defs.h"
+#include "tables-jamos.i"
+
+#define SCRIPT_ENGINE_NAME "HangulScriptEngineXft"
+
+static PangoEngineRange hangul_ranges[] = {
+ /* Language characters */
+ { 0x1100, 0x11FF, "*" }, /* Hangul Jamo */
+};
+
+static PangoEngineInfo script_engines[] = {
+ {
+ SCRIPT_ENGINE_NAME,
+ PANGO_ENGINE_TYPE_SHAPE,
+ PANGO_RENDER_TYPE_XFT,
+ hangul_ranges, G_N_ELEMENTS(hangul_ranges)
+ }
+};
+
+static void
+set_glyph (PangoFont *font, PangoGlyphString *glyphs, int i, int offset, PangoGlyph glyph)
+{
+ PangoRectangle logical_rect;
+
+ glyphs->glyphs[i].glyph = glyph;
+ glyphs->glyphs[i].geometry.x_offset = 0;
+ glyphs->glyphs[i].geometry.y_offset = 0;
+ glyphs->log_clusters[i] = offset;
+
+ pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph, NULL, &logical_rect);
+ glyphs->glyphs[i].geometry.width = logical_rect.width;
+}
+
+static guint
+find_char (FT_Face face, PangoFont *font, gunichar wc)
+{
+ int index = FT_Get_Char_Index (face, wc);
+
+ if (index && index <= face->num_glyphs)
+ return index;
+ else
+ return 0;
+}
+
+static void
+render_syllable (FT_Face face, PangoFont *font, gunichar *text, int length,
+ PangoGlyphString *glyphs, int *n_glyphs, int cluster_offset)
+{
+ int index;
+ gunichar wc;
+ int i, j, composed;
+
+ if (length >= 3 && IS_L_S(text[0]) && IS_V_S(text[1]) && IS_T_S(text[2]))
+ composed = 3;
+ else if (length >= 2 && IS_L_S(text[0]) && IS_V_S(text[1]))
+ composed = 2;
+ else
+ composed = 0;
+
+ if (composed)
+ {
+ if (composed == 3)
+ wc = S_FROM_LVT(text[0], text[1], text[2]);
+ else
+ wc = S_FROM_LV(text[0], text[1]);
+ index = find_char (face, font, wc);
+ pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
+ if (!index)
+ set_glyph (font, glyphs, *n_glyphs, cluster_offset,
+ pango_xft_font_get_unknown_glyph (font, wc));
+ else
+ set_glyph (font, glyphs, *n_glyphs, cluster_offset, index);
+ (*n_glyphs)++;
+ text += composed;
+ length -= composed;
+ }
+
+ /* Render the remaining text as uncomposed forms as a fallback. */
+ for (i = 0; i < length; i++)
+ {
+ int jindex;
+
+ index = find_char (face, font, text[i]);
+ if (index)
+ {
+ pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
+ set_glyph (font, glyphs, *n_glyphs, cluster_offset, index);
+ (*n_glyphs)++;
+ continue;
+ }
+
+ /* This font has no glyphs on the Hangul Jamo area! Find a
+ fallback from the Hangul Compatibility Jamo area. */
+ jindex = text[i] - LBASE;
+ for (j = 0; j < 3 && (__jamo_to_ksc5601[jindex][j] != 0); j++)
+ {
+ wc = __jamo_to_ksc5601[jindex][j] - KSC_JAMOBASE + UNI_JAMOBASE;
+ index = (wc >= 0x3131) ? find_char (face, font, wc) : 0;
+ pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
+ if (!index)
+ set_glyph (font, glyphs, *n_glyphs, cluster_offset,
+ pango_xft_font_get_unknown_glyph (font, index));
+ else
+ set_glyph (font, glyphs, *n_glyphs, cluster_offset, index);
+ (*n_glyphs)++;
+ }
+ }
+}
+
+static void
+hangul_engine_shape (PangoFont *font,
+ const char *text,
+ gint length,
+ PangoAnalysis *analysis,
+ PangoGlyphString *glyphs)
+{
+ int n_chars, n_glyphs;
+ int i;
+ const char *p, *start;
+ FT_Face face;
+
+ gunichar jamos_static[3];
+ guint max_jamos = G_N_ELEMENTS (jamos_static);
+ gunichar *jamos = jamos_static;
+ int n_jamos;
+
+ face = pango_xft_font_get_face (font);
+ g_assert (face);
+
+ n_chars = g_utf8_strlen (text, length);
+ n_glyphs = 0;
+ start = p = text;
+ n_jamos = 0;
+
+ for (i = 0; i < n_chars; i++)
+ {
+ 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))))
+ {
+ /* Draw a syllable. */
+ render_syllable (face, font, jamos, n_jamos, glyphs,
+ &n_glyphs, start - text);
+ n_jamos = 0;
+ start = p;
+ }
+
+ if (n_jamos == max_jamos)
+ {
+ max_jamos++;
+ if (jamos == jamos_static)
+ jamos = g_new (gunichar, max_jamos);
+ else
+ jamos = g_renew (gunichar, jamos, max_jamos);
+ }
+
+ jamos[n_jamos++] = wc;
+ p = g_utf8_next_char (p);
+ }
+
+ if (n_jamos != 0)
+ render_syllable (face, font, jamos, n_jamos, glyphs, &n_glyphs,
+ start - text);
+
+ if (jamos != jamos_static)
+ g_free(jamos);
+}
+
+static PangoCoverage *
+hangul_engine_get_coverage (PangoFont *font,
+ PangoLanguage *lang)
+{
+ PangoCoverage *result = pango_coverage_new ();
+ int i;
+
+ /* Well, no unicode rendering engine could render Hangul Jamo area
+ _exactly_, I sure. */
+ for (i = 0x1100; i <= 0x11FF; i++)
+ pango_coverage_set (result, i, PANGO_COVERAGE_FALLBACK);
+ return result;
+}
+
+static PangoEngine *
+hangul_engine_xft_new ()
+{
+ PangoEngineShape *result;
+
+ result = g_new (PangoEngineShape, 1);
+
+ result->engine.id = SCRIPT_ENGINE_NAME;
+ result->engine.type = PANGO_ENGINE_TYPE_SHAPE;
+ result->engine.length = sizeof (result);
+ result->script_shape = hangul_engine_shape;
+ result->get_coverage = hangul_engine_get_coverage;
+
+ return (PangoEngine *)result;
+}
+
+/* The following three functions provide the public module API for
+ * Pango. If we are compiling it is a module, then we name the
+ * entry points script_engine_list, etc. But if we are compiling
+ * it for inclusion directly in Pango, then we need them to
+ * to have distinct names for this module, so we prepend
+ * _pango_hangul_xft__
+ */
+#ifdef XFT_MODULE_PREFIX
+#define MODULE_ENTRY(func) _pango_hangul_xft_##func
+#else
+#define MODULE_ENTRY(func) func
+#endif
+
+/* List the engines contained within this module
+ */
+void
+MODULE_ENTRY(script_engine_list) (PangoEngineInfo **engines, gint *n_engines)
+{
+ *engines = script_engines;
+ *n_engines = G_N_ELEMENTS (script_engines);
+}
+
+/* Load a particular engine given the ID for the engine
+ */
+PangoEngine *
+MODULE_ENTRY(script_engine_load) (const char *id)
+{
+ if (!strcmp (id, SCRIPT_ENGINE_NAME))
+ return hangul_engine_xft_new ();
+ else
+ return NULL;
+}
+
+void
+MODULE_ENTRY(script_engine_unload) (PangoEngine *engine)
+{
+}
diff --git a/modules/hangul/hangul-x.c b/modules/hangul/hangul-x.c
index 052f7a64..272f10ed 100644
--- a/modules/hangul/hangul-x.c
+++ b/modules/hangul/hangul-x.c
@@ -1,7 +1,7 @@
/* Pango
* hangul.c:
*
- * Copyright (C) 1999 Changwoo Ryu
+ * Copyright (C) 1999, 2002 Changwoo Ryu
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -96,33 +96,8 @@ set_unknown_glyph (PangoGlyphString *glyphs,
glyphs->log_clusters[i] = cluster_offset;
}
-/*
- * From 3.10 of the Unicode 2.0 Book; used for combining Jamos.
- */
-
-#define SBASE 0xAC00
-#define LBASE 0x1100
-#define VBASE 0x1161
-#define TBASE 0x11A7
-#define SCOUNT 11172
-#define LCOUNT 19
-#define VCOUNT 21
-#define TCOUNT 28
-#define NCOUNT (VCOUNT * TCOUNT)
-
-/*
- * Unicode 2.0 doesn't define the fill for trailing consonants, but
- * I'll use 0x11A7 as that purpose internally.
- */
-
-#define LFILL 0x115F
-#define VFILL 0x1160
-#define TFILL 0x11A7
-
-#define IS_L(wc) (wc >= 0x1100 && wc < 0x115F)
-#define IS_V(wc) (wc >= 0x1160 && wc < 0x11A2)
-#define IS_T(wc) (wc >= 0x11A7 && wc < 0x11F9)
+#include "hangul-defs.h"
typedef void (* RenderSyllableFunc) (PangoFont *font, PangoXSubfont subfont,
gunichar2 *text, int length,
@@ -133,6 +108,7 @@ typedef void (* RenderSyllableFunc) (PangoFont *font, PangoXSubfont subfont,
#include "tables-johabfont.i"
#include "tables-ksc5601.i"
+#include "tables-jamos.i"
#define JOHAB_COMMON \
int i; \
@@ -160,8 +136,9 @@ typedef void (* RenderSyllableFunc) (PangoFont *font, PangoXSubfont subfont,
i++; \
} \
\
- if (n_cho <= 1 && n_jung <= 1 && n_jong <= 1) \
+ if (n_cho <= 1 && n_jung <= 1) \
{ \
+ int composed = 0; \
gunichar2 l, v, t; \
\
if (n_cho > 0) \
@@ -179,10 +156,19 @@ typedef void (* RenderSyllableFunc) (PangoFont *font, PangoXSubfont subfont,
else \
t = TFILL; \
\
- /* COMPOSABLE */ \
if ((__choseong_johabfont_base[l - LBASE] != 0 || l == LFILL) && \
(__jungseong_johabfont_base[v - VBASE] != 0 || v == VFILL) && \
(__jongseong_johabfont_base[t - TBASE] != 0 || t == TFILL)) \
+ composed = n_cho + n_jung + ((n_jong > 0) ? 1 : 0); \
+ else if ((__choseong_johabfont_base[l - LBASE] != 0 || l == LFILL) && \
+ (__jungseong_johabfont_base[v - VBASE] != 0 || v == VFILL)) \
+ { \
+ composed = n_cho + n_jung; \
+ t = TFILL; \
+ } \
+ \
+ /* COMPOSABLE */ \
+ if (composed) \
{ \
if (l != LFILL) \
{ \
@@ -245,7 +231,8 @@ typedef void (* RenderSyllableFunc) (PangoFont *font, PangoXSubfont subfont,
(*n_glyphs)++; \
} \
\
- return; \
+ text += composed; \
+ length -= composed; \
} \
}
@@ -255,42 +242,40 @@ render_syllable_with_johabs (PangoFont *font, PangoXSubfont subfont,
PangoGlyphString *glyphs,
int *n_glyphs, int cluster_offset)
{
-JOHAB_COMMON
+ JOHAB_COMMON
/* Render as uncomposed forms as a fallback. */
for (i = 0; i < length; i++)
{
int j;
+ if (text[i] == LFILL || text[i] == VFILL || text[i] == TFILL)
+ continue;
/*
* Uses KSC5601 symbol glyphs which johabS-1 has; they're
* not in the normal johab-1. The glyphs are better than composable
* components.
*/
- for (j = 0; j < 3; j++)
+ for (j = 0; j < 3 && (__jamo_to_ksc5601[text[i] - LBASE][j] != 0); j++)
{
gindex = __jamo_to_ksc5601[text[i] - LBASE][j];
-
- if (gindex != 0)
- {
- if ((gindex >= 0x2421) && (gindex <= 0x247f))
- gindex += (0x032b - 0x2420);
- else if ((gindex >= 0x2421) && (gindex <= 0x247f))
- gindex += (0x02cd - 0x2321);
- else
- break;
-
- pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
- set_glyph (glyphs, *n_glyphs, font, subfont, gindex);
- glyphs->log_clusters[*n_glyphs] = cluster_offset;
- (*n_glyphs)++;
- }
+
+ if ((gindex >= 0x2421) && (gindex <= 0x247f))
+ gindex += (0x032b - 0x2421);
+ else if ((gindex >= 0x2321) && (gindex <= 0x2420))
+ gindex += (0x02cd - 0x2321);
else
break;
+
+ pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
+ set_glyph (glyphs, *n_glyphs, font, subfont, gindex);
+ glyphs->log_clusters[*n_glyphs] = cluster_offset;
+ (*n_glyphs)++;
}
if (j == 0)
set_unknown_glyph (glyphs, n_glyphs, font, text[i], cluster_offset);
}
+
}
static void
@@ -299,23 +284,23 @@ render_syllable_with_johab (PangoFont *font, PangoXSubfont subfont,
PangoGlyphString *glyphs,
int *n_glyphs, int cluster_offset)
{
-JOHAB_COMMON
+ JOHAB_COMMON
/* Render as uncomposed forms as a fallback. */
for (i = 0; i < length; i++)
{
int j;
- gunichar2 wc;
- wc = text[i];
- for (j = 0; (j < 3) && (__jamo_to_johabfont[wc-LBASE][j] != 0); j++)
+ if (text[i] == LFILL || text[i] == VFILL || text[i] == TFILL)
+ continue;
+ for (j = 0; (j < 3) && (__jamo_to_johabfont[text[i]-LBASE][j] != 0); j++)
{
pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
set_glyph (glyphs, *n_glyphs, font, subfont,
- __jamo_to_johabfont[wc - LBASE][j]);
+ __jamo_to_johabfont[text[i] - LBASE][j]);
glyphs->log_clusters[*n_glyphs] = cluster_offset;
(*n_glyphs)++;
- if (IS_L (wc))
+ if (IS_L (text[i]) || IS_T (text[i]))
{
pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
set_glyph (glyphs, *n_glyphs, font, subfont, JOHAB_FILLER);
@@ -324,8 +309,10 @@ JOHAB_COMMON
}
}
if (j == 0)
- set_unknown_glyph (glyphs, n_glyphs, font, wc, cluster_offset);
+ set_unknown_glyph (glyphs, n_glyphs, font, text[i], cluster_offset);
}
+ if (*n_glyphs == 0)
+ set_unknown_glyph (glyphs, n_glyphs, font, 0, cluster_offset);
}
static void
@@ -411,56 +398,29 @@ render_syllable_with_iso10646 (PangoFont *font, PangoXSubfont subfont,
int *n_glyphs, int cluster_offset)
{
guint16 gindex;
- int i;
-
- /*
- * Check if there are one CHOSEONG, one JUNGSEONG, and no more
- * than one JONGSEONG.
- */
- int n_cho = 0, n_jung = 0, n_jong = 0;
- i = 0;
- while (i < length && IS_L (text[i]))
- {
- n_cho++;
- i++;
- }
- while (i < length && IS_V (text[i]))
- {
- n_jung++;
- i++;
- }
- while (i < length && IS_T (text[i]))
- {
- n_jong++;
- i++;
- }
-
- if (n_cho == 1 && n_jung == 1 && n_jong <= 1)
- {
- int lindex, vindex, tindex;
+ int i, composed;
- lindex = text[0] - LBASE;
- vindex = text[1] - VBASE;
- if (n_jong > 0)
- tindex = text[2] - TBASE;
- else
- tindex = 0;
+ if (length >= 3 && IS_L_S(text[0]) && IS_V_S(text[1]) && IS_T_S(text[2]))
+ composed = 3;
+ else if (length >= 2 && IS_L_S(text[0]) && IS_V_S(text[1]))
+ composed = 2;
+ else
+ composed = 0;
- /* COMPOSABLE */
- if (lindex >= 0 && lindex < LCOUNT &&
- vindex >= 0 && vindex < VCOUNT &&
- tindex >= 0 && tindex < TCOUNT)
- {
- gindex = (lindex * VCOUNT + vindex) * TCOUNT + tindex + SBASE;
- /* easy for composed syllables. */
- pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
- set_glyph (glyphs, *n_glyphs, font, subfont, gindex);
- glyphs->log_clusters[*n_glyphs] = cluster_offset;
- (*n_glyphs)++;
- return;
- }
+ if (composed)
+ {
+ if (composed == 3)
+ gindex = S_FROM_LVT(text[0], text[1], text[2]);
+ else
+ gindex = S_FROM_LV(text[0], text[1]);
+ pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
+ set_glyph (glyphs, *n_glyphs, font, subfont, gindex);
+ glyphs->log_clusters[*n_glyphs] = cluster_offset;
+ (*n_glyphs)++;
+ text += composed;
+ length -= composed;
}
-
+
/* Render as uncomposed forms as a fallback. */
for (i = 0; i < length; i++)
{
@@ -472,81 +432,134 @@ render_syllable_with_iso10646 (PangoFont *font, PangoXSubfont subfont,
}
}
+static int
+find_ksc5601 (gunichar2 ucs)
+{
+ int l = 0;
+ int u = KSC5601_HANGUL - 1;
+ int index;
+
+ guint16 try;
+
+ /* Do binary search. */
+ while (l <= u)
+ {
+ int m = (l + u) / 2;
+ try = __ksc5601_hangul_to_ucs[m];
+ if (try > ucs)
+ u = m - 1;
+ else if (try < ucs)
+ l = m + 1;
+ else
+ {
+ /* equation to find the index in ksc5601 font. */
+ index = (((m / 94) + 0x30) << 8) | ((m % 94) + 0x21);
+ return index;
+ }
+ }
+ return 0;
+}
+
+static gboolean
+try_decompose_jongseong(gunichar2 jong, gunichar2 *jong1, gunichar2 *jong2)
+{
+ static gunichar2 table[][2] = {
+ {0, 0},
+ /* U+11A8- */
+ {0, 0}, {0, 0}, {0x11A8, 0x11BA}, {0, 0},
+ {0x11AB, 0x11BD}, {0x11AB, 0x11C2}, {0, 0}, {0, 0},
+ /* U+11B0- */
+ {0x11AF, 0x11A8}, {0x11AF, 0x11B7}, {0x11AF, 0x11B8}, {0x11AF, 0x11BA},
+ {0x11AF, 0x11C0}, {0x11AF, 0x11C1}, {0x11AF, 0x11C2}, {0, 0},
+ {0, 0}, {0x11B8, 0x11BA}, {0, 0}, {0, 0},
+ {0, 0}, {0, 0}, {0, 0}, {0, 0},
+ /* U+11C0- */
+ {0, 0}, {0, 0}, {0, 0}, {0, 0},
+ {0, 0}, {0, 0}, {0, 0}, {0, 0},
+ {0, 0}, {0, 0}, {0, 0}, {0, 0},
+ {0, 0}, {0, 0}, {0, 0}, {0, 0},
+ /* U+11D0- */
+ {0, 0}, {0, 0}, {0, 0}, {0, 0},
+ {0, 0}, {0, 0}, {0, 0}, {0, 0},
+ {0, 0}, {0, 0}, {0, 0}, {0, 0},
+ {0, 0}, {0, 0}, {0, 0}, {0, 0},
+ /* U+11E0- */
+ {0, 0}, {0, 0}, {0, 0}, {0, 0},
+ {0, 0}, {0, 0}, {0, 0}, {0, 0},
+ {0, 0}, {0, 0}, {0, 0}, {0, 0},
+ {0, 0}, {0, 0}, {0, 0}, {0, 0},
+ /* U+11F0- */
+ {0, 0}, {0, 0}, {0, 0}, {0, 0},
+ {0, 0}, {0, 0}, {0, 0}, {0, 0},
+ {0, 0}, {0, 0}, {0, 0}, {0, 0},
+ {0, 0}, {0, 0}, {0, 0}, {0, 0}
+ };
+
+ if (IS_T(jong) && table[jong - TBASE][0])
+ {
+ *jong1 = table[jong - TBASE][0];
+ *jong2 = table[jong - TBASE][1];
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
static void
render_syllable_with_ksc5601 (PangoFont *font, PangoXSubfont subfont,
gunichar2 *text, int length,
PangoGlyphString *glyphs,
int *n_glyphs, int cluster_offset)
{
- guint16 sindex;
- guint16 gindex;
+ int gindex = 0, composed = 0;
+ gunichar2 jong1, jong2 = 0;
int i;
- /*
- * Check if there are one CHOSEONG, one JUNGSEONG, and no more
- * than one JONGSEONG.
- */
- int n_cho = 0, n_jung = 0, n_jong = 0;
- i = 0;
- while (i < length && IS_L (text[i]))
+ if (length >= 3 && IS_L_S(text[0]) && IS_V_S(text[1]) && IS_T_S(text[2]))
{
- n_cho++;
- i++;
+ gindex = find_ksc5601(S_FROM_LVT(text[0], text[1], text[2]));
+ if (gindex)
+ composed = 3;
+ else
+ {
+ if (try_decompose_jongseong(text[2], &jong1, &jong2))
+ {
+ gindex = find_ksc5601(S_FROM_LVT(text[0], text[1], jong1));
+ composed = 3;
+ }
+ }
}
- while (i < length && IS_V (text[i]))
+ if (!composed && length >= 2 && IS_L_S(text[0]) && IS_V_S(text[1]))
{
- n_jung++;
- i++;
+ gindex = find_ksc5601(S_FROM_LV(text[0], text[1]));
+ if (gindex)
+ composed = 2;
}
- while (i < length && IS_T (text[i]))
+
+ if (composed)
{
- n_jong++;
- i++;
+ pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
+ set_glyph (glyphs, *n_glyphs, font, subfont, gindex);
+ glyphs->log_clusters[*n_glyphs] = cluster_offset;
+ (*n_glyphs)++;
+ text += composed;
+ length -= composed;
}
-
- if (n_cho == 1 && n_jung == 1 && n_jong <= 1)
- {
- int lindex, vindex, tindex;
-
- lindex = text[0] - LBASE;
- vindex = text[1] - VBASE;
- if (n_jong > 0)
- tindex = text[2] - TBASE;
- else
- tindex = 0;
- /* COMPOSABLE */
- if (lindex >= 0 && lindex < LCOUNT &&
- vindex >= 0 && vindex < VCOUNT &&
- tindex >= 0 && tindex < TCOUNT)
+ if (jong2)
+ {
+ int i;
+
+ for (i = 0; (i < 3) && (__jamo_to_ksc5601[jong2 - LBASE][i] != 0); i++)
{
- int l = 0;
- int u = KSC5601_HANGUL - 1;
- guint16 try;
-
- sindex = (lindex * VCOUNT + vindex) * TCOUNT + tindex + SBASE;
-
- /* Do binary search. */
- while (l <= u)
- {
- int m = (l + u) / 2;
- try = __ksc5601_hangul_to_ucs[m];
- if (try > sindex)
- u = m - 1;
- else if (try < sindex)
- l = m + 1;
- else
- {
- gindex = (((m / 94) + 0x30) << 8) | ((m % 94) + 0x21);
-
- pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
- set_glyph (glyphs, *n_glyphs, font, subfont, gindex);
- glyphs->log_clusters[*n_glyphs] = cluster_offset;
- (*n_glyphs)++;
- return;
- }
- }
+ pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
+ set_glyph (glyphs, *n_glyphs, font, subfont,
+ __jamo_to_ksc5601[jong2 - LBASE][i]);
+ glyphs->log_clusters[*n_glyphs] = cluster_offset;
+ (*n_glyphs)++;
}
+ if (i == 0)
+ set_unknown_glyph (glyphs, n_glyphs, font, gindex, cluster_offset);
}
for (i = 0; i < length; i++)
@@ -600,7 +613,8 @@ find_subfont (PangoFont *font, char **charsets, int n_charsets,
for (i=0; i<n_subfonts; i++)
{
- if (strcmp (charsets[subfont_charsets[i]], "johabs-1") == 0)
+ if (strcmp (charsets[subfont_charsets[i]], "johabs-1") == 0 ||
+ strcmp (charsets[subfont_charsets[i]], "johabsh-1") == 0)
{
*subfont = subfonts[i];
*render_func = render_syllable_with_johabs;
@@ -669,7 +683,7 @@ hangul_engine_shape (PangoFont *font,
const char *next;
int i, n_chars;
gunichar2 jamos_static[4];
- guint jamos_max = G_N_ELEMENTS (jamos_static);
+ guint max_jamos = G_N_ELEMENTS (jamos_static);
gunichar2 *jamos = jamos_static;
int n_jamos = 0;
@@ -752,15 +766,13 @@ hangul_engine_shape (PangoFont *font,
/* Clear. */
n_jamos = 0;
}
- if (n_jamos == jamos_max)
+ if (n_jamos == max_jamos)
{
- gunichar2 *new_jamos;
-
- jamos_max++;
- new_jamos = g_new (gunichar2, jamos_max);
- memcpy (new_jamos, jamos, n_jamos * sizeof (gunichar2));
-
- jamos = new_jamos;
+ max_jamos++;
+ if (jamos == jamos_static)
+ jamos = g_new (gunichar2, max_jamos);
+ else
+ jamos = g_renew (gunichar2, jamos, max_jamos);
}
jamos[n_jamos++] = wc;
}
diff --git a/modules/hangul/hangul-xft.c b/modules/hangul/hangul-xft.c
new file mode 100644
index 00000000..13ff5fba
--- /dev/null
+++ b/modules/hangul/hangul-xft.c
@@ -0,0 +1,269 @@
+/* Pango
+ * hangul-xft.c:
+ *
+ * Copyright (C) 2002 Changwoo Ryu
+ * Author: Changwoo Ryu <cwryu@debian.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <string.h>
+
+#include "pangoxft.h"
+#include "pango-engine.h"
+#include "pango-utils.h"
+
+#include "hangul-defs.h"
+#include "tables-jamos.i"
+
+#define SCRIPT_ENGINE_NAME "HangulScriptEngineXft"
+
+static PangoEngineRange hangul_ranges[] = {
+ /* Language characters */
+ { 0x1100, 0x11FF, "*" }, /* Hangul Jamo */
+};
+
+static PangoEngineInfo script_engines[] = {
+ {
+ SCRIPT_ENGINE_NAME,
+ PANGO_ENGINE_TYPE_SHAPE,
+ PANGO_RENDER_TYPE_XFT,
+ hangul_ranges, G_N_ELEMENTS(hangul_ranges)
+ }
+};
+
+static void
+set_glyph (PangoFont *font, PangoGlyphString *glyphs, int i, int offset, PangoGlyph glyph)
+{
+ PangoRectangle logical_rect;
+
+ glyphs->glyphs[i].glyph = glyph;
+ glyphs->glyphs[i].geometry.x_offset = 0;
+ glyphs->glyphs[i].geometry.y_offset = 0;
+ glyphs->log_clusters[i] = offset;
+
+ pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph, NULL, &logical_rect);
+ glyphs->glyphs[i].geometry.width = logical_rect.width;
+}
+
+static guint
+find_char (FT_Face face, PangoFont *font, gunichar wc)
+{
+ int index = FT_Get_Char_Index (face, wc);
+
+ if (index && index <= face->num_glyphs)
+ return index;
+ else
+ return 0;
+}
+
+static void
+render_syllable (FT_Face face, PangoFont *font, gunichar *text, int length,
+ PangoGlyphString *glyphs, int *n_glyphs, int cluster_offset)
+{
+ int index;
+ gunichar wc;
+ int i, j, composed;
+
+ if (length >= 3 && IS_L_S(text[0]) && IS_V_S(text[1]) && IS_T_S(text[2]))
+ composed = 3;
+ else if (length >= 2 && IS_L_S(text[0]) && IS_V_S(text[1]))
+ composed = 2;
+ else
+ composed = 0;
+
+ if (composed)
+ {
+ if (composed == 3)
+ wc = S_FROM_LVT(text[0], text[1], text[2]);
+ else
+ wc = S_FROM_LV(text[0], text[1]);
+ index = find_char (face, font, wc);
+ pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
+ if (!index)
+ set_glyph (font, glyphs, *n_glyphs, cluster_offset,
+ pango_xft_font_get_unknown_glyph (font, wc));
+ else
+ set_glyph (font, glyphs, *n_glyphs, cluster_offset, index);
+ (*n_glyphs)++;
+ text += composed;
+ length -= composed;
+ }
+
+ /* Render the remaining text as uncomposed forms as a fallback. */
+ for (i = 0; i < length; i++)
+ {
+ int jindex;
+
+ index = find_char (face, font, text[i]);
+ if (index)
+ {
+ pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
+ set_glyph (font, glyphs, *n_glyphs, cluster_offset, index);
+ (*n_glyphs)++;
+ continue;
+ }
+
+ /* This font has no glyphs on the Hangul Jamo area! Find a
+ fallback from the Hangul Compatibility Jamo area. */
+ jindex = text[i] - LBASE;
+ for (j = 0; j < 3 && (__jamo_to_ksc5601[jindex][j] != 0); j++)
+ {
+ wc = __jamo_to_ksc5601[jindex][j] - KSC_JAMOBASE + UNI_JAMOBASE;
+ index = (wc >= 0x3131) ? find_char (face, font, wc) : 0;
+ pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
+ if (!index)
+ set_glyph (font, glyphs, *n_glyphs, cluster_offset,
+ pango_xft_font_get_unknown_glyph (font, index));
+ else
+ set_glyph (font, glyphs, *n_glyphs, cluster_offset, index);
+ (*n_glyphs)++;
+ }
+ }
+}
+
+static void
+hangul_engine_shape (PangoFont *font,
+ const char *text,
+ gint length,
+ PangoAnalysis *analysis,
+ PangoGlyphString *glyphs)
+{
+ int n_chars, n_glyphs;
+ int i;
+ const char *p, *start;
+ FT_Face face;
+
+ gunichar jamos_static[3];
+ guint max_jamos = G_N_ELEMENTS (jamos_static);
+ gunichar *jamos = jamos_static;
+ int n_jamos;
+
+ face = pango_xft_font_get_face (font);
+ g_assert (face);
+
+ n_chars = g_utf8_strlen (text, length);
+ n_glyphs = 0;
+ start = p = text;
+ n_jamos = 0;
+
+ for (i = 0; i < n_chars; i++)
+ {
+ 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))))
+ {
+ /* Draw a syllable. */
+ render_syllable (face, font, jamos, n_jamos, glyphs,
+ &n_glyphs, start - text);
+ n_jamos = 0;
+ start = p;
+ }
+
+ if (n_jamos == max_jamos)
+ {
+ max_jamos++;
+ if (jamos == jamos_static)
+ jamos = g_new (gunichar, max_jamos);
+ else
+ jamos = g_renew (gunichar, jamos, max_jamos);
+ }
+
+ jamos[n_jamos++] = wc;
+ p = g_utf8_next_char (p);
+ }
+
+ if (n_jamos != 0)
+ render_syllable (face, font, jamos, n_jamos, glyphs, &n_glyphs,
+ start - text);
+
+ if (jamos != jamos_static)
+ g_free(jamos);
+}
+
+static PangoCoverage *
+hangul_engine_get_coverage (PangoFont *font,
+ PangoLanguage *lang)
+{
+ PangoCoverage *result = pango_coverage_new ();
+ int i;
+
+ /* Well, no unicode rendering engine could render Hangul Jamo area
+ _exactly_, I sure. */
+ for (i = 0x1100; i <= 0x11FF; i++)
+ pango_coverage_set (result, i, PANGO_COVERAGE_FALLBACK);
+ return result;
+}
+
+static PangoEngine *
+hangul_engine_xft_new ()
+{
+ PangoEngineShape *result;
+
+ result = g_new (PangoEngineShape, 1);
+
+ result->engine.id = SCRIPT_ENGINE_NAME;
+ result->engine.type = PANGO_ENGINE_TYPE_SHAPE;
+ result->engine.length = sizeof (result);
+ result->script_shape = hangul_engine_shape;
+ result->get_coverage = hangul_engine_get_coverage;
+
+ return (PangoEngine *)result;
+}
+
+/* The following three functions provide the public module API for
+ * Pango. If we are compiling it is a module, then we name the
+ * entry points script_engine_list, etc. But if we are compiling
+ * it for inclusion directly in Pango, then we need them to
+ * to have distinct names for this module, so we prepend
+ * _pango_hangul_xft__
+ */
+#ifdef XFT_MODULE_PREFIX
+#define MODULE_ENTRY(func) _pango_hangul_xft_##func
+#else
+#define MODULE_ENTRY(func) func
+#endif
+
+/* List the engines contained within this module
+ */
+void
+MODULE_ENTRY(script_engine_list) (PangoEngineInfo **engines, gint *n_engines)
+{
+ *engines = script_engines;
+ *n_engines = G_N_ELEMENTS (script_engines);
+}
+
+/* Load a particular engine given the ID for the engine
+ */
+PangoEngine *
+MODULE_ENTRY(script_engine_load) (const char *id)
+{
+ if (!strcmp (id, SCRIPT_ENGINE_NAME))
+ return hangul_engine_xft_new ();
+ else
+ return NULL;
+}
+
+void
+MODULE_ENTRY(script_engine_unload) (PangoEngine *engine)
+{
+}
diff --git a/modules/hangul/tables-jamos.i b/modules/hangul/tables-jamos.i
new file mode 100644
index 00000000..0b83d1a7
--- /dev/null
+++ b/modules/hangul/tables-jamos.i
@@ -0,0 +1,401 @@
+/* -*-c-*- */
+
+#define KSC_JAMOBASE 0x2420
+#define UNI_JAMOBASE 0x3130
+
+#define KSC_KIYEOK 0x2421
+#define KSC_SSANGKIYEOK 0x2422
+#define KSC_KIYEOK_SIOS 0x2423
+#define KSC_NIEUN 0x2424
+#define KSC_NIEUN_CIEUC 0x2425
+#define KSC_NIEUN_HIEUH 0x2426
+#define KSC_TIKEUT 0x2427
+#define KSC_SSANGTIKEUT 0x2428
+#define KSC_RIEUL 0x2429
+#define KSC_RIEUL_KIYEOK 0x242a
+#define KSC_RIEUL_MIEUM 0x242b
+#define KSC_RIEUL_PIEUP 0x242c
+#define KSC_RIEUL_SIOS 0x242d
+#define KSC_RIEUL_THIEUTH 0x242e
+#define KSC_RIEUL_PHIEUPH 0x242f
+#define KSC_RIEUL_HIEUH 0x2430
+#define KSC_MIEUM 0x2431
+#define KSC_PIEUP 0x2432
+#define KSC_SSANGPIEUP 0x2433
+#define KSC_PIEUP_SIOS 0x2434
+#define KSC_SIOS 0x2435
+#define KSC_SSANGSIOS 0x2436
+#define KSC_IEUNG 0x2437
+#define KSC_CIEUC 0x2438
+#define KSC_SSANGCIEUC 0x2439
+#define KSC_CHIEUCH 0x243a
+#define KSC_KHIEUKH 0x243b
+#define KSC_THIEUTH 0x243c
+#define KSC_PHIEUPH 0x243d
+#define KSC_HIEUH 0x243e
+
+#define KSC_A 0x243f
+#define KSC_AE 0x2440
+#define KSC_YA 0x2441
+#define KSC_YAE 0x2442
+#define KSC_EO 0x2443
+#define KSC_E 0x2444
+#define KSC_YEO 0x2445
+#define KSC_YE 0x2446
+#define KSC_O 0x2447
+#define KSC_WA 0x2448
+#define KSC_WAE 0x2449
+#define KSC_OE 0x244a
+#define KSC_YO 0x244b
+#define KSC_U 0x244c
+#define KSC_WEO 0x244d
+#define KSC_WE 0x244e
+#define KSC_WI 0x244f
+#define KSC_YU 0x2450
+#define KSC_EU 0x2451
+#define KSC_YI 0x2452
+#define KSC_I 0x2453
+
+#define KSC_SSANGNIEUN 0x2455
+#define KSC_NIEUN_TIKEUT 0x2456
+#define KSC_NIEUN_SIOS 0x2457
+#define KSC_NIEUN_PANSIOS 0x2458
+#define KSC_RIEUL_KIYEOK_SIOS 0x2459
+#define KSC_RIEUL_TIKEUT 0x245a
+#define KSC_RIEUL_PIEUP_SIOS 0x245b
+#define KSC_RIEUL_PANSIOS 0x245c
+#define KSC_RIEUL_YEORINHIEUH 0x245d
+#define KSC_MIEUM_PIEUP 0x245e
+#define KSC_MIEUM_SIOS 0x245f
+#define KSC_MIEUM_PANSIOS 0x2460
+#define KSC_KAPYEOUNMIEUM 0x2461
+#define KSC_PIEUP_KIYEOK 0x2462
+#define KSC_PIEUP_TIKEUT 0x2463
+#define KSC_PIEUP_SIOS_KIYEOK 0x2464
+#define KSC_PIEUP_SIOS_TIKEUT 0x2465
+#define KSC_PIEUP_CIEUC 0x2466
+#define KSC_PIEUP_THIEUTH 0x2467
+#define KSC_KAPYEOUNPIEUP 0x2468
+#define KSC_KAPYEOUNSSANGPIEUP 0x2469
+#define KSC_SIOS_KIYEOK 0x246a
+#define KSC_SIOS_NIEUN 0x246b
+#define KSC_SIOS_TIKEUT 0x246c
+#define KSC_SIOS_PIEUP 0x246d
+#define KSC_SIOS_CIEUC 0x246e
+#define KSC_PANSIOS 0x246f
+#define KSC_SSANGIEUNG 0x2470
+#define KSC_YESIEUNG 0x2471
+#define KSC_IEUNG_CIEUC 0x2472
+#define KSC_IEUNG_PANSIOS 0x2473
+#define KSC_KAPYEOUNPHIEUPH 0x2474
+#define KSC_SSANGHIEUH 0x2475
+#define KSC_YEORINHIEUH 0x2476
+#define KSC_YO_YA 0x2477
+#define KSC_YO_YAE 0x2478
+#define KSC_YO_I 0x2479
+#define KSC_YU_YEO 0x247a
+#define KSC_YU_YE 0x247b
+#define KSC_YU_I 0x247c
+#define KSC_ARAEA 0x247d
+#define KSC_ARAEA_I 0x247e
+
+/*
+ * Some jamos are not representable with KSC5601. These are ugly
+ * fallbacks:
+ *
+ * CHITUEUMSIOS: 0x233c (less than)
+ * CEONGCHITUEUMSIOS: 0x233e (greater than)
+ * CHITUEUMCIEUC 0x237b (left bracket)
+ * CEONGEUMCIEUC 0x237d (right bracket)
+ * CHITUEUMCHIEUCH 0x237b (left brace)
+ * CEONGEUMCHIEUCH 0x237d (right brace)
+ */
+#define KSC_CHITUEUMSIOS 0x233c
+#define KSC_CEONGCHITUEUMSIOS 0x233e
+#define KSC_CHITUEUMCIEUC 0x235b
+#define KSC_CEONGEUMCIEUC 0x235d
+#define KSC_CHITUEUMCHIEUCH 0x237b
+#define KSC_CEONGEUMCHIEUCH 0x237d
+
+static guint16 __jamo_to_ksc5601[0x100][3] =
+{
+ /*
+ * CHOSEONG
+ */
+ /* CHOSEONG 0x1100 -- 0x1112 : matched to each ksc5601 Jamos extactly. */
+ {KSC_KIYEOK, 0, 0},
+ {KSC_SSANGKIYEOK, 0, 0},
+ {KSC_NIEUN, 0, 0},
+ {KSC_TIKEUT, 0, 0},
+ {KSC_SSANGTIKEUT, 0, 0},
+ {KSC_RIEUL, 0, 0},
+ {KSC_MIEUM, 0, 0},
+ {KSC_PIEUP, 0, 0},
+ {KSC_SSANGPIEUP, 0, 0},
+ {KSC_SIOS, 0, 0},
+ {KSC_SSANGSIOS, 0, 0},
+ {KSC_IEUNG, 0, 0},
+ {KSC_CIEUC, 0, 0},
+ {KSC_SSANGCIEUC, 0, 0},
+ {KSC_CHIEUCH, 0, 0},
+ {KSC_KHIEUKH, 0, 0},
+ {KSC_THIEUTH, 0, 0},
+ {KSC_PHIEUPH, 0, 0},
+ {KSC_HIEUH, 0, 0},
+ /* Some of the following are representable as a glyph, the others not. */
+ {KSC_NIEUN, KSC_KIYEOK, 0},
+ {KSC_SSANGNIEUN, 0, 0},
+ {KSC_NIEUN_TIKEUT, 0, 0},
+ {KSC_NIEUN, KSC_PIEUP, 0},
+ {KSC_TIKEUT, KSC_KIYEOK, 0},
+ {KSC_RIEUL, KSC_NIEUN, 0},
+ {KSC_RIEUL, KSC_RIEUL, 0},
+ {KSC_RIEUL_HIEUH, 0, 0},
+ {KSC_RIEUL, KSC_IEUNG, 0},
+ {KSC_MIEUM_PIEUP, 0, 0},
+ {KSC_KAPYEOUNMIEUM, 0, 0},
+ {KSC_PIEUP_KIYEOK, 0, 0},
+ {KSC_PIEUP, KSC_NIEUN, 0},
+ {KSC_PIEUP_TIKEUT, 0, 0},
+ {KSC_PIEUP_SIOS, 0, 0},
+ {KSC_PIEUP_SIOS_KIYEOK, 0, 0},
+ {KSC_PIEUP_SIOS_TIKEUT, 0, 0},
+ {KSC_PIEUP, KSC_SIOS, KSC_PIEUP},
+ {KSC_PIEUP, KSC_SIOS, KSC_SIOS},
+ {KSC_PIEUP, KSC_SIOS, KSC_CIEUC},
+ {KSC_PIEUP_CIEUC, 0, 0},
+ {KSC_PIEUP, KSC_CHIEUCH, 0},
+ {KSC_PIEUP_THIEUTH, 0, 0},
+ {KSC_PIEUP, KSC_PHIEUPH, 0},
+ {KSC_KAPYEOUNPIEUP, 0, 0},
+ {KSC_KAPYEOUNSSANGPIEUP, 0, 0},
+ {KSC_SIOS_KIYEOK, 0, 0},
+ {KSC_SIOS_NIEUN, 0, 0},
+ {KSC_SIOS_TIKEUT, 0, 0},
+ {KSC_SIOS, KSC_RIEUL, 0},
+ {KSC_SIOS, KSC_MIEUM, 0},
+ {KSC_SIOS_PIEUP, 0, 0},
+ {KSC_SIOS, KSC_PIEUP, KSC_KIYEOK},
+ {KSC_SIOS, KSC_SIOS, KSC_SIOS},
+ {KSC_SIOS, KSC_IEUNG, 0},
+ {KSC_SIOS_CIEUC, 0, 0},
+ {KSC_SIOS, KSC_CHIEUCH, 0},
+ {KSC_SIOS, KSC_KHIEUKH, 0},
+ {KSC_SIOS, KSC_THIEUTH, 0},
+ {KSC_SIOS, KSC_PHIEUPH, 0},
+ {KSC_SIOS, KSC_HIEUH, 0},
+ {KSC_CHITUEUMSIOS, 0, 0},
+ {KSC_CHITUEUMSIOS, KSC_CHITUEUMSIOS, 0},
+ {KSC_CEONGCHITUEUMSIOS, 0, 0},
+ {KSC_CEONGCHITUEUMSIOS, KSC_CEONGCHITUEUMSIOS, 0},
+ {KSC_PANSIOS, 0, 0},
+ {KSC_IEUNG, KSC_KIYEOK, 0},
+ {KSC_IEUNG, KSC_TIKEUT, 0},
+ {KSC_IEUNG, KSC_MIEUM, 0},
+ {KSC_IEUNG, KSC_PIEUP, 0},
+ {KSC_IEUNG, KSC_SIOS, 0},
+ {KSC_IEUNG_PANSIOS, 0, 0},
+ {KSC_SSANGIEUNG, 0, 0},
+ {KSC_IEUNG_CIEUC, 0, 0},
+ {KSC_IEUNG, KSC_CHIEUCH, 0},
+ {KSC_IEUNG, KSC_THIEUTH, 0},
+ {KSC_IEUNG, KSC_PHIEUPH, 0},
+ {KSC_YESIEUNG, 0, 0},
+ {KSC_CIEUC, KSC_IEUNG, 0},
+ {KSC_CHITUEUMCIEUC, 0, 0},
+ {KSC_CHITUEUMCIEUC, KSC_CHITUEUMCIEUC, 0},
+ {KSC_CEONGEUMCIEUC, 0, 0},
+ {KSC_CEONGEUMCIEUC, KSC_CEONGEUMCIEUC, 0},
+ {KSC_CHIEUCH, KSC_KHIEUKH, 0},
+ {KSC_CHIEUCH, KSC_HIEUH, 0},
+ {KSC_CHITUEUMCHIEUCH, 0, 0},
+ {KSC_CEONGEUMCHIEUCH, 0, 0},
+ {KSC_PHIEUPH, KSC_PIEUP, 0},
+ {KSC_KAPYEOUNPHIEUPH, 0, 0},
+ {KSC_SSANGHIEUH, 0, 0},
+ {KSC_YEORINHIEUH, 0, 0},
+ /* 0x115A ~ 0x115E -- reserved */
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ /* CHOSEONG FILLER */
+ {0, 0, 0},
+
+ /*
+ * JUNGSEONG
+ */
+ /*
+ * JUNGSEONG
+ */
+ {0, 0, 0}, /* JUNGSEONG FILL */
+ /* JUNGSEONG 0x1161 -- 0x1175 : matched to each ksc5601 Jamos extactly. */
+ {KSC_A, 0, 0},
+ {KSC_AE, 0, 0},
+ {KSC_YA, 0, 0},
+ {KSC_YAE, 0, 0},
+ {KSC_EO, 0, 0},
+ {KSC_E, 0, 0},
+ {KSC_YEO, 0, 0},
+ {KSC_YE, 0, 0},
+ {KSC_O, 0, 0},
+ {KSC_WA, 0, 0},
+ {KSC_WAE, 0, 0},
+ {KSC_OE, 0, 0},
+ {KSC_YO, 0, 0},
+ {KSC_U, 0, 0},
+ {KSC_WEO, 0, 0},
+ {KSC_WE, 0, 0},
+ {KSC_WI, 0, 0},
+ {KSC_YU, 0, 0},
+ {KSC_EU, 0, 0},
+ {KSC_YI, 0, 0},
+ {KSC_I, 0, 0},
+ /* Some of the following are representable as a glyph, the others not. */
+ {KSC_A, KSC_O, 0},
+ {KSC_A, KSC_U, 0},
+ {KSC_YA, KSC_O, 0},
+ {KSC_YA, KSC_YO, 0},
+ {KSC_EO, KSC_O, 0},
+ {KSC_EO, KSC_U, 0},
+ {KSC_EO, KSC_EU, 0},
+ {KSC_YEO, KSC_O, 0},
+ {KSC_YEO, KSC_U, 0},
+ {KSC_O, KSC_EO, 0},
+ {KSC_O, KSC_E, 0},
+ {KSC_O, KSC_YE, 0},
+ {KSC_O, KSC_O, 0},
+ {KSC_O, KSC_U, 0},
+ {KSC_YO_YA, 0, 0},
+ {KSC_YO_YAE, 0, 0},
+ {KSC_YO, KSC_YEO, 0},
+ {KSC_YO, KSC_O, 0},
+ {KSC_YO_I, 0, 0},
+ {KSC_U, KSC_A, 0},
+ {KSC_U, KSC_AE, 0},
+ {KSC_U, KSC_EO, KSC_EU},
+ {KSC_U, KSC_YE, 0},
+ {KSC_U, KSC_U, 0},
+ {KSC_YU, KSC_A, 0},
+ {KSC_YU, KSC_EO, 0},
+ {KSC_YU, KSC_E, 0},
+ {KSC_YU_YEO, 0, 0},
+ {KSC_YU_YE, 0, 0},
+ {KSC_YU, KSC_U, 0},
+ {KSC_YU_I, 0, 0},
+ {KSC_EU, KSC_U, 0},
+ {KSC_EU, KSC_EU, 0},
+ {KSC_YI, KSC_U, 0},
+ {KSC_I, KSC_A, 0},
+ {KSC_I, KSC_YA, 0},
+ {KSC_I, KSC_O, 0},
+ {KSC_I, KSC_U, 0},
+ {KSC_I, KSC_EU, 0},
+ {KSC_I, KSC_ARAEA, 0},
+ {KSC_ARAEA, 0, 0},
+ {KSC_ARAEA, KSC_EO, 0},
+ {KSC_ARAEA, KSC_U, 0},
+ {KSC_ARAEA, KSC_I, 0},
+ {KSC_ARAEA, KSC_ARAEA, 0},
+ /* 0x11A3 ~ 0x11A7 -- reserved */
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0}, /* (INTERNAL) JONGSEONG FILL */
+
+ /*
+ * JONGSEONG
+ */
+ {KSC_KIYEOK, 0, 0},
+ {KSC_SSANGKIYEOK, 0, 0},
+ {KSC_KIYEOK_SIOS, 0, 0},
+ {KSC_NIEUN, 0, 0},
+ {KSC_NIEUN_CIEUC, 0, 0},
+ {KSC_NIEUN_HIEUH, 0, 0},
+ {KSC_TIKEUT, 0, 0},
+ {KSC_RIEUL, 0, 0},
+ {KSC_RIEUL_KIYEOK, 0, 0},
+ {KSC_RIEUL_MIEUM, 0, 0},
+ {KSC_RIEUL_PIEUP, 0, 0},
+ {KSC_RIEUL_SIOS, 0, 0},
+ {KSC_RIEUL_TIKEUT, 0, 0},
+ {KSC_RIEUL_PHIEUPH, 0, 0},
+ {KSC_RIEUL_HIEUH, 0, 0},
+ {KSC_MIEUM, 0, 0},
+ {KSC_PIEUP, 0, 0},
+ {KSC_PIEUP_SIOS, 0, 0},
+ {KSC_SIOS, 0, 0},
+ {KSC_SSANGSIOS, 0, 0},
+ {KSC_IEUNG, 0, 0},
+ {KSC_CIEUC, 0, 0},
+ {KSC_CHIEUCH, 0, 0},
+ {KSC_KHIEUKH, 0, 0},
+ {KSC_THIEUTH, 0, 0},
+ {KSC_PHIEUPH, 0, 0},
+ {KSC_HIEUH, 0, 0},
+ {KSC_KIYEOK, KSC_RIEUL, 0},
+ {KSC_KIYEOK, KSC_SIOS, KSC_KIYEOK},
+ {KSC_NIEUN, KSC_KIYEOK, 0},
+ {KSC_NIEUN_TIKEUT, 0, 0},
+ {KSC_NIEUN_SIOS, 0, 0},
+ {KSC_NIEUN_PANSIOS, 0, 0},
+ {KSC_NIEUN, KSC_THIEUTH, 0},
+ {KSC_TIKEUT, KSC_KIYEOK, 0},
+ {KSC_TIKEUT, KSC_RIEUL, 0},
+ {KSC_RIEUL_KIYEOK_SIOS, 0, 0},
+ {KSC_RIEUL, KSC_NIEUN, 0},
+ {KSC_RIEUL_TIKEUT, 0, 0},
+ {KSC_RIEUL, KSC_TIKEUT, KSC_HIEUH},
+ {KSC_RIEUL, KSC_RIEUL, 0},
+ {KSC_RIEUL, KSC_MIEUM, KSC_KIYEOK},
+ {KSC_RIEUL, KSC_MIEUM, KSC_SIOS},
+ {KSC_RIEUL_PIEUP_SIOS, 0, 0},
+ {KSC_RIEUL, KSC_PHIEUPH, KSC_HIEUH},
+ {KSC_RIEUL, KSC_KAPYEOUNPIEUP, 0},
+ {KSC_RIEUL, KSC_SIOS, KSC_SIOS},
+ {KSC_RIEUL_PANSIOS, 0, 0},
+ {KSC_RIEUL, KSC_KHIEUKH, 0},
+ {KSC_RIEUL_YEORINHIEUH, 0, 0},
+ {KSC_MIEUM, KSC_KIYEOK, 0},
+ {KSC_MIEUM, KSC_RIEUL, 0},
+ {KSC_MIEUM_PIEUP, 0, 0},
+ {KSC_MIEUM_SIOS, 0, 0},
+ {KSC_MIEUM, KSC_SIOS, KSC_SIOS},
+ {KSC_MIEUM_PANSIOS, 0, 0},
+ {KSC_MIEUM, KSC_CHIEUCH, 0},
+ {KSC_MIEUM, KSC_HIEUH, 0},
+ {KSC_KAPYEOUNMIEUM, 0, 0},
+ {KSC_PIEUP, KSC_RIEUL, 0},
+ {KSC_PIEUP, KSC_PHIEUPH, 0},
+ {KSC_PIEUP, KSC_HIEUH, 0},
+ {KSC_KAPYEOUNPIEUP, 0, 0},
+ {KSC_SIOS_KIYEOK, 0, 0},
+ {KSC_SIOS_TIKEUT, 0, 0},
+ {KSC_SIOS, KSC_RIEUL, 0},
+ {KSC_SIOS_PIEUP, 0, 0},
+ {KSC_PANSIOS, 0, 0},
+ {KSC_IEUNG, KSC_KIYEOK, 0},
+ {KSC_IEUNG, KSC_KIYEOK, KSC_KIYEOK},
+ {KSC_SSANGIEUNG, 0, 0},
+ {KSC_IEUNG, KSC_KHIEUKH, 0},
+ {KSC_YESIEUNG, 0, 0},
+ {KSC_YESIEUNG, KSC_SIOS, 0},
+ {KSC_YESIEUNG, KSC_PANSIOS, 0},
+ {KSC_PHIEUPH, KSC_PIEUP, 0},
+ {KSC_KAPYEOUNPHIEUPH, 0, 0},
+ {KSC_HIEUH, KSC_NIEUN, 0},
+ {KSC_HIEUH, KSC_RIEUL, 0},
+ {KSC_HIEUH, KSC_MIEUM, 0},
+ {KSC_HIEUH, KSC_PIEUP, 0},
+ {KSC_YEORINHIEUH, 0, 0},
+ /* reserved */
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0}
+};
+
diff --git a/modules/hangul/tables-johabfont.i b/modules/hangul/tables-johabfont.i
index 8d2cb05c..8204ea2e 100644
--- a/modules/hangul/tables-johabfont.i
+++ b/modules/hangul/tables-johabfont.i
@@ -284,16 +284,16 @@ const static gint __jongseong_map[] =
#define JOHAB_A 0x0137
#define JOHAB_AE 0x013a
#define JOHAB_YA 0x013d
-#define JOHAB_YAE 0x014d
+#define JOHAB_YAE 0x0140
#define JOHAB_EO 0x0143
#define JOHAB_E 0x0146
#define JOHAB_YEO 0x0149
#define JOHAB_YE 0x014c
-#define JOHAB_O 0x014e
+#define JOHAB_O 0x014f
#define JOHAB_WA 0x0153
#define JOHAB_WAE 0x0157
#define JOHAB_OE 0x015b
-#define JOHAB_YO 0x015e
+#define JOHAB_YO 0x015f
#define JOHAB_U 0x0163
#define JOHAB_WEO 0x0166
#define JOHAB_WE 0x0169
diff --git a/modules/hangul/tables-ksc5601.i b/modules/hangul/tables-ksc5601.i
index 5f64052e..d457bd25 100644
--- a/modules/hangul/tables-ksc5601.i
+++ b/modules/hangul/tables-ksc5601.i
@@ -310,403 +310,6 @@ static guint16 __ksc5601_hangul_to_ucs[KSC5601_HANGUL]=
};
-#define KSC_KIYEOK 0x2421
-#define KSC_SSANGKIYEOK 0x2422
-#define KSC_KIYEOK_SIOS 0x2423
-#define KSC_NIEUN 0x2424
-#define KSC_NIEUN_CIEUC 0x2425
-#define KSC_NIEUN_HIEUH 0x2426
-#define KSC_TIKEUT 0x2427
-#define KSC_SSANGTIKEUT 0x2428
-#define KSC_RIEUL 0x2429
-#define KSC_RIEUL_KIYEOK 0x242a
-#define KSC_RIEUL_MIEUM 0x242b
-#define KSC_RIEUL_PIEUP 0x242c
-#define KSC_RIEUL_SIOS 0x242d
-#define KSC_RIEUL_THIEUTH 0x242e
-#define KSC_RIEUL_PHIEUPH 0x242f
-#define KSC_RIEUL_HIEUH 0x2430
-#define KSC_MIEUM 0x2431
-#define KSC_PIEUP 0x2432
-#define KSC_SSANGPIEUP 0x2433
-#define KSC_PIEUP_SIOS 0x2434
-#define KSC_SIOS 0x2435
-#define KSC_SSANGSIOS 0x2436
-#define KSC_IEUNG 0x2437
-#define KSC_CIEUC 0x2438
-#define KSC_SSANGCIEUC 0x2439
-#define KSC_CHIEUCH 0x243a
-#define KSC_KHIEUKH 0x243b
-#define KSC_THIEUTH 0x243c
-#define KSC_PHIEUPH 0x243d
-#define KSC_HIEUH 0x243e
-
-#define KSC_A 0x243f
-#define KSC_AE 0x2440
-#define KSC_YA 0x2441
-#define KSC_YAE 0x2442
-#define KSC_EO 0x2443
-#define KSC_E 0x2444
-#define KSC_YEO 0x2445
-#define KSC_YE 0x2446
-#define KSC_O 0x2447
-#define KSC_WA 0x2448
-#define KSC_WAE 0x2449
-#define KSC_OE 0x244a
-#define KSC_YO 0x244b
-#define KSC_U 0x244c
-#define KSC_WEO 0x244d
-#define KSC_WE 0x244e
-#define KSC_WI 0x244f
-#define KSC_YU 0x2450
-#define KSC_EU 0x2451
-#define KSC_YI 0x2452
-#define KSC_I 0x2453
-
-#define KSC_SSANGNIEUN 0x2455
-#define KSC_NIEUN_TIKEUT 0x2456
-#define KSC_NIEUN_SIOS 0x2457
-#define KSC_NIEUN_PANSIOS 0x2458
-#define KSC_RIEUL_KIYEOK_SIOS 0x2459
-#define KSC_RIEUL_TIKEUT 0x245a
-#define KSC_RIEUL_PIEUP_SIOS 0x245b
-#define KSC_RIEUL_PANSIOS 0x245c
-#define KSC_RIEUL_YEORINHIEUH 0x245d
-#define KSC_MIEUM_PIEUP 0x245e
-#define KSC_MIEUM_SIOS 0x245f
-#define KSC_MIEUM_PANSIOS 0x2460
-#define KSC_KAPYEOUNMIEUM 0x2461
-#define KSC_PIEUP_KIYEOK 0x2462
-#define KSC_PIEUP_TIKEUT 0x2463
-#define KSC_PIEUP_SIOS_KIYEOK 0x2464
-#define KSC_PIEUP_SIOS_TIKEUT 0x2465
-#define KSC_PIEUP_CIEUC 0x2466
-#define KSC_PIEUP_THIEUTH 0x2467
-#define KSC_KAPYEOUNPIEUP 0x2468
-#define KSC_KAPYEOUNSSANGPIEUP 0x2469
-#define KSC_SIOS_KIYEOK 0x246a
-#define KSC_SIOS_NIEUN 0x246b
-#define KSC_SIOS_TIKEUT 0x246c
-#define KSC_SIOS_PIEUP 0x246d
-#define KSC_SIOS_CIEUC 0x246e
-#define KSC_PANSIOS 0x246f
-#define KSC_SSANGIEUNG 0x2470
-#define KSC_YESIEUNG 0x2471
-#define KSC_IEUNG_CIEUC 0x2472
-#define KSC_IEUNG_PANSIOS 0x2473
-#define KSC_KAPYEOUNPHIEUPH 0x2474
-#define KSC_SSANGHIEUH 0x2475
-#define KSC_YEORINHIEUH 0x2476
-#define KSC_YO_YA 0x2477
-#define KSC_YO_YAE 0x2478
-#define KSC_YO_I 0x2479
-#define KSC_YU_YEO 0x247a
-#define KSC_YU_YE 0x247b
-#define KSC_YU_I 0x247c
-#define KSC_ARAEA 0x247d
-#define KSC_ARAEA_I 0x247e
-
-/*
- * Some jamos are not representable with KSC5601. These are ugly
- * fallbacks:
- *
- * CHITUEUMSIOS: 0x233c (less than)
- * CEONGCHITUEUMSIOS: 0x233e (greater than)
- * CHITUEUMCIEUC 0x237b (left bracket)
- * CEONGEUMCIEUC 0x237d (right bracket)
- * CHITUEUMCHIEUCH 0x237b (left brace)
- * CEONGEUMCHIEUCH 0x237d (right brace)
- */
-#define KSC_CHITUEUMSIOS 0x233c
-#define KSC_CEONGCHITUEUMSIOS 0x233e
-#define KSC_CHITUEUMCIEUC 0x235b
-#define KSC_CEONGEUMCIEUC 0x235d
-#define KSC_CHITUEUMCHIEUCH 0x237b
-#define KSC_CEONGEUMCHIEUCH 0x237d
-
-static guint16 __jamo_to_ksc5601[0x100][3] =
-{
- /*
- * CHOSEONG
- */
- /* CHOSEONG 0x1100 -- 0x1112 : matched to each ksc5601 Jamos extactly. */
- {KSC_KIYEOK, 0, 0},
- {KSC_SSANGKIYEOK, 0, 0},
- {KSC_NIEUN, 0, 0},
- {KSC_TIKEUT, 0, 0},
- {KSC_SSANGTIKEUT, 0, 0},
- {KSC_RIEUL, 0, 0},
- {KSC_MIEUM, 0, 0},
- {KSC_PIEUP, 0, 0},
- {KSC_SSANGPIEUP, 0, 0},
- {KSC_SIOS, 0, 0},
- {KSC_SSANGSIOS, 0, 0},
- {KSC_IEUNG, 0, 0},
- {KSC_CIEUC, 0, 0},
- {KSC_SSANGCIEUC, 0, 0},
- {KSC_CHIEUCH, 0, 0},
- {KSC_KHIEUKH, 0, 0},
- {KSC_THIEUTH, 0, 0},
- {KSC_PHIEUPH, 0, 0},
- {KSC_HIEUH, 0, 0},
- /* Some of the following are representable as a glyph, the others not. */
- {KSC_NIEUN, KSC_KIYEOK, 0},
- {KSC_SSANGNIEUN, 0, 0},
- {KSC_NIEUN_TIKEUT, 0, 0},
- {KSC_NIEUN, KSC_PIEUP, 0},
- {KSC_TIKEUT, KSC_KIYEOK, 0},
- {KSC_RIEUL, KSC_NIEUN, 0},
- {KSC_RIEUL, KSC_RIEUL, 0},
- {KSC_RIEUL_HIEUH, 0, 0},
- {KSC_RIEUL, KSC_IEUNG, 0},
- {KSC_MIEUM_PIEUP, 0, 0},
- {KSC_KAPYEOUNMIEUM, 0, 0},
- {KSC_PIEUP_KIYEOK, 0, 0},
- {KSC_PIEUP, KSC_NIEUN, 0},
- {KSC_PIEUP_TIKEUT, 0, 0},
- {KSC_PIEUP_SIOS, 0, 0},
- {KSC_PIEUP_SIOS_KIYEOK, 0, 0},
- {KSC_PIEUP_SIOS_TIKEUT, 0, 0},
- {KSC_PIEUP, KSC_SIOS, KSC_PIEUP},
- {KSC_PIEUP, KSC_SIOS, KSC_SIOS},
- {KSC_PIEUP, KSC_SIOS, KSC_CIEUC},
- {KSC_PIEUP_CIEUC, 0, 0},
- {KSC_PIEUP, KSC_CHIEUCH, 0},
- {KSC_PIEUP_THIEUTH, 0, 0},
- {KSC_PIEUP, KSC_PHIEUPH, 0},
- {KSC_KAPYEOUNPIEUP, 0, 0},
- {KSC_KAPYEOUNSSANGPIEUP, 0, 0},
- {KSC_SIOS_KIYEOK, 0, 0},
- {KSC_SIOS_NIEUN, 0, 0},
- {KSC_SIOS_TIKEUT, 0, 0},
- {KSC_SIOS, KSC_RIEUL, 0},
- {KSC_SIOS, KSC_MIEUM, 0},
- {KSC_SIOS_PIEUP, 0, 0},
- {KSC_SIOS, KSC_PIEUP, KSC_KIYEOK},
- {KSC_SIOS, KSC_SIOS, KSC_SIOS},
- {KSC_SIOS, KSC_IEUNG, 0},
- {KSC_SIOS_CIEUC, 0, 0},
- {KSC_SIOS, KSC_CHIEUCH, 0},
- {KSC_SIOS, KSC_KHIEUKH, 0},
- {KSC_SIOS, KSC_THIEUTH, 0},
- {KSC_SIOS, KSC_PHIEUPH, 0},
- {KSC_SIOS, KSC_HIEUH, 0},
- {KSC_CHITUEUMSIOS, 0, 0},
- {KSC_CHITUEUMSIOS, KSC_CHITUEUMSIOS, 0},
- {KSC_CEONGCHITUEUMSIOS, 0, 0},
- {KSC_CEONGCHITUEUMSIOS, KSC_CEONGCHITUEUMSIOS, 0},
- {KSC_PANSIOS, 0, 0},
- {KSC_IEUNG, KSC_KIYEOK, 0},
- {KSC_IEUNG, KSC_TIKEUT, 0},
- {KSC_IEUNG, KSC_MIEUM, 0},
- {KSC_IEUNG, KSC_PIEUP, 0},
- {KSC_IEUNG, KSC_SIOS, 0},
- {KSC_IEUNG_PANSIOS, 0, 0},
- {KSC_SSANGIEUNG, 0, 0},
- {KSC_IEUNG_CIEUC, 0, 0},
- {KSC_IEUNG, KSC_CHIEUCH, 0},
- {KSC_IEUNG, KSC_THIEUTH, 0},
- {KSC_IEUNG, KSC_PHIEUPH, 0},
- {KSC_YESIEUNG, 0, 0},
- {KSC_CIEUC, KSC_IEUNG, 0},
- {KSC_CHITUEUMCIEUC, 0, 0},
- {KSC_CHITUEUMCIEUC, KSC_CHITUEUMCIEUC, 0},
- {KSC_CEONGEUMCIEUC, 0, 0},
- {KSC_CEONGEUMCIEUC, KSC_CEONGEUMCIEUC, 0},
- {KSC_CHIEUCH, KSC_KHIEUKH, 0},
- {KSC_CHIEUCH, KSC_HIEUH, 0},
- {KSC_CHITUEUMCHIEUCH, 0, 0},
- {KSC_CEONGEUMCHIEUCH, 0, 0},
- {KSC_PHIEUPH, KSC_PIEUP, 0},
- {KSC_KAPYEOUNPHIEUPH, 0, 0},
- {KSC_SSANGHIEUH, 0, 0},
- {KSC_YEORINHIEUH, 0, 0},
- /* 0x115A ~ 0x115E -- reserved */
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- /* CHOSEONG FILLER */
- {0, 0, 0},
-
- /*
- * JUNGSEONG
- */
- /*
- * JUNGSEONG
- */
- {0, 0, 0}, /* JUNGSEONG FILL */
- /* JUNGSEONG 0x1161 -- 0x1175 : matched to each ksc5601 Jamos extactly. */
- {KSC_A, 0, 0},
- {KSC_AE, 0, 0},
- {KSC_YA, 0, 0},
- {KSC_YAE, 0, 0},
- {KSC_EO, 0, 0},
- {KSC_E, 0, 0},
- {KSC_YEO, 0, 0},
- {KSC_YE, 0, 0},
- {KSC_O, 0, 0},
- {KSC_WA, 0, 0},
- {KSC_WAE, 0, 0},
- {KSC_OE, 0, 0},
- {KSC_YO, 0, 0},
- {KSC_U, 0, 0},
- {KSC_WEO, 0, 0},
- {KSC_WE, 0, 0},
- {KSC_WI, 0, 0},
- {KSC_YU, 0, 0},
- {KSC_EU, 0, 0},
- {KSC_YI, 0, 0},
- {KSC_I, 0, 0},
- /* Some of the following are representable as a glyph, the others not. */
- {KSC_A, KSC_O, 0},
- {KSC_A, KSC_U, 0},
- {KSC_YA, KSC_O, 0},
- {KSC_YA, KSC_YO, 0},
- {KSC_EO, KSC_O, 0},
- {KSC_EO, KSC_U, 0},
- {KSC_EO, KSC_EU, 0},
- {KSC_YEO, KSC_O, 0},
- {KSC_YEO, KSC_U, 0},
- {KSC_O, KSC_EO, 0},
- {KSC_O, KSC_E, 0},
- {KSC_O, KSC_YE, 0},
- {KSC_O, KSC_O, 0},
- {KSC_O, KSC_U, 0},
- {KSC_YO_YA, 0, 0},
- {KSC_YO_YAE, 0, 0},
- {KSC_YO, KSC_YEO, 0},
- {KSC_YO, KSC_O, 0},
- {KSC_YO_I, 0, 0},
- {KSC_U, KSC_A, 0},
- {KSC_U, KSC_AE, 0},
- {KSC_U, KSC_EO, KSC_EU},
- {KSC_U, KSC_YE, 0},
- {KSC_U, KSC_U, 0},
- {KSC_YU, KSC_A, 0},
- {KSC_YU, KSC_EO, 0},
- {KSC_YU, KSC_E, 0},
- {KSC_YU_YEO, 0, 0},
- {KSC_YU_YE, 0, 0},
- {KSC_YU, KSC_U, 0},
- {KSC_YU_I, 0, 0},
- {KSC_EU, KSC_U, 0},
- {KSC_EU, KSC_EU, 0},
- {KSC_YI, KSC_U, 0},
- {KSC_I, KSC_A, 0},
- {KSC_I, KSC_YA, 0},
- {KSC_I, KSC_O, 0},
- {KSC_I, KSC_U, 0},
- {KSC_I, KSC_EU, 0},
- {KSC_I, KSC_ARAEA, 0},
- {KSC_ARAEA, 0, 0},
- {KSC_ARAEA, KSC_EO, 0},
- {KSC_ARAEA, KSC_U, 0},
- {KSC_ARAEA, KSC_I, 0},
- {KSC_ARAEA, KSC_ARAEA, 0},
- /* 0x11A3 ~ 0x11A7 -- reserved */
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0}, /* (INTERNAL) JONGSEONG FILL */
-
- /*
- * JONGSEONG
- */
- {KSC_KIYEOK, 0, 0},
- {KSC_SSANGKIYEOK, 0, 0},
- {KSC_KIYEOK_SIOS, 0, 0},
- {KSC_NIEUN, 0, 0},
- {KSC_NIEUN_CIEUC, 0, 0},
- {KSC_NIEUN_HIEUH, 0, 0},
- {KSC_TIKEUT, 0, 0},
- {KSC_RIEUL, 0, 0},
- {KSC_RIEUL_KIYEOK, 0, 0},
- {KSC_RIEUL_MIEUM, 0, 0},
- {KSC_RIEUL_PIEUP, 0, 0},
- {KSC_RIEUL_SIOS, 0, 0},
- {KSC_RIEUL_TIKEUT, 0, 0},
- {KSC_RIEUL_PHIEUPH, 0, 0},
- {KSC_RIEUL_HIEUH, 0, 0},
- {KSC_MIEUM, 0, 0},
- {KSC_PIEUP, 0, 0},
- {KSC_PIEUP_SIOS, 0, 0},
- {KSC_SIOS, 0, 0},
- {KSC_SSANGSIOS, 0, 0},
- {KSC_IEUNG, 0, 0},
- {KSC_CIEUC, 0, 0},
- {KSC_CHIEUCH, 0, 0},
- {KSC_KHIEUKH, 0, 0},
- {KSC_THIEUTH, 0, 0},
- {KSC_PHIEUPH, 0, 0},
- {KSC_HIEUH, 0, 0},
- {KSC_KIYEOK, KSC_RIEUL, 0},
- {KSC_KIYEOK, KSC_SIOS, KSC_KIYEOK},
- {KSC_NIEUN, KSC_KIYEOK, 0},
- {KSC_NIEUN_TIKEUT, 0, 0},
- {KSC_NIEUN_SIOS, 0, 0},
- {KSC_NIEUN_PANSIOS, 0, 0},
- {KSC_NIEUN, KSC_THIEUTH, 0},
- {KSC_TIKEUT, KSC_KIYEOK, 0},
- {KSC_TIKEUT, KSC_RIEUL, 0},
- {KSC_RIEUL_KIYEOK_SIOS, 0, 0},
- {KSC_RIEUL, KSC_NIEUN, 0},
- {KSC_RIEUL_TIKEUT, 0, 0},
- {KSC_RIEUL, KSC_TIKEUT, KSC_HIEUH},
- {KSC_RIEUL, KSC_RIEUL, 0},
- {KSC_RIEUL, KSC_MIEUM, KSC_KIYEOK},
- {KSC_RIEUL, KSC_MIEUM, KSC_SIOS},
- {KSC_RIEUL_PIEUP_SIOS, 0, 0},
- {KSC_RIEUL, KSC_PHIEUPH, KSC_HIEUH},
- {KSC_RIEUL, KSC_KAPYEOUNPIEUP, 0},
- {KSC_RIEUL, KSC_SIOS, KSC_SIOS},
- {KSC_RIEUL_PANSIOS, 0, 0},
- {KSC_RIEUL, KSC_KHIEUKH, 0},
- {KSC_RIEUL_YEORINHIEUH, 0, 0},
- {KSC_MIEUM, KSC_KIYEOK, 0},
- {KSC_MIEUM, KSC_RIEUL, 0},
- {KSC_MIEUM_PIEUP, 0, 0},
- {KSC_MIEUM_SIOS, 0, 0},
- {KSC_MIEUM, KSC_SIOS, KSC_SIOS},
- {KSC_MIEUM_PANSIOS, 0, 0},
- {KSC_MIEUM, KSC_CHIEUCH, 0},
- {KSC_MIEUM, KSC_HIEUH, 0},
- {KSC_KAPYEOUNMIEUM, 0, 0},
- {KSC_PIEUP, KSC_RIEUL, 0},
- {KSC_PIEUP, KSC_PHIEUPH, 0},
- {KSC_PIEUP, KSC_HIEUH, 0},
- {KSC_KAPYEOUNPIEUP, 0, 0},
- {KSC_SIOS_KIYEOK, 0, 0},
- {KSC_SIOS_TIKEUT, 0, 0},
- {KSC_SIOS, KSC_RIEUL, 0},
- {KSC_SIOS_PIEUP, 0, 0},
- {KSC_PANSIOS, 0, 0},
- {KSC_IEUNG, KSC_KIYEOK, 0},
- {KSC_IEUNG, KSC_KIYEOK, KSC_KIYEOK},
- {KSC_SSANGIEUNG, 0, 0},
- {KSC_IEUNG, KSC_KHIEUKH, 0},
- {KSC_YESIEUNG, 0, 0},
- {KSC_YESIEUNG, KSC_SIOS, 0},
- {KSC_YESIEUNG, KSC_PANSIOS, 0},
- {KSC_PHIEUPH, KSC_PIEUP, 0},
- {KSC_KAPYEOUNPHIEUPH, 0, 0},
- {KSC_HIEUH, KSC_NIEUN, 0},
- {KSC_HIEUH, KSC_RIEUL, 0},
- {KSC_HIEUH, KSC_MIEUM, 0},
- {KSC_HIEUH, KSC_PIEUP, 0},
- {KSC_YEORINHIEUH, 0, 0},
- /* reserved */
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0}
-};
-
-
/* mapping table used to convert indexes to JOHAB
bit 43210 초 성 중 성 종 성
00000 no code no code no code