OLD | NEW |
| (Empty) |
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_INCLUDE_FX_UCD_H_ | |
8 #define CORE_FXCRT_INCLUDE_FX_UCD_H_ | |
9 | |
10 #include "core/fxcrt/include/fx_basic.h" | |
11 | |
12 #define FX_BIDICLASSBITS 6 | |
13 #define FX_BIDICLASSBITSMASK (31 << FX_BIDICLASSBITS) | |
14 | |
15 enum FX_BIDICLASS { | |
16 FX_BIDICLASS_ON = 0, // Other Neutral | |
17 FX_BIDICLASS_L = 1, // Left Letter | |
18 FX_BIDICLASS_R = 2, // Right Letter | |
19 FX_BIDICLASS_AN = 3, // Arabic Number | |
20 FX_BIDICLASS_EN = 4, // European Number | |
21 FX_BIDICLASS_AL = 5, // Arabic Letter | |
22 FX_BIDICLASS_NSM = 6, // Non-spacing Mark | |
23 FX_BIDICLASS_CS = 7, // Common Number Separator | |
24 FX_BIDICLASS_ES = 8, // European Separator | |
25 FX_BIDICLASS_ET = 9, // European Number Terminator | |
26 FX_BIDICLASS_BN = 10, // Boundary Neutral | |
27 FX_BIDICLASS_S = 11, // Segment Separator | |
28 FX_BIDICLASS_WS = 12, // Whitespace | |
29 FX_BIDICLASS_B = 13, // Paragraph Separator | |
30 FX_BIDICLASS_RLO = 14, // Right-to-Left Override | |
31 FX_BIDICLASS_RLE = 15, // Right-to-Left Embedding | |
32 FX_BIDICLASS_LRO = 16, // Left-to-Right Override | |
33 FX_BIDICLASS_LRE = 17, // Left-to-Right Embedding | |
34 FX_BIDICLASS_PDF = 18, // Pop Directional Format | |
35 FX_BIDICLASS_N = FX_BIDICLASS_ON, | |
36 }; | |
37 | |
38 extern const uint32_t kTextLayoutCodeProperties[]; | |
39 extern const size_t kTextLayoutCodePropertiesSize; | |
40 | |
41 extern const uint16_t kFXTextLayoutVerticalMirror[]; | |
42 extern const size_t kFXTextLayoutVerticalMirrorSize; | |
43 | |
44 extern const uint16_t kFXTextLayoutBidiMirror[]; | |
45 extern const size_t kFXTextLayoutBidiMirrorSize; | |
46 | |
47 uint32_t FX_GetUnicodeProperties(FX_WCHAR wch); | |
48 FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical); | |
49 | |
50 #ifdef PDF_ENABLE_XFA | |
51 enum FX_CHARBREAKPROP { | |
52 FX_CBP_OP = 0, | |
53 FX_CBP_CL = 1, | |
54 FX_CBP_QU = 2, | |
55 FX_CBP_GL = 3, | |
56 FX_CBP_NS = 4, | |
57 FX_CBP_EX = 5, | |
58 FX_CBP_SY = 6, | |
59 FX_CBP_IS = 7, | |
60 FX_CBP_PR = 8, | |
61 FX_CBP_PO = 9, | |
62 FX_CBP_NU = 10, | |
63 FX_CBP_AL = 11, | |
64 FX_CBP_ID = 12, | |
65 FX_CBP_IN = 13, | |
66 FX_CBP_HY = 14, | |
67 FX_CBP_BA = 15, | |
68 FX_CBP_BB = 16, | |
69 FX_CBP_B2 = 17, | |
70 FX_CBP_ZW = 18, | |
71 FX_CBP_CM = 19, | |
72 FX_CBP_WJ = 20, | |
73 FX_CBP_H2 = 21, | |
74 FX_CBP_H3 = 22, | |
75 FX_CBP_JL = 23, | |
76 FX_CBP_JV = 24, | |
77 FX_CBP_JT = 25, | |
78 | |
79 FX_CBP_BK = 26, | |
80 FX_CBP_CR = 27, | |
81 FX_CBP_LF = 28, | |
82 FX_CBP_NL = 29, | |
83 FX_CBP_SA = 30, | |
84 FX_CBP_SG = 31, | |
85 FX_CBP_CB = 32, | |
86 FX_CBP_XX = 33, | |
87 FX_CBP_AI = 34, | |
88 FX_CBP_SP = 35, | |
89 FX_CBP_TB = 37, | |
90 FX_CBP_NONE = 36, | |
91 }; | |
92 | |
93 #define FX_CHARTYPEBITS 11 | |
94 #define FX_CHARTYPEBITSMASK (15 << FX_CHARTYPEBITS) | |
95 enum FX_CHARTYPE { | |
96 FX_CHARTYPE_Unknown = 0, | |
97 FX_CHARTYPE_Tab = (1 << FX_CHARTYPEBITS), | |
98 FX_CHARTYPE_Space = (2 << FX_CHARTYPEBITS), | |
99 FX_CHARTYPE_Control = (3 << FX_CHARTYPEBITS), | |
100 FX_CHARTYPE_Combination = (4 << FX_CHARTYPEBITS), | |
101 FX_CHARTYPE_Numeric = (5 << FX_CHARTYPEBITS), | |
102 FX_CHARTYPE_Normal = (6 << FX_CHARTYPEBITS), | |
103 FX_CHARTYPE_ArabicAlef = (7 << FX_CHARTYPEBITS), | |
104 FX_CHARTYPE_ArabicSpecial = (8 << FX_CHARTYPEBITS), | |
105 FX_CHARTYPE_ArabicDistortion = (9 << FX_CHARTYPEBITS), | |
106 FX_CHARTYPE_ArabicNormal = (10 << FX_CHARTYPEBITS), | |
107 FX_CHARTYPE_ArabicForm = (11 << FX_CHARTYPEBITS), | |
108 FX_CHARTYPE_Arabic = (12 << FX_CHARTYPEBITS), | |
109 }; | |
110 inline FX_CHARTYPE GetCharTypeFromProp(uint32_t prop) { | |
111 return static_cast<FX_CHARTYPE>(prop & FX_CHARTYPEBITSMASK); | |
112 } | |
113 | |
114 FX_BOOL FX_IsCtrlCode(FX_WCHAR ch); | |
115 FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, | |
116 uint32_t dwProps, | |
117 FX_BOOL bRTL, | |
118 FX_BOOL bVertical); | |
119 class CFX_Char { | |
120 public: | |
121 CFX_Char() | |
122 : m_wCharCode(0), | |
123 m_nBreakType(0), | |
124 m_nRotation(0), | |
125 m_dwCharProps(0), | |
126 m_dwCharStyles(0), | |
127 m_iCharWidth(0), | |
128 m_iHorizontalScale(100), | |
129 m_iVertialScale(100) {} | |
130 CFX_Char(uint16_t wCharCode, uint32_t dwCharProps) | |
131 : m_wCharCode(wCharCode), | |
132 m_nBreakType(0), | |
133 m_nRotation(0), | |
134 m_dwCharProps(dwCharProps), | |
135 m_dwCharStyles(0), | |
136 m_iCharWidth(0), | |
137 m_iHorizontalScale(100), | |
138 m_iVertialScale(100) {} | |
139 | |
140 FX_CHARTYPE GetCharType() const { return GetCharTypeFromProp(m_dwCharProps); } | |
141 | |
142 uint16_t m_wCharCode; | |
143 uint8_t m_nBreakType; | |
144 int8_t m_nRotation; | |
145 uint32_t m_dwCharProps; | |
146 uint32_t m_dwCharStyles; | |
147 int32_t m_iCharWidth; | |
148 int32_t m_iHorizontalScale; | |
149 int32_t m_iVertialScale; | |
150 }; | |
151 typedef CFX_ArrayTemplate<CFX_Char> CFX_CharArray; | |
152 class CFX_TxtChar : public CFX_Char { | |
153 public: | |
154 CFX_TxtChar() | |
155 : m_dwStatus(0), | |
156 m_iBidiClass(0), | |
157 m_iBidiLevel(0), | |
158 m_iBidiPos(0), | |
159 m_iBidiOrder(0), | |
160 m_pUserData(nullptr) {} | |
161 uint32_t m_dwStatus; | |
162 int16_t m_iBidiClass; | |
163 int16_t m_iBidiLevel; | |
164 int16_t m_iBidiPos; | |
165 int16_t m_iBidiOrder; | |
166 void* m_pUserData; | |
167 }; | |
168 typedef CFX_ArrayTemplate<CFX_TxtChar> CFX_TxtCharArray; | |
169 class CFX_RTFChar : public CFX_Char { | |
170 public: | |
171 CFX_RTFChar(); | |
172 CFX_RTFChar(const CFX_RTFChar& other); | |
173 | |
174 uint32_t m_dwStatus; | |
175 int32_t m_iFontSize; | |
176 int32_t m_iFontHeight; | |
177 int16_t m_iBidiClass; | |
178 int16_t m_iBidiLevel; | |
179 int16_t m_iBidiPos; | |
180 int16_t m_iBidiOrder; | |
181 uint32_t m_dwLayoutStyles; | |
182 uint32_t m_dwIdentity; | |
183 IFX_Retainable* m_pUserData; | |
184 }; | |
185 | |
186 inline CFX_RTFChar::CFX_RTFChar() | |
187 : m_dwStatus(0), | |
188 m_iFontSize(0), | |
189 m_iFontHeight(0), | |
190 m_iBidiClass(0), | |
191 m_iBidiLevel(0), | |
192 m_iBidiPos(0), | |
193 m_dwLayoutStyles(0), | |
194 m_dwIdentity(0), | |
195 m_pUserData(nullptr) {} | |
196 | |
197 inline CFX_RTFChar::CFX_RTFChar(const CFX_RTFChar& other) = default; | |
198 | |
199 typedef CFX_ArrayTemplate<CFX_RTFChar> CFX_RTFCharArray; | |
200 #endif // PDF_ENABLE_XFA | |
201 | |
202 #endif // CORE_FXCRT_INCLUDE_FX_UCD_H_ | |
OLD | NEW |