1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef CORE_FXCRT_FX_UNICODE_H_
8 #define CORE_FXCRT_FX_UNICODE_H_
9 
10 #include "core/fxcrt/fx_system.h"
11 
12 // NOTE: Order matters, less-than/greater-than comparisons are used.
13 enum class FX_BIDICLASS : uint8_t {
14   kON = 0,    // Other Neutral
15   kL = 1,     // Left Letter
16   kR = 2,     // Right Letter
17   kAN = 3,    // Arabic Number
18   kEN = 4,    // European Number
19   kAL = 5,    // Arabic Letter
20   kNSM = 6,   // Non-spacing Mark
21   kCS = 7,    // Common Number Separator
22   kES = 8,    // European Separator
23   kET = 9,    // European Number Terminator
24   kBN = 10,   // Boundary Neutral
25   kS = 11,    // Segment Separator
26   kWS = 12,   // Whitespace
27   kB = 13,    // Paragraph Separator
28   kRLO = 14,  // Right-to-Left Override
29   kRLE = 15,  // Right-to-Left Embedding
30   kLRO = 16,  // Left-to-Right Override
31   kLRE = 17,  // Left-to-Right Embedding
32   kPDF = 18,  // Pop Directional Format
33   kN = kON,
34 };
35 
36 wchar_t FX_GetMirrorChar(wchar_t wch);
37 FX_BIDICLASS FX_GetBidiClass(wchar_t wch);
38 
39 #ifdef PDF_ENABLE_XFA
40 // As defined in http://www.unicode.org/reports/tr14
41 enum class FX_BREAKPROPERTY : uint8_t {
42   kOP = 0,
43   kCL = 1,
44   kQU = 2,
45   kGL = 3,
46   kNS = 4,
47   kEX = 5,
48   kSY = 6,
49   kIS = 7,
50   kPR = 8,
51   kPO = 9,
52   kNU = 10,
53   kAL = 11,
54   kID = 12,
55   kIN = 13,
56   kHY = 14,
57   kBA = 15,
58   kBB = 16,
59   kB2 = 17,
60   kZW = 18,
61   kCM = 19,
62   kWJ = 20,
63   kH2 = 21,
64   kH3 = 22,
65   kJL = 23,
66   kJV = 24,
67   kJT = 25,
68   kBK = 26,
69   kCR = 27,
70   kLF = 28,
71   kNL = 29,
72   kSA = 30,
73   kSG = 31,
74   kCB = 32,
75   kXX = 33,
76   kAI = 34,
77   kSP = 35,
78   kNONE = 36,
79   kTB = 37,
80 };
81 
82 enum class FX_CHARTYPE : uint8_t {
83   kUnknown = 0,
84   kTab,
85   kSpace,
86   kControl,
87   kCombination,
88   kNumeric,
89   kNormal,
90   kArabicAlef,
91   kArabicSpecial,
92   kArabicDistortion,
93   kArabicNormal,
94   kArabicForm,
95   kArabic,
96 };
97 
98 FX_CHARTYPE FX_GetCharType(wchar_t wch);
99 
100 // Analagous to ULineBreak in icu's uchar.h, but permuted order, and a
101 // subset lacking some more recent additions.
102 FX_BREAKPROPERTY FX_GetBreakProperty(wchar_t wch);
103 #endif  // PDF_ENABLE_XFA
104 
105 #endif  // CORE_FXCRT_FX_UNICODE_H_
106