Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 11ed711

Browse files
Invalidate the cached SkParagraph font collection when a new font manager is installed (#22157)
1 parent d615a97 commit 11ed711

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

third_party/txt/src/txt/font_collection.cc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,34 @@ void FontCollection::SetupDefaultFontManager() {
103103

104104
void FontCollection::SetDefaultFontManager(sk_sp<SkFontMgr> font_manager) {
105105
default_font_manager_ = font_manager;
106+
107+
#if FLUTTER_ENABLE_SKSHAPER
108+
skt_collection_.reset();
109+
#endif
106110
}
107111

108112
void FontCollection::SetAssetFontManager(sk_sp<SkFontMgr> font_manager) {
109113
asset_font_manager_ = font_manager;
114+
115+
#if FLUTTER_ENABLE_SKSHAPER
116+
skt_collection_.reset();
117+
#endif
110118
}
111119

112120
void FontCollection::SetDynamicFontManager(sk_sp<SkFontMgr> font_manager) {
113121
dynamic_font_manager_ = font_manager;
122+
123+
#if FLUTTER_ENABLE_SKSHAPER
124+
skt_collection_.reset();
125+
#endif
114126
}
115127

116128
void FontCollection::SetTestFontManager(sk_sp<SkFontMgr> font_manager) {
117129
test_font_manager_ = font_manager;
130+
131+
#if FLUTTER_ENABLE_SKSHAPER
132+
skt_collection_.reset();
133+
#endif
118134
}
119135

120136
// Return the available font managers in the order they should be queried.
@@ -365,6 +381,7 @@ void FontCollection::ClearFontFamilyCache() {
365381
}
366382
#endif
367383
}
384+
368385
#if FLUTTER_ENABLE_SKSHAPER
369386

370387
sk_sp<skia::textlayout::FontCollection>

0 commit comments

Comments
 (0)