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_cmaps/cmap_int.h" | 9 #include "core/fpdfapi/fpdf_cmaps/cmap_int.h" |
10 #include "core/fpdfapi/fpdf_font/ttgsubtable.h" | 10 #include "core/fpdfapi/fpdf_font/ttgsubtable.h" |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 } | 297 } |
298 CPDF_CMap* pCMap = LoadPredefinedCMap(name, bPromptCJK); | 298 CPDF_CMap* pCMap = LoadPredefinedCMap(name, bPromptCJK); |
299 if (!name.IsEmpty()) { | 299 if (!name.IsEmpty()) { |
300 m_CMaps[name] = pCMap; | 300 m_CMaps[name] = pCMap; |
301 } | 301 } |
302 return pCMap; | 302 return pCMap; |
303 } | 303 } |
304 CPDF_CMap* CPDF_CMapManager::LoadPredefinedCMap(const CFX_ByteString& name, | 304 CPDF_CMap* CPDF_CMapManager::LoadPredefinedCMap(const CFX_ByteString& name, |
305 FX_BOOL bPromptCJK) { | 305 FX_BOOL bPromptCJK) { |
306 CPDF_CMap* pCMap = new CPDF_CMap; | 306 CPDF_CMap* pCMap = new CPDF_CMap; |
307 const FX_CHAR* pname = name; | 307 const FX_CHAR* pname = name.c_str(); |
308 if (*pname == '/') { | 308 if (*pname == '/') { |
309 pname++; | 309 pname++; |
310 } | 310 } |
311 pCMap->LoadPredefined(this, pname, bPromptCJK); | 311 pCMap->LoadPredefined(this, pname, bPromptCJK); |
312 return pCMap; | 312 return pCMap; |
313 } | 313 } |
314 | 314 |
315 void CPDF_CMapManager::ReloadAll() { | 315 void CPDF_CMapManager::ReloadAll() { |
316 for (const auto& pair : m_CMaps) { | 316 for (const auto& pair : m_CMaps) { |
317 CPDF_CMap* pCMap = pair.second; | 317 CPDF_CMap* pCMap = pair.second; |
318 pCMap->LoadPredefined(this, pair.first, FALSE); | 318 pCMap->LoadPredefined(this, pair.first.c_str(), FALSE); |
319 } | 319 } |
320 for (size_t i = 0; i < FX_ArraySize(m_CID2UnicodeMaps); ++i) { | 320 for (size_t i = 0; i < FX_ArraySize(m_CID2UnicodeMaps); ++i) { |
321 if (CPDF_CID2UnicodeMap* pMap = m_CID2UnicodeMaps[i]) { | 321 if (CPDF_CID2UnicodeMap* pMap = m_CID2UnicodeMaps[i]) { |
322 pMap->Load(this, CIDSetFromSizeT(i), FALSE); | 322 pMap->Load(this, CIDSetFromSizeT(i), FALSE); |
323 } | 323 } |
324 } | 324 } |
325 } | 325 } |
326 CPDF_CID2UnicodeMap* CPDF_CMapManager::GetCID2UnicodeMap(CIDSet charset, | 326 CPDF_CID2UnicodeMap* CPDF_CMapManager::GetCID2UnicodeMap(CIDSet charset, |
327 FX_BOOL bPromptCJK) { | 327 FX_BOOL bPromptCJK) { |
328 if (!m_CID2UnicodeMaps[charset]) | 328 if (!m_CID2UnicodeMaps[charset]) |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 FPDFAPI_LoadCID2UnicodeMap(charset, m_pEmbeddedMap, m_EmbeddedCount); | 788 FPDFAPI_LoadCID2UnicodeMap(charset, m_pEmbeddedMap, m_EmbeddedCount); |
789 } | 789 } |
790 | 790 |
791 CIDSet CharsetFromOrdering(const CFX_ByteString& ordering) { | 791 CIDSet CharsetFromOrdering(const CFX_ByteString& ordering) { |
792 for (size_t charset = 1; charset < FX_ArraySize(g_CharsetNames); ++charset) { | 792 for (size_t charset = 1; charset < FX_ArraySize(g_CharsetNames); ++charset) { |
793 if (ordering == CFX_ByteStringC(g_CharsetNames[charset])) | 793 if (ordering == CFX_ByteStringC(g_CharsetNames[charset])) |
794 return CIDSetFromSizeT(charset); | 794 return CIDSetFromSizeT(charset); |
795 } | 795 } |
796 return CIDSET_UNKNOWN; | 796 return CIDSET_UNKNOWN; |
797 } | 797 } |
OLD | NEW |