1 // Copyright 2019 Google LLC. 2 #include "modules/skparagraph/include/FontCollection.h" 3 #include "modules/skparagraph/include/TypefaceFontProvider.h" 4 #include "src/core/SkFontDescriptor.h" 5 6 #include <string> 7 8 namespace skia { 9 namespace textlayout { 10 class TestFontCollection : public FontCollection { 11 public: 12 // if load is true, will load the fonts (using Freetype, Core Text, or DirectWrite) from 13 // resourceDir. 14 TestFontCollection(const std::string& resourceDir, bool testOnly = false, bool loadFonts = true); 15 fontsFound()16 size_t fontsFound() const { return fFontsFound; } 17 bool addFontFromFile(const std::string& path, const std::string& familyName = ""); 18 19 private: 20 std::string fResourceDir; 21 size_t fFontsFound; 22 sk_sp<TypefaceFontProvider> fFontProvider; 23 std::string fDirs; 24 }; 25 } // namespace textlayout 26 } // namespace skia 27