#include "cjk.h"
-/*
- * Non-spacing attribute table.
- * Consists of:
- * - Non-spacing characters; generated from PropList.txt or
- * "grep '^[^;]*;[^;]*;[^;]*;[^;]*;NSM;' UnicodeData.txt"
- * - Format control characters; generated from
- * "grep '^[^;]*;[^;]*;Cf;' UnicodeData.txt"
- * - Zero width characters; generated from
- * "grep '^[^;]*;ZERO WIDTH ' UnicodeData.txt"
+/* The non-spacing attribute table consists of:
+ * Non-spacing characters; generated from PropList.txt or
+ "grep '^[^;]*;[^;]*;[^;]*;[^;]*;NSM;' UnicodeData.txt"
+ * Format control characters; generated from
+ "grep '^[^;]*;[^;]*;Cf;' UnicodeData.txt"
+ * Zero width characters; generated from
+ "grep '^[^;]*;ZERO WIDTH ' UnicodeData.txt"
+ * Hangul Jamo characters that have conjoining behaviour:
+ - jungseong = syllable-middle vowels
+ - jongseong = syllable-final consonants
+ Rationale:
+ 1) These characters act like combining characters. They have no
+ equivalent in legacy character sets. Therefore the EastAsianWidth.txt
+ file does not really matter for them; UAX #11 East Asian Width
+ <https://www.unicode.org/reports/tr11/> makes it clear that it focus
+ is on compatibility with traditional Japanese layout.
+ By contrast, the same glyphs without conjoining behaviour are available
+ in the U+3130..U+318F block, and these characters are mapped to legacy
+ character sets, and traditional Japanese layout matters for them.
+ 2) glibc does the same thing, see
+ <https://sourceware.org/bugzilla/show_bug.cgi?id=21750>
+ <https://sourceware.org/bugzilla/show_bug.cgi?id=26120>
*/
-static const unsigned char nonspacing_table_data[39*64] = {
+static const unsigned char nonspacing_table_data[40*64] = {
/* 0x0000-0x01ff */
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, /* 0x0000-0x003f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0x0040-0x007f */
0x64, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, /* 0x1080-0x10bf */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10c0-0x10ff */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1100-0x113f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1140-0x117f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1180-0x11bf */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11c0-0x11ff */
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, /* 0x1140-0x117f */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x1180-0x11bf */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x11c0-0x11ff */
/* 0x1200-0x13ff */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1200-0x123f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1240-0x127f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xab40-0xab7f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xab80-0xabbf */
0x00, 0x00, 0x00, 0x00, 0x20, 0x21, 0x00, 0x00, /* 0xabc0-0xabff */
+ /* 0xd600-0xd7ff */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd600-0xd63f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd640-0xd67f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd680-0xd6bf */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd6c0-0xd6ff */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd700-0xd73f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd740-0xd77f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, /* 0xd780-0xd7bf */
+ 0x7f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, /* 0xd7c0-0xd7ff */
/* 0xfa00-0xfbff */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa00-0xfa3f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa40-0xfa7f */
-1, -1, -1, 17, 18, 19, -1, -1, /* 0xa000-0xafff */
-1, -1, -1, -1, -1, -1, -1, -1, /* 0xb000-0xbfff */
-1, -1, -1, -1, -1, -1, -1, -1, /* 0xc000-0xcfff */
- -1, -1, -1, -1, -1, -1, -1, -1, /* 0xd000-0xdfff */
+ -1, -1, -1, 20, -1, -1, -1, -1, /* 0xd000-0xdfff */
-1, -1, -1, -1, -1, -1, -1, -1, /* 0xe000-0xefff */
- -1, -1, -1, -1, -1, 20, -1, 21, /* 0xf000-0xffff */
- 22, 23, -1, -1, -1, 24, -1, -1, /* 0x10000-0x10fff */
- 25, 26, 27, 28, -1, 29, 30, -1, /* 0x11000-0x11fff */
+ -1, -1, -1, -1, -1, 21, -1, 22, /* 0xf000-0xffff */
+ 23, 24, -1, -1, -1, 25, -1, -1, /* 0x10000-0x10fff */
+ 26, 27, 28, 29, -1, 30, 31, -1, /* 0x11000-0x11fff */
-1, -1, -1, -1, -1, -1, -1, -1, /* 0x12000-0x12fff */
-1, -1, -1, -1, -1, -1, -1, -1, /* 0x13000-0x13fff */
-1, -1, -1, -1, -1, -1, -1, -1, /* 0x14000-0x14fff */
-1, -1, -1, -1, -1, -1, -1, -1, /* 0x15000-0x15fff */
- -1, -1, -1, -1, -1, 31, -1, 32, /* 0x16000-0x16fff */
+ -1, -1, -1, -1, -1, 32, -1, 33, /* 0x16000-0x16fff */
-1, -1, -1, -1, -1, -1, -1, -1, /* 0x17000-0x17fff */
-1, -1, -1, -1, -1, -1, -1, -1, /* 0x18000-0x18fff */
-1, -1, -1, -1, -1, -1, -1, -1, /* 0x19000-0x19fff */
-1, -1, -1, -1, -1, -1, -1, -1, /* 0x1a000-0x1afff */
- -1, -1, -1, -1, -1, -1, 33, -1, /* 0x1b000-0x1bfff */
+ -1, -1, -1, -1, -1, -1, 34, -1, /* 0x1b000-0x1bfff */
-1, -1, -1, -1, -1, -1, -1, -1, /* 0x1c000-0x1cfff */
- 34, 35, -1, -1, -1, 36, -1, -1, /* 0x1d000-0x1dfff */
- 37, -1, -1, -1, 38, -1, -1, -1 /* 0x1e000-0x1efff */
+ 35, 36, -1, -1, -1, 37, -1, -1, /* 0x1d000-0x1dfff */
+ 38, -1, -1, -1, 39, -1, -1, -1 /* 0x1e000-0x1efff */
};
/* Determine number of column positions required for UC. */