Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
SkFontMgr Class Referenceabstract

#include <SkFontMgr.h>

Inheritance diagram for SkFontMgr:
SkRefCnt SkRefCntBase OneFontMgr SkEmptyFontMgr SkFontMgr_Custom SkFontMgr_FCI SkFontMgr_Fuchsia SkFontMgr_fontconfig SkOrderedFontMgr skia::textlayout::TypefaceFontProvider txt::AssetFontManager

Public Member Functions

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
 

Static Public Member Functions

static sk_sp< SkFontMgrRefEmpty ()
 

Protected Member Functions

virtual int onCountFamilies () const =0
 
virtual void onGetFamilyName (int index, SkString *familyName) const =0
 
virtual sk_sp< SkFontStyleSetonCreateStyleSet (int index) const =0
 
virtual sk_sp< SkFontStyleSetonMatchFamily (const char familyName[]) const =0
 
virtual sk_sp< SkTypefaceonMatchFamilyStyle (const char familyName[], const SkFontStyle &) const =0
 
virtual sk_sp< SkTypefaceonMatchFamilyStyleCharacter (const char familyName[], const SkFontStyle &, const char *bcp47[], int bcp47Count, SkUnichar character) const =0
 
virtual sk_sp< SkTypefaceonMakeFromData (sk_sp< SkData >, int ttcIndex) const =0
 
virtual sk_sp< SkTypefaceonMakeFromStreamIndex (std::unique_ptr< SkStreamAsset >, int ttcIndex) const =0
 
virtual sk_sp< SkTypefaceonMakeFromStreamArgs (std::unique_ptr< SkStreamAsset >, const SkFontArguments &) const =0
 
virtual sk_sp< SkTypefaceonMakeFromFile (const char path[], int ttcIndex) const =0
 
virtual sk_sp< SkTypefaceonLegacyMakeTypeface (const char familyName[], SkFontStyle) const =0
 

Detailed Description

Definition at line 36 of file SkFontMgr.h.

Member Function Documentation

◆ countFamilies()

int SkFontMgr::countFamilies ( ) const

Definition at line 93 of file SkFontMgr.cpp.

93 {
94 return this->onCountFamilies();
95}
virtual int onCountFamilies() const =0

◆ createStyleSet()

sk_sp< SkFontStyleSet > SkFontMgr::createStyleSet ( int  index) const

Definition at line 101 of file SkFontMgr.cpp.

101 {
102 return emptyOnNull(this->onCreateStyleSet(index));
103}
static sk_sp< SkFontStyleSet > emptyOnNull(sk_sp< SkFontStyleSet > &&fsset)
Definition: SkFontMgr.cpp:86
virtual sk_sp< SkFontStyleSet > onCreateStyleSet(int index) const =0

◆ getFamilyName()

void SkFontMgr::getFamilyName ( int  index,
SkString familyName 
) const

Definition at line 97 of file SkFontMgr.cpp.

97 {
98 this->onGetFamilyName(index, familyName);
99}
virtual void onGetFamilyName(int index, SkString *familyName) const =0

◆ legacyMakeTypeface()

sk_sp< SkTypeface > SkFontMgr::legacyMakeTypeface ( const char  familyName[],
SkFontStyle  style 
) const

Definition at line 150 of file SkFontMgr.cpp.

150 {
151 return this->onLegacyMakeTypeface(familyName, style);
152}
virtual sk_sp< SkTypeface > onLegacyMakeTypeface(const char familyName[], SkFontStyle) const =0

◆ makeFromData()

sk_sp< SkTypeface > SkFontMgr::makeFromData ( sk_sp< SkData data,
int  ttcIndex = 0 
) const

Create a typeface for the specified data and TTC index (pass 0 for none) or NULL if the data is not recognized. The caller must call unref() on the returned object if it is not null.

Definition at line 120 of file SkFontMgr.cpp.

120 {
121 if (nullptr == data) {
122 return nullptr;
123 }
124 return this->onMakeFromData(std::move(data), ttcIndex);
125}
virtual sk_sp< SkTypeface > onMakeFromData(sk_sp< SkData >, int ttcIndex) const =0
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ makeFromFile()

sk_sp< SkTypeface > SkFontMgr::makeFromFile ( const char  path[],
int  ttcIndex = 0 
) const

Create a typeface for the specified fileName and TTC index (pass 0 for none) or NULL if the file is not found, or its contents are not recognized. The caller must call unref() on the returned object if it is not null.

Definition at line 143 of file SkFontMgr.cpp.

143 {
144 if (nullptr == path) {
145 return nullptr;
146 }
147 return this->onMakeFromFile(path, ttcIndex);
148}
virtual sk_sp< SkTypeface > onMakeFromFile(const char path[], int ttcIndex) const =0
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57

◆ makeFromStream() [1/2]

sk_sp< SkTypeface > SkFontMgr::makeFromStream ( std::unique_ptr< SkStreamAsset stream,
const SkFontArguments args 
) const

Definition at line 135 of file SkFontMgr.cpp.

136 {
137 if (nullptr == stream) {
138 return nullptr;
139 }
140 return this->onMakeFromStreamArgs(std::move(stream), args);
141}
virtual sk_sp< SkTypeface > onMakeFromStreamArgs(std::unique_ptr< SkStreamAsset >, const SkFontArguments &) const =0
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args

◆ makeFromStream() [2/2]

sk_sp< SkTypeface > SkFontMgr::makeFromStream ( std::unique_ptr< SkStreamAsset stream,
int  ttcIndex = 0 
) const

