From edd1e923fce5f4ff8b9f60ad5a3d881b7885fb29 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Thu, 29 Oct 2020 09:31:04 -0700 Subject: [PATCH] Invalidate the cached SkParagraph font collection when a new font manager is installed (flutter/engine#22157) --- .../third_party/txt/src/txt/font_collection.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/engine/src/flutter/third_party/txt/src/txt/font_collection.cc b/engine/src/flutter/third_party/txt/src/txt/font_collection.cc index 6820f14264..01edddb440 100644 --- a/engine/src/flutter/third_party/txt/src/txt/font_collection.cc +++ b/engine/src/flutter/third_party/txt/src/txt/font_collection.cc @@ -103,18 +103,34 @@ void FontCollection::SetupDefaultFontManager() { void FontCollection::SetDefaultFontManager(sk_sp font_manager) { default_font_manager_ = font_manager; + +#if FLUTTER_ENABLE_SKSHAPER + skt_collection_.reset(); +#endif } void FontCollection::SetAssetFontManager(sk_sp font_manager) { asset_font_manager_ = font_manager; + +#if FLUTTER_ENABLE_SKSHAPER + skt_collection_.reset(); +#endif } void FontCollection::SetDynamicFontManager(sk_sp font_manager) { dynamic_font_manager_ = font_manager; + +#if FLUTTER_ENABLE_SKSHAPER + skt_collection_.reset(); +#endif } void FontCollection::SetTestFontManager(sk_sp font_manager) { test_font_manager_ = font_manager; + +#if FLUTTER_ENABLE_SKSHAPER + skt_collection_.reset(); +#endif } // Return the available font managers in the order they should be queried. @@ -365,6 +381,7 @@ void FontCollection::ClearFontFamilyCache() { } #endif } + #if FLUTTER_ENABLE_SKSHAPER sk_sp