Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
SkOrderedFontMgr Class Reference

#include <SkOrderedFontMgr.h>

Inheritance diagram for SkOrderedFontMgr:
SkFontMgr SkRefCnt SkRefCntBase

Public Member Functions

 SkOrderedFontMgr ()
 
 ~SkOrderedFontMgr () override
 
void append (sk_sp< SkFontMgr >)
 
- 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
 

Protected Member Functions

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

Additional Inherited Members

- Static Public Member Functions inherited from SkFontMgr
static sk_sp< SkFontMgrRefEmpty ()
 

Detailed Description

Collects an order list of other font managers, and visits them in order when a request to find or match is issued.

Note: this explicitly fails on any attempt to Make a typeface: all of those requests will return null.

Definition at line 32 of file SkOrderedFontMgr.h.

Constructor & Destructor Documentation

◆ SkOrderedFontMgr()

SkOrderedFontMgr::SkOrderedFontMgr ( )

Definition at line 20 of file SkOrderedFontMgr.cpp.

20{}

◆ ~SkOrderedFontMgr()

SkOrderedFontMgr::~SkOrderedFontMgr ( )
override

Definition at line 21 of file SkOrderedFontMgr.cpp.

21{}

Member Function Documentation

◆ append()

void SkOrderedFontMgr::append ( sk_sp< SkFontMgr fm)

Definition at line 23 of file SkOrderedFontMgr.cpp.

23 {
24 fList.push_back(std::move(fm));
25}

◆ onCountFamilies()

int SkOrderedFontMgr::onCountFamilies ( ) const
overrideprotectedvirtual

Implements SkFontMgr.

Definition at line 27 of file SkOrderedFontMgr.cpp.

27 {
28 int count = 0;
29 for (const auto& fm : fList) {
30 count += fm->countFamilies();
31 }
32 return count;
33}
int count
Definition: FontMgrTest.cpp:50

◆ onCreateStyleSet()

sk_sp< SkFontStyleSet > SkOrderedFontMgr::onCreateStyleSet ( int  index) const
overrideprotectedvirtual

Implements SkFontMgr.

Definition at line 45 of file SkOrderedFontMgr.cpp.

45 {
46 for (const auto& fm : fList) {
47 const int count = fm->countFamilies();
48 if (index < count) {
49 return fm->createStyleSet(index);
50 }
51 index -= count;
52 }
53 return nullptr;
54}

◆ onGetFamilyName()

void SkOrderedFontMgr::onGetFamilyName ( int  index,
SkString familyName 
) const
overrideprotectedvirtual

Implements SkFontMgr.

Definition at line 35 of file SkOrderedFontMgr.cpp.

35 {
36 for (const auto& fm : fList) {
37 const int count = fm->countFamilies();
38 if (index < count) {
39 return fm->getFamilyName(index, familyName);
40 }
41 index -= count;
42 }
43}

◆ onLegacyMakeTypeface()

sk_sp< SkTypeface > SkOrderedFontMgr::onLegacyMakeTypeface ( const char  familyName[],
SkFontStyle   
) const
overrideprotectedvirtual

Implements SkFontMgr.

Definition at line 108 of file SkOrderedFontMgr.cpp.

108 {
109 return nullptr;
110}

◆ onMakeFromData()

sk_sp< SkTypeface > SkOrderedFontMgr::onMakeFromData ( sk_sp< SkData ,
int  ttcIndex 
) const
overrideprotectedvirtual

Implements SkFontMgr.

Definition at line 90 of file SkOrderedFontMgr.cpp.

90 {
91 return nullptr;
92}

◆ onMakeFromFile()

sk_sp< SkTypeface > SkOrderedFontMgr::onMakeFromFile ( const char  path[],
int  ttcIndex 
) const
overrideprotectedvirtual

Implements SkFontMgr.

Definition at line 104 of file SkOrderedFontMgr.cpp.

104 {
105 return nullptr;
106}

◆ onMakeFromStreamArgs()

sk_sp< SkTypeface > SkOrderedFontMgr::onMakeFromStreamArgs ( std::unique_ptr< SkStreamAsset ,
const SkFontArguments  
) const
overrideprotectedvirtual

Implements SkFontMgr.

Definition at line 99 of file SkOrderedFontMgr.cpp.

100 {
101 return nullptr;
102}

◆ onMakeFromStreamIndex()

sk_sp< SkTypeface > SkOrderedFontMgr::onMakeFromStreamIndex ( std::unique_ptr< SkStreamAsset ,
int  ttcIndex 
) const
overrideprotectedvirtual

Implements SkFontMgr.

Definition at line 94 of file SkOrderedFontMgr.cpp.

95 {
96 return nullptr;
97}

◆ onMatchFamily()

sk_sp< SkFontStyleSet > SkOrderedFontMgr::onMatchFamily ( const char  familyName[]) const
overrideprotectedvirtual

May return NULL if the name is not found.

Implements SkFontMgr.

Definition at line 56 of file SkOrderedFontMgr.cpp.

56 {
57 for (const auto& fm : fList) {
58 if (auto fs = fm->matchFamily(familyName)) {
59 return fs;
60 }
61 }
62 return nullptr;
63}

◆ onMatchFamilyStyle()

sk_sp< SkTypeface > SkOrderedFontMgr::onMatchFamilyStyle ( const char  familyName[],
const SkFontStyle style 
) const
overrideprotectedvirtual

Implements SkFontMgr.

Definition at line 65 of file SkOrderedFontMgr.cpp.

66 {
67 for (const auto& fm : fList) {
68 if (auto tf = fm->matchFamilyStyle(family, style)) {
69 return tf;
70 }
71 }
72 return nullptr;
73}

◆ onMatchFamilyStyleCharacter()

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

Implements SkFontMgr.

Definition at line 75 of file SkOrderedFontMgr.cpp.

79{
80 for (const auto& fm : fList) {
81 if (auto tf = fm->matchFamilyStyleCharacter(familyName, style, bcp47, bcp47Count, uni)) {
82 return tf;
83 }
84 }
85 return nullptr;
86}

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