Index: ui/gfx/render_text_harfbuzz.cc |
diff --git a/ui/gfx/render_text_harfbuzz.cc b/ui/gfx/render_text_harfbuzz.cc |
index b193451682fd1277cc947694c0b723aef9b8a13a..a2312875db8e514f493d5261e76ed6d9045bbdfa 100644 |
--- a/ui/gfx/render_text_harfbuzz.cc |
+++ b/ui/gfx/render_text_harfbuzz.cc |
@@ -1194,6 +1194,19 @@ void RenderTextHarfBuzz::ShapeRun(internal::TextRunHarfBuzz* run) { |
} |
#endif |
+ // Get rid of duplicate fonts in the fallback list. We use the std::unique |
+ // algorithm for this. However for this function to work we need to sort |
+ // the font list as the unique algorithm relies on duplicates being adjacent. |
+ // TODO(ananta) |
+ // Sorting the list changes the order in which fonts are evaluated. This may |
+ // cause problems in the way some characters appear. It may be best to do |
+ // font fallback on the same lines as blink or skia which do this based on |
+ // character glyph mapping. |
+ std::sort(fallback_families.begin(), fallback_families.end()); |
+ fallback_families.erase(std::unique( |
+ fallback_families.begin(), fallback_families.end()), |
+ fallback_families.end()); |
+ |
// Try shaping with the fallback fonts. |
for (const auto& family : fallback_families) { |
if (family == primary_family) |