Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
re-implement in skwasm
  • Loading branch information
kjlubick committed Nov 17, 2023
commit 0fd658c0126905759397e29f7b975b2f89864b8f
10 changes: 7 additions & 3 deletions lib/web_ui/skwasm/fonts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

#include "export.h"
#include "third_party/skia/include/core/SkFontMgr.h"
#include "third_party/skia/include/ports/SkFontMgr_empty.h"
#include "third_party/skia/modules/skparagraph/include/FontCollection.h"
#include "third_party/skia/modules/skparagraph/include/TypefaceFontProvider.h"
#include "third_party/txt/platform.h"
#include "wrappers.h"

#include <memory>
Expand All @@ -29,9 +29,13 @@ SKWASM_EXPORT void fontCollection_dispose(FlutterFontCollection* collection) {
delete collection;
}

static sk_sp<SkFontMgr> default_fontmgr() {
static sk_sp<SkFontMgr> mgr = SkFontMgr_New_Custom_Empty();
return mgr;
}

SKWASM_EXPORT SkTypeface* typeface_create(SkData* fontData) {
auto typeface =
txt::GetDefaultFontManager()->makeFromData(sk_ref_sp<SkData>(fontData));
auto typeface = default_fontmgr()->makeFromData(sk_ref_sp<SkData>(fontData));
return typeface.release();
}

Expand Down