• 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_FPDFAPI_FONT_CPDF_TYPE1FONT_H_
8 #define CORE_FPDFAPI_FONT_CPDF_TYPE1FONT_H_
9 
10 #include "build/build_config.h"
11 #include "core/fpdfapi/font/cpdf_simplefont.h"
12 #include "core/fxcrt/fx_system.h"
13 #include "core/fxge/cfx_fontmapper.h"
14 
15 class CPDF_Type1Font final : public CPDF_SimpleFont {
16  public:
17   template <typename T, typename... Args>
18   friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
19 
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 defined(OS_MACOSX)
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, CPDF_Dictionary* pFontDict);
34 
35   // CPDF_Font:
36   bool Load() override;
37 
38   // CPDF_SimpleFont:
39   void LoadGlyphMap() override;
40 
41   bool IsSymbolicFont() const;
42   bool IsFixedFont() const;
43 
44 #if defined(OS_MACOSX)
45   void SetExtGID(const char* name, uint32_t charcode);
46   void CalcExtGID(uint32_t charcode);
47 
48   uint16_t m_ExtGID[256];
49 #endif
50 
51   Optional<CFX_FontMapper::StandardFont> m_Base14Font;
52 };
53 
54 #endif  // CORE_FPDFAPI_FONT_CPDF_TYPE1FONT_H_
55