• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 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_FONT_CPDF_TYPE1FONT_H_
8 #define CORE_FPDFAPI_FONT_CPDF_TYPE1FONT_H_
9 
10 #include <stdint.h>
11 
12 #include <array>
13 
14 #include "build/build_config.h"
15 #include "core/fpdfapi/font/cpdf_simplefont.h"
16 #include "core/fxcrt/retain_ptr.h"
17 #include "core/fxge/cfx_fontmapper.h"
18 
19 class CPDF_Type1Font final : public CPDF_SimpleFont {
20  public:
21   CONSTRUCT_VIA_MAKE_RETAIN;
22   ~CPDF_Type1Font() override;
23 
24   // CPDF_Font:
25   bool IsType1Font() const override;
26   const CPDF_Type1Font* AsType1Font() const override;
27   CPDF_Type1Font* AsType1Font() override;
28 #if BUILDFLAG(IS_APPLE)
29   int GlyphFromCharCodeExt(uint32_t charcode) override;
30 #endif
31 
IsBase14Font()32   bool IsBase14Font() const { return m_Base14Font.has_value(); }
33 
34  private:
35   CPDF_Type1Font(CPDF_Document* pDocument,
36                  RetainPtr<CPDF_Dictionary> pFontDict);
37 
38   // CPDF_Font:
39   bool Load() override;
40 
41   // CPDF_SimpleFont:
42   void LoadGlyphMap() override;
43 
44   bool IsSymbolicFont() const;
45   bool IsFixedFont() const;
46 
47 #if BUILDFLAG(IS_APPLE)
48   void SetExtGID(const char* name, uint32_t charcode);
49   void CalcExtGID(uint32_t charcode);
50 
51   std::array<uint16_t, kInternalTableSize> m_ExtGID;
52 #endif
53 
54   std::optional<CFX_FontMapper::StandardFont> m_Base14Font;
55 };
56 
57 #endif  // CORE_FPDFAPI_FONT_CPDF_TYPE1FONT_H_
58