Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(429)

Unified Diff: ui/gfx/render_text_harfbuzz.cc

Issue 1021353003: Merging to M42 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2311
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text_harfbuzz.cc
diff --git a/ui/gfx/render_text_harfbuzz.cc b/ui/gfx/render_text_harfbuzz.cc
index 1083def6baebc12a423681ad420a41ee82198ccd..aaff7ed1f04511e3ca6c0397a60585fc029a51e7 100644
--- a/ui/gfx/render_text_harfbuzz.cc
+++ b/ui/gfx/render_text_harfbuzz.cc
@@ -1267,6 +1267,19 @@ void RenderTextHarfBuzz::ShapeRun(const base::string16& text,
default_fallback_families.begin(), default_fallback_families.end());
#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)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698