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