Create a typeface for the specified stream and TTC index (pass 0 for none) or NULL if the stream is not recognized. The caller must call unref() on the returned object if it is not null.

Definition at line 127 of file SkFontMgr.cpp.

128 {
129 if (nullptr == stream) {
130 return nullptr;
131 }
132 return this->onMakeFromStreamIndex(std::move(stream), ttcIndex);
133}
virtual sk_sp< SkTypeface > onMakeFromStreamIndex(std::unique_ptr< SkStreamAsset >, int ttcIndex) const =0

◆ matchFamily()

sk_sp< SkFontStyleSet > SkFontMgr::matchFamily ( const char  familyName[]) const

The caller must call unref() on the returned object. Never returns NULL; will return an empty set if the name is not found.

Passing nullptr as the parameter will return the default system family. Note that most systems don't have a default system family, so passing nullptr will often result in the empty set.

It is possible that this will return a style set not accessible from createStyleSet(int) due to hidden or auto-activated fonts.

Definition at line 105 of file SkFontMgr.cpp.

105 {
106 return emptyOnNull(this->onMatchFamily(familyName));
107}
virtual sk_sp< SkFontStyleSet > onMatchFamily(const char familyName[]) const =0

◆ matchFamilyStyle()

sk_sp< SkTypeface > SkFontMgr::matchFamilyStyle ( const char  familyName[],
const SkFontStyle fs 
) const

Find the closest matching typeface to the specified familyName and style and return a ref to it. The caller must call unref() on the returned object. Will return nullptr if no 'good' match is found.

Passing |nullptr| as the parameter for |familyName| will return the default system font.

It is possible that this will return a style set not accessible from createStyleSet(int) or matchFamily(const char[]) due to hidden or auto-activated fonts.

Definition at line 109 of file SkFontMgr.cpp.

110 {
111 return this->onMatchFamilyStyle(familyName, fs);
112}
virtual sk_sp< SkTypeface > onMatchFamilyStyle(const char familyName[], const SkFontStyle &) const =0

◆ matchFamilyStyleCharacter()

sk_sp< SkTypeface > SkFontMgr::matchFamilyStyleCharacter ( const char  familyName[],
const SkFontStyle style,
const char *  bcp47[],
int  bcp47Count,
SkUnichar  character 
) const

Use the system fallback to find a typeface for the given character. Note that bcp47 is a combination of ISO 639, 15924, and 3166-1 codes, so it is fine to just pass a ISO 639 here.

Will return NULL if no family can be found for the character in the system fallback.

Passing |nullptr| as the parameter for |familyName| will return the default system font.

bcp47[0] is the least significant fallback, bcp47[bcp47Count-1] is the most significant. If no specified bcp47 codes match, any font with the requested character will be matched.

Definition at line 114 of file SkFontMgr.cpp.

116 {
117 return this->onMatchFamilyStyleCharacter(familyName, style, bcp47, bcp47Count, character);
118}
virtual sk_sp< SkTypeface > onMatchFamilyStyleCharacter(const char familyName[], const SkFontStyle &, const char *bcp47[], int bcp47Count, SkUnichar character) const =0

◆ onCountFamilies()

virtual int SkFontMgr::onCountFamilies ( ) const
protectedpure virtual

◆ onCreateStyleSet()

virtual sk_sp< SkFontStyleSet > SkFontMgr::onCreateStyleSet ( int  index) const
protectedpure virtual

◆ onGetFamilyName()

virtual void SkFontMgr::onGetFamilyName ( int  index,
SkString familyName 
) const
protectedpure virtual

◆ onLegacyMakeTypeface()

virtual sk_sp< SkTypeface > SkFontMgr::onLegacyMakeTypeface ( const char  familyName[],
SkFontStyle   
) const
protectedpure virtual

◆ onMakeFromData()

virtual sk_sp< SkTypeface > SkFontMgr::onMakeFromData ( sk_sp< SkData ,
int  ttcIndex 
) const
protectedpure virtual

◆ onMakeFromFile()

virtual sk_sp< SkTypeface > SkFontMgr::onMakeFromFile ( const char  path[],
int  ttcIndex 
) const
protectedpure virtual

◆ onMakeFromStreamArgs()

virtual sk_sp< SkTypeface > SkFontMgr::onMakeFromStreamArgs ( std::unique_ptr< SkStreamAsset ,
const SkFontArguments  
) const
protectedpure virtual

◆ onMakeFromStreamIndex()

virtual sk_sp< SkTypeface > SkFontMgr::onMakeFromStreamIndex ( std::unique_ptr< SkStreamAsset ,
int  ttcIndex 
) const
protectedpure virtual

◆ onMatchFamily()

virtual sk_sp< SkFontStyleSet > SkFontMgr::onMatchFamily ( const char  familyName[]) const
protectedpure virtual

◆ onMatchFamilyStyle()

virtual sk_sp< SkTypeface > SkFontMgr::onMatchFamilyStyle ( const char  familyName[],
const SkFontStyle  
) const
protectedpure virtual

◆ onMatchFamilyStyleCharacter()

virtual sk_sp< SkTypeface > SkFontMgr::onMatchFamilyStyleCharacter ( const char  familyName[],
const SkFontStyle ,
const char *  bcp47[],
int  bcp47Count,
SkUnichar  character 
) const
protectedpure virtual

◆ RefEmpty()

sk_sp< SkFontMgr > SkFontMgr::RefEmpty ( )
static

Definition at line 154 of file SkFontMgr.cpp.

154 {
155 static sk_sp<SkFontMgr> singleton(new SkEmptyFontMgr);
156 return singleton;
157}

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