10#include "third_party/skia/include/core/SkFontMgr.h"
11#include "third_party/skia/include/ports/SkFontMgr_empty.h"
12#include "third_party/skia/modules/skparagraph/include/FontCollection.h"
13#include "third_party/skia/modules/skparagraph/include/TypefaceFontProvider.h"
17 auto collection = sk_make_sp<skia::textlayout::FontCollection>();
18 auto provider = sk_make_sp<skia::textlayout::TypefaceFontProvider>();
19 collection->enableFontFallback();
20 collection->setDefaultFontManager(provider,
"Roboto");
22 std::move(collection),
34 static sk_sp<SkFontMgr> mgr = SkFontMgr_New_Custom_Empty();
40 auto typeface =
default_fontmgr()->makeFromData(sk_ref_sp<SkData>(font_data));
41 return typeface.release();
52 SkString* font_name) {
54 SkString alias = *font_name;
55 collection->
provider->registerTypeface(sk_ref_sp<SkTypeface>(typeface),
58 collection->
provider->registerTypeface(sk_ref_sp<SkTypeface>(typeface));
static sk_sp< SkFontMgr > default_fontmgr()
SKWASM_EXPORT void fontCollection_clearCaches(Skwasm::FlutterFontCollection *collection)
SKWASM_EXPORT void fontCollection_dispose(Skwasm::FlutterFontCollection *collection)
SKWASM_EXPORT void typeface_dispose(SkTypeface *typeface)
SKWASM_EXPORT void fontCollection_registerTypeface(Skwasm::FlutterFontCollection *collection, SkTypeface *typeface, SkString *font_name)
SKWASM_EXPORT Skwasm::FlutterFontCollection * fontCollection_create()
SKWASM_EXPORT SkTypeface * typeface_create(SkData *font_data)
uint32_t live_typeface_count
uint32_t live_font_collection_count
sk_sp< skia::textlayout::TypefaceFontProvider > provider
sk_sp< skia::textlayout::FontCollection > collection