Clear the font collection's cache when a font is dynamically loaded (flutter/engine#7436)
Fixes https://github.com/flutter/flutter/issues/26293
This commit is contained in:
@@ -158,6 +158,7 @@ void FontCollection::LoadFontFromList(const uint8_t* font_data,
|
||||
} else {
|
||||
font_provider.RegisterTypeface(typeface, family_name);
|
||||
}
|
||||
collection_->ClearFontFamilyCache();
|
||||
}
|
||||
|
||||
} // namespace blink
|
||||
|
||||
@@ -286,4 +286,8 @@ FontCollection::GetFallbackFontFamily(const sk_sp<SkFontMgr>& manager,
|
||||
return insert_it.first->second;
|
||||
}
|
||||
|
||||
void FontCollection::ClearFontFamilyCache() {
|
||||
font_collections_cache_.clear();
|
||||
}
|
||||
|
||||
} // namespace txt
|
||||
|
||||
@@ -59,6 +59,9 @@ class FontCollection : public std::enable_shared_from_this<FontCollection> {
|
||||
// missing from the requested font family.
|
||||
void DisableFontFallback();
|
||||
|
||||
// Remove all entries in the font family cache.
|
||||
void ClearFontFamilyCache();
|
||||
|
||||
private:
|
||||
struct FamilyKey {
|
||||
FamilyKey(const std::vector<std::string>& families, const std::string& loc);
|
||||
|
||||
Reference in New Issue
Block a user