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 #include "core/fxcrt/fx_arabic.h" | 7 #include "core/fxcrt/include/fx_arabic.h" |
8 #include "core/fxcrt/include/fx_ucd.h" | 8 #include "core/fxcrt/include/fx_ucd.h" |
9 | 9 |
10 namespace { | 10 namespace { |
11 | 11 |
12 const FX_ARBFORMTABLE g_FX_ArabicFormTables[] = { | 12 const FX_ARBFORMTABLE g_FX_ArabicFormTables[] = { |
13 {0xFE81, 0xFE82, 0xFE81, 0xFE82}, {0xFE83, 0xFE84, 0xFE83, 0xFE84}, | 13 {0xFE81, 0xFE82, 0xFE81, 0xFE82}, {0xFE83, 0xFE84, 0xFE83, 0xFE84}, |
14 {0xFE85, 0xFE86, 0xFE85, 0xFE86}, {0xFE87, 0xFE88, 0xFE87, 0xFE88}, | 14 {0xFE85, 0xFE86, 0xFE85, 0xFE86}, {0xFE87, 0xFE88, 0xFE87, 0xFE88}, |
15 {0xFE89, 0xFE8A, 0xFE8B, 0xFE8C}, {0xFE8D, 0xFE8E, 0xFE8D, 0xFE8E}, | 15 {0xFE89, 0xFE8A, 0xFE8B, 0xFE8C}, {0xFE8D, 0xFE8E, 0xFE8D, 0xFE8E}, |
16 {0xFE8F, 0xFE90, 0xFE91, 0xFE92}, {0xFE93, 0xFE94, 0xFE93, 0xFE94}, | 16 {0xFE8F, 0xFE90, 0xFE91, 0xFE92}, {0xFE93, 0xFE94, 0xFE93, 0xFE94}, |
17 {0xFE95, 0xFE96, 0xFE97, 0xFE98}, {0xFE99, 0xFE9A, 0xFE9B, 0xFE9C}, | 17 {0xFE95, 0xFE96, 0xFE97, 0xFE98}, {0xFE99, 0xFE9A, 0xFE9B, 0xFE9C}, |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 sizeof(gs_FX_ShaddaTable) / sizeof(FX_ARASHADDA); | 138 sizeof(gs_FX_ShaddaTable) / sizeof(FX_ARASHADDA); |
139 for (int32_t iStart = 0; iStart < s_iShaddaCount; iStart++) { | 139 for (int32_t iStart = 0; iStart < s_iShaddaCount; iStart++) { |
140 const FX_ARASHADDA& v = gs_FX_ShaddaTable[iStart]; | 140 const FX_ARASHADDA& v = gs_FX_ShaddaTable[iStart]; |
141 if (v.wShadda == shadda) { | 141 if (v.wShadda == shadda) { |
142 return v.wIsolated; | 142 return v.wIsolated; |
143 } | 143 } |
144 } | 144 } |
145 return shadda; | 145 return shadda; |
146 } | 146 } |
147 | 147 |
148 IFX_ArabicChar* IFX_ArabicChar::Create() { | |
149 return new CFX_ArabicChar; | |
150 } | |
151 FX_BOOL CFX_ArabicChar::IsArabicChar(FX_WCHAR wch) const { | 148 FX_BOOL CFX_ArabicChar::IsArabicChar(FX_WCHAR wch) const { |
152 uint32_t dwRet = | 149 uint32_t dwRet = |
153 kTextLayoutCodeProperties[(uint16_t)wch] & FX_CHARTYPEBITSMASK; | 150 kTextLayoutCodeProperties[(uint16_t)wch] & FX_CHARTYPEBITSMASK; |
154 return dwRet >= FX_CHARTYPE_ArabicAlef; | 151 return dwRet >= FX_CHARTYPE_ArabicAlef; |
155 } | 152 } |
156 FX_BOOL CFX_ArabicChar::IsArabicFormChar(FX_WCHAR wch) const { | 153 FX_BOOL CFX_ArabicChar::IsArabicFormChar(FX_WCHAR wch) const { |
157 return (kTextLayoutCodeProperties[(uint16_t)wch] & FX_CHARTYPEBITSMASK) == | 154 return (kTextLayoutCodeProperties[(uint16_t)wch] & FX_CHARTYPEBITSMASK) == |
158 FX_CHARTYPE_ArabicForm; | 155 FX_CHARTYPE_ArabicForm; |
159 } | 156 } |
160 FX_WCHAR CFX_ArabicChar::GetFormChar(FX_WCHAR wch, | 157 FX_WCHAR CFX_ArabicChar::GetFormChar(FX_WCHAR wch, |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 const int32_t gc_FX_BidiNeutralStates[][5] = { | 428 const int32_t gc_FX_BidiNeutralStates[][5] = { |
432 {FX_BNSrn, FX_BNSl, FX_BNSr, FX_BNSr, FX_BNSr}, | 429 {FX_BNSrn, FX_BNSl, FX_BNSr, FX_BNSr, FX_BNSr}, |
433 {FX_BNSln, FX_BNSl, FX_BNSr, FX_BNSa, FX_BNSl}, | 430 {FX_BNSln, FX_BNSl, FX_BNSr, FX_BNSa, FX_BNSl}, |
434 {FX_BNSrn, FX_BNSl, FX_BNSr, FX_BNSr, FX_BNSr}, | 431 {FX_BNSrn, FX_BNSl, FX_BNSr, FX_BNSr, FX_BNSr}, |
435 {FX_BNSln, FX_BNSl, FX_BNSr, FX_BNSa, FX_BNSl}, | 432 {FX_BNSln, FX_BNSl, FX_BNSr, FX_BNSa, FX_BNSl}, |
436 {FX_BNSna, FX_BNSl, FX_BNSr, FX_BNSa, FX_BNSl}, | 433 {FX_BNSna, FX_BNSl, FX_BNSr, FX_BNSa, FX_BNSl}, |
437 {FX_BNSna, FX_BNSl, FX_BNSr, FX_BNSa, FX_BNSl}, | 434 {FX_BNSna, FX_BNSl, FX_BNSr, FX_BNSa, FX_BNSl}, |
438 }; | 435 }; |
439 const int32_t gc_FX_BidiNeutralActions[][5] = { | 436 const int32_t gc_FX_BidiNeutralActions[][5] = { |
440 {FX_BNAIn, 0, 0, 0, 0}, | 437 {FX_BNAIn, 0, 0, 0, 0}, |
441 {FX_BNAIn, 0, 0, 0, FX_BCL}, | 438 {FX_BNAIn, 0, 0, 0, FX_BIDICLASS_L}, |
442 {FX_BNAIn, FX_BNAEn, FX_BNARn, FX_BNARn, FX_BNARn}, | 439 {FX_BNAIn, FX_BNAEn, FX_BNARn, FX_BNARn, FX_BNARn}, |
443 {FX_BNAIn, FX_BNALn, FX_BNAEn, FX_BNAEn, FX_BNALnL}, | 440 {FX_BNAIn, FX_BNALn, FX_BNAEn, FX_BNAEn, FX_BNALnL}, |
444 {FX_BNAIn, 0, 0, 0, FX_BCL}, | 441 {FX_BNAIn, 0, 0, 0, FX_BIDICLASS_L}, |
445 {FX_BNAIn, FX_BNAEn, FX_BNARn, FX_BNARn, FX_BNAEn}, | 442 {FX_BNAIn, FX_BNAEn, FX_BNARn, FX_BNARn, FX_BNAEn}, |
446 }; | 443 }; |
447 int32_t FX_BidiGetDeferredNeutrals(int32_t iAction, int32_t iLevel) { | 444 int32_t FX_BidiGetDeferredNeutrals(int32_t iAction, int32_t iLevel) { |
448 iAction = (iAction >> 4) & 0xF; | 445 iAction = (iAction >> 4) & 0xF; |
449 if (iAction == (FX_BIDINEUTRALACTION_En >> 4)) { | 446 if (iAction == (FX_BIDINEUTRALACTION_En >> 4)) { |
450 return FX_BidiDirection(iLevel); | 447 return FX_BidiDirection(iLevel); |
451 } else { | 448 } else { |
452 return iAction; | 449 return iAction; |
453 } | 450 } |
454 } | 451 } |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 } | 958 } |
962 }; | 959 }; |
963 void FX_BidiLine(CFX_TxtCharArray& chars, int32_t iCount, int32_t iBaseLevel) { | 960 void FX_BidiLine(CFX_TxtCharArray& chars, int32_t iCount, int32_t iBaseLevel) { |
964 CFX_BidiLineTemplate<CFX_TxtChar> blt; | 961 CFX_BidiLineTemplate<CFX_TxtChar> blt; |
965 blt.FX_BidiLine(chars, iCount, iBaseLevel); | 962 blt.FX_BidiLine(chars, iCount, iBaseLevel); |
966 } | 963 } |
967 void FX_BidiLine(CFX_RTFCharArray& chars, int32_t iCount, int32_t iBaseLevel) { | 964 void FX_BidiLine(CFX_RTFCharArray& chars, int32_t iCount, int32_t iBaseLevel) { |
968 CFX_BidiLineTemplate<CFX_RTFChar> blt; | 965 CFX_BidiLineTemplate<CFX_RTFChar> blt; |
969 blt.FX_BidiLine(chars, iCount, iBaseLevel); | 966 blt.FX_BidiLine(chars, iCount, iBaseLevel); |
970 } | 967 } |
OLD | NEW |