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

Commit b7358b3

Browse files
libtxt: cache font families that are remapped to the default font family (#4990)
1 parent a530035 commit b7358b3

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎third_party/txt/src/txt/font_collection.cc‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@ FontCollection::GetMinikinFontCollectionForFamily(const std::string& family) {
156156

157157
const auto default_font_family = GetDefaultFontFamily();
158158
if (family != default_font_family) {
159-
return GetMinikinFontCollectionForFamily(default_font_family);
159+
std::shared_ptr<minikin::FontCollection> default_collection =
160+
GetMinikinFontCollectionForFamily(default_font_family);
161+
font_collections_cache_[family] = default_collection;
162+
return default_collection;
160163
}
161164

162165
// No match found in any of our font managers.

0 commit comments

Comments
 (0)