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 "../../include/fxcrt/fx_ucd.h" | 7 #include "../../include/fxcrt/fx_ucd.h" |
8 #include "fx_arabic.h" | 8 #include "fx_arabic.h" |
9 | 9 |
10 #ifdef __cplusplus | 10 namespace { |
11 extern "C" { | 11 |
12 #endif | 12 const FX_ARBFORMTABLE g_FX_ArabicFormTables[] = { |
13 static const FX_ARBFORMTABLE g_FX_ArabicFormTables[] = { | 13 {0xFE81, 0xFE82, 0xFE81, 0xFE82}, |
14 {0xFE81, 0xFE82, 0xFE81, 0xFE82}, {0xFE83, 0xFE84, 0xFE83, 0xFE84}, | 14 {0xFE83, 0xFE84, 0xFE83, 0xFE84}, |
15 {0xFE85, 0xFE86, 0xFE85, 0xFE86}, {0xFE87, 0xFE88, 0xFE87, 0xFE88}, | 15 {0xFE85, 0xFE86, 0xFE85, 0xFE86}, |
16 {0xFE89, 0xFE8A, 0xFE8B, 0xFE8C}, {0xFE8D, 0xFE8E, 0xFE8D, 0xFE8E}, | 16 {0xFE87, 0xFE88, 0xFE87, 0xFE88}, |
17 {0xFE8F, 0xFE90, 0xFE91, 0xFE92}, {0xFE93, 0xFE94, 0xFE93, 0xFE94}, | 17 {0xFE89, 0xFE8A, 0xFE8B, 0xFE8C}, |
18 {0xFE95, 0xFE96, 0xFE97, 0xFE98}, {0xFE99, 0xFE9A, 0xFE9B, 0xFE9C}, | 18 {0xFE8D, 0xFE8E, 0xFE8D, 0xFE8E}, |
19 {0xFE9D, 0xFE9E, 0xFE9F, 0xFEA0}, {0xFEA1, 0xFEA2, 0xFEA3, 0xFEA4}, | 19 {0xFE8F, 0xFE90, 0xFE91, 0xFE92}, |
20 {0xFEA5, 0xFEA6, 0xFEA7, 0xFEA8}, {0xFEA9, 0xFEAA, 0xFEA9, 0xFEAA}, | 20 {0xFE93, 0xFE94, 0xFE93, 0xFE94}, |
21 {0xFEAB, 0xFEAC, 0xFEAB, 0xFEAC}, {0xFEAD, 0xFEAE, 0xFEAD, 0xFEAE}, | 21 {0xFE95, 0xFE96, 0xFE97, 0xFE98}, |
22 {0xFEAF, 0xFEB0, 0xFEAF, 0xFEB0}, {0xFEB1, 0xFEB2, 0xFEB3, 0xFEB4}, | 22 {0xFE99, 0xFE9A, 0xFE9B, 0xFE9C}, |
23 {0xFEB5, 0xFEB6, 0xFEB7, 0xFEB8}, {0xFEB9, 0xFEBA, 0xFEBB, 0xFEBC}, | 23 {0xFE9D, 0xFE9E, 0xFE9F, 0xFEA0}, |
24 {0xFEBD, 0xFEBE, 0xFEBF, 0xFEC0}, {0xFEC1, 0xFEC2, 0xFEC3, 0xFEC4}, | 24 {0xFEA1, 0xFEA2, 0xFEA3, 0xFEA4}, |
25 {0xFEC5, 0xFEC6, 0xFEC7, 0xFEC8}, {0xFEC9, 0xFECA, 0xFECB, 0xFECC}, | 25 {0xFEA5, 0xFEA6, 0xFEA7, 0xFEA8}, |
26 {0xFECD, 0xFECE, 0xFECF, 0xFED0}, {0x063B, 0x063B, 0x063B, 0x063B}, | 26 {0xFEA9, 0xFEAA, 0xFEA9, 0xFEAA}, |
27 {0x063C, 0x063C, 0x063C, 0x063C}, {0x063D, 0x063D, 0x063D, 0x063D}, | 27 {0xFEAB, 0xFEAC, 0xFEAB, 0xFEAC}, |
28 {0x063E, 0x063E, 0x063E, 0x063E}, {0x063F, 0x063F, 0x063F, 0x063F}, | 28 {0xFEAD, 0xFEAE, 0xFEAD, 0xFEAE}, |
29 {0x0640, 0x0640, 0x0640, 0x0640}, {0xFED1, 0xFED2, 0xFED3, 0xFED4}, | 29 {0xFEAF, 0xFEB0, 0xFEAF, 0xFEB0}, |
30 {0xFED5, 0xFED6, 0xFED7, 0xFED8}, {0xFED9, 0xFEDA, 0xFEDB, 0xFEDC}, | 30 {0xFEB1, 0xFEB2, 0xFEB3, 0xFEB4}, |
31 {0xFEDD, 0xFEDE, 0xFEDF, 0xFEE0}, {0xFEE1, 0xFEE2, 0xFEE3, 0xFEE4}, | 31 {0xFEB5, 0xFEB6, 0xFEB7, 0xFEB8}, |
32 {0xFEE5, 0xFEE6, 0xFEE7, 0xFEE8}, {0xFEE9, 0xFEEA, 0xFEEB, 0xFEEC}, | 32 {0xFEB9, 0xFEBA, 0xFEBB, 0xFEBC}, |
33 {0xFEED, 0xFEEE, 0xFEED, 0xFEEE}, {0xFEEF, 0xFEF0, 0xFBFE, 0xFBFF}, | 33 {0xFEBD, 0xFEBE, 0xFEBF, 0xFEC0}, |
34 {0xFEF1, 0xFEF2, 0xFEF3, 0xFEF4}, {0x064B, 0x064B, 0x064B, 0x064B}, | 34 {0xFEC1, 0xFEC2, 0xFEC3, 0xFEC4}, |
35 {0x064C, 0x064C, 0x064C, 0x064C}, {0x064D, 0x064D, 0x064D, 0x064D}, | 35 {0xFEC5, 0xFEC6, 0xFEC7, 0xFEC8}, |
36 {0x064E, 0x064E, 0x064E, 0x064E}, {0x064F, 0x064F, 0x064F, 0x064F}, | 36 {0xFEC9, 0xFECA, 0xFECB, 0xFECC}, |
37 {0x0650, 0x0650, 0x0650, 0x0650}, {0x0651, 0x0651, 0x0651, 0x0651}, | 37 {0xFECD, 0xFECE, 0xFECF, 0xFED0}, |
38 {0x0652, 0x0652, 0x0652, 0x0652}, {0x0653, 0x0653, 0x0653, 0x0653}, | 38 {0x063B, 0x063B, 0x063B, 0x063B}, |
39 {0x0654, 0x0654, 0x0654, 0x0654}, {0x0655, 0x0655, 0x0655, 0x0655}, | 39 {0x063C, 0x063C, 0x063C, 0x063C}, |
40 {0x0656, 0x0656, 0x0656, 0x0656}, {0x0657, 0x0657, 0x0657, 0x0657}, | 40 {0x063D, 0x063D, 0x063D, 0x063D}, |
41 {0x0658, 0x0658, 0x0658, 0x0658}, {0x0659, 0x0659, 0x0659, 0x0659}, | 41 {0x063E, 0x063E, 0x063E, 0x063E}, |
42 {0x065A, 0x065A, 0x065A, 0x065A}, {0x065B, 0x065B, 0x065B, 0x065B}, | 42 {0x063F, 0x063F, 0x063F, 0x063F}, |
43 {0x065C, 0x065C, 0x065C, 0x065C}, {0x065D, 0x065D, 0x065D, 0x065D}, | 43 {0x0640, 0x0640, 0x0640, 0x0640}, |
44 {0x065E, 0x065E, 0x065E, 0x065E}, {0x065F, 0x065F, 0x065F, 0x065F}, | 44 {0xFED1, 0xFED2, 0xFED3, 0xFED4}, |
45 {0x0660, 0x0660, 0x0660, 0x0660}, {0x0661, 0x0661, 0x0661, 0x0661}, | 45 {0xFED5, 0xFED6, 0xFED7, 0xFED8}, |
46 {0x0662, 0x0662, 0x0662, 0x0662}, {0x0663, 0x0663, 0x0663, 0x0663}, | 46 {0xFED9, 0xFEDA, 0xFEDB, 0xFEDC}, |
47 {0x0664, 0x0664, 0x0664, 0x0664}, {0x0665, 0x0665, 0x0665, 0x0665}, | 47 {0xFEDD, 0xFEDE, 0xFEDF, 0xFEE0}, |
48 {0x0666, 0x0666, 0x0666, 0x0666}, {0x0667, 0x0667, 0x0667, 0x0667}, | 48 {0xFEE1, 0xFEE2, 0xFEE3, 0xFEE4}, |
49 {0x0668, 0x0668, 0x0668, 0x0668}, {0x0669, 0x0669, 0x0669, 0x0669}, | 49 {0xFEE5, 0xFEE6, 0xFEE7, 0xFEE8}, |
50 {0x066A, 0x066A, 0x066A, 0x066A}, {0x066B, 0x066B, 0x066B, 0x066B}, | 50 {0xFEE9, 0xFEEA, 0xFEEB, 0xFEEC}, |
51 {0x066C, 0x066C, 0x066C, 0x066C}, {0x066D, 0x066D, 0x066D, 0x066D}, | 51 {0xFEED, 0xFEEE, 0xFEED, 0xFEEE}, |
52 {0x066E, 0x066E, 0x066E, 0x066E}, {0x066F, 0x066F, 0x066F, 0x066F}, | 52 {0xFEEF, 0xFEF0, 0xFBFE, 0xFBFF}, |
53 {0x0670, 0x0670, 0x0670, 0x0670}, {0xFB50, 0xFB51, 0xFB50, 0xFB51}, | 53 {0xFEF1, 0xFEF2, 0xFEF3, 0xFEF4}, |
54 {0x0672, 0x0672, 0x0672, 0x0672}, {0x0673, 0x0673, 0x0673, 0x0673}, | 54 {0x064B, 0x064B, 0x064B, 0x064B}, |
55 {0x0674, 0x0674, 0x0674, 0x0674}, {0x0675, 0x0675, 0x0675, 0x0675}, | 55 {0x064C, 0x064C, 0x064C, 0x064C}, |
56 {0x0676, 0x0676, 0x0676, 0x0676}, {0x0677, 0x0677, 0x0677, 0x0677}, | 56 {0x064D, 0x064D, 0x064D, 0x064D}, |
57 {0x0678, 0x0678, 0x0678, 0x0678}, {0xFB66, 0xFB67, 0xFB68, 0xFB69}, | 57 {0x064E, 0x064E, 0x064E, 0x064E}, |
58 {0xFB5E, 0xFB5F, 0xFB60, 0xFB61}, {0xFB52, 0xFB53, 0xFB54, 0xFB55}, | 58 {0x064F, 0x064F, 0x064F, 0x064F}, |
59 {0x067C, 0x067C, 0x067C, 0x067C}, {0x067D, 0x067D, 0x067D, 0x067D}, | 59 {0x0650, 0x0650, 0x0650, 0x0650}, |
60 {0xFB56, 0xFB57, 0xFB58, 0xFB59}, {0xFB62, 0xFB63, 0xFB64, 0xFB65}, | 60 {0x0651, 0x0651, 0x0651, 0x0651}, |
61 {0xFB5A, 0xFB5B, 0xFB5C, 0xFB5D}, {0x0681, 0x0681, 0x0681, 0x0681}, | 61 {0x0652, 0x0652, 0x0652, 0x0652}, |
62 {0x0682, 0x0682, 0x0682, 0x0682}, {0xFB76, 0xFB77, 0xFB78, 0xFB79}, | 62 {0x0653, 0x0653, 0x0653, 0x0653}, |
63 {0xFB72, 0xFB73, 0xFB74, 0xFB75}, {0x0685, 0x0685, 0x0685, 0x0685}, | 63 {0x0654, 0x0654, 0x0654, 0x0654}, |
64 {0xFB7A, 0xFB7B, 0xFB7C, 0xFB7D}, {0xFB7E, 0xFB7F, 0xFB80, 0xFB81}, | 64 {0x0655, 0x0655, 0x0655, 0x0655}, |
65 {0xFB88, 0xFB89, 0xFB88, 0xFB89}, {0x0689, 0x0689, 0x0689, 0x0689}, | 65 {0x0656, 0x0656, 0x0656, 0x0656}, |
66 {0x068A, 0x068A, 0x068A, 0x068A}, {0x068B, 0x068B, 0x068B, 0x068B}, | 66 {0x0657, 0x0657, 0x0657, 0x0657}, |
67 {0xFB84, 0xFB85, 0xFB84, 0xFB85}, {0xFB82, 0xFB83, 0xFB82, 0xFB83}, | 67 {0x0658, 0x0658, 0x0658, 0x0658}, |
68 {0xFB86, 0xFB87, 0xFB86, 0xFB87}, {0x068F, 0x068F, 0x068F, 0x068F}, | 68 {0x0659, 0x0659, 0x0659, 0x0659}, |
69 {0x0690, 0x0690, 0x0690, 0x0690}, {0xFB8C, 0xFB8D, 0xFB8C, 0xFB8D}, | 69 {0x065A, 0x065A, 0x065A, 0x065A}, |
70 {0x0692, 0x0692, 0x0692, 0x0692}, {0x0693, 0x0693, 0x0693, 0x0693}, | 70 {0x065B, 0x065B, 0x065B, 0x065B}, |
71 {0x0694, 0x0694, 0x0694, 0x0694}, {0x0695, 0x0695, 0x0695, 0x0695}, | 71 {0x065C, 0x065C, 0x065C, 0x065C}, |
72 {0x0696, 0x0696, 0x0696, 0x0696}, {0x0697, 0x0697, 0x0697, 0x0697}, | 72 {0x065D, 0x065D, 0x065D, 0x065D}, |
73 {0xFB8A, 0xFB8B, 0xFB8A, 0xFB8B}, {0x0699, 0x0699, 0x0699, 0x0699}, | 73 {0x065E, 0x065E, 0x065E, 0x065E}, |
74 {0x069A, 0x069A, 0x069A, 0x069A}, {0x069B, 0x069B, 0x069B, 0x069B}, | 74 {0x065F, 0x065F, 0x065F, 0x065F}, |
75 {0x069C, 0x069C, 0x069C, 0x069C}, {0x069D, 0x069D, 0x069D, 0x069D}, | 75 {0x0660, 0x0660, 0x0660, 0x0660}, |
76 {0x069E, 0x069E, 0x069E, 0x069E}, {0x069F, 0x069F, 0x069F, 0x069F}, | 76 {0x0661, 0x0661, 0x0661, 0x0661}, |
77 {0x06A0, 0x06A0, 0x06A0, 0x06A0}, {0x06A1, 0x06A1, 0x06A1, 0x06A1}, | 77 {0x0662, 0x0662, 0x0662, 0x0662}, |
78 {0x06A2, 0x06A2, 0x06A2, 0x06A2}, {0x06A3, 0x06A3, 0x06A3, 0x06A3}, | 78 {0x0663, 0x0663, 0x0663, 0x0663}, |
79 {0xFB6A, 0xFB6B, 0xFB6C, 0xFB6D}, {0x06A5, 0x06A5, 0x06A5, 0x06A5}, | 79 {0x0664, 0x0664, 0x0664, 0x0664}, |
80 {0xFB6E, 0xFB6F, 0xFB70, 0xFB71}, {0x06A7, 0x06A7, 0x06A7, 0x06A7}, | 80 {0x0665, 0x0665, 0x0665, 0x0665}, |
81 {0x06A8, 0x06A8, 0x06A8, 0x06A8}, {0xFB8E, 0xFB8F, 0xFB90, 0xFB91}, | 81 {0x0666, 0x0666, 0x0666, 0x0666}, |
82 {0x06AA, 0x06AA, 0x06AA, 0x06AA}, {0x06AB, 0x06AB, 0x06AB, 0x06AB}, | 82 {0x0667, 0x0667, 0x0667, 0x0667}, |
83 {0x06AC, 0x06AC, 0x06AC, 0x06AC}, {0xFBD3, 0xFBD4, 0xFBD5, 0xFBD6}, | 83 {0x0668, 0x0668, 0x0668, 0x0668}, |
84 {0x06AE, 0x06AE, 0x06AE, 0x06AE}, {0xFB92, 0xFB93, 0xFB94, 0xFB95}, | 84 {0x0669, 0x0669, 0x0669, 0x0669}, |
85 {0x06B0, 0x06B0, 0x06B0, 0x06B0}, {0xFB9A, 0xFB9B, 0xFB9C, 0xFB9D}, | 85 {0x066A, 0x066A, 0x066A, 0x066A}, |
86 {0x06B2, 0x06B2, 0x06B2, 0x06B2}, {0xFB96, 0xFB97, 0xFB98, 0xFB99}, | 86 {0x066B, 0x066B, 0x066B, 0x066B}, |
87 {0x06B4, 0x06B4, 0x06B4, 0x06B4}, {0x06B5, 0x06B5, 0x06B5, 0x06B5}, | 87 {0x066C, 0x066C, 0x066C, 0x066C}, |
88 {0x06B6, 0x06B6, 0x06B6, 0x06B6}, {0x06B7, 0x06B7, 0x06B7, 0x06B7}, | 88 {0x066D, 0x066D, 0x066D, 0x066D}, |
89 {0x06B8, 0x06B8, 0x06B8, 0x06B8}, {0x06B9, 0x06B9, 0x06B9, 0x06B9}, | 89 {0x066E, 0x066E, 0x066E, 0x066E}, |
90 {0xFB9E, 0xFB9F, 0xFBE8, 0xFBE9}, {0xFBA0, 0xFBA1, 0xFBA2, 0xFBA3}, | 90 {0x066F, 0x066F, 0x066F, 0x066F}, |
91 {0x06BC, 0x06BC, 0x06BC, 0x06BC}, {0x06BD, 0x06BD, 0x06BD, 0x06BD}, | 91 {0x0670, 0x0670, 0x0670, 0x0670}, |
92 {0xFBAA, 0xFBAB, 0xFBAC, 0xFBAD}, {0x06BF, 0x06BF, 0x06BF, 0x06BF}, | 92 {0xFB50, 0xFB51, 0xFB50, 0xFB51}, |
93 {0xFBA4, 0xFBA5, 0xFBA4, 0xFBA5}, {0xFBA6, 0xFBA7, 0xFBA8, 0xFBA9}, | 93 {0x0672, 0x0672, 0x0672, 0x0672}, |
94 {0x06C2, 0x06C2, 0x06C2, 0x06C2}, {0x06C3, 0x06C3, 0x06C3, 0x06C3}, | 94 {0x0673, 0x0673, 0x0673, 0x0673}, |
95 {0x06C4, 0x06C4, 0x06C4, 0x06C4}, {0xFBE0, 0xFBE1, 0xFBE0, 0xFBE1}, | 95 {0x0674, 0x0674, 0x0674, 0x0674}, |
96 {0xFBD9, 0xFBDA, 0xFBD9, 0xFBDA}, {0xFBD7, 0xFBD8, 0xFBD7, 0xFBD8}, | 96 {0x0675, 0x0675, 0x0675, 0x0675}, |
97 {0xFBDB, 0xFBDC, 0xFBDB, 0xFBDC}, {0xFBE2, 0xFBE3, 0xFBE2, 0xFBE3}, | 97 {0x0676, 0x0676, 0x0676, 0x0676}, |
98 {0x06CA, 0x06CA, 0x06CA, 0x06CA}, {0xFBDE, 0xFBDF, 0xFBDE, 0xFBDF}, | 98 {0x0677, 0x0677, 0x0677, 0x0677}, |
99 {0xFBFC, 0xFBFD, 0xFBFE, 0xFBFF}, {0x06CD, 0x06CD, 0x06CD, 0x06CD}, | 99 {0x0678, 0x0678, 0x0678, 0x0678}, |
100 {0x06CE, 0x06CE, 0x06CE, 0x06CE}, {0x06CF, 0x06CF, 0x06CF, 0x06CF}, | 100 {0xFB66, 0xFB67, 0xFB68, 0xFB69}, |
101 {0xFBE4, 0xFBE5, 0xFBE6, 0xFBE7}, {0x06D1, 0x06D1, 0x06D1, 0x06D1}, | 101 {0xFB5E, 0xFB5F, 0xFB60, 0xFB61}, |
102 {0xFBAE, 0xFBAF, 0xFBAE, 0xFBAF}, {0xFBB0, 0xFBB1, 0xFBB0, 0xFBB1}, | 102 {0xFB52, 0xFB53, 0xFB54, 0xFB55}, |
103 {0x06D4, 0x06D4, 0x06D4, 0x06D4}, {0x06D5, 0x06D5, 0x06D5, 0x06D5}, | 103 {0x067C, 0x067C, 0x067C, 0x067C}, |
| 104 {0x067D, 0x067D, 0x067D, 0x067D}, |
| 105 {0xFB56, 0xFB57, 0xFB58, 0xFB59}, |
| 106 {0xFB62, 0xFB63, 0xFB64, 0xFB65}, |
| 107 {0xFB5A, 0xFB5B, 0xFB5C, 0xFB5D}, |
| 108 {0x0681, 0x0681, 0x0681, 0x0681}, |
| 109 {0x0682, 0x0682, 0x0682, 0x0682}, |
| 110 {0xFB76, 0xFB77, 0xFB78, 0xFB79}, |
| 111 {0xFB72, 0xFB73, 0xFB74, 0xFB75}, |
| 112 {0x0685, 0x0685, 0x0685, 0x0685}, |
| 113 {0xFB7A, 0xFB7B, 0xFB7C, 0xFB7D}, |
| 114 {0xFB7E, 0xFB7F, 0xFB80, 0xFB81}, |
| 115 {0xFB88, 0xFB89, 0xFB88, 0xFB89}, |
| 116 {0x0689, 0x0689, 0x0689, 0x0689}, |
| 117 {0x068A, 0x068A, 0x068A, 0x068A}, |
| 118 {0x068B, 0x068B, 0x068B, 0x068B}, |
| 119 {0xFB84, 0xFB85, 0xFB84, 0xFB85}, |
| 120 {0xFB82, 0xFB83, 0xFB82, 0xFB83}, |
| 121 {0xFB86, 0xFB87, 0xFB86, 0xFB87}, |
| 122 {0x068F, 0x068F, 0x068F, 0x068F}, |
| 123 {0x0690, 0x0690, 0x0690, 0x0690}, |
| 124 {0xFB8C, 0xFB8D, 0xFB8C, 0xFB8D}, |
| 125 {0x0692, 0x0692, 0x0692, 0x0692}, |
| 126 {0x0693, 0x0693, 0x0693, 0x0693}, |
| 127 {0x0694, 0x0694, 0x0694, 0x0694}, |
| 128 {0x0695, 0x0695, 0x0695, 0x0695}, |
| 129 {0x0696, 0x0696, 0x0696, 0x0696}, |
| 130 {0x0697, 0x0697, 0x0697, 0x0697}, |
| 131 {0xFB8A, 0xFB8B, 0xFB8A, 0xFB8B}, |
| 132 {0x0699, 0x0699, 0x0699, 0x0699}, |
| 133 {0x069A, 0x069A, 0x069A, 0x069A}, |
| 134 {0x069B, 0x069B, 0x069B, 0x069B}, |
| 135 {0x069C, 0x069C, 0x069C, 0x069C}, |
| 136 {0x069D, 0x069D, 0x069D, 0x069D}, |
| 137 {0x069E, 0x069E, 0x069E, 0x069E}, |
| 138 {0x069F, 0x069F, 0x069F, 0x069F}, |
| 139 {0x06A0, 0x06A0, 0x06A0, 0x06A0}, |
| 140 {0x06A1, 0x06A1, 0x06A1, 0x06A1}, |
| 141 {0x06A2, 0x06A2, 0x06A2, 0x06A2}, |
| 142 {0x06A3, 0x06A3, 0x06A3, 0x06A3}, |
| 143 {0xFB6A, 0xFB6B, 0xFB6C, 0xFB6D}, |
| 144 {0x06A5, 0x06A5, 0x06A5, 0x06A5}, |
| 145 {0xFB6E, 0xFB6F, 0xFB70, 0xFB71}, |
| 146 {0x06A7, 0x06A7, 0x06A7, 0x06A7}, |
| 147 {0x06A8, 0x06A8, 0x06A8, 0x06A8}, |
| 148 {0xFB8E, 0xFB8F, 0xFB90, 0xFB91}, |
| 149 {0x06AA, 0x06AA, 0x06AA, 0x06AA}, |
| 150 {0x06AB, 0x06AB, 0x06AB, 0x06AB}, |
| 151 {0x06AC, 0x06AC, 0x06AC, 0x06AC}, |
| 152 {0xFBD3, 0xFBD4, 0xFBD5, 0xFBD6}, |
| 153 {0x06AE, 0x06AE, 0x06AE, 0x06AE}, |
| 154 {0xFB92, 0xFB93, 0xFB94, 0xFB95}, |
| 155 {0x06B0, 0x06B0, 0x06B0, 0x06B0}, |
| 156 {0xFB9A, 0xFB9B, 0xFB9C, 0xFB9D}, |
| 157 {0x06B2, 0x06B2, 0x06B2, 0x06B2}, |
| 158 {0xFB96, 0xFB97, 0xFB98, 0xFB99}, |
| 159 {0x06B4, 0x06B4, 0x06B4, 0x06B4}, |
| 160 {0x06B5, 0x06B5, 0x06B5, 0x06B5}, |
| 161 {0x06B6, 0x06B6, 0x06B6, 0x06B6}, |
| 162 {0x06B7, 0x06B7, 0x06B7, 0x06B7}, |
| 163 {0x06B8, 0x06B8, 0x06B8, 0x06B8}, |
| 164 {0x06B9, 0x06B9, 0x06B9, 0x06B9}, |
| 165 {0xFB9E, 0xFB9F, 0xFBE8, 0xFBE9}, |
| 166 {0xFBA0, 0xFBA1, 0xFBA2, 0xFBA3}, |
| 167 {0x06BC, 0x06BC, 0x06BC, 0x06BC}, |
| 168 {0x06BD, 0x06BD, 0x06BD, 0x06BD}, |
| 169 {0xFBAA, 0xFBAB, 0xFBAC, 0xFBAD}, |
| 170 {0x06BF, 0x06BF, 0x06BF, 0x06BF}, |
| 171 {0xFBA4, 0xFBA5, 0xFBA4, 0xFBA5}, |
| 172 {0xFBA6, 0xFBA7, 0xFBA8, 0xFBA9}, |
| 173 {0x06C2, 0x06C2, 0x06C2, 0x06C2}, |
| 174 {0x06C3, 0x06C3, 0x06C3, 0x06C3}, |
| 175 {0x06C4, 0x06C4, 0x06C4, 0x06C4}, |
| 176 {0xFBE0, 0xFBE1, 0xFBE0, 0xFBE1}, |
| 177 {0xFBD9, 0xFBDA, 0xFBD9, 0xFBDA}, |
| 178 {0xFBD7, 0xFBD8, 0xFBD7, 0xFBD8}, |
| 179 {0xFBDB, 0xFBDC, 0xFBDB, 0xFBDC}, |
| 180 {0xFBE2, 0xFBE3, 0xFBE2, 0xFBE3}, |
| 181 {0x06CA, 0x06CA, 0x06CA, 0x06CA}, |
| 182 {0xFBDE, 0xFBDF, 0xFBDE, 0xFBDF}, |
| 183 {0xFBFC, 0xFBFD, 0xFBFE, 0xFBFF}, |
| 184 {0x06CD, 0x06CD, 0x06CD, 0x06CD}, |
| 185 {0x06CE, 0x06CE, 0x06CE, 0x06CE}, |
| 186 {0x06CF, 0x06CF, 0x06CF, 0x06CF}, |
| 187 {0xFBE4, 0xFBE5, 0xFBE6, 0xFBE7}, |
| 188 {0x06D1, 0x06D1, 0x06D1, 0x06D1}, |
| 189 {0xFBAE, 0xFBAF, 0xFBAE, 0xFBAF}, |
| 190 {0xFBB0, 0xFBB1, 0xFBB0, 0xFBB1}, |
| 191 {0x06D4, 0x06D4, 0x06D4, 0x06D4}, |
| 192 {0x06D5, 0x06D5, 0x06D5, 0x06D5}, |
104 }; | 193 }; |
105 static const FX_ARAALEF gs_FX_AlefTable[] = { | 194 |
| 195 const FX_ARAALEF gs_FX_AlefTable[] = { |
106 {0x0622, 0xFEF5}, | 196 {0x0622, 0xFEF5}, |
107 {0x0623, 0xFEF7}, | 197 {0x0623, 0xFEF7}, |
108 {0x0625, 0xFEF9}, | 198 {0x0625, 0xFEF9}, |
109 {0x0627, 0xFEFB}, | 199 {0x0627, 0xFEFB}, |
110 }; | 200 }; |
111 static const FX_ARASHADDA gs_FX_ShaddaTable[] = { | 201 |
112 {0x064C, 0xFC5E}, {0x064D, 0xFC5F}, {0x064E, 0xFC60}, | 202 const FX_ARASHADDA gs_FX_ShaddaTable[] = { |
113 {0x064F, 0xFC61}, {0x0650, 0xFC62}, | 203 {0x064C, 0xFC5E}, |
| 204 {0x064D, 0xFC5F}, |
| 205 {0x064E, 0xFC60}, |
| 206 {0x064F, 0xFC61}, |
| 207 {0x0650, 0xFC62}, |
114 }; | 208 }; |
115 FX_LPCARBFORMTABLE FX_GetArabicFormTable(FX_WCHAR unicode) { | 209 |
| 210 } // namespace |
| 211 |
| 212 const FX_ARBFORMTABLE* FX_GetArabicFormTable(FX_WCHAR unicode) { |
116 if (unicode < 0x622 || unicode > 0x6d5) { | 213 if (unicode < 0x622 || unicode > 0x6d5) { |
117 return NULL; | 214 return NULL; |
118 } | 215 } |
119 return g_FX_ArabicFormTables + unicode - 0x622; | 216 return g_FX_ArabicFormTables + unicode - 0x622; |
120 } | 217 } |
121 FX_WCHAR FX_GetArabicFromAlefTable(FX_WCHAR alef) { | 218 FX_WCHAR FX_GetArabicFromAlefTable(FX_WCHAR alef) { |
122 static const int32_t s_iAlefCount = | 219 static const int32_t s_iAlefCount = |
123 sizeof(gs_FX_AlefTable) / sizeof(FX_ARAALEF); | 220 sizeof(gs_FX_AlefTable) / sizeof(FX_ARAALEF); |
124 for (int32_t iStart = 0; iStart < s_iAlefCount; iStart++) { | 221 for (int32_t iStart = 0; iStart < s_iAlefCount; iStart++) { |
125 const FX_ARAALEF& v = gs_FX_AlefTable[iStart]; | 222 const FX_ARAALEF& v = gs_FX_AlefTable[iStart]; |
126 if (v.wAlef == alef) { | 223 if (v.wAlef == alef) { |
127 return v.wIsolated; | 224 return v.wIsolated; |
128 } | 225 } |
129 } | 226 } |
130 return alef; | 227 return alef; |
131 } | 228 } |
132 FX_WCHAR FX_GetArabicFromShaddaTable(FX_WCHAR shadda) { | 229 FX_WCHAR FX_GetArabicFromShaddaTable(FX_WCHAR shadda) { |
133 static const int32_t s_iShaddaCount = | 230 static const int32_t s_iShaddaCount = |
134 sizeof(gs_FX_ShaddaTable) / sizeof(FX_ARASHADDA); | 231 sizeof(gs_FX_ShaddaTable) / sizeof(FX_ARASHADDA); |
135 for (int32_t iStart = 0; iStart < s_iShaddaCount; iStart++) { | 232 for (int32_t iStart = 0; iStart < s_iShaddaCount; iStart++) { |
136 const FX_ARASHADDA& v = gs_FX_ShaddaTable[iStart]; | 233 const FX_ARASHADDA& v = gs_FX_ShaddaTable[iStart]; |
137 if (v.wShadda == shadda) { | 234 if (v.wShadda == shadda) { |
138 return v.wIsolated; | 235 return v.wIsolated; |
139 } | 236 } |
140 } | 237 } |
141 return shadda; | 238 return shadda; |
142 } | 239 } |
143 #ifdef __cplusplus | 240 |
144 }; | |
145 #endif | |
146 IFX_ArabicChar* IFX_ArabicChar::Create() { | 241 IFX_ArabicChar* IFX_ArabicChar::Create() { |
147 return new CFX_ArabicChar; | 242 return new CFX_ArabicChar; |
148 } | 243 } |
149 FX_BOOL CFX_ArabicChar::IsArabicChar(FX_WCHAR wch) const { | 244 FX_BOOL CFX_ArabicChar::IsArabicChar(FX_WCHAR wch) const { |
150 FX_DWORD dwRet = | 245 FX_DWORD dwRet = |
151 kTextLayoutCodeProperties[(FX_WORD)wch] & FX_CHARTYPEBITSMASK; | 246 kTextLayoutCodeProperties[(FX_WORD)wch] & FX_CHARTYPEBITSMASK; |
152 return dwRet >= FX_CHARTYPE_ArabicAlef; | 247 return dwRet >= FX_CHARTYPE_ArabicAlef; |
153 } | 248 } |
154 FX_BOOL CFX_ArabicChar::IsArabicFormChar(FX_WCHAR wch) const { | 249 FX_BOOL CFX_ArabicChar::IsArabicFormChar(FX_WCHAR wch) const { |
155 return (kTextLayoutCodeProperties[(FX_WORD)wch] & FX_CHARTYPEBITSMASK) == | 250 return (kTextLayoutCodeProperties[(FX_WORD)wch] & FX_CHARTYPEBITSMASK) == |
156 FX_CHARTYPE_ArabicForm; | 251 FX_CHARTYPE_ArabicForm; |
157 } | 252 } |
158 FX_WCHAR CFX_ArabicChar::GetFormChar(FX_WCHAR wch, | 253 FX_WCHAR CFX_ArabicChar::GetFormChar(FX_WCHAR wch, |
159 FX_WCHAR prev, | 254 FX_WCHAR prev, |
160 FX_WCHAR next) const { | 255 FX_WCHAR next) const { |
161 CFX_Char c(wch, kTextLayoutCodeProperties[(FX_WORD)wch]); | 256 CFX_Char c(wch, kTextLayoutCodeProperties[(FX_WORD)wch]); |
162 CFX_Char p(prev, kTextLayoutCodeProperties[(FX_WORD)prev]); | 257 CFX_Char p(prev, kTextLayoutCodeProperties[(FX_WORD)prev]); |
163 CFX_Char n(next, kTextLayoutCodeProperties[(FX_WORD)next]); | 258 CFX_Char n(next, kTextLayoutCodeProperties[(FX_WORD)next]); |
164 return GetFormChar(&c, &p, &n); | 259 return GetFormChar(&c, &p, &n); |
165 } | 260 } |
166 FX_WCHAR CFX_ArabicChar::GetFormChar(const CFX_Char* cur, | 261 FX_WCHAR CFX_ArabicChar::GetFormChar(const CFX_Char* cur, |
167 const CFX_Char* prev, | 262 const CFX_Char* prev, |
168 const CFX_Char* next) const { | 263 const CFX_Char* next) const { |
169 FX_CHARTYPE eCur; | 264 FX_CHARTYPE eCur; |
170 FX_WCHAR wCur; | 265 FX_WCHAR wCur; |
171 FX_LPCARBFORMTABLE ft = ParseChar(cur, wCur, eCur); | 266 const FX_ARBFORMTABLE* ft = ParseChar(cur, wCur, eCur); |
172 if (eCur < FX_CHARTYPE_ArabicAlef || eCur >= FX_CHARTYPE_ArabicNormal) { | 267 if (eCur < FX_CHARTYPE_ArabicAlef || eCur >= FX_CHARTYPE_ArabicNormal) { |
173 return wCur; | 268 return wCur; |
174 } | 269 } |
175 FX_CHARTYPE ePrev; | 270 FX_CHARTYPE ePrev; |
176 FX_WCHAR wPrev; | 271 FX_WCHAR wPrev; |
177 ParseChar(prev, wPrev, ePrev); | 272 ParseChar(prev, wPrev, ePrev); |
178 if (wPrev == 0x0644 && eCur == FX_CHARTYPE_ArabicAlef) { | 273 if (wPrev == 0x0644 && eCur == FX_CHARTYPE_ArabicAlef) { |
179 return 0xFEFF; | 274 return 0xFEFF; |
180 } | 275 } |
181 FX_CHARTYPE eNext; | 276 FX_CHARTYPE eNext; |
(...skipping 11 matching lines...) Expand all Loading... |
193 wCur = FX_GetArabicFromAlefTable(wNext); | 288 wCur = FX_GetArabicFromAlefTable(wNext); |
194 return (ePrev != FX_CHARTYPE_ArabicDistortion) ? wCur : ++wCur; | 289 return (ePrev != FX_CHARTYPE_ArabicDistortion) ? wCur : ++wCur; |
195 } else if (ePrev == FX_CHARTYPE_ArabicAlef || | 290 } else if (ePrev == FX_CHARTYPE_ArabicAlef || |
196 ePrev == FX_CHARTYPE_ArabicSpecial) { | 291 ePrev == FX_CHARTYPE_ArabicSpecial) { |
197 return (eNext < FX_CHARTYPE_ArabicAlef) ? ft->wIsolated : ft->wInitial; | 292 return (eNext < FX_CHARTYPE_ArabicAlef) ? ft->wIsolated : ft->wInitial; |
198 } else { | 293 } else { |
199 return (eNext < FX_CHARTYPE_ArabicAlef) ? ft->wFinal : ft->wMedial; | 294 return (eNext < FX_CHARTYPE_ArabicAlef) ? ft->wFinal : ft->wMedial; |
200 } | 295 } |
201 } | 296 } |
202 } | 297 } |
203 FX_LPCARBFORMTABLE CFX_ArabicChar::ParseChar(const CFX_Char* pTC, | 298 const FX_ARBFORMTABLE* CFX_ArabicChar::ParseChar(const CFX_Char* pTC, |
204 FX_WCHAR& wChar, | 299 FX_WCHAR& wChar, |
205 FX_CHARTYPE& eType) const { | 300 FX_CHARTYPE& eType) const { |
206 if (pTC == NULL) { | 301 if (pTC == NULL) { |
207 eType = FX_CHARTYPE_Unknown; | 302 eType = FX_CHARTYPE_Unknown; |
208 wChar = 0xFEFF; | 303 wChar = 0xFEFF; |
209 return NULL; | 304 return NULL; |
210 } | 305 } |
211 eType = (FX_CHARTYPE)pTC->GetCharType(); | 306 eType = (FX_CHARTYPE)pTC->GetCharType(); |
212 wChar = (FX_WCHAR)pTC->m_wCharCode; | 307 wChar = (FX_WCHAR)pTC->m_wCharCode; |
213 FX_LPCARBFORMTABLE pFT = FX_GetArabicFormTable(wChar); | 308 const FX_ARBFORMTABLE* pFT = FX_GetArabicFormTable(wChar); |
214 if (pFT == NULL || eType >= FX_CHARTYPE_ArabicNormal) { | 309 if (pFT == NULL || eType >= FX_CHARTYPE_ArabicNormal) { |
215 eType = FX_CHARTYPE_Unknown; | 310 eType = FX_CHARTYPE_Unknown; |
216 } | 311 } |
217 return pFT; | 312 return pFT; |
218 } | 313 } |
219 void FX_BidiReverseString(CFX_WideString& wsText, | 314 void FX_BidiReverseString(CFX_WideString& wsText, |
220 int32_t iStart, | 315 int32_t iStart, |
221 int32_t iCount) { | 316 int32_t iCount) { |
222 FXSYS_assert(iStart > -1 && iStart < wsText.GetLength()); | 317 FXSYS_assert(iStart > -1 && iStart < wsText.GetLength()); |
223 FXSYS_assert(iCount >= 0 && iStart + iCount <= wsText.GetLength()); | 318 FXSYS_assert(iCount >= 0 && iStart + iCount <= wsText.GetLength()); |
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1046 } | 1141 } |
1047 }; | 1142 }; |
1048 void FX_BidiLine(CFX_TxtCharArray& chars, int32_t iCount, int32_t iBaseLevel) { | 1143 void FX_BidiLine(CFX_TxtCharArray& chars, int32_t iCount, int32_t iBaseLevel) { |
1049 CFX_BidiLineTemplate<CFX_TxtChar> blt; | 1144 CFX_BidiLineTemplate<CFX_TxtChar> blt; |
1050 blt.FX_BidiLine(chars, iCount, iBaseLevel); | 1145 blt.FX_BidiLine(chars, iCount, iBaseLevel); |
1051 } | 1146 } |
1052 void FX_BidiLine(CFX_RTFCharArray& chars, int32_t iCount, int32_t iBaseLevel) { | 1147 void FX_BidiLine(CFX_RTFCharArray& chars, int32_t iCount, int32_t iBaseLevel) { |
1053 CFX_BidiLineTemplate<CFX_RTFChar> blt; | 1148 CFX_BidiLineTemplate<CFX_RTFChar> blt; |
1054 blt.FX_BidiLine(chars, iCount, iBaseLevel); | 1149 blt.FX_BidiLine(chars, iCount, iBaseLevel); |
1055 } | 1150 } |
1056 IFX_BidiChar* IFX_BidiChar::Create() { | |
1057 return new CFX_BidiChar; | |
1058 } | |
1059 CFX_BidiChar::CFX_BidiChar() | |
1060 : m_bSeparateNeutral(TRUE), | |
1061 m_iCurStart(0), | |
1062 m_iCurCount(0), | |
1063 m_iCurBidi(0), | |
1064 m_iLastBidi(0), | |
1065 m_iLastStart(0), | |
1066 m_iLastCount(0) {} | |
1067 void CFX_BidiChar::SetPolicy(FX_BOOL bSeparateNeutral) { | |
1068 m_bSeparateNeutral = bSeparateNeutral; | |
1069 } | |
1070 | |
1071 FX_BOOL CFX_BidiChar::AppendChar(FX_WCHAR wch) { | |
1072 FX_DWORD dwProps = kTextLayoutCodeProperties[(FX_WORD)wch]; | |
1073 int32_t iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; | |
1074 int32_t iContext = 0; | |
1075 switch (iBidiCls) { | |
1076 case FX_BIDICLASS_L: | |
1077 case FX_BIDICLASS_AN: | |
1078 case FX_BIDICLASS_EN: | |
1079 iContext = 1; | |
1080 break; | |
1081 case FX_BIDICLASS_R: | |
1082 case FX_BIDICLASS_AL: | |
1083 iContext = 2; | |
1084 break; | |
1085 } | |
1086 FX_BOOL bRet = FALSE; | |
1087 if (iContext != m_iCurBidi) { | |
1088 if (m_bSeparateNeutral) { | |
1089 bRet = TRUE; | |
1090 } else { | |
1091 if (m_iCurBidi == 0) { | |
1092 bRet = (m_iCurCount > 0); | |
1093 } else { | |
1094 bRet = (iContext != 0); | |
1095 } | |
1096 } | |
1097 if (bRet) { | |
1098 m_iLastBidi = m_iCurBidi; | |
1099 m_iLastStart = m_iCurStart; | |
1100 m_iCurStart = m_iCurCount; | |
1101 m_iLastCount = m_iCurCount - m_iLastStart; | |
1102 } | |
1103 if (m_bSeparateNeutral || iContext != 0) { | |
1104 m_iCurBidi = iContext; | |
1105 } | |
1106 } | |
1107 m_iCurCount++; | |
1108 return bRet; | |
1109 } | |
1110 FX_BOOL CFX_BidiChar::EndChar() { | |
1111 m_iLastBidi = m_iCurBidi; | |
1112 m_iLastStart = m_iCurStart; | |
1113 m_iCurStart = m_iCurCount; | |
1114 m_iLastCount = m_iCurCount - m_iLastStart; | |
1115 return m_iLastCount > 0; | |
1116 } | |
1117 int32_t CFX_BidiChar::GetBidiInfo(int32_t& iStart, int32_t& iCount) { | |
1118 iStart = m_iLastStart; | |
1119 iCount = m_iLastCount; | |
1120 return m_iLastBidi; | |
1121 } | |
1122 void CFX_BidiChar::Reset() { | |
1123 m_iCurStart = 0; | |
1124 m_iCurCount = 0; | |
1125 m_iCurBidi = 0; | |
1126 m_iLastBidi = 0; | |
1127 m_iLastStart = 0; | |
1128 m_iLastCount = 0; | |
1129 } | |
OLD | NEW |