summaryrefslogtreecommitdiff
path: root/core/fpdfapi/font
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-08-23 17:57:39 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-23 17:57:39 +0000
commit18342f5d7c80528ffe85a5c89a48d3bbd93fb6bd (patch)
tree781c3b7c083675946751af40daf962b338fba94a /core/fpdfapi/font
parent7aa4bc461a171cc2b5a27490a55f0baedd6623fb (diff)
downloadpdfium-18342f5d7c80528ffe85a5c89a48d3bbd93fb6bd.tar.xz
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>
Diffstat (limited to 'core/fpdfapi/font')
-rw-r--r--core/fpdfapi/font/cpdf_cid2unicodemap.cpp5
-rw-r--r--core/fpdfapi/font/cpdf_cid2unicodemap.h2
-rw-r--r--core/fpdfapi/font/cpdf_cidfont.cpp11
-rw-r--r--core/fpdfapi/font/cpdf_cmap.cpp3
-rw-r--r--core/fpdfapi/font/cpdf_cmap.h4
-rw-r--r--core/fpdfapi/font/cpdf_cmapmanager.cpp21
-rw-r--r--core/fpdfapi/font/cpdf_cmapmanager.h10
-rw-r--r--core/fpdfapi/font/cpdf_tounicodemap.cpp2
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 <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 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_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 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<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 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;
}