| 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/fpdfapi/fpdf_font/font_int.h" | 7 #include "core/fpdfapi/fpdf_font/font_int.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" | 9 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" |
| 10 #include "core/fpdfapi/fpdf_page/pageint.h" | 10 #include "core/fpdfapi/fpdf_page/pageint.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 uint32_t CPDF_ToUnicodeMap::ReverseLookup(FX_WCHAR unicode) { | 124 uint32_t CPDF_ToUnicodeMap::ReverseLookup(FX_WCHAR unicode) { |
| 125 for (const auto& pair : m_Map) { | 125 for (const auto& pair : m_Map) { |
| 126 if (pair.second == static_cast<uint32_t>(unicode)) | 126 if (pair.second == static_cast<uint32_t>(unicode)) |
| 127 return pair.first; | 127 return pair.first; |
| 128 } | 128 } |
| 129 return 0; | 129 return 0; |
| 130 } | 130 } |
| 131 | 131 |
| 132 // Static. | 132 // Static. |
| 133 uint32_t CPDF_ToUnicodeMap::StringToCode(const CFX_ByteStringC& str) { | 133 uint32_t CPDF_ToUnicodeMap::StringToCode(const CFX_ByteStringC& str) { |
| 134 const FX_CHAR* buf = str.GetCStr(); | 134 const FX_CHAR* buf = str.c_str(); |
| 135 int len = str.GetLength(); | 135 int len = str.GetLength(); |
| 136 if (len == 0) | 136 if (len == 0) |
| 137 return 0; | 137 return 0; |
| 138 | 138 |
| 139 int result = 0; | 139 int result = 0; |
| 140 if (buf[0] == '<') { | 140 if (buf[0] == '<') { |
| 141 for (int i = 1; i < len && std::isxdigit(buf[i]); ++i) | 141 for (int i = 1; i < len && std::isxdigit(buf[i]); ++i) |
| 142 result = result * 16 + FXSYS_toHexDigit(buf[i]); | 142 result = result * 16 + FXSYS_toHexDigit(buf[i]); |
| 143 return result; | 143 return result; |
| 144 } | 144 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 164 } | 164 } |
| 165 if (value) { | 165 if (value) { |
| 166 ret.Insert(0, value); | 166 ret.Insert(0, value); |
| 167 } | 167 } |
| 168 return ret; | 168 return ret; |
| 169 } | 169 } |
| 170 | 170 |
| 171 // Static. | 171 // Static. |
| 172 CFX_WideString CPDF_ToUnicodeMap::StringToWideString( | 172 CFX_WideString CPDF_ToUnicodeMap::StringToWideString( |
| 173 const CFX_ByteStringC& str) { | 173 const CFX_ByteStringC& str) { |
| 174 const FX_CHAR* buf = str.GetCStr(); | 174 const FX_CHAR* buf = str.c_str(); |
| 175 int len = str.GetLength(); | 175 int len = str.GetLength(); |
| 176 if (len == 0) | 176 if (len == 0) |
| 177 return CFX_WideString(); | 177 return CFX_WideString(); |
| 178 | 178 |
| 179 CFX_WideString result; | 179 CFX_WideString result; |
| 180 if (buf[0] == '<') { | 180 if (buf[0] == '<') { |
| 181 int byte_pos = 0; | 181 int byte_pos = 0; |
| 182 FX_WCHAR ch = 0; | 182 FX_WCHAR ch = 0; |
| 183 for (int i = 1; i < len && std::isxdigit(buf[i]); ++i) { | 183 for (int i = 1; i < len && std::isxdigit(buf[i]); ++i) { |
| 184 ch = ch * 16 + FXSYS_toHexDigit(buf[i]); | 184 ch = ch * 16 + FXSYS_toHexDigit(buf[i]); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 } | 294 } |
| 295 if (cid_set) { | 295 if (cid_set) { |
| 296 m_pBaseMap = CPDF_ModuleMgr::Get() | 296 m_pBaseMap = CPDF_ModuleMgr::Get() |
| 297 ->GetPageModule() | 297 ->GetPageModule() |
| 298 ->GetFontGlobals() | 298 ->GetFontGlobals() |
| 299 ->m_CMapManager.GetCID2UnicodeMap(cid_set, FALSE); | 299 ->m_CMapManager.GetCID2UnicodeMap(cid_set, FALSE); |
| 300 } else { | 300 } else { |
| 301 m_pBaseMap = NULL; | 301 m_pBaseMap = NULL; |
| 302 } | 302 } |
| 303 } | 303 } |
| OLD | NEW |