OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
| 7 #include "core/fpdftext/unicodenormalizationdata.h" |
7 #include "core/include/fxcrt/fx_string.h" | 8 #include "core/include/fxcrt/fx_string.h" |
8 #include "core/src/fpdftext/unicodenormalizationdata.h" | |
9 | 9 |
10 const FX_WCHAR* const g_UnicodeData_Normalization_Maps[5] = { | 10 const FX_WCHAR* const g_UnicodeData_Normalization_Maps[5] = { |
11 nullptr, | 11 nullptr, g_UnicodeData_Normalization_Map1, g_UnicodeData_Normalization_Map2, |
12 g_UnicodeData_Normalization_Map1, | 12 g_UnicodeData_Normalization_Map3, g_UnicodeData_Normalization_Map4}; |
13 g_UnicodeData_Normalization_Map2, | |
14 g_UnicodeData_Normalization_Map3, | |
15 g_UnicodeData_Normalization_Map4}; | |
16 | 13 |
17 FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst) { | 14 FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst) { |
18 wch = wch & 0xFFFF; | 15 wch = wch & 0xFFFF; |
19 FX_WCHAR wFind = g_UnicodeData_Normalization[wch]; | 16 FX_WCHAR wFind = g_UnicodeData_Normalization[wch]; |
20 if (!wFind) { | 17 if (!wFind) { |
21 if (pDst) { | 18 if (pDst) { |
22 *pDst = wch; | 19 *pDst = wch; |
23 } | 20 } |
24 return 1; | 21 return 1; |
25 } | 22 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 CFX_WideString& wsDst) { | 59 CFX_WideString& wsDst) { |
63 FX_STRSIZE nLen = FX_WideString_GetNormalization(wsSrc, (FX_WCHAR*)NULL); | 60 FX_STRSIZE nLen = FX_WideString_GetNormalization(wsSrc, (FX_WCHAR*)NULL); |
64 if (!nLen) { | 61 if (!nLen) { |
65 return 0; | 62 return 0; |
66 } | 63 } |
67 FX_WCHAR* pBuf = wsDst.GetBuffer(nLen); | 64 FX_WCHAR* pBuf = wsDst.GetBuffer(nLen); |
68 FX_WideString_GetNormalization(wsSrc, pBuf); | 65 FX_WideString_GetNormalization(wsSrc, pBuf); |
69 wsDst.ReleaseBuffer(nLen); | 66 wsDst.ReleaseBuffer(nLen); |
70 return nLen; | 67 return nLen; |
71 } | 68 } |
OLD | NEW |