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 <rharrison@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/font/cpdf_cid2unicodemap.cpp b/core/fpdfapi/font/cpdf_cid2unicodemap.cpp
index b2e435b..f36834d 100644
--- a/core/fpdfapi/font/cpdf_cid2unicodemap.cpp
+++ b/core/fpdfapi/font/cpdf_cid2unicodemap.cpp
@@ -28,13 +28,10 @@
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 73c5059..16467f3 100644
--- a/core/fpdfapi/font/cpdf_cid2unicodemap.h
+++ b/core/fpdfapi/font/cpdf_cid2unicodemap.h
@@ -19,7 +19,7 @@
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 a423daa..98478c3 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -362,8 +362,7 @@
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 @@
}
}
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 @@
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 ee8f264..3e57322 100644
--- a/core/fpdfapi/font/cpdf_cmap.cpp
+++ b/core/fpdfapi/font/cpdf_cmap.cpp
@@ -248,8 +248,7 @@
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 b3c09d5..45053bd 100644
--- a/core/fpdfapi/font/cpdf_cmap.h
+++ b/core/fpdfapi/font/cpdf_cmap.h
@@ -51,9 +51,7 @@
template <typename T, typename... Args>
friend RetainPtr<T> 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<const uint8_t> data);
bool IsLoaded() const { return m_bLoaded; }
diff --git a/core/fpdfapi/font/cpdf_cmapmanager.cpp b/core/fpdfapi/font/cpdf_cmapmanager.cpp
index 62a2013..c33759c 100644
--- a/core/fpdfapi/font/cpdf_cmapmanager.cpp
+++ b/core/fpdfapi/font/cpdf_cmapmanager.cpp
@@ -16,41 +16,38 @@
CPDF_CMapManager::~CPDF_CMapManager() {}
-RetainPtr<CPDF_CMap> CPDF_CMapManager::GetPredefinedCMap(const ByteString& name,
- bool bPromptCJK) {
+RetainPtr<CPDF_CMap> CPDF_CMapManager::GetPredefinedCMap(
+ const ByteString& name) {
auto it = m_CMaps.find(name);
if (it != m_CMaps.end())
return it->second;
- RetainPtr<CPDF_CMap> pCMap = LoadPredefinedCMap(name, bPromptCJK);
+ RetainPtr<CPDF_CMap> pCMap = LoadPredefinedCMap(name);
if (!name.IsEmpty())
m_CMaps[name] = pCMap;
return pCMap;
}
-RetainPtr<CPDF_CMap> CPDF_CMapManager::LoadPredefinedCMap(ByteString name,
- bool bPromptCJK) {
+RetainPtr<CPDF_CMap> CPDF_CMapManager::LoadPredefinedCMap(ByteString name) {
if (!name.IsEmpty() && name[0] == '/')
name = name.Right(name.GetLength() - 1);
auto pCMap = pdfium::MakeRetain<CPDF_CMap>();
- 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_CID2UnicodeMap> CPDF_CMapManager::LoadCID2UnicodeMap(
- CIDSet charset,
- bool bPromptCJK) {
+ CIDSet charset) {
auto pMap = pdfium::MakeUnique<CPDF_CID2UnicodeMap>();
- 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 47a0be0..af61e3f 100644
--- a/core/fpdfapi/font/cpdf_cmapmanager.h
+++ b/core/fpdfapi/font/cpdf_cmapmanager.h
@@ -19,14 +19,12 @@
CPDF_CMapManager();
~CPDF_CMapManager();
- RetainPtr<CPDF_CMap> GetPredefinedCMap(const ByteString& name,
- bool bPromptCJK);
- CPDF_CID2UnicodeMap* GetCID2UnicodeMap(CIDSet charset, bool bPromptCJK);
+ RetainPtr<CPDF_CMap> GetPredefinedCMap(const ByteString& name);
+ CPDF_CID2UnicodeMap* GetCID2UnicodeMap(CIDSet charset);
private:
- RetainPtr<CPDF_CMap> LoadPredefinedCMap(ByteString name, bool bPromptCJK);
- std::unique_ptr<CPDF_CID2UnicodeMap> LoadCID2UnicodeMap(CIDSet charset,
- bool bPromptCJK);
+ RetainPtr<CPDF_CMap> LoadPredefinedCMap(ByteString name);
+ std::unique_ptr<CPDF_CID2UnicodeMap> LoadCID2UnicodeMap(CIDSet charset);
std::map<ByteString, RetainPtr<CPDF_CMap>> m_CMaps;
std::unique_ptr<CPDF_CID2UnicodeMap> m_CID2UnicodeMaps[6];
diff --git a/core/fpdfapi/font/cpdf_tounicodemap.cpp b/core/fpdfapi/font/cpdf_tounicodemap.cpp
index e891731..5362e48 100644
--- a/core/fpdfapi/font/cpdf_tounicodemap.cpp
+++ b/core/fpdfapi/font/cpdf_tounicodemap.cpp
@@ -227,7 +227,7 @@
->GetPageModule()
->GetFontGlobals()
->GetCMapManager()
- ->GetCID2UnicodeMap(cid_set, false);
+ ->GetCID2UnicodeMap(cid_set);
} else {
m_pBaseMap = nullptr;
}