Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
txt::TypefaceFontStyleSet Class Reference

#include <typeface_font_asset_provider.h>

Inheritance diagram for txt::TypefaceFontStyleSet:
SkFontStyleSet SkRefCnt SkRefCntBase

Public Member Functions

 TypefaceFontStyleSet ()
 
 ~TypefaceFontStyleSet () override
 
void registerTypeface (sk_sp< SkTypeface > typeface)
 
int count () override
 
void getStyle (int index, SkFontStyle *style, SkString *name) override
 
sk_sp< SkTypefacecreateTypeface (int index) override
 
sk_sp< SkTypefacematchStyle (const SkFontStyle &pattern) override
 
virtual int count ()=0
 
virtual void getStyle (int index, SkFontStyle *, SkString *style)=0
 
virtual sk_sp< SkTypefacecreateTypeface (int index)=0
 
virtual sk_sp< SkTypefacematchStyle (const SkFontStyle &pattern)=0
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Additional Inherited Members

- Static Public Member Functions inherited from SkFontStyleSet
static sk_sp< SkFontStyleSetCreateEmpty ()
 
- Protected Member Functions inherited from SkFontStyleSet
sk_sp< SkTypefacematchStyleCSS3 (const SkFontStyle &pattern)
 

Detailed Description

Definition at line 30 of file typeface_font_asset_provider.h.

Constructor & Destructor Documentation

◆ TypefaceFontStyleSet()

txt::TypefaceFontStyleSet::TypefaceFontStyleSet ( )
default

◆ ~TypefaceFontStyleSet()

txt::TypefaceFontStyleSet::~TypefaceFontStyleSet ( )
overridedefault

Member Function Documentation

◆ count()

int txt::TypefaceFontStyleSet::count ( )
overridevirtual

Implements SkFontStyleSet.

Definition at line 90 of file typeface_font_asset_provider.cc.

90 {
91 return typefaces_.size();
92}

◆ createTypeface()

sk_sp< SkTypeface > txt::TypefaceFontStyleSet::createTypeface ( int  index)
overridevirtual

Implements SkFontStyleSet.

Definition at line 106 of file typeface_font_asset_provider.cc.

106 {
107 size_t index = i;
108 if (index >= typefaces_.size()) {
109 return nullptr;
110 }
111 return typefaces_[index];
112}

◆ getStyle()

void txt::TypefaceFontStyleSet::getStyle ( int  index,
SkFontStyle style,
SkString name 
)
overridevirtual

Implements SkFontStyleSet.

Definition at line 94 of file typeface_font_asset_provider.cc.

96 {
97 FML_DCHECK(static_cast<size_t>(index) < typefaces_.size());
98 if (style) {
99 *style = typefaces_[index]->fontStyle();
100 }
101 if (name) {
102 name->reset();
103 }
104}
#define FML_DCHECK(condition)
Definition: logging.h:103
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

◆ matchStyle()

sk_sp< SkTypeface > txt::TypefaceFontStyleSet::matchStyle ( const SkFontStyle pattern)
overridevirtual

Implements SkFontStyleSet.

Definition at line 114 of file typeface_font_asset_provider.cc.

114 {
115 return matchStyleCSS3(pattern);
116}
sk_sp< SkTypeface > matchStyleCSS3(const SkFontStyle &pattern)
Definition: SkFontMgr.cpp:184

◆ registerTypeface()

void txt::TypefaceFontStyleSet::registerTypeface ( sk_sp< SkTypeface typeface)

Definition at line 83 of file typeface_font_asset_provider.cc.

83 {
84 if (typeface == nullptr) {
85 return;
86 }
87 typefaces_.emplace_back(std::move(typeface));
88}

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