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_INCLUDE_FXCRT_FX_UCD_H_ | |
8 #define CORE_INCLUDE_FXCRT_FX_UCD_H_ | |
9 | |
10 #include "core/include/fxcrt/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 FX_DWORD 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 FX_DWORD 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 | |
111 FX_BOOL FX_IsCtrlCode(FX_WCHAR ch); | |
112 FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, | |
113 FX_DWORD dwProps, | |
114 FX_BOOL bRTL, | |
115 FX_BOOL bVertical); | |
116 class CFX_Char { | |
117 public: | |
118 CFX_Char() | |
119 : m_wCharCode(0), | |
120 m_nBreakType(0), | |
121 m_nRotation(0), | |
122 m_dwCharProps(0), | |
123 m_dwCharStyles(0), | |
124 m_iCharWidth(0), | |
125 m_iHorizontalScale(100), | |
126 m_iVertialScale(100) {} | |
127 CFX_Char(uint16_t wCharCode, FX_DWORD dwCharProps) | |
128 : m_wCharCode(wCharCode), | |
129 m_nBreakType(0), | |
130 m_nRotation(0), | |
131 m_dwCharProps(dwCharProps), | |
132 m_dwCharStyles(0), | |
133 m_iCharWidth(0), | |
134 m_iHorizontalScale(100), | |
135 m_iVertialScale(100) {} | |
136 FX_DWORD GetCharType() const { return m_dwCharProps & FX_CHARTYPEBITSMASK; } | |
137 uint16_t m_wCharCode; | |
138 uint8_t m_nBreakType; | |
139 int8_t m_nRotation; | |
140 FX_DWORD m_dwCharProps; | |
141 FX_DWORD m_dwCharStyles; | |
142 int32_t m_iCharWidth; | |
143 int32_t m_iHorizontalScale; | |
144 int32_t m_iVertialScale; | |
145 }; | |
146 typedef CFX_ArrayTemplate<CFX_Char> CFX_CharArray; | |
147 class CFX_TxtChar : public CFX_Char { | |
148 public: | |
149 CFX_TxtChar() | |
150 : CFX_Char(), | |
151 m_dwStatus(0), | |
152 m_iBidiClass(0), | |
153 m_iBidiLevel(0), | |
154 m_iBidiPos(0), | |
155 m_iBidiOrder(0), | |
156 m_pUserData(NULL) {} | |
157 FX_DWORD m_dwStatus; | |
158 int16_t m_iBidiClass; | |
159 int16_t m_iBidiLevel; | |
160 int16_t m_iBidiPos; | |
161 int16_t m_iBidiOrder; | |
162 void* m_pUserData; | |
163 }; | |
164 typedef CFX_ArrayTemplate<CFX_TxtChar> CFX_TxtCharArray; | |
165 class CFX_RTFChar : public CFX_Char { | |
166 public: | |
167 CFX_RTFChar() | |
168 : CFX_Char(), | |
169 m_dwStatus(0), | |
170 m_iFontSize(0), | |
171 m_iFontHeight(0), | |
172 m_iBidiClass(0), | |
173 m_iBidiLevel(0), | |
174 m_iBidiPos(0), | |
175 m_dwLayoutStyles(0), | |
176 m_dwIdentity(0), | |
177 m_pUserData(NULL) {} | |
178 FX_DWORD m_dwStatus; | |
179 int32_t m_iFontSize; | |
180 int32_t m_iFontHeight; | |
181 int16_t m_iBidiClass; | |
182 int16_t m_iBidiLevel; | |
183 int16_t m_iBidiPos; | |
184 int16_t m_iBidiOrder; | |
185 FX_DWORD m_dwLayoutStyles; | |
186 FX_DWORD m_dwIdentity; | |
187 IFX_Unknown* m_pUserData; | |
188 }; | |
189 typedef CFX_ArrayTemplate<CFX_RTFChar> CFX_RTFCharArray; | |
190 #endif // PDF_ENABLE_XFA | |
191 | |
192 #endif // CORE_INCLUDE_FXCRT_FX_UCD_H_ | |
OLD | NEW |