18 auto collection = sk_make_sp<FontCollection>();
19 auto provider = sk_make_sp<TypefaceFontProvider>();
20 collection->enableFontFallback();
21 collection->setDefaultFontManager(provider,
"Roboto");
23 std::move(collection),
53 std::unique_ptr<SkGlyphID[]> glyphBuffer =
54 std::make_unique<SkGlyphID[]>(codePointCount);
55 SkGlyphID* glyphPointer = glyphBuffer.get();
56 int remainingCodePointCount = codePointCount;
57 for (
int typefaceIndex = 0; typefaceIndex < typefaceCount; typefaceIndex++) {
59 codePoints, remainingCodePointCount, glyphPointer);
61 for (
int inputIndex = 0; inputIndex < remainingCodePointCount;
63 if (glyphPointer[inputIndex] == 0) {
64 if (outputIndex != inputIndex) {
65 codePoints[outputIndex] = codePoints[inputIndex];
70 if (outputIndex == 0) {
73 remainingCodePointCount = outputIndex;
76 return remainingCodePointCount;
SK_API sk_sp< SkFontMgr > SkFontMgr_New_Custom_Empty()
sk_sp< SkTypeface > makeFromData(sk_sp< SkData >, int ttcIndex=0) const
void unicharsToGlyphs(const SkUnichar uni[], int count, SkGlyphID glyphs[]) const
size_t registerTypeface(sk_sp< SkTypeface > typeface)
static sk_sp< SkFontMgr > default_fontmgr()
SKWASM_EXPORT FlutterFontCollection * fontCollection_create()
SKWASM_EXPORT int typefaces_filterCoveredCodePoints(SkTypeface **typefaces, int typefaceCount, SkUnichar *codePoints, int codePointCount)
SKWASM_EXPORT void fontCollection_registerTypeface(FlutterFontCollection *collection, SkTypeface *typeface, SkString *fontName)
SKWASM_EXPORT void typeface_dispose(SkTypeface *typeface)
SKWASM_EXPORT void fontCollection_dispose(FlutterFontCollection *collection)
SKWASM_EXPORT void fontCollection_clearCaches(FlutterFontCollection *collection)
SKWASM_EXPORT SkTypeface * typeface_create(SkData *fontData)
sk_sp< skia::textlayout::TypefaceFontProvider > provider
sk_sp< skia::textlayout::FontCollection > collection