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

Clear the font collection's cache when a font is dynamically loaded #7436

Merged
merged 1 commit into from
Jan 10, 2019
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
1 change: 1 addition & 0 deletions lib/ui/text/font_collection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ void FontCollection::LoadFontFromList(const uint8_t* font_data,
} else {
font_provider.RegisterTypeface(typeface, family_name);
}
collection_->ClearFontFamilyCache();
}

} // namespace blink
4 changes: 4 additions & 0 deletions third_party/txt/src/txt/font_collection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions third_party/txt/src/txt/font_collection.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down