Add more unicode code point ranges

This commit is contained in:
toasted-nutbread 2020-03-14 16:11:07 -04:00
parent 0f15cca2df
commit 264820f208

View File

@ -84,9 +84,24 @@ const jp = (() => {
const KATAKANA_RANGE = [0x30a0, 0x30ff]; const KATAKANA_RANGE = [0x30a0, 0x30ff];
const KANA_RANGES = [HIRAGANA_RANGE, KATAKANA_RANGE]; const KANA_RANGES = [HIRAGANA_RANGE, KATAKANA_RANGE];
const CJK_COMMON_RANGE = [0x4e00, 0x9fff]; const CJK_UNIFIED_IDEOGRAPHS_RANGE = [0x4e00, 0x9fff];
const CJK_RARE_RANGE = [0x3400, 0x4dbf]; const CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A_RANGE = [0x3400, 0x4dbf];
const CJK_RANGES = [CJK_COMMON_RANGE, CJK_RARE_RANGE]; const CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B_RANGE = [0x20000, 0x2a6df];
const CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C_RANGE = [0x2a700, 0x2b73f];
const CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D_RANGE = [0x2b740, 0x2b81f];
const CJK_UNIFIED_IDEOGRAPHS_EXTENSION_E_RANGE = [0x2b820, 0x2ceaf];
const CJK_UNIFIED_IDEOGRAPHS_EXTENSION_F_RANGE = [0x2ceb0, 0x2ebef];
const CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT_RANGE = [0x2f800, 0x2fa1f];
const CJK_UNIFIED_IDEOGRAPHS_RANGES = [
CJK_UNIFIED_IDEOGRAPHS_RANGE,
CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A_RANGE,
CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B_RANGE,
CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C_RANGE,
CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D_RANGE,
CJK_UNIFIED_IDEOGRAPHS_EXTENSION_E_RANGE,
CJK_UNIFIED_IDEOGRAPHS_EXTENSION_F_RANGE,
CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT_RANGE
];
const ITERATION_MARK_CODE_POINT = 0x3005; const ITERATION_MARK_CODE_POINT = 0x3005;
@ -95,8 +110,7 @@ const jp = (() => {
HIRAGANA_RANGE, HIRAGANA_RANGE,
KATAKANA_RANGE, KATAKANA_RANGE,
CJK_COMMON_RANGE, ...CJK_UNIFIED_IDEOGRAPHS_RANGES,
CJK_RARE_RANGE,
[0xff66, 0xff9f], // Halfwidth katakana [0xff66, 0xff9f], // Halfwidth katakana
@ -119,7 +133,7 @@ const jp = (() => {
// Character code testing functions // Character code testing functions
function isCodePointKanji(codePoint) { function isCodePointKanji(codePoint) {
return isCodePointInRanges(codePoint, CJK_RANGES); return isCodePointInRanges(codePoint, CJK_UNIFIED_IDEOGRAPHS_RANGES);
} }
function isCodePointKana(codePoint) { function isCodePointKana(codePoint) {