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   CONSTRUCT_VIA_MAKE_RETAIN;
18   ~CPDF_Type1Font() override;
19 
20   // CPDF_Font:
21   bool IsType1Font() const override;
22   const CPDF_Type1Font* AsType1Font() const override;
23   CPDF_Type1Font* AsType1Font() override;
24 #if defined(OS_APPLE)
25   int GlyphFromCharCodeExt(uint32_t charcode) override;
26 #endif
27 
IsBase14Font()28   bool IsBase14Font() const { return m_Base14Font.has_value(); }
29 
30  private:
31   CPDF_Type1Font(CPDF_Document* pDocument, CPDF_Dictionary* pFontDict);
32 
33   // CPDF_Font:
34   bool Load() override;
35 
36   // CPDF_SimpleFont:
37   void LoadGlyphMap() override;
38 
39   bool IsSymbolicFont() const;
40   bool IsFixedFont() const;
41 
42 #if defined(OS_APPLE)
43   void SetExtGID(const char* name, uint32_t charcode);
44   void CalcExtGID(uint32_t charcode);
45 
46   uint16_t m_ExtGID[256];
47 #endif
48 
49   Optional<CFX_FontMapper::StandardFont> m_Base14Font;
50 };
51 
52 #endif  // CORE_FPDFAPI_FONT_CPDF_TYPE1FONT_H_
53