• 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 #ifndef CORE_FPDFAPI_CMAPS_FPDF_CMAPS_H_
8 #define CORE_FPDFAPI_CMAPS_FPDF_CMAPS_H_
9 
10 #include <stdint.h>
11 
12 #include "core/fxcrt/fx_string.h"
13 #include "third_party/base/span.h"
14 
15 struct FXCMAP_DWordCIDMap {
16   uint16_t m_HiWord;
17   uint16_t m_LoWordLow;
18   uint16_t m_LoWordHigh;
19   uint16_t m_CID;
20 };
21 
22 struct FXCMAP_CMap {
23   enum MapType : uint8_t { Single, Range };
24 
25   const char* m_Name;                     // Raw, POD struct.
26   const uint16_t* m_pWordMap;             // Raw, POD struct.
27   const FXCMAP_DWordCIDMap* m_pDWordMap;  // Raw, POD struct.
28   uint16_t m_WordCount;
29   uint16_t m_DWordCount;
30   MapType m_WordMapType;
31   int8_t m_UseOffset;
32 };
33 
34 const FXCMAP_CMap* FindEmbeddedCMap(pdfium::span<const FXCMAP_CMap> pCMaps,
35                                     ByteStringView name);
36 uint16_t CIDFromCharCode(const FXCMAP_CMap* pMap, uint32_t charcode);
37 uint32_t CharCodeFromCID(const FXCMAP_CMap* pMap, uint16_t cid);
38 
39 #endif  // CORE_FPDFAPI_CMAPS_FPDF_CMAPS_H_
40