[poppler] poppler/UnicodeTypeTable.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jan 28 23:00:56 UTC 2020


 poppler/UnicodeTypeTable.cc |   52 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 43 insertions(+), 9 deletions(-)

New commits:
commit b9c8632375e0c8a96dbf706e813ef1639dd297af
Author: Alex Henrie <alexhenrie24 at gmail.com>
Date:   Thu Jan 23 20:01:57 2020 -0700

    Add case table for Deseret and Osage
    
    Fixes #853

diff --git a/poppler/UnicodeTypeTable.cc b/poppler/UnicodeTypeTable.cc
index f4b7e3f8..678ddc71 100644
--- a/poppler/UnicodeTypeTable.cc
+++ b/poppler/UnicodeTypeTable.cc
@@ -672,7 +672,41 @@ static const UnicodeCaseTableVector caseTableff = {{
   0xfff0, 0xfff1, 0xfff2, 0xfff3, 0xfff4, 0xfff5, 0xfff6, 0xfff7,
   0xfff8, 0xfff9, 0xfffa, 0xfffb, 0xfffc, 0xfffd, 0xfffe, 0xffff
 }};
-static const UnicodeCaseTableVector *caseTable[256] = {
+static const UnicodeCaseTableVector caseTable104 = {{
+  0x10400, 0x10401, 0x10402, 0x10403, 0x10404, 0x10405, 0x10406, 0x10407,
+  0x10408, 0x10409, 0x1040a, 0x1040b, 0x1040c, 0x1040d, 0x1040e, 0x1040f,
+  0x10410, 0x10411, 0x10412, 0x10413, 0x10414, 0x10415, 0x10416, 0x10417,
+  0x10418, 0x10419, 0x1041a, 0x1041b, 0x1041c, 0x1041d, 0x1041e, 0x1041f,
+  0x10420, 0x10421, 0x10422, 0x10423, 0x10424, 0x10425, 0x10426, 0x10427,
+  0x10400, 0x10401, 0x10402, 0x10403, 0x10404, 0x10405, 0x10406, 0x10407,
+  0x10408, 0x10409, 0x1040a, 0x1040b, 0x1040c, 0x1040d, 0x1040e, 0x1040f,
+  0x10410, 0x10411, 0x10412, 0x10413, 0x10414, 0x10415, 0x10416, 0x10417,
+  0x10418, 0x10419, 0x1041a, 0x1041b, 0x1041c, 0x1041d, 0x1041e, 0x1041f,
+  0x10420, 0x10421, 0x10422, 0x10423, 0x10424, 0x10425, 0x10426, 0x10427,
+  0x10450, 0x10451, 0x10452, 0x10453, 0x10454, 0x10455, 0x10456, 0x10457,
+  0x10458, 0x10459, 0x1045a, 0x1045b, 0x1045c, 0x1045d, 0x1045e, 0x1045f,
+  0x10460, 0x10461, 0x10462, 0x10463, 0x10464, 0x10465, 0x10466, 0x10467,
+  0x10468, 0x10469, 0x1046a, 0x1046b, 0x1046c, 0x1046d, 0x1046e, 0x1046f,
+  0x10470, 0x10471, 0x10472, 0x10473, 0x10474, 0x10475, 0x10476, 0x10477,
+  0x10478, 0x10479, 0x1047a, 0x1047b, 0x1047c, 0x1047d, 0x1047e, 0x1047f,
+  0x10480, 0x10481, 0x10482, 0x10483, 0x10484, 0x10485, 0x10486, 0x10487,
+  0x10488, 0x10489, 0x1048a, 0x1048b, 0x1048c, 0x1048d, 0x1048e, 0x1048f,
+  0x10490, 0x10491, 0x10492, 0x10493, 0x10494, 0x10495, 0x10496, 0x10497,
+  0x10498, 0x10499, 0x1049a, 0x1049b, 0x1049c, 0x1049d, 0x1049e, 0x1049f,
+  0x104a0, 0x104a1, 0x104a2, 0x104a3, 0x104a4, 0x104a5, 0x104a6, 0x104a7,
+  0x104a8, 0x104a9, 0x104aa, 0x104ab, 0x104ac, 0x104ad, 0x104ae, 0x104af,
+  0x104b0, 0x104b1, 0x104b2, 0x104b3, 0x104b4, 0x104b5, 0x104b6, 0x104b7,
+  0x104b8, 0x104b9, 0x104ba, 0x104bb, 0x104bc, 0x104bd, 0x104be, 0x104bf,
+  0x104c0, 0x104c1, 0x104c2, 0x104c3, 0x104c4, 0x104c5, 0x104c6, 0x104c7,
+  0x104c8, 0x104c9, 0x104ca, 0x104cb, 0x104cc, 0x104cd, 0x104ce, 0x104cf,
+  0x104d0, 0x104d1, 0x104d2, 0x104d3, 0x104d4, 0x104d5, 0x104d6, 0x104d7,
+  0x104b0, 0x104b1, 0x104b2, 0x104b3, 0x104b4, 0x104b5, 0x104b6, 0x104b7,
+  0x104b8, 0x104b9, 0x104ba, 0x104bb, 0x104bc, 0x104bd, 0x104be, 0x104bf,
+  0x104c0, 0x104c1, 0x104c2, 0x104c3, 0x104c4, 0x104c5, 0x104c6, 0x104c7,
+  0x104c8, 0x104c9, 0x104ca, 0x104cb, 0x104cc, 0x104cd, 0x104ce, 0x104cf,
+  0x104d0, 0x104d1, 0x104d2, 0x104d3, 0x104fc, 0x104fd, 0x104fe, 0x104ff,
+}};
+static const UnicodeCaseTableVector *caseTable[] = {
   &caseTable00,
   &caseTable01,
   &caseTable02,
@@ -928,7 +962,12 @@ static const UnicodeCaseTableVector *caseTable[256] = {
   nullptr,
   nullptr,
   nullptr,
-  &caseTableff
+  &caseTableff,
+  nullptr,
+  nullptr,
+  nullptr,
+  nullptr,
+  &caseTable104,
 };
 
 static inline char getType(Unicode c) {
@@ -974,13 +1013,8 @@ bool unicodeIsAlphabeticPresentationForm(Unicode c) {
 }
 
 Unicode unicodeToUpper(Unicode c) {
-  int i;
-
-  if (c > 0xffff) {
-    return c;
-  }
-  i = (c >> 8) & 0xff;
-  if (caseTable[i]) {
+  size_t i = (c >> 8);
+  if (i < sizeof(caseTable)/sizeof(caseTable[0]) && caseTable[i]) {
     return caseTable[i]->codes[c & 0xff];
   }
   return c;


More information about the poppler mailing list