From b43e4270a323b2e41a20d959968a864cbeee3767 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. (flutter/engine#12426) --- .../src/flutter/third_party/txt/src/txt/font_collection.cc | 5 ++++- engine/src/flutter/third_party/txt/src/txt/font_collection.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) 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 25c2fc79fb..90fd5db378 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 @@ -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/engine/src/flutter/third_party/txt/src/txt/font_collection.h b/engine/src/flutter/third_party/txt/src/txt/font_collection.h index 8c122790a3..c1b3d9f093 100644 --- a/engine/src/flutter/third_party/txt/src/txt/font_collection.h +++ b/engine/src/flutter/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_;