summaryrefslogtreecommitdiff
path: root/core/fpdftext/cpdf_textpage.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-04-30 22:30:53 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-30 22:30:53 +0000
commit723543481bea9c6ea14fc39b71333b34eb8d89b4 (patch)
treeb1f1bc0161e68e01e3889ac086bef906a481c5a1 /core/fpdftext/cpdf_textpage.cpp
parent8dbad1ef10c86c893581696a87be32d04105d3a3 (diff)
downloadpdfium-723543481bea9c6ea14fc39b71333b34eb8d89b4.tar.xz
Reorganize Unicode_GetNormalization() some more.
Change-Id: I183a53d08f5da73d788c92b53382e3fac3b823e2 Reviewed-on: https://pdfium-review.googlesource.com/31671 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fpdftext/cpdf_textpage.cpp')
-rw-r--r--core/fpdftext/cpdf_textpage.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index 81637624ee..31ed9fc704 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -28,9 +28,9 @@
namespace {
const float kDefaultFontSize = 1.0f;
-const uint16_t* const g_UnicodeData_Normalization_Maps[5] = {
- nullptr, g_UnicodeData_Normalization_Map1, g_UnicodeData_Normalization_Map2,
- g_UnicodeData_Normalization_Map3, g_UnicodeData_Normalization_Map4};
+const uint16_t* const g_UnicodeData_Normalization_Maps[] = {
+ g_UnicodeData_Normalization_Map2, g_UnicodeData_Normalization_Map3,
+ g_UnicodeData_Normalization_Map4};
float NormalizeThreshold(float threshold, int t1, int t2, int t3) {
ASSERT(t1 < t2);
@@ -78,15 +78,18 @@ size_t Unicode_GetNormalization(wchar_t wch, wchar_t* pDst) {
return 1;
}
if (wFind >= 0x8000) {
- wch = wFind - 0x8000;
- wFind = 1;
- } else {
- wch = wFind & 0x0FFF;
- wFind >>= 12;
+ const uint16_t* pMap = g_UnicodeData_Normalization_Map1 + (wFind - 0x8000);
+ if (pDst)
+ *pDst = *pMap;
+ return 1;
}
- const uint16_t* pMap = g_UnicodeData_Normalization_Maps[wFind] + wch;
+
+ wch = wFind & 0x0FFF;
+ wFind >>= 12;
+ const uint16_t* pMap = g_UnicodeData_Normalization_Maps[wFind - 2] + wch;
if (wFind == 4)
wFind = (wchar_t)(*pMap++);
+
if (pDst) {
wchar_t n = wFind;
while (n--)