| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef CORE_SRC_FXCRT_FX_ARABIC_H_ | 7 #ifndef CORE_SRC_FXCRT_FX_ARABIC_H_ |
| 8 #define CORE_SRC_FXCRT_FX_ARABIC_H_ | 8 #define CORE_SRC_FXCRT_FX_ARABIC_H_ |
| 9 | 9 |
| 10 typedef struct _FX_ARABICCHARRANGE { | 10 typedef struct _FX_ARABICCHARRANGE { |
| 11 FX_WCHAR wStart; | 11 FX_WCHAR wStart; |
| 12 FX_WCHAR wEnd; | 12 FX_WCHAR wEnd; |
| 13 } FX_ARABICCHARRANGE; | 13 } FX_ARABICCHARRANGE; |
| 14 class CFX_ArabicChar : public IFX_ArabicChar | 14 class CFX_ArabicChar : public IFX_ArabicChar |
| 15 { | 15 { |
| 16 public: | 16 public: |
| 17 virtual void Release() | 17 virtual void Release() |
| 18 { | 18 { |
| 19 delete this; | 19 delete this; |
| 20 } | 20 } |
| 21 virtual FX_BOOL IsArabicChar(FX_WCHAR wch) const; | 21 virtual FX_BOOL IsArabicChar(FX_WCHAR wch) const; |
| 22 virtual FX_BOOL IsArabicFormChar(FX_WCHAR wch) const; | 22 virtual FX_BOOL IsArabicFormChar(FX_WCHAR wch) const; |
| 23 | 23 |
| 24 virtual FX_WCHAR GetFormChar(FX_WCHAR wch, FX_WCHAR prev = 0, FX_WCHAR ne
xt = 0) const; | 24 virtual FX_WCHAR GetFormChar(FX_WCHAR wch, FX_WCHAR prev = 0, FX_WCHAR ne
xt = 0) const; |
| 25 virtual FX_WCHAR GetFormChar(const CFX_Char *cur, const CFX_Char *prev, c
onst CFX_Char *next) const; | 25 virtual FX_WCHAR GetFormChar(const CFX_Char *cur, const CFX_Char *prev, c
onst CFX_Char *next) const; |
| 26 protected: | 26 protected: |
| 27 FX_LPCARBFORMTABLE ParseChar(const CFX_Char *pTC, FX_WCHAR &wChar, FX_CHARTY
PE &eType) const; | 27 FX_LPCARBFORMTABLE ParseChar(const CFX_Char *pTC, FX_WCHAR &wChar, FX_CHARTY
PE &eType) const; |
| 28 }; | 28 }; |
| 29 void FX_BidiReverseString(CFX_WideString &wsText, FX_INT32 iStart, FX_INT32 iCou
nt); | 29 void FX_BidiReverseString(CFX_WideString &wsText, int32_t iStart, int32_t iCount
); |
| 30 void FX_BidiSetDeferredRun(CFX_Int32Array &values, FX_INT32 iStart, FX_INT32 iCo
unt, FX_INT32 iValue); | 30 void FX_BidiSetDeferredRun(CFX_Int32Array &values, int32_t iStart, int32_t iCoun
t, int32_t iValue); |
| 31 #define FX_BCON FX_BIDICLASS_ON | 31 #define FX_BCON FX_BIDICLASS_ON |
| 32 #define FX_BCL FX_BIDICLASS_L | 32 #define FX_BCL FX_BIDICLASS_L |
| 33 #define FX_BCR FX_BIDICLASS_R | 33 #define FX_BCR FX_BIDICLASS_R |
| 34 #define FX_BCAN FX_BIDICLASS_AN | 34 #define FX_BCAN FX_BIDICLASS_AN |
| 35 #define FX_BCEN FX_BIDICLASS_EN | 35 #define FX_BCEN FX_BIDICLASS_EN |
| 36 #define FX_BCAL FX_BIDICLASS_AL | 36 #define FX_BCAL FX_BIDICLASS_AL |
| 37 #define FX_BCNSM FX_BIDICLASS_NSM | 37 #define FX_BCNSM FX_BIDICLASS_NSM |
| 38 #define FX_BCCS FX_BIDICLASS_CS | 38 #define FX_BCCS FX_BIDICLASS_CS |
| 39 #define FX_BCES FX_BIDICLASS_ES | 39 #define FX_BCES FX_BIDICLASS_ES |
| 40 #define FX_BCET FX_BIDICLASS_ET | 40 #define FX_BCET FX_BIDICLASS_ET |
| 41 #define FX_BCBN FX_BIDICLASS_BN | 41 #define FX_BCBN FX_BIDICLASS_BN |
| 42 #define FX_BCS FX_BIDICLASS_S | 42 #define FX_BCS FX_BIDICLASS_S |
| 43 #define FX_BCWS FX_BIDICLASS_WS | 43 #define FX_BCWS FX_BIDICLASS_WS |
| 44 #define FX_BCB FX_BIDICLASS_B | 44 #define FX_BCB FX_BIDICLASS_B |
| 45 #define FX_BCRLO FX_BIDICLASS_RLO | 45 #define FX_BCRLO FX_BIDICLASS_RLO |
| 46 #define FX_BCRLE FX_BIDICLASS_RLE | 46 #define FX_BCRLE FX_BIDICLASS_RLE |
| 47 #define FX_BCLRO FX_BIDICLASS_LRO | 47 #define FX_BCLRO FX_BIDICLASS_LRO |
| 48 #define FX_BCLRE FX_BIDICLASS_LRE | 48 #define FX_BCLRE FX_BIDICLASS_LRE |
| 49 #define FX_BCPDF FX_BIDICLASS_PDF | 49 #define FX_BCPDF FX_BIDICLASS_PDF |
| 50 #define FX_BCN FX_BIDICLASS_N | 50 #define FX_BCN FX_BIDICLASS_N |
| 51 void FX_BidiClassify(const CFX_WideString &wsText, CFX_Int32Array &classes, FX_B
OOL bWS = FALSE); | 51 void FX_BidiClassify(const CFX_WideString &wsText, CFX_Int32Array &classes, FX_B
OOL bWS = FALSE); |
| 52 #define FX_BIDIMAXLEVEL 61 | 52 #define FX_BIDIMAXLEVEL 61 |
| 53 #define FX_BidiGreaterEven(a) (FX_IsOdd(a) ? ((a) + 1) : ((a) + 2)) | 53 #define FX_BidiGreaterEven(a) (FX_IsOdd(a) ? ((a) + 1) : ((a) + 2)) |
| 54 #define FX_BidiGreaterOdd(a) (FX_IsOdd(a) ? ((a) + 2) : ((a) + 1)) | 54 #define FX_BidiGreaterOdd(a) (FX_IsOdd(a) ? ((a) + 2) : ((a) + 1)) |
| 55 FX_INT32 FX_BidiResolveExplicit(FX_INT32 iBaseLevel, FX_INT32 iDirection, CFX_In
t32Array &classes, CFX_Int32Array &levels, FX_INT32 iStart, FX_INT32 iCount, FX_
INT32 iNest = 0); | 55 int32_t FX_BidiResolveExplicit(int32_t iBaseLevel, int32_t iDirection, CFX_Int32
Array &classes, CFX_Int32Array &levels, int32_t iStart, int32_t iCount, int32_t
iNest = 0); |
| 56 #define FX_BidiDirection(a) (FX_IsOdd(a) ? FX_BIDICLASS_R : FX_BIDICLASS_L) | 56 #define FX_BidiDirection(a) (FX_IsOdd(a) ? FX_BIDICLASS_R : FX_BIDICLASS_L) |
| 57 enum FX_BIDIWEAKSTATE { | 57 enum FX_BIDIWEAKSTATE { |
| 58 FX_BIDIWEAKSTATE_xa = 0, | 58 FX_BIDIWEAKSTATE_xa = 0, |
| 59 FX_BIDIWEAKSTATE_xr, | 59 FX_BIDIWEAKSTATE_xr, |
| 60 FX_BIDIWEAKSTATE_xl, | 60 FX_BIDIWEAKSTATE_xl, |
| 61 FX_BIDIWEAKSTATE_ao, | 61 FX_BIDIWEAKSTATE_ao, |
| 62 FX_BIDIWEAKSTATE_ro, | 62 FX_BIDIWEAKSTATE_ro, |
| 63 FX_BIDIWEAKSTATE_lo, | 63 FX_BIDIWEAKSTATE_lo, |
| 64 FX_BIDIWEAKSTATE_rt, | 64 FX_BIDIWEAKSTATE_rt, |
| 65 FX_BIDIWEAKSTATE_lt, | 65 FX_BIDIWEAKSTATE_lt, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 #define FX_BWANxR FX_BIDIWEAKACTION_NxR | 137 #define FX_BWANxR FX_BIDIWEAKACTION_NxR |
| 138 #define FX_BWANxE FX_BIDIWEAKACTION_NxE | 138 #define FX_BWANxE FX_BIDIWEAKACTION_NxE |
| 139 #define FX_BWAAxA FX_BIDIWEAKACTION_AxA | 139 #define FX_BWAAxA FX_BIDIWEAKACTION_AxA |
| 140 #define FX_BWANxL FX_BIDIWEAKACTION_NxL | 140 #define FX_BWANxL FX_BIDIWEAKACTION_NxL |
| 141 #define FX_BWALxL FX_BIDIWEAKACTION_LxL | 141 #define FX_BWALxL FX_BIDIWEAKACTION_LxL |
| 142 #define FX_BWAxIL FX_BIDIWEAKACTION_xIL | 142 #define FX_BWAxIL FX_BIDIWEAKACTION_xIL |
| 143 #define FX_BWAAxR FX_BIDIWEAKACTION_AxR | 143 #define FX_BWAAxR FX_BIDIWEAKACTION_AxR |
| 144 #define FX_BWALxx FX_BIDIWEAKACTION_Lxx | 144 #define FX_BWALxx FX_BIDIWEAKACTION_Lxx |
| 145 #define FX_BidiGetDeferredType(a) (((a) >> 4) & 0x0F) | 145 #define FX_BidiGetDeferredType(a) (((a) >> 4) & 0x0F) |
| 146 #define FX_BidiGetResolvedType(a) ((a) & 0x0F) | 146 #define FX_BidiGetResolvedType(a) ((a) & 0x0F) |
| 147 void FX_BidiResolveWeak(FX_INT32 iBaseLevel, CFX_Int32Array &classes, CFX_Int32A
rray &levels); | 147 void FX_BidiResolveWeak(int32_t iBaseLevel, CFX_Int32Array &classes, CFX_Int32Ar
ray &levels); |
| 148 enum FX_BIDINEUTRALSTATE { | 148 enum FX_BIDINEUTRALSTATE { |
| 149 FX_BIDINEUTRALSTATE_r = 0, | 149 FX_BIDINEUTRALSTATE_r = 0, |
| 150 FX_BIDINEUTRALSTATE_l, | 150 FX_BIDINEUTRALSTATE_l, |
| 151 FX_BIDINEUTRALSTATE_rn, | 151 FX_BIDINEUTRALSTATE_rn, |
| 152 FX_BIDINEUTRALSTATE_ln, | 152 FX_BIDINEUTRALSTATE_ln, |
| 153 FX_BIDINEUTRALSTATE_a, | 153 FX_BIDINEUTRALSTATE_a, |
| 154 FX_BIDINEUTRALSTATE_na, | 154 FX_BIDINEUTRALSTATE_na, |
| 155 }; | 155 }; |
| 156 #define FX_BNSr FX_BIDINEUTRALSTATE_r | 156 #define FX_BNSr FX_BIDINEUTRALSTATE_r |
| 157 #define FX_BNSl FX_BIDINEUTRALSTATE_l | 157 #define FX_BNSl FX_BIDINEUTRALSTATE_l |
| 158 #define FX_BNSrn FX_BIDINEUTRALSTATE_rn | 158 #define FX_BNSrn FX_BIDINEUTRALSTATE_rn |
| 159 #define FX_BNSln FX_BIDINEUTRALSTATE_ln | 159 #define FX_BNSln FX_BIDINEUTRALSTATE_ln |
| 160 #define FX_BNSa FX_BIDINEUTRALSTATE_a | 160 #define FX_BNSa FX_BIDINEUTRALSTATE_a |
| 161 #define FX_BNSna FX_BIDINEUTRALSTATE_na | 161 #define FX_BNSna FX_BIDINEUTRALSTATE_na |
| 162 enum FX_BIDINEUTRALACTION { | 162 enum FX_BIDINEUTRALACTION { |
| 163 FX_BIDINEUTRALACTION_nL = FX_BIDICLASS_L, | 163 FX_BIDINEUTRALACTION_nL = FX_BIDICLASS_L, |
| 164 FX_BIDINEUTRALACTION_En = (FX_BIDICLASS_AN << 4), | 164 FX_BIDINEUTRALACTION_En = (FX_BIDICLASS_AN << 4), |
| 165 FX_BIDINEUTRALACTION_Rn = (FX_BIDICLASS_R << 4), | 165 FX_BIDINEUTRALACTION_Rn = (FX_BIDICLASS_R << 4), |
| 166 FX_BIDINEUTRALACTION_Ln = (FX_BIDICLASS_L << 4), | 166 FX_BIDINEUTRALACTION_Ln = (FX_BIDICLASS_L << 4), |
| 167 FX_BIDINEUTRALACTION_In = FX_BIDIWEAKACTION_IX, | 167 FX_BIDINEUTRALACTION_In = FX_BIDIWEAKACTION_IX, |
| 168 FX_BIDINEUTRALACTION_LnL = (FX_BIDICLASS_L << 4) + FX_BIDICLASS_L, | 168 FX_BIDINEUTRALACTION_LnL = (FX_BIDICLASS_L << 4) + FX_BIDICLASS_L, |
| 169 }; | 169 }; |
| 170 #define FX_BNAnL FX_BIDINEUTRALACTION_nL | 170 #define FX_BNAnL FX_BIDINEUTRALACTION_nL |
| 171 #define FX_BNAEn FX_BIDINEUTRALACTION_En | 171 #define FX_BNAEn FX_BIDINEUTRALACTION_En |
| 172 #define FX_BNARn FX_BIDINEUTRALACTION_Rn | 172 #define FX_BNARn FX_BIDINEUTRALACTION_Rn |
| 173 #define FX_BNALn FX_BIDINEUTRALACTION_Ln | 173 #define FX_BNALn FX_BIDINEUTRALACTION_Ln |
| 174 #define FX_BNAIn FX_BIDINEUTRALACTION_In | 174 #define FX_BNAIn FX_BIDINEUTRALACTION_In |
| 175 #define FX_BNALnL FX_BIDINEUTRALACTION_LnL | 175 #define FX_BNALnL FX_BIDINEUTRALACTION_LnL |
| 176 FX_INT32 FX_BidiGetDeferredNeutrals(FX_INT32 iAction, FX_INT32 iLevel); | 176 int32_t FX_BidiGetDeferredNeutrals(int32_t iAction, int32_t iLevel); |
| 177 FX_INT32 FX_BidiGetResolvedNeutrals(FX_INT32 iAction); | 177 int32_t FX_BidiGetResolvedNeutrals(int32_t iAction); |
| 178 void FX_BidiResolveNeutrals(FX_INT32 iBaseLevel, CFX_Int32Array &classes, const
CFX_Int32Array &levels); | 178 void FX_BidiResolveNeutrals(int32_t iBaseLevel, CFX_Int32Array &classes, const C
FX_Int32Array &levels); |
| 179 void FX_BidiResolveImplicit(const CFX_Int32Array &classes, CFX_Int32Array &level
s); | 179 void FX_BidiResolveImplicit(const CFX_Int32Array &classes, CFX_Int32Array &level
s); |
| 180 void FX_BidiResolveWhitespace(FX_INT32 iBaseLevel, const CFX_Int32Array &classes
, CFX_Int32Array &levels); | 180 void FX_BidiResolveWhitespace(int32_t iBaseLevel, const CFX_Int32Array &classes,
CFX_Int32Array &levels); |
| 181 FX_INT32 FX_BidiReorderLevel(FX_INT32 iBaseLevel, CFX_WideString &wsText, const
CFX_Int32Array &levels, FX_INT32 iStart, FX_BOOL bReverse = FALSE); | 181 int32_t FX_BidiReorderLevel(int32_t iBaseLevel, CFX_WideString &wsText, const CF
X_Int32Array &levels, int32_t iStart, FX_BOOL bReverse = FALSE); |
| 182 void FX_BidiReorder(FX_INT32 iBaseLevel, CFX_WideString &wsText, const CFX_Int32
Array &levels); | 182 void FX_BidiReorder(int32_t iBaseLevel, CFX_WideString &wsText, const CFX_Int32A
rray &levels); |
| 183 class CFX_BidiChar final : public IFX_BidiChar | 183 class CFX_BidiChar final : public IFX_BidiChar |
| 184 { | 184 { |
| 185 public: | 185 public: |
| 186 CFX_BidiChar(); | 186 CFX_BidiChar(); |
| 187 virtual void Release() override | 187 virtual void Release() override |
| 188 { | 188 { |
| 189 delete this; | 189 delete this; |
| 190 } | 190 } |
| 191 virtual void SetPolicy(FX_BOOL bSeparateNeutral = TRUE) overr
ide | 191 virtual void SetPolicy(FX_BOOL bSeparateNeutral = TRUE) overr
ide |
| 192 { | 192 { |
| 193 m_bSeparateNeutral = bSeparateNeutral; | 193 m_bSeparateNeutral = bSeparateNeutral; |
| 194 } | 194 } |
| 195 virtual FX_BOOL AppendChar(FX_WCHAR wch) override; | 195 virtual FX_BOOL AppendChar(FX_WCHAR wch) override; |
| 196 virtual FX_BOOL EndChar() override; | 196 virtual FX_BOOL EndChar() override; |
| 197 virtual FX_INT32» GetBidiInfo(FX_INT32 &iStart, FX_INT32 &iCount) override
; | 197 virtual int32_t » GetBidiInfo(int32_t &iStart, int32_t &iCount) override; |
| 198 virtual void Reset() override; | 198 virtual void Reset() override; |
| 199 | 199 |
| 200 private: | 200 private: |
| 201 ~CFX_BidiChar() { } | 201 ~CFX_BidiChar() { } |
| 202 FX_BOOL» » m_bSeparateNeutral; | 202 FX_BOOL» m_bSeparateNeutral; |
| 203 FX_INT32» m_iCurStart; | 203 int32_t» m_iCurStart; |
| 204 FX_INT32» m_iCurCount; | 204 int32_t» m_iCurCount; |
| 205 FX_INT32» m_iCurBidi; | 205 int32_t» m_iCurBidi; |
| 206 FX_INT32» m_iLastBidi; | 206 int32_t» m_iLastBidi; |
| 207 FX_INT32» m_iLastStart; | 207 int32_t» m_iLastStart; |
| 208 FX_INT32» m_iLastCount; | 208 int32_t» m_iLastCount; |
| 209 }; | 209 }; |
| 210 | 210 |
| 211 #endif // CORE_SRC_FXCRT_FX_ARABIC_H_ | 211 #endif // CORE_SRC_FXCRT_FX_ARABIC_H_ |
| OLD | NEW |