Skip to content

Commit 6fdcdd9

Browse files
Forward font collection APIs to the SkParagraph font collection (flutter#21734)
1 parent bcc557f commit 6fdcdd9

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

third_party/txt/src/txt/font_collection.cc

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ FontCollection::FontCollection() : enable_font_fallback_(true) {}
8585

8686
FontCollection::~FontCollection() {
8787
minikin::Layout::purgeCaches();
88+
89+
#if FLUTTER_ENABLE_SKSHAPER
90+
if (skt_collection_) {
91+
skt_collection_->clearCaches();
92+
}
93+
#endif
8894
}
8995

9096
size_t FontCollection::GetFontManagersCount() const {
@@ -127,6 +133,12 @@ std::vector<sk_sp<SkFontMgr>> FontCollection::GetFontManagerOrder() const {
127133

128134
void FontCollection::DisableFontFallback() {
129135
enable_font_fallback_ = false;
136+
137+
#if FLUTTER_ENABLE_SKSHAPER
138+
if (skt_collection_) {
139+
skt_collection_->disableFontFallback();
140+
}
141+
#endif
130142
}
131143

132144
std::shared_ptr<minikin::FontCollection>
@@ -346,8 +358,13 @@ FontCollection::GetFallbackFontFamily(const sk_sp<SkFontMgr>& manager,
346358

347359
void FontCollection::ClearFontFamilyCache() {
348360
font_collections_cache_.clear();
349-
}
350361

362+
#if FLUTTER_ENABLE_SKSHAPER
363+
if (skt_collection_) {
364+
skt_collection_->clearCaches();
365+
}
366+
#endif
367+
}
351368
#if FLUTTER_ENABLE_SKSHAPER
352369

353370
sk_sp<skia::textlayout::FontCollection>

0 commit comments

Comments
 (0)