Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
SkFontMgr_FCI Class Reference
Inheritance diagram for SkFontMgr_FCI:
SkFontMgr SkRefCnt SkRefCntBase

Public Member Functions

 SkFontMgr_FCI (sk_sp< SkFontConfigInterface > fci)
 
- 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 requestedFamilyName[], const SkFontStyle &requestedStyle) 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 > data, int ttcIndex) const override
 
sk_sp< SkTypefaceonMakeFromStreamIndex (std::unique_ptr< SkStreamAsset > stream, int ttcIndex) const override
 
sk_sp< SkTypefaceonMakeFromStreamArgs (std::unique_ptr< SkStreamAsset > stream, const SkFontArguments &args) const override
 
sk_sp< SkTypefaceonMakeFromFile (const char path[], int ttcIndex) const override
 
sk_sp< SkTypefaceonLegacyMakeTypeface (const char requestedFamilyName[], SkFontStyle requestedStyle) 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

Definition at line 145 of file SkFontMgr_FontConfigInterface.cpp.

Constructor & Destructor Documentation

◆ SkFontMgr_FCI()

SkFontMgr_FCI::SkFontMgr_FCI ( sk_sp< SkFontConfigInterface fci)
inline

Definition at line 157 of file SkFontMgr_FontConfigInterface.cpp.

158 : fFCI(std::move(fci))
159 , fCache(kMaxSize)
160 {
161 SkASSERT_RELEASE(fFCI);
162 }
#define SkASSERT_RELEASE(cond)
Definition: SkAssert.h:100

Member Function Documentation

◆ onCountFamilies()

int SkFontMgr_FCI::onCountFamilies ( ) const
inlineoverrideprotectedvirtual

Implements SkFontMgr.

Definition at line 165 of file SkFontMgr_FontConfigInterface.cpp.

165 {
166 SK_ABORT("Not implemented.");
167 }
#define SK_ABORT(message,...)
Definition: SkAssert.h:70

◆ onCreateStyleSet()

sk_sp< SkFontStyleSet > SkFontMgr_FCI::onCreateStyleSet ( int  index) const
inlineoverrideprotectedvirtual

Implements SkFontMgr.

Definition at line 173 of file SkFontMgr_FontConfigInterface.cpp.

173 {
174 SK_ABORT("Not implemented.");
175 }

◆ onGetFamilyName()

void SkFontMgr_FCI::onGetFamilyName ( int  index,
SkString familyName 
) const
inlineoverrideprotectedvirtual

Implements SkFontMgr.

Definition at line 169 of file SkFontMgr_FontConfigInterface.cpp.

169 {
170 SK_ABORT("Not implemented.");
171 }

◆ onLegacyMakeTypeface()

sk_sp< SkTypeface > SkFontMgr_FCI::onLegacyMakeTypeface ( const char  requestedFamilyName[],
SkFontStyle  requestedStyle 
) const
inlineoverrideprotectedvirtual

Implements SkFontMgr.

Definition at line 250 of file SkFontMgr_FontConfigInterface.cpp.

251 {
252 return this->onMatchFamilyStyle(requestedFamilyName, requestedStyle);
253 }
sk_sp< SkTypeface > onMatchFamilyStyle(const char requestedFamilyName[], const SkFontStyle &requestedStyle) const override

◆ onMakeFromData()

sk_sp< SkTypeface > SkFontMgr_FCI::onMakeFromData ( sk_sp< SkData data,
int  ttcIndex 
) const
inlineoverrideprotectedvirtual

Implements SkFontMgr.

Definition at line 222 of file SkFontMgr_FontConfigInterface.cpp.

222 {
223 return this->onMakeFromStreamIndex(SkMemoryStream::Make(std::move(data)), ttcIndex);
224 }
sk_sp< SkTypeface > onMakeFromStreamIndex(std::unique_ptr< SkStreamAsset > stream, int ttcIndex) const override
static std::unique_ptr< SkMemoryStream > Make(sk_sp< SkData > data)
Definition: SkStream.cpp:314
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ onMakeFromFile()

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

Implements SkFontMgr.

Definition at line 245 of file SkFontMgr_FontConfigInterface.cpp.

245 {
246 std::unique_ptr<SkStreamAsset> stream = SkStream::MakeFromFile(path);
247 return stream ? this->makeFromStream(std::move(stream), ttcIndex) : nullptr;
248 }
sk_sp< SkTypeface > makeFromStream(std::unique_ptr< SkStreamAsset >, int ttcIndex=0) const
Definition: SkFontMgr.cpp:127
static std::unique_ptr< SkStreamAsset > MakeFromFile(const char path[])
Definition: SkStream.cpp:922
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

