From 18342f5d7c80528ffe85a5c89a48d3bbd93fb6bd Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 23 Aug 2018 17:57:39 +0000 Subject: Remove bool bPromptCJK argument (several places) It gets computed, and passed around, but in the end no decisions are made because of it. Change-Id: If67f6f0cd0c37e52993832be1fb83498fd851914 Reviewed-on: https://pdfium-review.googlesource.com/41190 Reviewed-by: Ryan Harrison Commit-Queue: Tom Sepez --- core/fpdfapi/font/cpdf_cid2unicodemap.cpp | 5 +---- core/fpdfapi/font/cpdf_cid2unicodemap.h | 2 +- core/fpdfapi/font/cpdf_cidfont.cpp | 11 ++++------- core/fpdfapi/font/cpdf_cmap.cpp | 3 +-- core/fpdfapi/font/cpdf_cmap.h | 4 +--- core/fpdfapi/font/cpdf_cmapmanager.cpp | 21 +++++++++------------ core/fpdfapi/font/cpdf_cmapmanager.h | 10 ++++------ core/fpdfapi/font/cpdf_tounicodemap.cpp | 2 +- 8 files changed, 22 insertions(+), 36 deletions(-) diff --git a/core/fpdfapi/font/cpdf_cid2unicodemap.cpp b/core/fpdfapi/font/cpdf_cid2unicodemap.cpp index b2e435b5f1..f36834df96 100644 --- a/core/fpdfapi/font/cpdf_cid2unicodemap.cpp +++ b/core/fpdfapi/font/cpdf_cid2unicodemap.cpp @@ -28,13 +28,10 @@ wchar_t CPDF_CID2UnicodeMap::UnicodeFromCID(uint16_t CID) const { return 0; } -void CPDF_CID2UnicodeMap::Load(CPDF_CMapManager* pMgr, - CIDSet charset, - bool bPromptCJK) { +void CPDF_CID2UnicodeMap::Load(CPDF_CMapManager* pMgr, CIDSet charset) { m_Charset = charset; CPDF_FontGlobals* pFontGlobals = CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals(); - m_pEmbeddedMap = pFontGlobals->GetEmbeddedToUnicode(charset); } diff --git a/core/fpdfapi/font/cpdf_cid2unicodemap.h b/core/fpdfapi/font/cpdf_cid2unicodemap.h index 73c5059558..16467f31a7 100644 --- a/core/fpdfapi/font/cpdf_cid2unicodemap.h +++ b/core/fpdfapi/font/cpdf_cid2unicodemap.h @@ -19,7 +19,7 @@ class CPDF_CID2UnicodeMap { bool IsLoaded() const; wchar_t UnicodeFromCID(uint16_t CID) const; - void Load(CPDF_CMapManager* pMgr, CIDSet charset, bool bPromptCJK); + void Load(CPDF_CMapManager* pMgr, CIDSet charset); private: CIDSet m_Charset; diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp index a423daa1bb..98478c378a 100644 --- a/core/fpdfapi/font/cpdf_cidfont.cpp +++ b/core/fpdfapi/font/cpdf_cidfont.cpp @@ -362,8 +362,7 @@ bool CPDF_CIDFont::Load() { CPDF_CMapManager* manager = GetFontGlobals()->GetCMapManager(); if (pEncoding->IsName()) { ByteString cmap = pEncoding->GetString(); - bool bPromptCJK = m_pFontFile && m_bType1; - m_pCMap = manager->GetPredefinedCMap(cmap, bPromptCJK); + m_pCMap = manager->GetPredefinedCMap(cmap); if (!m_pCMap) return false; } else if (CPDF_Stream* pStream = pEncoding->AsStream()) { @@ -384,9 +383,7 @@ bool CPDF_CIDFont::Load() { } } if (m_Charset != CIDSET_UNKNOWN) { - bool bPromptCJK = !m_pFontFile && (m_pCMap->GetCoding() == CIDCODING_CID || - pCIDFontDict->KeyExist("W")); - m_pCID2UnicodeMap = manager->GetCID2UnicodeMap(m_Charset, bPromptCJK); + m_pCID2UnicodeMap = manager->GetCID2UnicodeMap(m_Charset); } if (m_Font.GetFace()) { if (m_bType1) @@ -832,8 +829,8 @@ void CPDF_CIDFont::LoadGB2312() { m_Charset = CIDSET_GB1; CPDF_CMapManager* manager = GetFontGlobals()->GetCMapManager(); - m_pCMap = manager->GetPredefinedCMap("GBK-EUC-H", false); - m_pCID2UnicodeMap = manager->GetCID2UnicodeMap(m_Charset, false); + m_pCMap = manager->GetPredefinedCMap("GBK-EUC-H"); + m_pCID2UnicodeMap = manager->GetCID2UnicodeMap(m_Charset); if (!IsEmbedded()) LoadSubstFont(); diff --git a/core/fpdfapi/font/cpdf_cmap.cpp b/core/fpdfapi/font/cpdf_cmap.cpp index ee8f264869..3e5732215d 100644 --- a/core/fpdfapi/font/cpdf_cmap.cpp +++ b/core/fpdfapi/font/cpdf_cmap.cpp @@ -248,8 +248,7 @@ CPDF_CMap::CPDF_CMap() CPDF_CMap::~CPDF_CMap() {} void CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, - const ByteString& bsName, - bool bPromptCJK) { + const ByteString& bsName) { m_PredefinedCMap = bsName; if (m_PredefinedCMap == "Identity-H" || m_PredefinedCMap == "Identity-V") { m_Coding = CIDCODING_CID; diff --git a/core/fpdfapi/font/cpdf_cmap.h b/core/fpdfapi/font/cpdf_cmap.h index b3c09d520f..45053bdfb5 100644 --- a/core/fpdfapi/font/cpdf_cmap.h +++ b/core/fpdfapi/font/cpdf_cmap.h @@ -51,9 +51,7 @@ class CPDF_CMap : public Retainable { template friend RetainPtr pdfium::MakeRetain(Args&&... args); - void LoadPredefined(CPDF_CMapManager* pMgr, - const ByteString& name, - bool bPromptCJK); + void LoadPredefined(CPDF_CMapManager* pMgr, const ByteString& name); void LoadEmbedded(pdfium::span data); bool IsLoaded() const { return m_bLoaded; } diff --git a/core/fpdfapi/font/cpdf_cmapmanager.cpp b/core/fpdfapi/font/cpdf_cmapmanager.cpp index 62a2013448..c33759cd11 100644 --- a/core/fpdfapi/font/cpdf_cmapmanager.cpp +++ b/core/fpdfapi/font/cpdf_cmapmanager.cpp @@ -16,41 +16,38 @@ CPDF_CMapManager::CPDF_CMapManager() {} CPDF_CMapManager::~CPDF_CMapManager() {} -RetainPtr CPDF_CMapManager::GetPredefinedCMap(const ByteString& name, - bool bPromptCJK) { +RetainPtr CPDF_CMapManager::GetPredefinedCMap( + const ByteString& name) { auto it = m_CMaps.find(name); if (it != m_CMaps.end()) return it->second; - RetainPtr pCMap = LoadPredefinedCMap(name, bPromptCJK); + RetainPtr pCMap = LoadPredefinedCMap(name); if (!name.IsEmpty()) m_CMaps[name] = pCMap; return pCMap; } -RetainPtr CPDF_CMapManager::LoadPredefinedCMap(ByteString name, - bool bPromptCJK) { +RetainPtr CPDF_CMapManager::LoadPredefinedCMap(ByteString name) { if (!name.IsEmpty() && name[0] == '/') name = name.Right(name.GetLength() - 1); auto pCMap = pdfium::MakeRetain(); - pCMap->LoadPredefined(this, name, bPromptCJK); + pCMap->LoadPredefined(this, name); return pCMap; } -CPDF_CID2UnicodeMap* CPDF_CMapManager::GetCID2UnicodeMap(CIDSet charset, - bool bPromptCJK) { +CPDF_CID2UnicodeMap* CPDF_CMapManager::GetCID2UnicodeMap(CIDSet charset) { if (!m_CID2UnicodeMaps[charset]) - m_CID2UnicodeMaps[charset] = LoadCID2UnicodeMap(charset, bPromptCJK); + m_CID2UnicodeMaps[charset] = LoadCID2UnicodeMap(charset); return m_CID2UnicodeMaps[charset].get(); } std::unique_ptr CPDF_CMapManager::LoadCID2UnicodeMap( - CIDSet charset, - bool bPromptCJK) { + CIDSet charset) { auto pMap = pdfium::MakeUnique(); - pMap->Load(this, charset, bPromptCJK); + pMap->Load(this, charset); return pMap; } diff --git a/core/fpdfapi/font/cpdf_cmapmanager.h b/core/fpdfapi/font/cpdf_cmapmanager.h index 47a0be063f..af61e3fb7e 100644 --- a/core/fpdfapi/font/cpdf_cmapmanager.h +++ b/core/fpdfapi/font/cpdf_cmapmanager.h @@ -19,14 +19,12 @@ class CPDF_CMapManager { CPDF_CMapManager(); ~CPDF_CMapManager(); - RetainPtr GetPredefinedCMap(const ByteString& name, - bool bPromptCJK); - CPDF_CID2UnicodeMap* GetCID2UnicodeMap(CIDSet charset, bool bPromptCJK); + RetainPtr GetPredefinedCMap(const ByteString& name); + CPDF_CID2UnicodeMap* GetCID2UnicodeMap(CIDSet charset); private: - RetainPtr LoadPredefinedCMap(ByteString name, bool bPromptCJK); - std::unique_ptr LoadCID2UnicodeMap(CIDSet charset, - bool bPromptCJK); + RetainPtr LoadPredefinedCMap(ByteString name); + std::unique_ptr LoadCID2UnicodeMap(CIDSet charset); std::map> m_CMaps; std::unique_ptr m_CID2UnicodeMaps[6]; diff --git a/core/fpdfapi/font/cpdf_tounicodemap.cpp b/core/fpdfapi/font/cpdf_tounicodemap.cpp index e8917310a2..5362e48e10 100644 --- a/core/fpdfapi/font/cpdf_tounicodemap.cpp +++ b/core/fpdfapi/font/cpdf_tounicodemap.cpp @@ -227,7 +227,7 @@ void CPDF_ToUnicodeMap::Load(const CPDF_Stream* pStream) { ->GetPageModule() ->GetFontGlobals() ->GetCMapManager() - ->GetCID2UnicodeMap(cid_set, false); + ->GetCID2UnicodeMap(cid_set); } else { m_pBaseMap = nullptr; } -- cgit v1.2.3