• 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_TRUETYPEFONT_H_
8 #define CORE_FPDFAPI_FONT_CPDF_TRUETYPEFONT_H_
9 
10 #include "core/fpdfapi/font/cpdf_simplefont.h"
11 #include "core/fxcrt/retain_ptr.h"
12 
13 class CPDF_TrueTypeFont final : public CPDF_SimpleFont {
14  public:
15   CONSTRUCT_VIA_MAKE_RETAIN;
16   ~CPDF_TrueTypeFont() override;
17 
18   // CPDF_Font:
19   bool IsTrueTypeFont() const override;
20   const CPDF_TrueTypeFont* AsTrueTypeFont() const override;
21   CPDF_TrueTypeFont* AsTrueTypeFont() override;
22 
23  private:
24   enum class CharmapType { kMSUnicode, kMSSymbol, kMacRoman, kOther };
25 
26   CPDF_TrueTypeFont(CPDF_Document* pDocument,
27                     RetainPtr<CPDF_Dictionary> pFontDict);
28 
29   // CPDF_Font:
30   bool Load() override;
31 
32   // CPDF_SimpleFont:
33   void LoadGlyphMap() override;
34 
35   bool HasAnyGlyphIndex() const;
36   CharmapType DetermineCharmapType() const;
37   FontEncoding DetermineEncoding() const;
38   void SetGlyphIndicesFromFirstChar();
39 };
40 
41 #endif  // CORE_FPDFAPI_FONT_CPDF_TRUETYPEFONT_H_
42