From 075c5b0f612b8dfeaf99cdaf3da4dbf112dfbd3b Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Tue, 24 Sep 2019 20:10:40 -0400 Subject: [PATCH] Track fallback font names as a vector instead of a set. (#12426) --- third_party/txt/src/txt/font_collection.cc | 5 ++++- third_party/txt/src/txt/font_collection.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/third_party/txt/src/txt/font_collection.cc b/third_party/txt/src/txt/font_collection.cc index 25c2fc79fbb..90fd5db378c 100644 --- a/third_party/txt/src/txt/font_collection.cc +++ b/third_party/txt/src/txt/font_collection.cc @@ -273,7 +273,10 @@ const std::shared_ptr& FontCollection::DoMatchFallbackFont( typeface->getFamilyName(&sk_family_name); std::string family_name(sk_family_name.c_str()); - fallback_fonts_for_locale_[locale].insert(family_name); + if (std::find(fallback_fonts_for_locale_[locale].begin(), + fallback_fonts_for_locale_[locale].end(), + family_name) == fallback_fonts_for_locale_[locale].end()) + fallback_fonts_for_locale_[locale].push_back(family_name); return GetFallbackFontFamily(manager, family_name); } diff --git a/third_party/txt/src/txt/font_collection.h b/third_party/txt/src/txt/font_collection.h index 8c122790a38..c1b3d9f0938 100644 --- a/third_party/txt/src/txt/font_collection.h +++ b/third_party/txt/src/txt/font_collection.h @@ -103,7 +103,7 @@ class FontCollection : public std::enable_shared_from_this { fallback_match_cache_; std::unordered_map> fallback_fonts_; - std::unordered_map> + std::unordered_map> fallback_fonts_for_locale_; bool enable_font_fallback_;