Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | List of all members
txt::TestFontManager Class Reference

#include <test_font_manager.h>

Inheritance diagram for txt::TestFontManager:
txt::AssetFontManager SkFontMgr SkRefCnt SkRefCntBase

Public Member Functions

 TestFontManager (std::unique_ptr< FontAssetProvider > font_provider, std::vector< std::string > test_font_family_names)
 
 ~TestFontManager () override
 
- Public Member Functions inherited from txt::AssetFontManager
 AssetFontManager (std::unique_ptr< FontAssetProvider > font_provider)
 
 ~AssetFontManager () override
 
- Public Member Functions inherited from SkFontMgr
int countFamilies () const
 
void getFamilyName (int index, SkString *familyName) const
 
sk_sp< SkFontStyleSetcreateStyleSet (int index) const
 
sk_sp< SkFontStyleSetmatchFamily (const char familyName[]) const
 
sk_sp< SkTypefacematchFamilyStyle (const char familyName[], const SkFontStyle &) const
 
sk_sp< SkTypefacematchFamilyStyleCharacter (const char familyName[], const SkFontStyle &, const char *bcp47[], int bcp47Count, SkUnichar character) const
 
sk_sp< SkTypefacemakeFromData (sk_sp< SkData >, int ttcIndex=0) const
 
sk_sp< SkTypefacemakeFromStream (std::unique_ptr< SkStreamAsset >, int ttcIndex=0) const
 
sk_sp< SkTypefacemakeFromStream (std::unique_ptr< SkStreamAsset >, const SkFontArguments &) const
 
sk_sp< SkTypefacemakeFromFile (const char path[], int ttcIndex=0) const
 
sk_sp< SkTypefacelegacyMakeTypeface (const char familyName[], SkFontStyle style) const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Private Member Functions

sk_sp< SkFontStyleSetonMatchFamily (const char family_name[]) const override
 

Additional Inherited Members

- Static Public Member Functions inherited from SkFontMgr
static sk_sp< SkFontMgrRefEmpty ()
 
- Protected Attributes inherited from txt::AssetFontManager
std::unique_ptr< FontAssetProviderfont_provider_
 

Detailed Description

Definition at line 33 of file test_font_manager.h.

Constructor & Destructor Documentation

◆ TestFontManager()

txt::TestFontManager::TestFontManager ( std::unique_ptr< FontAssetProvider font_provider,
std::vector< std::string >  test_font_family_names 
)

Definition at line 22 of file test_font_manager.cc.

25 : AssetFontManager(std::move(font_provider)),
26 test_font_family_names_(test_font_family_names) {}
AssetFontManager(std::unique_ptr< FontAssetProvider > font_provider)

◆ ~TestFontManager()

txt::TestFontManager::~TestFontManager ( )
overridedefault

Member Function Documentation

◆ onMatchFamily()

sk_sp< SkFontStyleSet > txt::TestFontManager::onMatchFamily ( const char  familyName[]) const
overrideprivatevirtual

May return NULL if the name is not found.

Reimplemented from txt::AssetFontManager.

Definition at line 30 of file test_font_manager.cc.

31 {
32 // Find the requested name in the list, if not found, default to the first
33 // font family in the test font family list.
34 std::string requested_name(family_name);
35 std::string sanitized_name = test_font_family_names_[0];
36 for (const std::string& test_family : test_font_family_names_) {
37 if (requested_name == test_family) {
38 sanitized_name = test_family;
39 }
40 }
41 return AssetFontManager::onMatchFamily(sanitized_name.c_str());
42}
sk_sp< SkFontStyleSet > onMatchFamily(const char familyName[]) const override

The documentation for this class was generated from the following files: