Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Friends | List of all members
SkFontMgr_Fuchsia Class Referencefinal
Inheritance diagram for SkFontMgr_Fuchsia:
SkFontMgr SkRefCnt SkRefCntBase

Public Member Functions

 SkFontMgr_Fuchsia (fuchsia::fonts::ProviderSyncPtr provider)
 
 ~SkFontMgr_Fuchsia () 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
 

Protected Member Functions

int onCountFamilies () const override
 
void onGetFamilyName (int index, SkString *familyName) const override
 
sk_sp< SkFontStyleSetonMatchFamily (const char familyName[]) const override
 
sk_sp< SkFontStyleSetonCreateStyleSet (int index) 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
 

Friends

class SkFontStyleSet_Fuchsia
 

Additional Inherited Members

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

Detailed Description

Definition at line 281 of file SkFontMgr_fuchsia.cpp.

Constructor & Destructor Documentation

◆ SkFontMgr_Fuchsia()

SkFontMgr_Fuchsia::SkFontMgr_Fuchsia ( fuchsia::fonts::ProviderSyncPtr  provider)

Definition at line 365 of file SkFontMgr_fuchsia.cpp.

366 : fFontProvider(std::move(provider)), fBufferCache(sk_make_sp<SkFuchsiaFontDataCache>()) {}

◆ ~SkFontMgr_Fuchsia()

SkFontMgr_Fuchsia::~SkFontMgr_Fuchsia ( )
overridedefault

Member Function Documentation

◆ onCountFamilies()

int SkFontMgr_Fuchsia::onCountFamilies ( ) const
overrideprotectedvirtual

Implements SkFontMgr.

Definition at line 370 of file SkFontMgr_fuchsia.cpp.

370 {
371 // Family enumeration is not supported.
372 return 0;
373}

◆ onCreateStyleSet()

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

Implements SkFontMgr.

Definition at line 380 of file SkFontMgr_fuchsia.cpp.

380 {
381 // Family enumeration is not supported.
382 return nullptr;
383}

◆ onGetFamilyName()

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

Implements SkFontMgr.

Definition at line 375 of file SkFontMgr_fuchsia.cpp.

375 {
376 // Family enumeration is not supported.
377 familyName->reset();
378}
void reset()
Definition SkString.cpp:358

◆ onLegacyMakeTypeface()

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

Implements SkFontMgr.

Definition at line 436 of file SkFontMgr_fuchsia.cpp.

437 {
438 return sk_sp<SkTypeface>(matchFamilyStyle(familyName, style));
439}
sk_sp< SkTypeface > matchFamilyStyle(const char familyName[], const SkFontStyle &) const

◆ onMakeFromData()

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

Implements SkFontMgr.

Definition at line 418 of file SkFontMgr_fuchsia.cpp.

418 {
419 return makeFromStream(std::make_unique<SkMemoryStream>(std::move(data)), ttcIndex);
420}
sk_sp< SkTypeface > makeFromStream(std::unique_ptr< SkStreamAsset >, int ttcIndex=0) const

◆ onMakeFromFile()

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

Implements SkFontMgr.

Definition at line 432 of file SkFontMgr_fuchsia.cpp.

432 {
433 return makeFromStream(std::make_unique<SkFILEStream>(path), ttcIndex);
434}

◆ onMakeFromStreamArgs()

sk_sp< SkTypeface > SkFontMgr_Fuchsia::onMakeFromStreamArgs ( std::unique_ptr< SkStreamAsset asset,
const SkFontArguments args 
) const
overrideprotectedvirtual

Implements SkFontMgr.

Definition at line 427 of file SkFontMgr_fuchsia.cpp.

428 {
429 return CreateTypefaceFromSkStream(std::move(asset), args, kNullTypefaceId);
430}
struct TypefaceId kNullTypefaceId
sk_sp< SkTypeface > CreateTypefaceFromSkStream(std::unique_ptr< SkStreamAsset > stream, const SkFontArguments &args, TypefaceId id)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args

◆ onMakeFromStreamIndex()

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

Implements SkFontMgr.

Definition at line 422 of file SkFontMgr_fuchsia.cpp.

423 {
424 return makeFromStream(std::move(asset), SkFontArguments().setCollectionIndex(ttcIndex));
425}

◆ onMatchFamily()

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

May return NULL if the name is not found.

Implements SkFontMgr.

Definition at line 385 of file SkFontMgr_fuchsia.cpp.

385 {
386 fuchsia::fonts::FamilyName typedFamilyName;
387 typedFamilyName.name = familyName;
388
389 fuchsia::fonts::FontFamilyInfo familyInfo;
390 int result = fFontProvider->GetFontFamilyInfo(typedFamilyName, &familyInfo);
391 if (result != ZX_OK || !familyInfo.has_styles() || familyInfo.styles().empty()) return nullptr;
392
393 std::vector<SkFontStyle> styles;
394 for (auto& style : familyInfo.styles()) {
395 styles.push_back(SkFontStyle(style.weight(), FuchsiaToSkWidth(style.width()),
396 FuchsiaToSkSlant(style.slant())));
397 }
398
400 new SkFontStyleSet_Fuchsia(sk_ref_sp(this), familyInfo.name().name, std::move(styles)));
401}
SkFontStyle::Slant FuchsiaToSkSlant(fuchsia::fonts::Slant slant)
SkFontStyle::Width FuchsiaToSkWidth(fuchsia::fonts::Width width)
sk_sp< T > sk_ref_sp(T *obj)
Definition SkRefCnt.h:381
friend class SkFontStyleSet_Fuchsia
GAsyncResult * result

◆ onMatchFamilyStyle()

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

Implements SkFontMgr.

Definition at line 403 of file SkFontMgr_fuchsia.cpp.

404 {
405 return FetchTypeface(familyName, style, /*bcp47=*/nullptr, /*bcp47Count=*/0, /*character=*/0,
406 /*allow_fallback=*/false, /*exact_style_match=*/false);
407}

◆ onMatchFamilyStyleCharacter()

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

Implements SkFontMgr.

Definition at line 409 of file SkFontMgr_fuchsia.cpp.

413{
414 return FetchTypeface(familyName, style, bcp47, bcp47Count, character,
415 /*allow_fallback=*/true, /*exact_style_match=*/false);
416}

Friends And Related Symbol Documentation

◆ SkFontStyleSet_Fuchsia

friend class SkFontStyleSet_Fuchsia
friend

Definition at line 305 of file SkFontMgr_fuchsia.cpp.


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