Track fallback font names as a vector instead of a set. (flutter/engine#12426)

This commit is contained in:
Gary Qian
2019-09-24 20:10:40 -04:00
committed by GitHub
parent 077c2434cb
commit b43e4270a3
2 changed files with 5 additions and 2 deletions

View File

@@ -273,7 +273,10 @@ const std::shared_ptr<minikin::FontFamily>& 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);
}

View File

@@ -103,7 +103,7 @@ class FontCollection : public std::enable_shared_from_this<FontCollection> {
fallback_match_cache_;
std::unordered_map<std::string, std::shared_ptr<minikin::FontFamily>>
fallback_fonts_;
std::unordered_map<std::string, std::set<std::string>>
std::unordered_map<std::string, std::vector<std::string>>
fallback_fonts_for_locale_;
bool enable_font_fallback_;