• 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_FXGE_ANDROID_CFPF_SKIAFONTMGR_H_
8 #define CORE_FXGE_ANDROID_CFPF_SKIAFONTMGR_H_
9 
10 #include <map>
11 #include <memory>
12 #include <vector>
13 
14 #include "core/fxcrt/bytestring.h"
15 #include "core/fxcrt/fx_codepage_forward.h"
16 #include "core/fxcrt/retain_ptr.h"
17 #include "core/fxge/cfx_face.h"
18 #include "core/fxge/freetype/fx_freetype.h"
19 
20 class CFPF_SkiaFont;
21 class CFPF_SkiaPathFont;
22 
23 class CFPF_SkiaFontMgr {
24  public:
25   CFPF_SkiaFontMgr();
26   ~CFPF_SkiaFontMgr();
27 
28   void LoadSystemFonts();
29   CFPF_SkiaFont* CreateFont(ByteStringView bsFamilyname,
30                             FX_Charset uCharset,
31                             uint32_t dwStyle);
32 
33   bool InitFTLibrary();
34   RetainPtr<CFX_Face> GetFontFace(ByteStringView bsFile, int32_t iFaceIndex);
35 
36  private:
37   void ScanPath(const ByteString& path);
38   void ScanFile(const ByteString& file);
39   std::unique_ptr<CFPF_SkiaPathFont> ReportFace(RetainPtr<CFX_Face> face,
40                                                 const ByteString& file);
41 
42   bool m_bLoaded = false;
43   ScopedFXFTLibraryRec m_FTLibrary;
44   std::vector<std::unique_ptr<CFPF_SkiaPathFont>> m_FontFaces;
45   std::map<uint32_t, std::unique_ptr<CFPF_SkiaFont>> m_FamilyFonts;
46 };
47 
48 #endif  // CORE_FXGE_ANDROID_CFPF_SKIAFONTMGR_H_
49