| 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 CPDF_CID2UnicodeMap* CPDF_CMapManager::LoadCID2UnicodeMap(CIDSet charset, | 334 CPDF_CID2UnicodeMap* CPDF_CMapManager::LoadCID2UnicodeMap(CIDSet charset, |
| 335 FX_BOOL bPromptCJK) { | 335 FX_BOOL bPromptCJK) { |
| 336 CPDF_CID2UnicodeMap* pMap = new CPDF_CID2UnicodeMap(); | 336 CPDF_CID2UnicodeMap* pMap = new CPDF_CID2UnicodeMap(); |
| 337 if (!pMap->Initialize()) { | 337 if (!pMap->Initialize()) { |
| 338 delete pMap; | 338 delete pMap; |
| 339 return nullptr; | 339 return nullptr; |
| 340 } | 340 } |
| 341 pMap->Load(this, charset, bPromptCJK); | 341 pMap->Load(this, charset, bPromptCJK); |
| 342 return pMap; | 342 return pMap; |
| 343 } | 343 } |
| 344 CPDF_CMapParser::CPDF_CMapParser() { | 344 |
| 345 m_pCMap = nullptr; | 345 CPDF_CMapParser::CPDF_CMapParser() |
| 346 m_Status = 0; | 346 : m_pCMap(nullptr), m_Status(0), m_CodeSeq(0) {} |
| 347 m_CodeSeq = 0; | 347 |
| 348 } | 348 CPDF_CMapParser::~CPDF_CMapParser() {} |
| 349 |
| 349 FX_BOOL CPDF_CMapParser::Initialize(CPDF_CMap* pCMap) { | 350 FX_BOOL CPDF_CMapParser::Initialize(CPDF_CMap* pCMap) { |
| 350 m_pCMap = pCMap; | 351 m_pCMap = pCMap; |
| 351 m_Status = 0; | 352 m_Status = 0; |
| 352 m_CodeSeq = 0; | 353 m_CodeSeq = 0; |
| 353 m_AddMaps.EstimateSize(0, 10240); | 354 m_AddMaps.EstimateSize(0, 10240); |
| 354 return TRUE; | 355 return TRUE; |
| 355 } | 356 } |
| 356 | 357 |
| 357 void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) { | 358 void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) { |
| 358 if (word.IsEmpty()) { | 359 if (word.IsEmpty()) { |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 FX_Free(m_pAddMapping); | 519 FX_Free(m_pAddMapping); |
| 519 FX_Free(m_pLeadingBytes); | 520 FX_Free(m_pLeadingBytes); |
| 520 delete m_pUseMap; | 521 delete m_pUseMap; |
| 521 } | 522 } |
| 522 void CPDF_CMap::Release() { | 523 void CPDF_CMap::Release() { |
| 523 if (m_PredefinedCMap.IsEmpty()) { | 524 if (m_PredefinedCMap.IsEmpty()) { |
| 524 delete this; | 525 delete this; |
| 525 } | 526 } |
| 526 } | 527 } |
| 527 | 528 |
| 529 FX_BOOL CPDF_CMap::IsLoaded() const { |
| 530 return m_bLoaded; |
| 531 } |
| 532 |
| 533 FX_BOOL CPDF_CMap::IsVertWriting() const { |
| 534 return m_bVertical; |
| 535 } |
| 536 |
| 528 FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, | 537 FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, |
| 529 const FX_CHAR* pName, | 538 const FX_CHAR* pName, |
| 530 FX_BOOL bPromptCJK) { | 539 FX_BOOL bPromptCJK) { |
| 531 m_PredefinedCMap = pName; | 540 m_PredefinedCMap = pName; |
| 532 if (m_PredefinedCMap == "Identity-H" || m_PredefinedCMap == "Identity-V") { | 541 if (m_PredefinedCMap == "Identity-H" || m_PredefinedCMap == "Identity-V") { |
| 533 m_Coding = CIDCODING_CID; | 542 m_Coding = CIDCODING_CID; |
| 534 m_bVertical = pName[9] == 'V'; | 543 m_bVertical = pName[9] == 'V'; |
| 535 m_bLoaded = TRUE; | 544 m_bLoaded = TRUE; |
| 536 return TRUE; | 545 return TRUE; |
| 537 } | 546 } |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 FPDFAPI_LoadCID2UnicodeMap(charset, m_pEmbeddedMap, m_EmbeddedCount); | 797 FPDFAPI_LoadCID2UnicodeMap(charset, m_pEmbeddedMap, m_EmbeddedCount); |
| 789 } | 798 } |
| 790 | 799 |
| 791 CIDSet CharsetFromOrdering(const CFX_ByteStringC& ordering) { | 800 CIDSet CharsetFromOrdering(const CFX_ByteStringC& ordering) { |
| 792 for (size_t charset = 1; charset < FX_ArraySize(g_CharsetNames); ++charset) { | 801 for (size_t charset = 1; charset < FX_ArraySize(g_CharsetNames); ++charset) { |
| 793 if (ordering == g_CharsetNames[charset]) | 802 if (ordering == g_CharsetNames[charset]) |
| 794 return CIDSetFromSizeT(charset); | 803 return CIDSetFromSizeT(charset); |
| 795 } | 804 } |
| 796 return CIDSET_UNKNOWN; | 805 return CIDSET_UNKNOWN; |
| 797 } | 806 } |
| OLD | NEW |