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