summaryrefslogtreecommitdiff
path: root/core/fpdfapi/cmaps
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-10-04 13:25:01 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-10-04 17:48:24 +0000
commit0181a84160e754717ebd26290628220f998ff66f (patch)
tree141b38e15a0b2f0c71ba612ebdf82be32f94596e /core/fpdfapi/cmaps
parent6ed297c5b418f8c9435b656b565cf48e6dcc2836 (diff)
downloadpdfium-0181a84160e754717ebd26290628220f998ff66f.tar.xz
Make CPDF_FontGlobals members private
This CL makes the embedded maps and the cmap manager private to CPDF_FontGlobals and adds accessor methods as needed. Change-Id: I50350fcfad5428defe5e68d9d3b29e8961e66e9f Reviewed-on: https://pdfium-review.googlesource.com/15412 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fpdfapi/cmaps')
-rw-r--r--core/fpdfapi/cmaps/CNS1/cmaps_cns1.cpp11
-rw-r--r--core/fpdfapi/cmaps/GB1/cmaps_gb1.cpp10
-rw-r--r--core/fpdfapi/cmaps/Japan1/cmaps_japan1.cpp11
-rw-r--r--core/fpdfapi/cmaps/Korea1/cmaps_korea1.cpp11
-rw-r--r--core/fpdfapi/cmaps/fpdf_cmaps.cpp9
5 files changed, 21 insertions, 31 deletions
diff --git a/core/fpdfapi/cmaps/CNS1/cmaps_cns1.cpp b/core/fpdfapi/cmaps/CNS1/cmaps_cns1.cpp
index 101c316c3b..bb57381400 100644
--- a/core/fpdfapi/cmaps/CNS1/cmaps_cns1.cpp
+++ b/core/fpdfapi/cmaps/CNS1/cmaps_cns1.cpp
@@ -45,11 +45,8 @@ static const FXCMAP_CMap g_FXCMAP_CNS1_cmaps[] = {
void CPDF_ModuleMgr::LoadEmbeddedCNS1CMaps() {
CPDF_FontGlobals* pFontGlobals =
CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
- pFontGlobals->m_EmbeddedCharsets[CIDSET_CNS1].m_pMapList =
- g_FXCMAP_CNS1_cmaps;
- pFontGlobals->m_EmbeddedCharsets[CIDSET_CNS1].m_Count =
- FX_ArraySize(g_FXCMAP_CNS1_cmaps);
- pFontGlobals->m_EmbeddedToUnicodes[CIDSET_CNS1].m_pMap =
- g_FXCMAP_CNS1CID2Unicode_5;
- pFontGlobals->m_EmbeddedToUnicodes[CIDSET_CNS1].m_Count = 19088;
+ pFontGlobals->SetEmbeddedCharset(CIDSET_CNS1, g_FXCMAP_CNS1_cmaps,
+ FX_ArraySize(g_FXCMAP_CNS1_cmaps));
+ pFontGlobals->SetEmbeddedToUnicode(CIDSET_CNS1, g_FXCMAP_CNS1CID2Unicode_5,
+ 19088);
}
diff --git a/core/fpdfapi/cmaps/GB1/cmaps_gb1.cpp b/core/fpdfapi/cmaps/GB1/cmaps_gb1.cpp
index 5776b18c0e..a91da32369 100644
--- a/core/fpdfapi/cmaps/GB1/cmaps_gb1.cpp
+++ b/core/fpdfapi/cmaps/GB1/cmaps_gb1.cpp
@@ -45,10 +45,8 @@ static const FXCMAP_CMap g_FXCMAP_GB1_cmaps[] = {
void CPDF_ModuleMgr::LoadEmbeddedGB1CMaps() {
CPDF_FontGlobals* pFontGlobals =
CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
- pFontGlobals->m_EmbeddedCharsets[CIDSET_GB1].m_pMapList = g_FXCMAP_GB1_cmaps;
- pFontGlobals->m_EmbeddedCharsets[CIDSET_GB1].m_Count =
- FX_ArraySize(g_FXCMAP_GB1_cmaps);
- pFontGlobals->m_EmbeddedToUnicodes[CIDSET_GB1].m_pMap =
- g_FXCMAP_GB1CID2Unicode_5;
- pFontGlobals->m_EmbeddedToUnicodes[CIDSET_GB1].m_Count = 30284;
+ pFontGlobals->SetEmbeddedCharset(CIDSET_GB1, g_FXCMAP_GB1_cmaps,
+ FX_ArraySize(g_FXCMAP_GB1_cmaps));
+ pFontGlobals->SetEmbeddedToUnicode(CIDSET_GB1, g_FXCMAP_GB1CID2Unicode_5,
+ 30284);
}
diff --git a/core/fpdfapi/cmaps/Japan1/cmaps_japan1.cpp b/core/fpdfapi/cmaps/Japan1/cmaps_japan1.cpp
index ba8f02dcdf..17611e774b 100644
--- a/core/fpdfapi/cmaps/Japan1/cmaps_japan1.cpp
+++ b/core/fpdfapi/cmaps/Japan1/cmaps_japan1.cpp
@@ -57,11 +57,8 @@ static const FXCMAP_CMap g_FXCMAP_Japan1_cmaps[] = {
void CPDF_ModuleMgr::LoadEmbeddedJapan1CMaps() {
CPDF_FontGlobals* pFontGlobals =
CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
- pFontGlobals->m_EmbeddedCharsets[CIDSET_JAPAN1].m_pMapList =
- g_FXCMAP_Japan1_cmaps;
- pFontGlobals->m_EmbeddedCharsets[CIDSET_JAPAN1].m_Count =
- FX_ArraySize(g_FXCMAP_Japan1_cmaps);
- pFontGlobals->m_EmbeddedToUnicodes[CIDSET_JAPAN1].m_pMap =
- g_FXCMAP_Japan1CID2Unicode_4;
- pFontGlobals->m_EmbeddedToUnicodes[CIDSET_JAPAN1].m_Count = 15444;
+ pFontGlobals->SetEmbeddedCharset(CIDSET_JAPAN1, g_FXCMAP_Japan1_cmaps,
+ FX_ArraySize(g_FXCMAP_Japan1_cmaps));
+ pFontGlobals->SetEmbeddedToUnicode(CIDSET_JAPAN1,
+ g_FXCMAP_Japan1CID2Unicode_4, 15444);
}
diff --git a/core/fpdfapi/cmaps/Korea1/cmaps_korea1.cpp b/core/fpdfapi/cmaps/Korea1/cmaps_korea1.cpp
index 12dbec6a74..690ce2a4ea 100644
--- a/core/fpdfapi/cmaps/Korea1/cmaps_korea1.cpp
+++ b/core/fpdfapi/cmaps/Korea1/cmaps_korea1.cpp
@@ -39,11 +39,8 @@ static const FXCMAP_CMap g_FXCMAP_Korea1_cmaps[] = {
void CPDF_ModuleMgr::LoadEmbeddedKorea1CMaps() {
CPDF_FontGlobals* pFontGlobals =
CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
- pFontGlobals->m_EmbeddedCharsets[CIDSET_KOREA1].m_pMapList =
- g_FXCMAP_Korea1_cmaps;
- pFontGlobals->m_EmbeddedCharsets[CIDSET_KOREA1].m_Count =
- FX_ArraySize(g_FXCMAP_Korea1_cmaps);
- pFontGlobals->m_EmbeddedToUnicodes[CIDSET_KOREA1].m_pMap =
- g_FXCMAP_Korea1CID2Unicode_2;
- pFontGlobals->m_EmbeddedToUnicodes[CIDSET_KOREA1].m_Count = 18352;
+ pFontGlobals->SetEmbeddedCharset(CIDSET_KOREA1, g_FXCMAP_Korea1_cmaps,
+ FX_ArraySize(g_FXCMAP_Korea1_cmaps));
+ pFontGlobals->SetEmbeddedToUnicode(CIDSET_KOREA1,
+ g_FXCMAP_Korea1CID2Unicode_2, 18352);
}
diff --git a/core/fpdfapi/cmaps/fpdf_cmaps.cpp b/core/fpdfapi/cmaps/fpdf_cmaps.cpp
index 01c8da9691..ac8456dc69 100644
--- a/core/fpdfapi/cmaps/fpdf_cmaps.cpp
+++ b/core/fpdfapi/cmaps/fpdf_cmaps.cpp
@@ -60,10 +60,11 @@ void FPDFAPI_FindEmbeddedCMap(const ByteString& bsName,
pMap = nullptr;
CPDF_FontGlobals* pFontGlobals =
CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
- const FXCMAP_CMap* pCMaps =
- pFontGlobals->m_EmbeddedCharsets[charset].m_pMapList.Get();
- for (uint32_t i = 0; i < pFontGlobals->m_EmbeddedCharsets[charset].m_Count;
- i++) {
+
+ const FXCMAP_CMap* pCMaps;
+ uint32_t count;
+ std::tie(count, pCMaps) = pFontGlobals->GetEmbeddedCharset(charset);
+ for (uint32_t i = 0; i < count; i++) {
if (bsName == pCMaps[i].m_Name) {
pMap = &pCMaps[i];
break;