Commit 5474583e authored by Marco Pesenti Gritti's avatar Marco Pesenti Gritti

2005-09-16 Marco Pesenti Gritti <mpg@redhat.com>

        * poppler/CharCodeToUnicode.cc:
        * poppler/CharCodeToUnicode.h:

        Improvements from xpdf 3.01
parent b2a6eab1
2005-09-16 Marco Pesenti Gritti <mpg@redhat.com>
* poppler/CharCodeToUnicode.cc:
* poppler/CharCodeToUnicode.h:
Improvements from xpdf 3.01
2005-09-16 Marco Pesenti Gritti <mpg@redhat.com>
* poppler/CMap.cc:
......
......@@ -251,7 +251,7 @@ void CharCodeToUnicode::parseCMap1(int (*getCharFunc)(void *), void *data,
error(-1, "Illegal entry in bfchar block in ToUnicode CMap");
continue;
}
addMapping(code1, tok2 + 1, n2 - 1, 0);
addMapping(code1, tok2 + 1, n2 - 2, 0);
}
pst->getToken(tok1, sizeof(tok1), &n1);
} else if (!strcmp(tok2, "beginbfrange")) {
......@@ -433,23 +433,30 @@ GBool CharCodeToUnicode::match(GooString *tagA) {
}
void CharCodeToUnicode::setMapping(CharCode c, Unicode *u, int len) {
int i;
int i, j;
if (len == 1) {
map[c] = u[0];
} else {
map[c] = 0;
if (sMapLen == sMapSize) {
sMapSize += 8;
sMap = (CharCodeToUnicodeString *)
greallocn(sMap, sMapSize, sizeof(CharCodeToUnicodeString));
for (i = 0; i < sMapLen; ++i) {
if (sMap[i].c == c) {
break;
}
}
sMap[sMapLen].c = c;
sMap[sMapLen].len = len;
for (i = 0; i < len && i < maxUnicodeString; ++i) {
sMap[sMapLen].u[i] = u[i];
if (i == sMapLen) {
if (sMapLen == sMapSize) {
sMapSize += 8;
sMap = (CharCodeToUnicodeString *)
greallocn(sMap, sMapSize, sizeof(CharCodeToUnicodeString));
}
++sMapLen;
}
map[c] = 0;
sMap[i].c = c;
sMap[i].len = len;
for (j = 0; j < len && j < maxUnicodeString; ++j) {
sMap[i].u[j] = u[j];
}
++sMapLen;
}
}
......
......@@ -66,6 +66,10 @@ public:
// Map a CharCode to Unicode.
int mapToUnicode(CharCode c, Unicode *u, int size);
// Return the mapping's length, i.e., one more than the max char
// code supported by the mapping.
CharCode getLength() { return mapLen; }
private:
void parseCMap1(int (*getCharFunc)(void *), void *data, int nBits);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment