Flutter Engine
The Flutter Engine
SkFontMgr_fuchsia.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2018 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
9
10#include <fuchsia/fonts/cpp/fidl.h>
11#include <lib/zx/vmar.h>
12#include <strings.h>
13#include <memory>
14#include <unordered_map>
15
18
24
25using namespace skia_private;
26
27// SkFuchsiaFontDataCache keep track of SkData created from `fuchsia::mem::Buffer` where each buffer
28// is identified with a unique identifier. It allows to share the same SkData instances between all
29// SkTypeface instances created from the same buffer.
31public:
33 ~SkFuchsiaFontDataCache() { SkASSERT(fBuffers.empty()); }
34
35 sk_sp<SkData> GetOrCreateSkData(int bufferId, const fuchsia::mem::Buffer& buffer);
36
37private:
38 struct ReleaseSkDataContext {
40 int fBufferId;
41 };
42
43 static void ReleaseSkData(const void* buffer, void* context);
44 void OnBufferDeleted(int bufferId);
45
46 SkMutex fMutex;
47 std::unordered_map<int, SkData*> fBuffers SK_GUARDED_BY(fMutex);
48};
49
51 const fuchsia::mem::Buffer& buffer) {
52 SkAutoMutexExclusive mutexLock(fMutex);
53
54 auto iter = fBuffers.find(bufferId);
55 if (iter != fBuffers.end()) {
56 return sk_ref_sp(iter->second);
57 }
58 auto font_mgr = sk_ref_sp(this);
59
60 uint64_t size = buffer.size;
61 uintptr_t mapped_addr = 0;
62 zx_status_t status =
63 zx::vmar::root_self()->map(ZX_VM_PERM_READ, 0, buffer.vmo, 0, size, &mapped_addr);
64 if (status != ZX_OK) return nullptr;
65
66 auto context = new ReleaseSkDataContext{sk_ref_sp(this), bufferId};
68 reinterpret_cast<void*>(mapped_addr), size, ReleaseSkData, context);
70
71 fBuffers[bufferId] = data.get();
72 return data;
73}
74
75void SkFuchsiaFontDataCache::OnBufferDeleted(int bufferId) {
76 zx_vaddr_t unmap_addr;
77 size_t unmap_size;
78 {
79 SkAutoMutexExclusive mutexLock(fMutex);
80 auto it = fBuffers.find(bufferId);
81 SkASSERT(it != fBuffers.end());
82 unmap_addr = reinterpret_cast<zx_vaddr_t>(it->second->data());
83 unmap_size = it->second->size();
84 fBuffers.erase(it);
85 }
86
87 zx::vmar::root_self()->unmap(unmap_addr, unmap_size);
88}
89
90// static
91void SkFuchsiaFontDataCache::ReleaseSkData(const void* buffer, void* context) {
92 auto releaseSkDataContext = reinterpret_cast<ReleaseSkDataContext*>(context);
93 releaseSkDataContext->fCache->OnBufferDeleted(releaseSkDataContext->fBufferId);
94 delete releaseSkDataContext;
95}
96
97fuchsia::fonts::Slant SkToFuchsiaSlant(SkFontStyle::Slant slant) {
98 switch (slant) {
100 return fuchsia::fonts::Slant::OBLIQUE;
102 return fuchsia::fonts::Slant::ITALIC;
104 default:
105 return fuchsia::fonts::Slant::UPRIGHT;
106 }
107}
108
109SkFontStyle::Slant FuchsiaToSkSlant(fuchsia::fonts::Slant slant) {
110 switch (slant) {
111 case fuchsia::fonts::Slant::OBLIQUE:
113 case fuchsia::fonts::Slant::ITALIC:
115 case fuchsia::fonts::Slant::UPRIGHT:
116 default:
118 }
119}
120
122 switch (width) {
123 case SkFontStyle::Width::kUltraCondensed_Width:
124 return fuchsia::fonts::Width::ULTRA_CONDENSED;
125 case SkFontStyle::Width::kExtraCondensed_Width:
126 return fuchsia::fonts::Width::EXTRA_CONDENSED;
127 case SkFontStyle::Width::kCondensed_Width:
128 return fuchsia::fonts::Width::CONDENSED;
129 case SkFontStyle::Width::kSemiCondensed_Width:
130 return fuchsia::fonts::Width::SEMI_CONDENSED;
131 case SkFontStyle::Width::kNormal_Width:
132 return fuchsia::fonts::Width::NORMAL;
133 case SkFontStyle::Width::kSemiExpanded_Width:
134 return fuchsia::fonts::Width::SEMI_EXPANDED;
135 case SkFontStyle::Width::kExpanded_Width:
136 return fuchsia::fonts::Width::EXPANDED;
137 case SkFontStyle::Width::kExtraExpanded_Width:
138 return fuchsia::fonts::Width::EXTRA_EXPANDED;
139 case SkFontStyle::Width::kUltraExpanded_Width:
140 return fuchsia::fonts::Width::ULTRA_EXPANDED;
141 }
142}
143
144// Tries to convert the given integer Skia style width value to the Fuchsia equivalent.
145//
146// On success, returns true. On failure, returns false, and `outFuchsiaWidth` is left untouched.
147bool SkToFuchsiaWidth(int skWidth, fuchsia::fonts::Width* outFuchsiaWidth) {
148 if (skWidth < SkFontStyle::Width::kUltraCondensed_Width ||
149 skWidth > SkFontStyle::Width::kUltraExpanded_Width) {
150 return false;
151 }
152 auto typedSkWidth = static_cast<SkFontStyle::Width>(skWidth);
153 *outFuchsiaWidth = SkToFuchsiaWidth(typedSkWidth);
154 return true;
155}
156
158 switch (width) {
159 case fuchsia::fonts::Width::ULTRA_CONDENSED:
160 return SkFontStyle::Width::kUltraCondensed_Width;
161 case fuchsia::fonts::Width::EXTRA_CONDENSED:
162 return SkFontStyle::Width::kExtraCondensed_Width;
163 case fuchsia::fonts::Width::CONDENSED:
164 return SkFontStyle::Width::kCondensed_Width;
165 case fuchsia::fonts::Width::SEMI_CONDENSED:
166 return SkFontStyle::Width::kSemiCondensed_Width;
167 case fuchsia::fonts::Width::NORMAL:
168 return SkFontStyle::Width::kNormal_Width;
169 case fuchsia::fonts::Width::SEMI_EXPANDED:
170 return SkFontStyle::Width::kSemiExpanded_Width;
171 case fuchsia::fonts::Width::EXPANDED:
172 return SkFontStyle::Width::kExpanded_Width;
173 case fuchsia::fonts::Width::EXTRA_EXPANDED:
174 return SkFontStyle::Width::kExtraExpanded_Width;
175 case fuchsia::fonts::Width::ULTRA_EXPANDED:
176 return SkFontStyle::Width::kUltraExpanded_Width;
177 }
178}
179
180fuchsia::fonts::Style2 SkToFuchsiaStyle(const SkFontStyle& style) {
181 fuchsia::fonts::Style2 fuchsiaStyle;
182 fuchsiaStyle.set_slant(SkToFuchsiaSlant(style.slant())).set_weight(style.weight());
183
184 fuchsia::fonts::Width fuchsiaWidth = fuchsia::fonts::Width::NORMAL;
185 if (SkToFuchsiaWidth(style.width(), &fuchsiaWidth)) {
186 fuchsiaStyle.set_width(fuchsiaWidth);
187 }
188
189 return fuchsiaStyle;
190}
191
192constexpr struct {
193 const char* fName;
194 fuchsia::fonts::GenericFontFamily fGenericFontFamily;
195} kGenericFontFamiliesByName[] = {{"serif", fuchsia::fonts::GenericFontFamily::SERIF},
196 {"sans", fuchsia::fonts::GenericFontFamily::SANS_SERIF},
197 {"sans-serif", fuchsia::fonts::GenericFontFamily::SANS_SERIF},
198 {"mono", fuchsia::fonts::GenericFontFamily::MONOSPACE},
199 {"monospace", fuchsia::fonts::GenericFontFamily::MONOSPACE},
200 {"cursive", fuchsia::fonts::GenericFontFamily::CURSIVE},
201 {"fantasy", fuchsia::fonts::GenericFontFamily::FANTASY},
202 {"system-ui", fuchsia::fonts::GenericFontFamily::SYSTEM_UI},
203 {"emoji", fuchsia::fonts::GenericFontFamily::EMOJI},
204 {"math", fuchsia::fonts::GenericFontFamily::MATH},
205 {"fangsong", fuchsia::fonts::GenericFontFamily::FANGSONG}};
206
207// Tries to find a generic font family with the given name. If none is found, returns false.
209 fuchsia::fonts::GenericFontFamily* outGenericFamily) {
210 if (!name) return false;
211 for (auto& genericFamily : kGenericFontFamiliesByName) {
212 if (strcasecmp(genericFamily.fName, name) == 0) {
213 *outGenericFamily = genericFamily.fGenericFontFamily;
214 return true;
215 }
216 }
217 return false;
218}
219
221 uint32_t bufferId;
222 uint32_t ttcIndex;
223
224 bool operator==(TypefaceId& other) const {
225 return std::tie(bufferId, ttcIndex) == std::tie(other.bufferId, other.ttcIndex);
226 }
227}
228
229constexpr kNullTypefaceId = {0xFFFFFFFF, 0xFFFFFFFF};
230
232public:
233 SkTypeface_Fuchsia(std::unique_ptr<SkFontData> fontData, const SkFontStyle& style,
234 bool isFixedPitch, const SkString familyName, TypefaceId id)
235 : SkTypeface_FreeTypeStream(std::move(fontData), familyName, style, isFixedPitch)
236 , fId(id) {}
237
238 TypefaceId id() { return fId; }
239
240private:
241 TypefaceId fId;
242};
243
245 const SkFontArguments& args, TypefaceId id) {
246 SkFontScanner_FreeType fontScanner;
247 int numInstances;
248 if (!fontScanner.scanFace(stream.get(), args.getCollectionIndex(), &numInstances)) {
249 return nullptr;
250 }
251 bool isFixedPitch;
252 SkFontStyle style;
254 SkFontScanner::AxisDefinitions axisDefinitions;
255 if (!fontScanner.scanInstance(stream.get(),
256 args.getCollectionIndex(),
257 0,
258 &name,
259 &style,
260 &isFixedPitch,
261 &axisDefinitions)) {
262 return nullptr;
263 }
264
265 const SkFontArguments::VariationPosition position = args.getVariationDesignPosition();
266 AutoSTMalloc<4, SkFixed> axisValues(axisDefinitions.size());
267 SkFontScanner_FreeType::computeAxisValues(axisDefinitions, position, axisValues, name, &style);
268
269 auto fontData = std::make_unique<SkFontData>(
270 std::move(stream), args.getCollectionIndex(), args.getPalette().index,
271 axisValues.get(), axisDefinitions.size(),
272 args.getPalette().overrides, args.getPalette().overrideCount);
273 return sk_make_sp<SkTypeface_Fuchsia>(std::move(fontData), style, isFixedPitch, name, id);
274}
275
277 return CreateTypefaceFromSkStream(std::make_unique<SkMemoryStream>(std::move(data)),
278 SkFontArguments().setCollectionIndex(id.ttcIndex), id);
279}
280
281class SkFontMgr_Fuchsia final : public SkFontMgr {
282public:
283 SkFontMgr_Fuchsia(fuchsia::fonts::ProviderSyncPtr provider);
285
286protected:
287 // SkFontMgr overrides.
288 int onCountFamilies() const override;
289 void onGetFamilyName(int index, SkString* familyName) const override;
290 sk_sp<SkFontStyleSet> onMatchFamily(const char familyName[]) const override;
291 sk_sp<SkFontStyleSet> onCreateStyleSet(int index) const override;
292 sk_sp<SkTypeface> onMatchFamilyStyle(const char familyName[], const SkFontStyle&) const override;
293 sk_sp<SkTypeface> onMatchFamilyStyleCharacter(const char familyName[], const SkFontStyle&,
294 const char* bcp47[], int bcp47Count,
295 SkUnichar character) const override;
296 sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData>, int ttcIndex) const override;
297 sk_sp<SkTypeface> onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset>,
298 int ttcIndex) const override;
299 sk_sp<SkTypeface> onMakeFromStreamArgs(std::unique_ptr<SkStreamAsset>,
300 const SkFontArguments&) const override;
301 sk_sp<SkTypeface> onMakeFromFile(const char path[], int ttcIndex) const override;
302 sk_sp<SkTypeface> onLegacyMakeTypeface(const char familyName[], SkFontStyle) const override;
303
304private:
306
307 sk_sp<SkTypeface> FetchTypeface(const char familyName[], const SkFontStyle& style,
308 const char* bcp47[], int bcp47Count, SkUnichar character,
309 bool allow_fallback, bool exact_style_match) const;
310
311 sk_sp<SkTypeface> GetOrCreateTypeface(TypefaceId id, const fuchsia::mem::Buffer& buffer) const;
312
313 mutable fuchsia::fonts::ProviderSyncPtr fFontProvider;
314
316
317 mutable SkMutex fCacheMutex;
318 mutable SkTypefaceCache fTypefaceCache SK_GUARDED_BY(fCacheMutex);
319};
320
322public:
323 SkFontStyleSet_Fuchsia(sk_sp<SkFontMgr_Fuchsia> font_manager, std::string familyName,
324 std::vector<SkFontStyle> styles)
325 : fFontManager(font_manager), fFamilyName(familyName), fStyles(styles) {}
326
327 ~SkFontStyleSet_Fuchsia() override = default;
328
329 int count() override { return fStyles.size(); }
330
331 void getStyle(int index, SkFontStyle* style, SkString* styleName) override {
332 SkASSERT(index >= 0 && index < static_cast<int>(fStyles.size()));
333 if (style) *style = fStyles[index];
334
335 // We don't have style names. Return an empty name.
336 if (styleName) styleName->reset();
337 }
338
339 sk_sp<SkTypeface> createTypeface(int index) override {
340 SkASSERT(index >= 0 && index < static_cast<int>(fStyles.size()));
341
342 if (fTypefaces.empty()) fTypefaces.resize(fStyles.size());
343
344 if (!fTypefaces[index]) {
345 fTypefaces[index] = fFontManager->FetchTypeface(
346 fFamilyName.c_str(), fStyles[index], /*bcp47=*/nullptr,
347 /*bcp47Count=*/0, /*character=*/0,
348 /*allow_fallback=*/false, /*exact_style_match=*/true);
349 }
350
351 return fTypefaces[index];
352 }
353
354 sk_sp<SkTypeface> matchStyle(const SkFontStyle& pattern) override {
355 return matchStyleCSS3(pattern);
356 }
357
358private:
359 sk_sp<SkFontMgr_Fuchsia> fFontManager;
360 std::string fFamilyName;
361 std::vector<SkFontStyle> fStyles;
362 std::vector<sk_sp<SkTypeface>> fTypefaces;
363};
364
365SkFontMgr_Fuchsia::SkFontMgr_Fuchsia(fuchsia::fonts::ProviderSyncPtr provider)
366 : fFontProvider(std::move(provider)), fBufferCache(sk_make_sp<SkFuchsiaFontDataCache>()) {}
367
369
371 // Family enumeration is not supported.
372 return 0;
373}
374
375void SkFontMgr_Fuchsia::onGetFamilyName(int index, SkString* familyName) const {
376 // Family enumeration is not supported.
377 familyName->reset();
378}
379
381 // Family enumeration is not supported.
382 return nullptr;
383}
384
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}
402
404 const SkFontStyle& style) const {
405 return FetchTypeface(familyName, style, /*bcp47=*/nullptr, /*bcp47Count=*/0, /*character=*/0,
406 /*allow_fallback=*/false, /*exact_style_match=*/false);
407}
408
410 const char familyName[], const SkFontStyle& style,
411 const char* bcp47[], int bcp47Count,
412 SkUnichar character) const
413{
414 return FetchTypeface(familyName, style, bcp47, bcp47Count, character,
415 /*allow_fallback=*/true, /*exact_style_match=*/false);
416}
417
419 return makeFromStream(std::make_unique<SkMemoryStream>(std::move(data)), ttcIndex);
420}
421
423 int ttcIndex) const {
424 return makeFromStream(std::move(asset), SkFontArguments().setCollectionIndex(ttcIndex));
425}
426
428 const SkFontArguments& args) const {
429 return CreateTypefaceFromSkStream(std::move(asset), args, kNullTypefaceId);
430}
431
433 return makeFromStream(std::make_unique<SkFILEStream>(path), ttcIndex);
434}
435
437 SkFontStyle style) const {
438 return sk_sp<SkTypeface>(matchFamilyStyle(familyName, style));
439}
440
441sk_sp<SkTypeface> SkFontMgr_Fuchsia::FetchTypeface(const char familyName[],
442 const SkFontStyle& style, const char* bcp47[],
443 int bcp47Count, SkUnichar character,
444 bool allow_fallback,
445 bool exact_style_match) const {
446 fuchsia::fonts::TypefaceQuery query;
447 query.set_style(SkToFuchsiaStyle(style));
448
449 if (bcp47Count > 0) {
450 std::vector<fuchsia::intl::LocaleId> languages{};
451 for (int i = 0; i < bcp47Count; i++) {
452 fuchsia::intl::LocaleId localeId;
453 localeId.id = bcp47[i];
454 languages.push_back(localeId);
455 }
456 query.set_languages(std::move(languages));
457 }
458
459 if (character) {
460 query.set_code_points({static_cast<uint32_t>(character)});
461 }
462
463 // If family name is not specified or is a generic family name (e.g. "serif"), then enable
464 // fallback; otherwise, pass the family name as is.
465 fuchsia::fonts::GenericFontFamily genericFontFamily =
466 fuchsia::fonts::GenericFontFamily::SANS_SERIF;
467 bool isGenericFontFamily = GetGenericFontFamilyByName(familyName, &genericFontFamily);
468 if (!familyName || *familyName == '\0' || isGenericFontFamily) {
469 if (isGenericFontFamily) {
470 query.set_fallback_family(genericFontFamily);
471 }
472 allow_fallback = true;
473 } else {
474 fuchsia::fonts::FamilyName typedFamilyName{};
475 typedFamilyName.name = familyName;
476 query.set_family(typedFamilyName);
477 }
478
479 fuchsia::fonts::TypefaceRequestFlags flags{};
480 if (!allow_fallback) flags |= fuchsia::fonts::TypefaceRequestFlags::EXACT_FAMILY;
481 if (exact_style_match) flags |= fuchsia::fonts::TypefaceRequestFlags::EXACT_STYLE;
482
483 fuchsia::fonts::TypefaceRequest request;
484 request.set_query(std::move(query));
485 request.set_flags(flags);
486
487 fuchsia::fonts::TypefaceResponse response;
488 int result = fFontProvider->GetTypeface(std::move(request), &response);
489 if (result != ZX_OK) return nullptr;
490
491 // The service may return an empty response if there is no font matching the request.
492 if (response.IsEmpty()) return nullptr;
493
494 return GetOrCreateTypeface(TypefaceId{response.buffer_id(), response.font_index()},
495 response.buffer());
496}
497
498static bool FindByTypefaceId(SkTypeface* cachedTypeface, void* ctx) {
499 SkTypeface_Fuchsia* cachedFuchsiaTypeface = static_cast<SkTypeface_Fuchsia*>(cachedTypeface);
500 TypefaceId* id = static_cast<TypefaceId*>(ctx);
501
502 return cachedFuchsiaTypeface->id() == *id;
503}
504
505sk_sp<SkTypeface> SkFontMgr_Fuchsia::GetOrCreateTypeface(TypefaceId id,
506 const fuchsia::mem::Buffer& buffer) const {
507 SkAutoMutexExclusive mutexLock(fCacheMutex);
508
509 sk_sp<SkTypeface> cached = fTypefaceCache.findByProcAndRef(FindByTypefaceId, &id);
510 if (cached) return cached;
511
512 sk_sp<SkData> data = fBufferCache->GetOrCreateSkData(id.bufferId, buffer);
513 if (!data) return nullptr;
514
515 auto result = CreateTypefaceFromSkData(std::move(data), id);
516 fTypefaceCache.add(result);
517 return result;
518}
519
520sk_sp<SkFontMgr> SkFontMgr_New_Fuchsia(fuchsia::fonts::ProviderSyncPtr provider) {
521 return sk_make_sp<SkFontMgr_Fuchsia>(std::move(provider));
522}
#define SkASSERT(cond)
Definition: SkAssert.h:116
static bool FindByTypefaceId(SkTypeface *cachedTypeface, void *ctx)
constexpr struct @420 kGenericFontFamiliesByName[]
struct TypefaceId kNullTypefaceId
sk_sp< SkFontMgr > SkFontMgr_New_Fuchsia(fuchsia::fonts::ProviderSyncPtr provider)
SkFontStyle::Slant FuchsiaToSkSlant(fuchsia::fonts::Slant slant)
sk_sp< SkTypeface > CreateTypefaceFromSkStream(std::unique_ptr< SkStreamAsset > stream, const SkFontArguments &args, TypefaceId id)
fuchsia::fonts::GenericFontFamily fGenericFontFamily
bool GetGenericFontFamilyByName(const char *name, fuchsia::fonts::GenericFontFamily *outGenericFamily)
fuchsia::fonts::Slant SkToFuchsiaSlant(SkFontStyle::Slant slant)
sk_sp< SkTypeface > CreateTypefaceFromSkData(sk_sp< SkData > data, TypefaceId id)
fuchsia::fonts::Style2 SkToFuchsiaStyle(const SkFontStyle &style)
const char * fName
SkFontStyle::Width FuchsiaToSkWidth(fuchsia::fonts::Width width)
fuchsia::fonts::Width SkToFuchsiaWidth(SkFontStyle::Width width)
sk_sp< T > sk_make_sp(Args &&... args)
Definition: SkRefCnt.h:371
sk_sp< T > sk_ref_sp(T *obj)
Definition: SkRefCnt.h:381
#define SK_GUARDED_BY(x)
int32_t SkUnichar
Definition: SkTypes.h:175
static sk_sp< SkData > MakeWithProc(const void *ptr, size_t length, ReleaseProc proc, void *ctx)
Definition: SkData.cpp:128
~SkFontMgr_Fuchsia() override
friend class SkFontStyleSet_Fuchsia
sk_sp< SkFontStyleSet > onMatchFamily(const char familyName[]) const override
sk_sp< SkTypeface > onMakeFromStreamArgs(std::unique_ptr< SkStreamAsset >, const SkFontArguments &) const override
void onGetFamilyName(int index, SkString *familyName) const override
SkFontMgr_Fuchsia(fuchsia::fonts::ProviderSyncPtr provider)
sk_sp< SkTypeface > onMatchFamilyStyle(const char familyName[], const SkFontStyle &) const override
int onCountFamilies() const override
sk_sp< SkFontStyleSet > onCreateStyleSet(int index) const override
sk_sp< SkTypeface > onMakeFromStreamIndex(std::unique_ptr< SkStreamAsset >, int ttcIndex) const override
sk_sp< SkTypeface > onMakeFromData(sk_sp< SkData >, int ttcIndex) const override
sk_sp< SkTypeface > onMatchFamilyStyleCharacter(const char familyName[], const SkFontStyle &, const char *bcp47[], int bcp47Count, SkUnichar character) const override
sk_sp< SkTypeface > onLegacyMakeTypeface(const char familyName[], SkFontStyle) const override
sk_sp< SkTypeface > onMakeFromFile(const char path[], int ttcIndex) const override
sk_sp< SkTypeface > makeFromStream(std::unique_ptr< SkStreamAsset >, int ttcIndex=0) const
Definition: SkFontMgr.cpp:127
sk_sp< SkTypeface > matchFamilyStyle(const char familyName[], const SkFontStyle &) const
Definition: SkFontMgr.cpp:109
bool scanFace(SkStreamAsset *stream, int faceIndex, int *numInstances) const override
static void computeAxisValues(AxisDefinitions axisDefinitions, const SkFontArguments::VariationPosition position, SkFixed *axisValues, const SkString &name, SkFontStyle *style, const SkFontArguments::VariationPosition::Coordinate *currentPosition=nullptr)
bool scanInstance(SkStreamAsset *stream, int faceIndex, int instanceIndex, SkString *name, SkFontStyle *style, bool *isFixedPitch, AxisDefinitions *axes) const override
void getStyle(int index, SkFontStyle *style, SkString *styleName) override
SkFontStyleSet_Fuchsia(sk_sp< SkFontMgr_Fuchsia > font_manager, std::string familyName, std::vector< SkFontStyle > styles)
sk_sp< SkTypeface > matchStyle(const SkFontStyle &pattern) override
~SkFontStyleSet_Fuchsia() override=default
sk_sp< SkTypeface > createTypeface(int index) override
sk_sp< SkTypeface > matchStyleCSS3(const SkFontStyle &pattern)
Definition: SkFontMgr.cpp:184
Slant slant() const
Definition: SkFontStyle.h:64
int width() const
Definition: SkFontStyle.h:63
int weight() const
Definition: SkFontStyle.h:62
sk_sp< SkData > GetOrCreateSkData(int bufferId, const fuchsia::mem::Buffer &buffer)
SkFuchsiaFontDataCache()=default
void reset()
Definition: SkString.cpp:358
SkTypeface_Fuchsia(std::unique_ptr< SkFontData > fontData, const SkFontStyle &style, bool isFixedPitch, const SkString familyName, TypefaceId id)
bool isFixedPitch() const
Definition: SkTypeface.h:68
int size() const
Definition: SkTArray.h:421
FlutterSemanticsFlag flags
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
GAsyncResult * result
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
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
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 to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
Definition: ref_ptr.h:256
int32_t width
bool operator==(TypefaceId &other) const
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63
const uintptr_t id