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 "cmaps_korea1.h"
8 
9 #include "core/include/fpdfapi/fpdf_module.h"
10 #include "core/include/fpdfapi/fpdf_resource.h"
11 #include "core/include/fxcrt/fx_basic.h"  // For FX_ArraySize().
12 #include "core/src/fpdfapi/fpdf_cmaps/cmap_int.h"
13 #include "core/src/fpdfapi/fpdf_font/font_int.h"
14 
15 static const FXCMAP_CMap g_FXCMAP_Korea1_cmaps[] = {
16     {"KSC-EUC-H", FXCMAP_CMap::Range, g_FXCMAP_KSC_EUC_H_0, 467,
17      FXCMAP_CMap::None, NULL, 0, 0},
18     {"KSC-EUC-V", FXCMAP_CMap::Range, g_FXCMAP_KSC_EUC_V_0, 16,
19      FXCMAP_CMap::None, NULL, 0, -1},
20     {"KSCms-UHC-H", FXCMAP_CMap::Range, g_FXCMAP_KSCms_UHC_H_1, 675,
21      FXCMAP_CMap::None, NULL, 0, -2},
22     {"KSCms-UHC-V", FXCMAP_CMap::Range, g_FXCMAP_KSCms_UHC_V_1, 16,
23      FXCMAP_CMap::None, NULL, 0, -1},
24     {"KSCms-UHC-HW-H", FXCMAP_CMap::Range, g_FXCMAP_KSCms_UHC_HW_H_1, 675,
25      FXCMAP_CMap::None, NULL, 0, 0},
26     {"KSCms-UHC-HW-V", FXCMAP_CMap::Range, g_FXCMAP_KSCms_UHC_HW_V_1, 16,
27      FXCMAP_CMap::None, NULL, 0, -1},
28     {"KSCpc-EUC-H", FXCMAP_CMap::Range, g_FXCMAP_KSCpc_EUC_H_0, 509,
29      FXCMAP_CMap::None, NULL, 0, -6},
30     {"UniKS-UCS2-H", FXCMAP_CMap::Range, g_FXCMAP_UniKS_UCS2_H_1, 8394,
31      FXCMAP_CMap::None, NULL, 0, 0},
32     {"UniKS-UCS2-V", FXCMAP_CMap::Range, g_FXCMAP_UniKS_UCS2_V_1, 18,
33      FXCMAP_CMap::None, NULL, 0, -1},
34     {"UniKS-UTF16-H", FXCMAP_CMap::Single, g_FXCMAP_UniKS_UTF16_H_0, 158,
35      FXCMAP_CMap::None, NULL, 0, -2},
36     {"UniKS-UTF16-V", FXCMAP_CMap::Range, g_FXCMAP_UniKS_UCS2_V_1, 18,
37      FXCMAP_CMap::None, NULL, 0, -1},
38 };
39 
LoadEmbeddedKorea1CMaps()40 void CPDF_ModuleMgr::LoadEmbeddedKorea1CMaps() {
41   CPDF_FontGlobals* pFontGlobals =
42       CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
43   pFontGlobals->m_EmbeddedCharsets[CIDSET_KOREA1].m_pMapList =
44       g_FXCMAP_Korea1_cmaps;
45   pFontGlobals->m_EmbeddedCharsets[CIDSET_KOREA1].m_Count =
46       FX_ArraySize(g_FXCMAP_Korea1_cmaps);
47   pFontGlobals->m_EmbeddedToUnicodes[CIDSET_KOREA1].m_pMap =
48       g_FXCMAP_Korea1CID2Unicode_2;
49   pFontGlobals->m_EmbeddedToUnicodes[CIDSET_KOREA1].m_Count = 18352;
50 }
51