Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(483)

Side by Side Diff: core/fpdftext/unicodenormalization.cpp

Issue 1897993002: Remove IPDF_TextPage, IPDF_TextPageFind and IPDF_LinkExtract interfaces. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/fpdftext/unicodenormalization.h ('k') | fpdfsdk/fpdf_searchex.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #include "core/fpdftext/unicodenormalization.h"
8
9 #include "core/fpdftext/unicodenormalizationdata.h"
10 #include "core/fxcrt/include/fx_string.h"
11
12 namespace {
13
14 const uint16_t* const g_UnicodeData_Normalization_Maps[5] = {
15 nullptr, g_UnicodeData_Normalization_Map1, g_UnicodeData_Normalization_Map2,
16 g_UnicodeData_Normalization_Map3, g_UnicodeData_Normalization_Map4};
17
18 } // namespace
19
20 FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst) {
21 wch = wch & 0xFFFF;
22 FX_WCHAR wFind = g_UnicodeData_Normalization[wch];
23 if (!wFind) {
24 if (pDst) {
25 *pDst = wch;
26 }
27 return 1;
28 }
29 if (wFind >= 0x8000) {
30 wch = wFind - 0x8000;
31 wFind = 1;
32 } else {
33 wch = wFind & 0x0FFF;
34 wFind >>= 12;
35 }
36 const uint16_t* pMap = g_UnicodeData_Normalization_Maps[wFind];
37 if (pMap == g_UnicodeData_Normalization_Map4) {
38 pMap = g_UnicodeData_Normalization_Map4 + wch;
39 wFind = (FX_WCHAR)(*pMap++);
40 } else {
41 pMap += wch;
42 }
43 if (pDst) {
44 FX_WCHAR n = wFind;
45 while (n--) {
46 *pDst++ = *pMap++;
47 }
48 }
49 return (FX_STRSIZE)wFind;
50 }
OLDNEW
« no previous file with comments | « core/fpdftext/unicodenormalization.h ('k') | fpdfsdk/fpdf_searchex.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698