summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorananta <ananta@chromium.org>2015-03-19 19:15:48 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-20 02:16:57 +0000
commit83de07b1894c61e53469c830c9f7c8986d9ae42c (patch)
tree6b395c38045842754bb9bcb14613c45e7b1d54d6 /ui
parentabaade8c1f7de4c2f6b26770cbb07e59cef54012 (diff)
downloadchromium_src-83de07b1894c61e53469c830c9f7c8986d9ae42c.zip
chromium_src-83de07b1894c61e53469c830c9f7c8986d9ae42c.tar.gz
chromium_src-83de07b1894c61e53469c830c9f7c8986d9ae42c.tar.bz2
Remove duplicate fonts from the font fallback list.
We use std::unique to remove duplicate entries from the fallback list. BUG=467459 Review URL: https://codereview.chromium.org/1019743004 Cr-Commit-Position: refs/heads/master@{#321497}
Diffstat (limited to 'ui')
-rw-r--r--ui/gfx/render_text_harfbuzz.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/ui/gfx/render_text_harfbuzz.cc b/ui/gfx/render_text_harfbuzz.cc
index 9a9d76c9..3c71cff 100644
--- a/ui/gfx/render_text_harfbuzz.cc
+++ b/ui/gfx/render_text_harfbuzz.cc
@@ -1302,6 +1302,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)