• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "core/fpdfapi/cmaps/GB1/cmaps_gb1.h"
8 
9 #include "core/fpdfapi/cmaps/cmap_int.h"
10 #include "core/fpdfapi/cpdf_modulemgr.h"
11 #include "core/fpdfapi/font/cpdf_fontglobals.h"
12 #include "core/fpdfapi/page/cpdf_pagemodule.h"
13 
14 static const FXCMAP_CMap g_FXCMAP_GB1_cmaps[] = {
15     {"GB-EUC-H", g_FXCMAP_GB_EUC_H_0, nullptr, 90, 0, FXCMAP_CMap::Range, 0},
16     {"GB-EUC-V", g_FXCMAP_GB_EUC_V_0, nullptr, 20, 0, FXCMAP_CMap::Range, -1},
17     {"GBpc-EUC-H", g_FXCMAP_GBpc_EUC_H_0, nullptr, 91, 0, FXCMAP_CMap::Range,
18      0},
19     {"GBpc-EUC-V", g_FXCMAP_GBpc_EUC_V_0, nullptr, 20, 0, FXCMAP_CMap::Range,
20      -1},
21     {"GBK-EUC-H", g_FXCMAP_GBK_EUC_H_2, nullptr, 4071, 0, FXCMAP_CMap::Range,
22      0},
23     {"GBK-EUC-V", g_FXCMAP_GBK_EUC_V_2, nullptr, 20, 0, FXCMAP_CMap::Range, -1},
24     {"GBKp-EUC-H", g_FXCMAP_GBKp_EUC_H_2, nullptr, 4070, 0, FXCMAP_CMap::Range,
25      -2},
26     {"GBKp-EUC-V", g_FXCMAP_GBKp_EUC_V_2, nullptr, 20, 0, FXCMAP_CMap::Range,
27      -1},
28     {"GBK2K-H", g_FXCMAP_GBK2K_H_5, g_FXCMAP_GBK2K_H_5_DWord, 4071, 1017,
29      FXCMAP_CMap::Range, -4},
30     {"GBK2K-V", g_FXCMAP_GBK2K_V_5, nullptr, 41, 0, FXCMAP_CMap::Range, -1},
31     {"UniGB-UCS2-H", g_FXCMAP_UniGB_UCS2_H_4, nullptr, 13825, 0,
32      FXCMAP_CMap::Range, 0},
33     {"UniGB-UCS2-V", g_FXCMAP_UniGB_UCS2_V_4, nullptr, 24, 0,
34      FXCMAP_CMap::Range, -1},
35     {"UniGB-UTF16-H", g_FXCMAP_UniGB_UCS2_H_4, nullptr, 13825, 0,
36      FXCMAP_CMap::Range, 0},
37     {"UniGB-UTF16-V", g_FXCMAP_UniGB_UCS2_V_4, nullptr, 24, 0,
38      FXCMAP_CMap::Range, -1},
39 };
40 
LoadEmbeddedGB1CMaps()41 void CPDF_ModuleMgr::LoadEmbeddedGB1CMaps() {
42   CPDF_FontGlobals* pFontGlobals =
43       CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
44   pFontGlobals->SetEmbeddedCharset(CIDSET_GB1, g_FXCMAP_GB1_cmaps,
45                                    FX_ArraySize(g_FXCMAP_GB1_cmaps));
46   pFontGlobals->SetEmbeddedToUnicode(CIDSET_GB1, g_FXCMAP_GB1CID2Unicode_5,
47                                      30284);
48 }
49