1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #include "../../../../include/fpdfapi/fpdf_resource.h"
8 #include "../../../../include/fpdfapi/fpdf_module.h"
9 #include "../../fpdf_font/font_int.h"
10 #include "../cmap_int.h"
11 extern const FX_WORD g_FXCMAP_83pv_RKSJ_H_1[];
12 extern const FX_WORD g_FXCMAP_90ms_RKSJ_H_2[];
13 extern const FX_WORD g_FXCMAP_90ms_RKSJ_V_2[];
14 extern const FX_WORD g_FXCMAP_90msp_RKSJ_H_2[];
15 extern const FX_WORD g_FXCMAP_90msp_RKSJ_V_2[];
16 extern const FX_WORD g_FXCMAP_90pv_RKSJ_H_1[];
17 extern const FX_WORD g_FXCMAP_Add_RKSJ_H_1[];
18 extern const FX_WORD g_FXCMAP_Add_RKSJ_V_1[];
19 extern const FX_WORD g_FXCMAP_EUC_H_1[];
20 extern const FX_WORD g_FXCMAP_EUC_V_1[];
21 extern const FX_WORD g_FXCMAP_Ext_RKSJ_H_2[];
22 extern const FX_WORD g_FXCMAP_Ext_RKSJ_V_2[];
23 extern const FX_WORD g_FXCMAP_H_1[];
24 extern const FX_WORD g_FXCMAP_V_1[];
25 extern const FX_WORD g_FXCMAP_UniJIS_UCS2_H_4[];
26 extern const FX_WORD g_FXCMAP_UniJIS_UCS2_V_4[];
27 extern const FX_WORD g_FXCMAP_UniJIS_UCS2_HW_H_4[];
28 extern const FX_WORD g_FXCMAP_UniJIS_UCS2_HW_V_4[];
29 extern const FX_WORD g_FXCMAP_UniJIS_UTF16_H_0[];
30 extern const FX_WORD g_FXCMAP_UniJIS_UTF16_H_0_DWord[];
31 extern const FX_WORD g_FXCMAP_UniJIS_UTF16_V_0[];
32 extern const FX_WORD g_FXCMAP_Japan1CID2Unicode_4[];
33 static const FXCMAP_CMap g_FXCMAP_Japan1_cmaps[] = {
34     { "83pv-RKSJ-H", FXCMAP_CMap::Range, g_FXCMAP_83pv_RKSJ_H_1, 222, FXCMAP_CMap::None, NULL, 0, 0 },
35     { "90ms-RKSJ-H", FXCMAP_CMap::Range, g_FXCMAP_90ms_RKSJ_H_2, 171, FXCMAP_CMap::None, NULL, 0, 0 },
36     { "90ms-RKSJ-V", FXCMAP_CMap::Range, g_FXCMAP_90ms_RKSJ_V_2, 78, FXCMAP_CMap::None, NULL, 0, -1 },
37     { "90msp-RKSJ-H", FXCMAP_CMap::Range, g_FXCMAP_90msp_RKSJ_H_2, 170, FXCMAP_CMap::None, NULL, 0, -2 },
38     { "90msp-RKSJ-V", FXCMAP_CMap::Range, g_FXCMAP_90msp_RKSJ_V_2, 78, FXCMAP_CMap::None, NULL, 0, -1 },
39     { "90pv-RKSJ-H", FXCMAP_CMap::Range, g_FXCMAP_90pv_RKSJ_H_1, 263, FXCMAP_CMap::None, NULL, 0, 0 },
40     { "Add-RKSJ-H", FXCMAP_CMap::Range, g_FXCMAP_Add_RKSJ_H_1, 635, FXCMAP_CMap::None, NULL, 0, 0 },
41     { "Add-RKSJ-V", FXCMAP_CMap::Range, g_FXCMAP_Add_RKSJ_V_1, 57, FXCMAP_CMap::None, NULL, 0, -1 },
42     { "EUC-H", FXCMAP_CMap::Range, g_FXCMAP_EUC_H_1, 120, FXCMAP_CMap::None, NULL, 0, 0 },
43     { "EUC-V", FXCMAP_CMap::Range, g_FXCMAP_EUC_V_1, 27, FXCMAP_CMap::None, NULL, 0, -1 },
44     { "Ext-RKSJ-H", FXCMAP_CMap::Range, g_FXCMAP_Ext_RKSJ_H_2, 665, FXCMAP_CMap::None, NULL, 0, -4 },
45     { "Ext-RKSJ-V", FXCMAP_CMap::Range, g_FXCMAP_Ext_RKSJ_V_2, 39, FXCMAP_CMap::None, NULL, 0, -1 },
46     { "H", FXCMAP_CMap::Range, g_FXCMAP_H_1, 118, FXCMAP_CMap::None, NULL, 0, 0 },
47     { "V", FXCMAP_CMap::Range, g_FXCMAP_V_1, 27, FXCMAP_CMap::None, NULL, 0, -1 },
48     { "UniJIS-UCS2-H", FXCMAP_CMap::Single, g_FXCMAP_UniJIS_UCS2_H_4, 9772, FXCMAP_CMap::None, NULL, 0, 0 },
49     { "UniJIS-UCS2-V", FXCMAP_CMap::Single, g_FXCMAP_UniJIS_UCS2_V_4, 251, FXCMAP_CMap::None, NULL, 0, -1 },
50     { "UniJIS-UCS2-HW-H", FXCMAP_CMap::Range, g_FXCMAP_UniJIS_UCS2_HW_H_4, 4, FXCMAP_CMap::None, NULL, 0, -2 },
51     { "UniJIS-UCS2-HW-V", FXCMAP_CMap::Range, g_FXCMAP_UniJIS_UCS2_HW_V_4, 199, FXCMAP_CMap::None, NULL, 0, -1 },
52     { "UniJIS-UTF16-H", FXCMAP_CMap::Single, g_FXCMAP_UniJIS_UCS2_H_4, 9772, FXCMAP_CMap::None, NULL, 0, 0 },
53     { "UniJIS-UTF16-V", FXCMAP_CMap::Single, g_FXCMAP_UniJIS_UCS2_V_4, 251, FXCMAP_CMap::None, NULL, 0, -1 },
54 };
LoadEmbeddedJapan1CMaps()55 void CPDF_ModuleMgr::LoadEmbeddedJapan1CMaps()
56 {
57     CPDF_FontGlobals* pFontGlobals = CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
58     pFontGlobals->m_EmbeddedCharsets[CIDSET_JAPAN1].m_pMapList = g_FXCMAP_Japan1_cmaps;
59     pFontGlobals->m_EmbeddedCharsets[CIDSET_JAPAN1].m_Count = sizeof g_FXCMAP_Japan1_cmaps / sizeof (FXCMAP_CMap);
60     pFontGlobals->m_EmbeddedToUnicodes[CIDSET_JAPAN1].m_pMap = g_FXCMAP_Japan1CID2Unicode_4;
61     pFontGlobals->m_EmbeddedToUnicodes[CIDSET_JAPAN1].m_Count = 15444;
62 }
63