[poppler] utils/HtmlOutputDev.cc
Albert Astals Cid
aacid at kemper.freedesktop.org
Thu Feb 23 14:47:50 PST 2012
utils/HtmlOutputDev.cc | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
New commits:
commit 466340d257ff0fe7e3a88a4e013e3feec3f7b70a
Author: Albert Astals Cid <aacid at kde.org>
Date: Thu Feb 23 23:47:15 2012 +0100
Combine UTF16 surrogate pairs
Bug 46521
diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc
index 9e113eb..17541a2 100644
--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -398,7 +398,19 @@ void HtmlPage::addChar(GfxState *state, double x, double y,
h1 /= uLen;
}
for (i = 0; i < uLen; ++i) {
- curStr->addChar(state, x1 + i*w1, y1 + i*h1, w1, h1, u[i]);
+ Unicode u1 = u[i];
+ if (u1 >= 0xd800 && u1 <= 0xdbff && i < uLen) {
+ // surrogate pair
+ const Unicode u2 = u[i + 1];
+ if (u2 >= 0xdc00 && u2 <= 0xdfff) {
+ u1 = 0x10000 + ((u1 - 0xd800) << 10) + (u2 - 0xdc00);
+
+ curStr->addChar(state, x1 + i*w1, y1 + i*h1, w1, h1, u1);
+ }
+ ++i;
+ } else {
+ curStr->addChar(state, x1 + i*w1, y1 + i*h1, w1, h1, u1);
+ }
}
}
More information about the poppler
mailing list