summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/cmaps/CNS1/cmaps_cns1.cpp14
-rw-r--r--core/fpdfapi/cmaps/CNS1/cmaps_cns1.h4
-rw-r--r--core/fpdfapi/cmaps/GB1/cmaps_gb1.cpp14
-rw-r--r--core/fpdfapi/cmaps/GB1/cmaps_gb1.h4
-rw-r--r--core/fpdfapi/cmaps/Japan1/cmaps_japan1.cpp15
-rw-r--r--core/fpdfapi/cmaps/Japan1/cmaps_japan1.h4
-rw-r--r--core/fpdfapi/cmaps/Korea1/cmaps_korea1.cpp15
-rw-r--r--core/fpdfapi/cmaps/Korea1/cmaps_korea1.h4
-rw-r--r--core/fpdfapi/cpdf_modulemgr.cpp96
-rw-r--r--core/fpdfapi/cpdf_modulemgr.h5
10 files changed, 89 insertions, 86 deletions
diff --git a/core/fpdfapi/cmaps/CNS1/cmaps_cns1.cpp b/core/fpdfapi/cmaps/CNS1/cmaps_cns1.cpp
index 1291fa1c40..80c31d6293 100644
--- a/core/fpdfapi/cmaps/CNS1/cmaps_cns1.cpp
+++ b/core/fpdfapi/cmaps/CNS1/cmaps_cns1.cpp
@@ -6,12 +6,7 @@
#include "core/fpdfapi/cmaps/CNS1/cmaps_cns1.h"
-#include "core/fpdfapi/cmaps/cmap_int.h"
-#include "core/fpdfapi/cpdf_modulemgr.h"
-#include "core/fpdfapi/font/cpdf_fontglobals.h"
-#include "core/fpdfapi/page/cpdf_pagemodule.h"
-
-static const FXCMAP_CMap g_FXCMAP_CNS1_cmaps[] = {
+const FXCMAP_CMap g_FXCMAP_CNS1_cmaps[] = {
{"B5pc-H", g_FXCMAP_B5pc_H_0, nullptr, 247, 0, FXCMAP_CMap::Range, 0},
{"B5pc-V", g_FXCMAP_B5pc_V_0, nullptr, 12, 0, FXCMAP_CMap::Range, -1},
{"HKscs-B5-H", g_FXCMAP_HKscs_B5_H_5, nullptr, 1210, 0, FXCMAP_CMap::Range,
@@ -38,9 +33,4 @@ static const FXCMAP_CMap g_FXCMAP_CNS1_cmaps[] = {
FXCMAP_CMap::Range, -1},
};
-void CPDF_ModuleMgr::LoadEmbeddedCNS1CMaps() {
- CPDF_FontGlobals* pFontGlobals =
- CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
- pFontGlobals->SetEmbeddedCharset(CIDSET_CNS1, g_FXCMAP_CNS1_cmaps);
- pFontGlobals->SetEmbeddedToUnicode(CIDSET_CNS1, g_FXCMAP_CNS1CID2Unicode_5);
-}
+const size_t g_FXCMAP_CNS1_cmaps_size = FX_ArraySize(g_FXCMAP_CNS1_cmaps);
diff --git a/core/fpdfapi/cmaps/CNS1/cmaps_cns1.h b/core/fpdfapi/cmaps/CNS1/cmaps_cns1.h
index 483fd66fc2..5868ed7241 100644
--- a/core/fpdfapi/cmaps/CNS1/cmaps_cns1.h
+++ b/core/fpdfapi/cmaps/CNS1/cmaps_cns1.h
@@ -7,8 +7,6 @@
#ifndef CORE_FPDFAPI_CMAPS_CNS1_CMAPS_CNS1_H_
#define CORE_FPDFAPI_CMAPS_CNS1_CMAPS_CNS1_H_
-#include <stdint.h>
-
#include "core/fpdfapi/cmaps/cmap_int.h"
extern const uint16_t g_FXCMAP_B5pc_H_0[];
@@ -27,5 +25,7 @@ extern const uint16_t g_FXCMAP_UniCNS_UCS2_H_3[];
extern const uint16_t g_FXCMAP_UniCNS_UCS2_V_3[];
extern const uint16_t g_FXCMAP_UniCNS_UTF16_H_0[];
extern const uint16_t g_FXCMAP_CNS1CID2Unicode_5[19088];
+extern const FXCMAP_CMap g_FXCMAP_CNS1_cmaps[];
+extern const size_t g_FXCMAP_CNS1_cmaps_size;
#endif // CORE_FPDFAPI_CMAPS_CNS1_CMAPS_CNS1_H_
diff --git a/core/fpdfapi/cmaps/GB1/cmaps_gb1.cpp b/core/fpdfapi/cmaps/GB1/cmaps_gb1.cpp
index 26022c623d..0ba0db71d1 100644
--- a/core/fpdfapi/cmaps/GB1/cmaps_gb1.cpp
+++ b/core/fpdfapi/cmaps/GB1/cmaps_gb1.cpp
@@ -6,12 +6,7 @@
#include "core/fpdfapi/cmaps/GB1/cmaps_gb1.h"
-#include "core/fpdfapi/cmaps/cmap_int.h"
-#include "core/fpdfapi/cpdf_modulemgr.h"
-#include "core/fpdfapi/font/cpdf_fontglobals.h"
-#include "core/fpdfapi/page/cpdf_pagemodule.h"
-
-static const FXCMAP_CMap g_FXCMAP_GB1_cmaps[] = {
+const FXCMAP_CMap g_FXCMAP_GB1_cmaps[] = {
{"GB-EUC-H", g_FXCMAP_GB_EUC_H_0, nullptr, 90, 0, FXCMAP_CMap::Range, 0},
{"GB-EUC-V", g_FXCMAP_GB_EUC_V_0, nullptr, 20, 0, FXCMAP_CMap::Range, -1},
{"GBpc-EUC-H", g_FXCMAP_GBpc_EUC_H_0, nullptr, 91, 0, FXCMAP_CMap::Range,
@@ -38,9 +33,4 @@ static const FXCMAP_CMap g_FXCMAP_GB1_cmaps[] = {
FXCMAP_CMap::Range, -1},
};
-void CPDF_ModuleMgr::LoadEmbeddedGB1CMaps() {
- CPDF_FontGlobals* pFontGlobals =
- CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
- pFontGlobals->SetEmbeddedCharset(CIDSET_GB1, g_FXCMAP_GB1_cmaps);
- pFontGlobals->SetEmbeddedToUnicode(CIDSET_GB1, g_FXCMAP_GB1CID2Unicode_5);
-}
+const size_t g_FXCMAP_GB1_cmaps_size = FX_ArraySize(g_FXCMAP_GB1_cmaps);
diff --git a/core/fpdfapi/cmaps/GB1/cmaps_gb1.h b/core/fpdfapi/cmaps/GB1/cmaps_gb1.h
index 989d9ce163..adec851e20 100644
--- a/core/fpdfapi/cmaps/GB1/cmaps_gb1.h
+++ b/core/fpdfapi/cmaps/GB1/cmaps_gb1.h
@@ -7,8 +7,6 @@
#ifndef CORE_FPDFAPI_CMAPS_GB1_CMAPS_GB1_H_
#define CORE_FPDFAPI_CMAPS_GB1_CMAPS_GB1_H_
-#include <stdint.h>
-
#include "core/fpdfapi/cmaps/cmap_int.h"
extern const uint16_t g_FXCMAP_GB_EUC_H_0[];
@@ -25,5 +23,7 @@ extern const uint16_t g_FXCMAP_GBK2K_V_5[];
extern const uint16_t g_FXCMAP_UniGB_UCS2_H_4[];
extern const uint16_t g_FXCMAP_UniGB_UCS2_V_4[];
extern const uint16_t g_FXCMAP_GB1CID2Unicode_5[30284];
+extern const FXCMAP_CMap g_FXCMAP_GB1_cmaps[];
+extern const size_t g_FXCMAP_GB1_cmaps_size;
#endif // CORE_FPDFAPI_CMAPS_GB1_CMAPS_GB1_H_
diff --git a/core/fpdfapi/cmaps/Japan1/cmaps_japan1.cpp b/core/fpdfapi/cmaps/Japan1/cmaps_japan1.cpp
index ecc2b3fd3b..9b9cfc37a0 100644
--- a/core/fpdfapi/cmaps/Japan1/cmaps_japan1.cpp
+++ b/core/fpdfapi/cmaps/Japan1/cmaps_japan1.cpp
@@ -6,12 +6,7 @@
#include "core/fpdfapi/cmaps/Japan1/cmaps_japan1.h"
-#include "core/fpdfapi/cmaps/cmap_int.h"
-#include "core/fpdfapi/cpdf_modulemgr.h"
-#include "core/fpdfapi/font/cpdf_fontglobals.h"
-#include "core/fpdfapi/page/cpdf_pagemodule.h"
-
-static const FXCMAP_CMap g_FXCMAP_Japan1_cmaps[] = {
+const FXCMAP_CMap g_FXCMAP_Japan1_cmaps[] = {
{"83pv-RKSJ-H", g_FXCMAP_83pv_RKSJ_H_1, nullptr, 222, 0, FXCMAP_CMap::Range,
0},
{"90ms-RKSJ-H", g_FXCMAP_90ms_RKSJ_H_2, nullptr, 171, 0, FXCMAP_CMap::Range,
@@ -50,10 +45,4 @@ static const FXCMAP_CMap g_FXCMAP_Japan1_cmaps[] = {
FXCMAP_CMap::Single, -1},
};
-void CPDF_ModuleMgr::LoadEmbeddedJapan1CMaps() {
- CPDF_FontGlobals* pFontGlobals =
- CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
- pFontGlobals->SetEmbeddedCharset(CIDSET_JAPAN1, g_FXCMAP_Japan1_cmaps);
- pFontGlobals->SetEmbeddedToUnicode(CIDSET_JAPAN1,
- g_FXCMAP_Japan1CID2Unicode_4);
-}
+const size_t g_FXCMAP_Japan1_cmaps_size = FX_ArraySize(g_FXCMAP_Japan1_cmaps);
diff --git a/core/fpdfapi/cmaps/Japan1/cmaps_japan1.h b/core/fpdfapi/cmaps/Japan1/cmaps_japan1.h
index 0979d2a40d..c98bb1581c 100644
--- a/core/fpdfapi/cmaps/Japan1/cmaps_japan1.h
+++ b/core/fpdfapi/cmaps/Japan1/cmaps_japan1.h
@@ -7,7 +7,7 @@
#ifndef CORE_FPDFAPI_CMAPS_JAPAN1_CMAPS_JAPAN1_H_
#define CORE_FPDFAPI_CMAPS_JAPAN1_CMAPS_JAPAN1_H_
-#include <stdint.h>
+#include "core/fpdfapi/cmaps/cmap_int.h"
extern const uint16_t g_FXCMAP_83pv_RKSJ_H_1[];
extern const uint16_t g_FXCMAP_90ms_RKSJ_H_2[];
@@ -31,5 +31,7 @@ extern const uint16_t g_FXCMAP_UniJIS_UTF16_H_0[];
extern const uint16_t g_FXCMAP_UniJIS_UTF16_H_0_DWord[];
extern const uint16_t g_FXCMAP_UniJIS_UTF16_V_0[];
extern const uint16_t g_FXCMAP_Japan1CID2Unicode_4[15444];
+extern const FXCMAP_CMap g_FXCMAP_Japan1_cmaps[];
+extern const size_t g_FXCMAP_Japan1_cmaps_size;
#endif // CORE_FPDFAPI_CMAPS_JAPAN1_CMAPS_JAPAN1_H_
diff --git a/core/fpdfapi/cmaps/Korea1/cmaps_korea1.cpp b/core/fpdfapi/cmaps/Korea1/cmaps_korea1.cpp
index 4c9201269c..a95ab3ee33 100644
--- a/core/fpdfapi/cmaps/Korea1/cmaps_korea1.cpp
+++ b/core/fpdfapi/cmaps/Korea1/cmaps_korea1.cpp
@@ -6,12 +6,7 @@
#include "core/fpdfapi/cmaps/Korea1/cmaps_korea1.h"
-#include "core/fpdfapi/cmaps/cmap_int.h"
-#include "core/fpdfapi/cpdf_modulemgr.h"
-#include "core/fpdfapi/font/cpdf_fontglobals.h"
-#include "core/fpdfapi/page/cpdf_pagemodule.h"
-
-static const FXCMAP_CMap g_FXCMAP_Korea1_cmaps[] = {
+const FXCMAP_CMap g_FXCMAP_Korea1_cmaps[] = {
{"KSC-EUC-H", g_FXCMAP_KSC_EUC_H_0, nullptr, 467, 0, FXCMAP_CMap::Range, 0},
{"KSC-EUC-V", g_FXCMAP_KSC_EUC_V_0, nullptr, 16, 0, FXCMAP_CMap::Range, -1},
{"KSCms-UHC-H", g_FXCMAP_KSCms_UHC_H_1, nullptr, 675, 0, FXCMAP_CMap::Range,
@@ -34,10 +29,4 @@ static const FXCMAP_CMap g_FXCMAP_Korea1_cmaps[] = {
FXCMAP_CMap::Range, -1},
};
-void CPDF_ModuleMgr::LoadEmbeddedKorea1CMaps() {
- CPDF_FontGlobals* pFontGlobals =
- CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
- pFontGlobals->SetEmbeddedCharset(CIDSET_KOREA1, g_FXCMAP_Korea1_cmaps);
- pFontGlobals->SetEmbeddedToUnicode(CIDSET_KOREA1,
- g_FXCMAP_Korea1CID2Unicode_2);
-}
+const size_t g_FXCMAP_Korea1_cmaps_size = FX_ArraySize(g_FXCMAP_Korea1_cmaps);
diff --git a/core/fpdfapi/cmaps/Korea1/cmaps_korea1.h b/core/fpdfapi/cmaps/Korea1/cmaps_korea1.h
index 27b9b0b7c4..b60813504a 100644
--- a/core/fpdfapi/cmaps/Korea1/cmaps_korea1.h
+++ b/core/fpdfapi/cmaps/Korea1/cmaps_korea1.h
@@ -7,7 +7,7 @@
#ifndef CORE_FPDFAPI_CMAPS_KOREA1_CMAPS_KOREA1_H_
#define CORE_FPDFAPI_CMAPS_KOREA1_CMAPS_KOREA1_H_
-#include <stdint.h>
+#include "core/fpdfapi/cmaps/cmap_int.h"
extern const uint16_t g_FXCMAP_KSC_EUC_H_0[];
extern const uint16_t g_FXCMAP_KSC_EUC_V_0[];
@@ -20,5 +20,7 @@ extern const uint16_t g_FXCMAP_UniKS_UCS2_H_1[];
extern const uint16_t g_FXCMAP_UniKS_UCS2_V_1[];
extern const uint16_t g_FXCMAP_UniKS_UTF16_H_0[];
extern const uint16_t g_FXCMAP_Korea1CID2Unicode_2[18352];
+extern const FXCMAP_CMap g_FXCMAP_Korea1_cmaps[];
+extern const size_t g_FXCMAP_Korea1_cmaps_size;
#endif // CORE_FPDFAPI_CMAPS_KOREA1_CMAPS_KOREA1_H_
diff --git a/core/fpdfapi/cpdf_modulemgr.cpp b/core/fpdfapi/cpdf_modulemgr.cpp
index 678997a8c9..34fe04996e 100644
--- a/core/fpdfapi/cpdf_modulemgr.cpp
+++ b/core/fpdfapi/cpdf_modulemgr.cpp
@@ -6,6 +6,10 @@
#include "core/fpdfapi/cpdf_modulemgr.h"
+#include "core/fpdfapi/cmaps/CNS1/cmaps_cns1.h"
+#include "core/fpdfapi/cmaps/GB1/cmaps_gb1.h"
+#include "core/fpdfapi/cmaps/Japan1/cmaps_japan1.h"
+#include "core/fpdfapi/cmaps/Korea1/cmaps_korea1.h"
#include "core/fpdfapi/page/cpdf_pagemodule.h"
#include "core/fxcodec/fx_codec.h"
#include "third_party/base/ptr_util.h"
@@ -56,11 +60,36 @@ void CPDF_ModuleMgr::Init() {
LoadCodecModules();
}
-void CPDF_ModuleMgr::LoadEmbeddedMaps() {
- LoadEmbeddedGB1CMaps();
- LoadEmbeddedJapan1CMaps();
- LoadEmbeddedCNS1CMaps();
- LoadEmbeddedKorea1CMaps();
+CCodec_FaxModule* CPDF_ModuleMgr::GetFaxModule() {
+ return m_pCodecModule->GetFaxModule();
+}
+
+CCodec_JpegModule* CPDF_ModuleMgr::GetJpegModule() {
+ return m_pCodecModule->GetJpegModule();
+}
+
+CCodec_JpxModule* CPDF_ModuleMgr::GetJpxModule() {
+ return m_pCodecModule->GetJpxModule();
+}
+
+CCodec_Jbig2Module* CPDF_ModuleMgr::GetJbig2Module() {
+ return m_pCodecModule->GetJbig2Module();
+}
+
+CCodec_IccModule* CPDF_ModuleMgr::GetIccModule() {
+ return m_pCodecModule->GetIccModule();
+}
+
+CCodec_FlateModule* CPDF_ModuleMgr::GetFlateModule() {
+ return m_pCodecModule->GetFlateModule();
+}
+
+void CPDF_ModuleMgr::InitPageModule() {
+ m_pPageModule = pdfium::MakeUnique<CPDF_PageModule>();
+}
+
+void CPDF_ModuleMgr::InitCodecModule() {
+ m_pCodecModule = pdfium::MakeUnique<CCodec_ModuleMgr>();
}
void CPDF_ModuleMgr::LoadCodecModules() {
@@ -81,34 +110,47 @@ void CPDF_ModuleMgr::LoadCodecModules() {
#endif
}
-void CPDF_ModuleMgr::InitCodecModule() {
- m_pCodecModule = pdfium::MakeUnique<CCodec_ModuleMgr>();
-}
-
-void CPDF_ModuleMgr::InitPageModule() {
- m_pPageModule = pdfium::MakeUnique<CPDF_PageModule>();
-}
-
-CCodec_FaxModule* CPDF_ModuleMgr::GetFaxModule() {
- return m_pCodecModule->GetFaxModule();
-}
-
-CCodec_JpegModule* CPDF_ModuleMgr::GetJpegModule() {
- return m_pCodecModule->GetJpegModule();
+void CPDF_ModuleMgr::LoadEmbeddedMaps() {
+ LoadEmbeddedGB1CMaps();
+ LoadEmbeddedCNS1CMaps();
+ LoadEmbeddedJapan1CMaps();
+ LoadEmbeddedKorea1CMaps();
}
-CCodec_JpxModule* CPDF_ModuleMgr::GetJpxModule() {
- return m_pCodecModule->GetJpxModule();
+void CPDF_ModuleMgr::LoadEmbeddedGB1CMaps() {
+ CPDF_FontGlobals* pFontGlobals =
+ CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
+ pFontGlobals->SetEmbeddedCharset(
+ CIDSET_GB1,
+ pdfium::make_span(g_FXCMAP_GB1_cmaps, g_FXCMAP_GB1_cmaps_size));
+ pFontGlobals->SetEmbeddedToUnicode(CIDSET_GB1, g_FXCMAP_GB1CID2Unicode_5);
}
-CCodec_Jbig2Module* CPDF_ModuleMgr::GetJbig2Module() {
- return m_pCodecModule->GetJbig2Module();
+void CPDF_ModuleMgr::LoadEmbeddedCNS1CMaps() {
+ CPDF_FontGlobals* pFontGlobals =
+ CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
+ pFontGlobals->SetEmbeddedCharset(
+ CIDSET_CNS1,
+ pdfium::make_span(g_FXCMAP_CNS1_cmaps, g_FXCMAP_CNS1_cmaps_size));
+ pFontGlobals->SetEmbeddedToUnicode(CIDSET_CNS1, g_FXCMAP_CNS1CID2Unicode_5);
}
-CCodec_IccModule* CPDF_ModuleMgr::GetIccModule() {
- return m_pCodecModule->GetIccModule();
+void CPDF_ModuleMgr::LoadEmbeddedJapan1CMaps() {
+ CPDF_FontGlobals* pFontGlobals =
+ CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
+ pFontGlobals->SetEmbeddedCharset(
+ CIDSET_JAPAN1,
+ pdfium::make_span(g_FXCMAP_Japan1_cmaps, g_FXCMAP_Japan1_cmaps_size));
+ pFontGlobals->SetEmbeddedToUnicode(CIDSET_JAPAN1,
+ g_FXCMAP_Japan1CID2Unicode_4);
}
-CCodec_FlateModule* CPDF_ModuleMgr::GetFlateModule() {
- return m_pCodecModule->GetFlateModule();
+void CPDF_ModuleMgr::LoadEmbeddedKorea1CMaps() {
+ CPDF_FontGlobals* pFontGlobals =
+ CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
+ pFontGlobals->SetEmbeddedCharset(
+ CIDSET_KOREA1,
+ pdfium::make_span(g_FXCMAP_Korea1_cmaps, g_FXCMAP_Korea1_cmaps_size));
+ pFontGlobals->SetEmbeddedToUnicode(CIDSET_KOREA1,
+ g_FXCMAP_Korea1CID2Unicode_2);
}
diff --git a/core/fpdfapi/cpdf_modulemgr.h b/core/fpdfapi/cpdf_modulemgr.h
index 6b83bc755d..39acfed032 100644
--- a/core/fpdfapi/cpdf_modulemgr.h
+++ b/core/fpdfapi/cpdf_modulemgr.h
@@ -60,11 +60,10 @@ class CPDF_ModuleMgr {
CPDF_ModuleMgr();
~CPDF_ModuleMgr();
- void InitCodecModule();
void InitPageModule();
- void LoadEmbeddedMaps();
+ void InitCodecModule();
void LoadCodecModules();
-
+ void LoadEmbeddedMaps();
void LoadEmbeddedGB1CMaps();
void LoadEmbeddedCNS1CMaps();
void LoadEmbeddedJapan1CMaps();