xref: /aosp_15_r20/external/pdfium/core/fpdfapi/cmaps/fpdf_cmaps.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2014 The PDFium Authors
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/unowned_ptr_exclusion.h"
13 
14 namespace fxcmap {
15 
16 struct DWordCIDMap {
17   uint16_t m_HiWord;
18   uint16_t m_LoWordLow;
19   uint16_t m_LoWordHigh;
20   uint16_t m_CID;
21 };
22 
23 struct CMap {
24   enum class Type : bool { kSingle, kRange };
25 
26   UNOWNED_PTR_EXCLUSION const char* m_Name;              // POD struct.
27   UNOWNED_PTR_EXCLUSION const uint16_t* m_pWordMap;      // POD struct.
28   UNOWNED_PTR_EXCLUSION const DWordCIDMap* m_pDWordMap;  // POD struct.
29   uint16_t m_WordCount;
30   uint16_t m_DWordCount;
31   Type m_WordMapType;
32   int8_t m_UseOffset;
33 };
34 
35 uint16_t CIDFromCharCode(const CMap* pMap, uint32_t charcode);
36 uint32_t CharCodeFromCID(const CMap* pMap, uint16_t cid);
37 
38 }  // namespace fxcmap
39 
40 #endif  // CORE_FPDFAPI_CMAPS_FPDF_CMAPS_H_
41