• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 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_FPDFDOC_CPVT_FONTMAP_H_
8 #define CORE_FPDFDOC_CPVT_FONTMAP_H_
9 
10 #include <stdint.h>
11 
12 #include "core/fpdfdoc/ipvt_fontmap.h"
13 #include "core/fxcrt/fx_string.h"
14 #include "core/fxcrt/unowned_ptr.h"
15 
16 class CPDF_Document;
17 class CPDF_Dictionary;
18 class CPDF_Font;
19 
20 class CPVT_FontMap : public IPVT_FontMap {
21  public:
22   CPVT_FontMap(CPDF_Document* pDoc,
23                CPDF_Dictionary* pResDict,
24                CPDF_Font* pDefFont,
25                const ByteString& sDefFontAlias);
26   ~CPVT_FontMap() override;
27 
28   // IPVT_FontMap:
29   CPDF_Font* GetPDFFont(int32_t nFontIndex) override;
30   ByteString GetPDFFontAlias(int32_t nFontIndex) override;
31   int32_t GetWordFontIndex(uint16_t word,
32                            int32_t charset,
33                            int32_t nFontIndex) override;
34   int32_t CharCodeFromUnicode(int32_t nFontIndex, uint16_t word) override;
35   int32_t CharSetFromUnicode(uint16_t word, int32_t nOldCharset) override;
36 
37   static CPDF_Font* GetAnnotSysPDFFont(CPDF_Document* pDoc,
38                                        const CPDF_Dictionary* pResDict,
39                                        ByteString* sSysFontAlias);
40 
41  private:
42   UnownedPtr<CPDF_Document> const m_pDocument;
43   UnownedPtr<CPDF_Dictionary> const m_pResDict;
44   UnownedPtr<CPDF_Font> const m_pDefFont;
45   UnownedPtr<CPDF_Font> m_pSysFont;
46   const ByteString m_sDefFontAlias;
47   ByteString m_sSysFontAlias;
48 };
49 
50 #endif  // CORE_FPDFDOC_CPVT_FONTMAP_H_
51