summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChangwoo Ryu <cwryu@debian.org>2005-04-27 15:29:55 +0000
committerChangwoo Ryu <cwryu@src.gnome.org>2005-04-27 15:29:55 +0000
commit694935328ce9f43738df9354fbdc00246481f2ed (patch)
tree24fcc53c52a648487b69f1285d5ad66b6ac47da0
parentb818431d079e3a7d2f549ac84270acec397c462f (diff)
downloadpango-694935328ce9f43738df9354fbdc00246481f2ed.tar.gz
Cleanups.
2005-04-28 Changwoo Ryu <cwryu@debian.org> * modules/hangul/hangul-defs.h: Cleanups.
-rw-r--r--ChangeLog4
-rw-r--r--ChangeLog.pre-1-104
-rw-r--r--modules/hangul/hangul-defs.h55
3 files changed, 40 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index 80635141..fb679c17 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-04-28 Changwoo Ryu <cwryu@debian.org>
+
+ * modules/hangul/hangul-defs.h: Cleanups.
+
2005-04-25 Changwoo Ryu <cwryu@debian.org>
* modules/hangul/hangul-fc.c (render_basic): handles zero width
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index 80635141..fb679c17 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,7 @@
+2005-04-28 Changwoo Ryu <cwryu@debian.org>
+
+ * modules/hangul/hangul-defs.h: Cleanups.
+
2005-04-25 Changwoo Ryu <cwryu@debian.org>
* modules/hangul/hangul-fc.c (render_basic): handles zero width
diff --git a/modules/hangul/hangul-defs.h b/modules/hangul/hangul-defs.h
index 59ed4625..1c6512f8 100644
--- a/modules/hangul/hangul-defs.h
+++ b/modules/hangul/hangul-defs.h
@@ -1,7 +1,7 @@
/* Pango
* hangul-defs.h:
*
- * Copyright (C) 2002 Changwoo Ryu
+ * Copyright (C) 2002-2005 Changwoo Ryu
* Author: Changwoo Ryu <cwryu@debian.org>
*
* This library is free software; you can redistribute it and/or
@@ -20,50 +20,59 @@
* Boston, MA 02111-1307, USA.
*/
-/*
- * From 3.10 of the Unicode 2.0 Book; used for combining Jamos.
+/* See 3.12 "Conjoining Jamo Behavior" in the Unicode Book for more
+ * information
*/
+
+/* The start of the Hangul Syllables (U+AC00-U+D7A3) */
#define SBASE 0xAC00
+#define SCOUNT 11172
+
+/* The starts/ends of the leading consonants (choseong), the vowels
+ * (jungseong) and the trailing consonants (jongseong).
+ */
#define LBASE 0x1100
#define VBASE 0x1161
#define TBASE 0x11A7
-
#define LEND 0x115F
-#define VEND 0x11A6
+#define VEND 0x11A7
#define TEND 0x11FF
-#define SCOUNT 11172
+/* Number of modern jamos */
#define LCOUNT 19
#define VCOUNT 21
#define TCOUNT 28
-#define NCOUNT (VCOUNT * TCOUNT)
+#define NCOUNT (VCOUNT * TCOUNT) /* number of syllables of a given choseong */
-/*
- * Unicode 2.0 doesn't define the fill for trailing consonants, but
- * I'll use 0x11A7 as that purpose internally.
- */
+/* choseong and jungseong filler */
#define LFILL 0x115F
#define VFILL 0x1160
+/* Old tone marks. */
#define HTONE1 0x302E
#define HTONE2 0x302F
-#define IS_JAMO(wc) (wc >= LBASE && wc <= TEND)
-#define IS_L(wc) (wc >= LBASE && wc <= LEND)
-#define IS_V(wc) (wc >= VFILL && wc <= VEND)
-#define IS_T(wc) (wc > TBASE && wc <= TEND)
-#define IS_M(wc) (wc == HTONE1 || wc == HTONE2)
+/* Useful macros
+ */
-/* 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 IS_JAMO(wc) ((wc) >= LBASE && (wc) <= TEND)
+#define IS_L(wc) ((wc) >= LBASE && (wc) <= LEND)
+#define IS_V(wc) ((wc) >= VFILL && (wc) <= VEND)
+#define IS_T(wc) ((wc) > TBASE && (wc) <= TEND)
+#define IS_M(wc) ((wc) == HTONE1 || (wc) == HTONE2)
+#define IS_S(wc) (SBASE <= (wc) && (wc) < (SBASE + SCOUNT))
+
+/* jamo which can be composited as a precomposed 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))
+
+/* if a syllable has a jongseong */
+#define S_HAS_T(s) (((s) - SBASE) % TCOUNT)
+/* composing/decomposing */
#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))
-
-#define IS_S(wc) (SBASE <= (wc) && (wc) < (SBASE + SCOUNT))
-#define S_HAS_T(s) (((s) - SBASE) % TCOUNT)