◆ onMakeFromStreamArgs()

sk_sp< SkTypeface > SkFontMgr_FCI::onMakeFromStreamArgs ( std::unique_ptr< SkStreamAsset stream,
const SkFontArguments args 
) const
inlineoverrideprotectedvirtual

Implements SkFontMgr.

Definition at line 232 of file SkFontMgr_FontConfigInterface.cpp.

233 {
234 const size_t length = stream->getLength();
235 if (!length) {
236 return nullptr;
237 }
238 if (length >= 1024 * 1024 * 1024) {
239 return nullptr; // don't accept too large fonts (>= 1GB) for safety.
240 }
241
243 }
static sk_sp< SkTypeface > MakeFromStream(std::unique_ptr< SkStreamAsset >, const SkFontArguments &)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
size_t length

◆ onMakeFromStreamIndex()

sk_sp< SkTypeface > SkFontMgr_FCI::onMakeFromStreamIndex ( std::unique_ptr< SkStreamAsset stream,
int  ttcIndex 
) const
inlineoverrideprotectedvirtual

Implements SkFontMgr.

Definition at line 226 of file SkFontMgr_FontConfigInterface.cpp.

227 {
228 return this->makeFromStream(std::move(stream),
229 SkFontArguments().setCollectionIndex(ttcIndex));
230 }

◆ onMatchFamily()

sk_sp< SkFontStyleSet > SkFontMgr_FCI::onMatchFamily ( const char  familyName[]) const
inlineoverrideprotectedvirtual

May return NULL if the name is not found.

Implements SkFontMgr.

Definition at line 177 of file SkFontMgr_FontConfigInterface.cpp.

177 {
178 SK_ABORT("Not implemented.");
179 }

◆ onMatchFamilyStyle()

sk_sp< SkTypeface > SkFontMgr_FCI::onMatchFamilyStyle ( const char  requestedFamilyName[],
const SkFontStyle requestedStyle 
) const
inlineoverrideprotectedvirtual

Implements SkFontMgr.

Definition at line 181 of file SkFontMgr_FontConfigInterface.cpp.

183 {
184 SkAutoMutexExclusive ama(fMutex);
185
186 // Check if this request is already in the request cache.
187 using Request = SkFontRequestCache::Request;
188 std::unique_ptr<Request> request(Request::Create(requestedFamilyName, requestedStyle));
189 sk_sp<SkTypeface> face = fCache.findAndRef(request.get());
190 if (face) {
191 return sk_sp<SkTypeface>(face);
192 }
193
195 SkString outFamilyName;
196 SkFontStyle outStyle;
197 if (!fFCI->matchFamilyName(requestedFamilyName, requestedStyle,
198 &identity, &outFamilyName, &outStyle))
199 {
200 return nullptr;
201 }
202
203 // Check if a typeface with this FontIdentity is already in the FontIdentity cache.
205 if (!face) {
206 face.reset(SkTypeface_FCI::Create(fFCI, identity, std::move(outFamilyName), outStyle));
207 // Add this FontIdentity to the FontIdentity cache.
208 fTFCache.add(face);
209 }
210 // Add this request to the request cache.
211 fCache.add(face, request.release());
212
213 return face;
214 }
static sk_sp< Effect > Create()
Definition: RefCntTest.cpp:117
static bool find_by_FontIdentity(SkTypeface *cachedTypeface, void *ctx)
virtual bool matchFamilyName(const char familyName[], SkFontStyle requested, FontIdentity *outFontIdentifier, SkString *outFamilyName, SkFontStyle *outStyle)=0
void add(sk_sp< SkTypeface > face, Request *request)
sk_sp< SkTypeface > findAndRef(Request *request)
sk_sp< SkTypeface > findByProcAndRef(FindProc proc, void *ctx) const
void add(sk_sp< SkTypeface >)
static SkTypeface_FCI * Create(sk_sp< SkFontConfigInterface > fci, const SkFontConfigInterface::FontIdentity &fi, SkString familyName, const SkFontStyle &style)
void reset(T *ptr=nullptr)
Definition: SkRefCnt.h:310

◆ onMatchFamilyStyleCharacter()

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

Implements SkFontMgr.

Definition at line 216 of file SkFontMgr_FontConfigInterface.cpp.

218 {
219 SK_ABORT("Not implemented.");
220 }

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