summaryrefslogtreecommitdiff
path: root/modules/hangul
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-07-26 23:28:57 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-07-26 23:28:57 +0000
commitc5d4993ea27cce54763836ddf9c82ea33ac25afa (patch)
tree7f473dcc0ccf8d5499b37c1bfff5dc55dcb220bf /modules/hangul
parent06aab38b27870d0026903de80e2e687ade30a915 (diff)
downloadpango-c5d4993ea27cce54763836ddf9c82ea33ac25afa.tar.gz
Patch from Qingjiang (Brian) Yuan and Changwoo Ryu to add support for
Fri Jul 26 19:23:58 2002 Owen Taylor <otaylor@redhat.com> * modules/hangul/hangul-x.c modules/hangul/tables-ksc5601.1: Patch from Qingjiang (Brian) Yuan and Changwoo Ryu to add support for ksc5601.1992-3 fonts.
Diffstat (limited to 'modules/hangul')
-rw-r--r--modules/hangul/hangul-x.c91
-rw-r--r--modules/hangul/tables-ksc5601.i50
2 files changed, 141 insertions, 0 deletions
diff --git a/modules/hangul/hangul-x.c b/modules/hangul/hangul-x.c
index d1308b6e..052f7a64 100644
--- a/modules/hangul/hangul-x.c
+++ b/modules/hangul/hangul-x.c
@@ -329,6 +329,82 @@ JOHAB_COMMON
}
static void
+render_syllable_with_ksx1005 (PangoFont *font, PangoXSubfont subfont,
+ gunichar2 *text, int length,
+ PangoGlyphString *glyphs,
+ 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;
+
+ lindex = text[0] - LBASE;
+ vindex = text[1] - VBASE;
+ tindex = text[2] - TBASE;
+
+ /* convert to JOHAB */
+
+ gindex = 0x8000 + (larray[lindex] << 10) + (varray[vindex] << 5) + tarray[tindex];
+
+ 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;
+ }
+
+ /* 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;
+
+ gindex = text[i];
+ for (j = 0; (j < 3) && (__jamo_to_ksc5601[gindex - LBASE][j] != 0); j++)
+ {
+ int index = __jamo_to_ksc5601[gindex - LBASE][j];
+ if (index >= 0x2400 && index < 0x2500)
+ index = 0xda80 + index % 256;
+ else /* 0x2300 - 0x2400 */
+ index = 0xda10 + index % 256;
+ pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
+ set_glyph (glyphs, *n_glyphs, font, subfont, index);
+ glyphs->log_clusters[*n_glyphs] = cluster_offset;
+ (*n_glyphs)++;
+ }
+ if (j == 0)
+ set_unknown_glyph (glyphs, n_glyphs, font, gindex, cluster_offset);
+ }
+}
+
+static void
render_syllable_with_iso10646 (PangoFont *font, PangoXSubfont subfont,
gunichar2 *text, int length,
PangoGlyphString *glyphs,
@@ -545,6 +621,12 @@ find_subfont (PangoFont *font, char **charsets, int n_charsets,
break;
}
}
+ else if (strcmp (charsets[subfont_charsets[i]], "ksc5601.1992-3") == 0)
+ {
+ *subfont = subfonts[i];
+ *render_func = render_syllable_with_ksx1005;
+ break;
+ }
else if (strcmp (charsets[subfont_charsets[i]], "ksc5601.1987-0") == 0)
{
*subfont = subfonts[i];
@@ -569,6 +651,7 @@ static char *secondary_charset[] = {
static char *fallback_charsets[] = {
"iso10646-1",
+ "ksc5601.1992-3",
"ksc5601.1987-0"
};
@@ -749,6 +832,14 @@ hangul_engine_get_coverage (PangoFont *font,
for (i=0; i<KSC5601_HANGUL; i++)
pango_coverage_set (result, __ksc5601_hangul_to_ucs[i], PANGO_COVERAGE_EXACT);
}
+ else if (render_func == render_syllable_with_ksx1005)
+ {
+ for (i = 0x1100; i <= 0x11ff; i++)
+ pango_coverage_set (result, i, PANGO_COVERAGE_EXACT);
+
+ for (i = 0xac00; i <= 0xd7a3; i++)
+ pango_coverage_set (result, i, PANGO_COVERAGE_EXACT);
+ }
else
g_assert_not_reached();
}
diff --git a/modules/hangul/tables-ksc5601.i b/modules/hangul/tables-ksc5601.i
index 3f5b818f..5f64052e 100644
--- a/modules/hangul/tables-ksc5601.i
+++ b/modules/hangul/tables-ksc5601.i
@@ -706,3 +706,53 @@ static guint16 __jamo_to_ksc5601[0x100][3] =
{0, 0, 0}
};
+
+/* mapping table used to convert indexes to JOHAB
+bit 43210 초 성 중 성 종 성
+00000 no code no code no code
+00001 file code no code file code
+00010 ㄱ file code ㄱ
+00011 ㄲ ㅏ ㄲ
+00100 ㄴ ㅐ ㄳ
+00101 ㄷ ㅑ ㄴ
+00110 ㄸ ㅒ ㄵ
+00111 ㄹ ㅓ ㄶ
+01000 ㅁ no code ㄷ
+01001 ㅂ no code ㄹ
+01010 ㅃ ㅔ ㄺ
+01011 ㅅ ㅕ ㄻ
+01100 ㅆ ㅖ ㄼ
+01101 ㅇ ㅗ ㄽ
+01110 ㅈ ㅘ ㄾ
+01111 ㅉ ㅙ ㄿ
+10000 ㅊ no code ㅀ
+10001 ㅋ no code ㅁ
+10010 ㅌ ㅚ no code
+10011 ㅍ ㅛ ㅂ
+10100 ㅎ ㅜ ㅄ
+10101 no code ㅝ ㅅ
+10110 no code ㅞ ㅆ
+10111 no code ㅟ ㅇ
+11000 no code no code ㅈ
+11001 no code no code ㅊ
+11010 no code ㅠ ㅋ
+11011 no code ㅡ ㅌ
+11100 no code ㅢ ㅍ
+11101 no code ㅣ ㅎ
+11110 no code no code no code
+11111 no code no code no code
+*/
+/* The following arrays are based on the above table: */
+static guint16 larray[32]=
+{
+2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,0,0,0,0,0,0,0,0,0,0,0,0,0
+};
+static guint16 varray[32]=
+{
+3,4,5,6,7,10,11,12,13,14,15,18,19,20,21,22,23,26,27,28,29,0,0,0,0,0,0,0,0,0,0,0
+};
+static guint16 tarray[32]=
+{
+1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,19,20,21,22,23,24,25,26,27,28,29,30,0,0
+};
+