Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
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
23 changes: 12 additions & 11 deletions third_party/txt/src/txt/font_collection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -315,19 +315,20 @@ void FontCollection::ClearFontFamilyCache() {

sk_sp<skia::textlayout::FontCollection>
FontCollection::CreateSktFontCollection() {
sk_sp<skia::textlayout::FontCollection> skt_collection =
sk_make_sp<skia::textlayout::FontCollection>();

skt_collection->setDefaultFontManager(default_font_manager_,
GetDefaultFontFamily().c_str());
skt_collection->setAssetFontManager(asset_font_manager_);
skt_collection->setDynamicFontManager(dynamic_font_manager_);
skt_collection->setTestFontManager(test_font_manager_);
if (!enable_font_fallback_) {
skt_collection->disableFontFallback();
if (!skt_collection_) {
skt_collection_ = sk_make_sp<skia::textlayout::FontCollection>();

skt_collection_->setDefaultFontManager(default_font_manager_,
GetDefaultFontFamily().c_str());
skt_collection_->setAssetFontManager(asset_font_manager_);
skt_collection_->setDynamicFontManager(dynamic_font_manager_);
skt_collection_->setTestFontManager(test_font_manager_);
if (!enable_font_fallback_) {
skt_collection_->disableFontFallback();
}
}

return skt_collection;
return skt_collection_;
}

#endif // FLUTTER_ENABLE_SKSHAPER
Expand Down
5 changes: 5 additions & 0 deletions third_party/txt/src/txt/font_collection.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ class FontCollection : public std::enable_shared_from_this<FontCollection> {
fallback_fonts_for_locale_;
bool enable_font_fallback_;

#if FLUTTER_ENABLE_SKSHAPER
// An equivalent font collection usable by the Skia text shaper library.
sk_sp<skia::textlayout::FontCollection> skt_collection_;
#endif

// Performs the actual work of MatchFallbackFont. The result is cached in
// fallback_match_cache_.
const std::shared_ptr<minikin::FontFamily>& DoMatchFallbackFont(
Expand Down