xref: /reactos/sdk/include/reactos/cjkcode.h (revision 726c46d2)
1 /*
2  * PROJECT:     ReactOS header
3  * LICENSE:     LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later)
4  * PURPOSE:     Encoding, charsets and codepages for Chinese, Japanese and Korean (CJK)
5  * COPYRIGHT:   Copyright 2017-2022 Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
6                 Copyright 2017-2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
7  */
8 
9 #pragma once
10 
11 #define CP_SHIFTJIS 932  // Japanese Shift-JIS
12 #define CP_HANGUL   949  // Korean Hangul/Wansung
13 #define CP_JOHAB    1361 // Korean Johab
14 #define CP_GB2312   936  // Chinese Simplified (GB2312)
15 #define CP_BIG5     950  // Chinese Traditional (Big5)
16 
17 /*
18  * "Human-understandable" names for the previous standard code pages.
19  * Taken from https://github.com/microsoft/terminal/blob/main/src/inc/unicode.hpp
20  */
21 #define CP_JAPANESE             CP_SHIFTJIS
22 #define CP_KOREAN               CP_HANGUL
23 #define CP_CHINESE_SIMPLIFIED   CP_GB2312
24 #define CP_CHINESE_TRADITIONAL  CP_BIG5
25 
26 /* IsFarEastCP(CodePage) */
27 #define IsCJKCodePage(CodePage) \
28     ((CodePage) == CP_SHIFTJIS || (CodePage) == CP_HANGUL || \
29   /* (CodePage) == CP_JOHAB || */ \
30      (CodePage) == CP_BIG5     || (CodePage) == CP_GB2312)
31 
32 #if !defined(_WINGDI_) || defined(NOGDI)
33 #define SHIFTJIS_CHARSET    128
34 #define HANGEUL_CHARSET     129
35 #define HANGUL_CHARSET      129 // HANGEUL_CHARSET
36 #if (WINVER >= 0x0400)
37 #define JOHAB_CHARSET       130
38 #endif /* WINVER */
39 #define GB2312_CHARSET      134
40 #define CHINESEBIG5_CHARSET 136
41 #endif /* !defined(_WINGDI_) || defined(NOGDI) */
42 
43 /* IsAnyDBCSCharSet(CharSet) */
44 #define IsCJKCharSet(CharSet)   \
45     ((CharSet) == SHIFTJIS_CHARSET || (CharSet) == HANGUL_CHARSET || \
46   /* (CharSet) == JOHAB_CHARSET || */ \
47      (CharSet) == GB2312_CHARSET   || (CharSet) == CHINESEBIG5_CHARSET)
48