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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/render_text_harfbuzz.h" 5 #include "ui/gfx/render_text_harfbuzz.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/i18n/bidi_line_iterator.h" 9 #include "base/i18n/bidi_line_iterator.h"
10 #include "base/i18n/break_iterator.h" 10 #include "base/i18n/break_iterator.h"
(...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 // ensure that the fallback list covers the basic cases. 1260 // ensure that the fallback list covers the basic cases.
1261 // http://crbug.com/467459. On some Windows configurations the default font 1261 // http://crbug.com/467459. On some Windows configurations the default font
1262 // could be a raster font like System, which would not give us a reasonable 1262 // could be a raster font like System, which would not give us a reasonable
1263 // fallback font list. 1263 // fallback font list.
1264 std::vector<std::string> default_fallback_families = 1264 std::vector<std::string> default_fallback_families =
1265 GetFallbackFontFamilies("Segoe UI"); 1265 GetFallbackFontFamilies("Segoe UI");
1266 fallback_families.insert(fallback_families.end(), 1266 fallback_families.insert(fallback_families.end(),
1267 default_fallback_families.begin(), default_fallback_families.end()); 1267 default_fallback_families.begin(), default_fallback_families.end());
1268 #endif 1268 #endif
1269 1269
1270 // Get rid of duplicate fonts in the fallback list. We use the std::unique
1271 // algorithm for this. However for this function to work we need to sort
1272 // the font list as the unique algorithm relies on duplicates being adjacent.
1273 // TODO(ananta)
1274 // Sorting the list changes the order in which fonts are evaluated. This may
1275 // cause problems in the way some characters appear. It may be best to do
1276 // font fallback on the same lines as blink or skia which do this based on
1277 // character glyph mapping.
1278 std::sort(fallback_families.begin(), fallback_families.end());
1279 fallback_families.erase(std::unique(
1280 fallback_families.begin(), fallback_families.end()),
1281 fallback_families.end());
1282
1270 // Try shaping with the fallback fonts. 1283 // Try shaping with the fallback fonts.
1271 for (const auto& family : fallback_families) { 1284 for (const auto& family : fallback_families) {
1272 if (family == primary_family) 1285 if (family == primary_family)
1273 continue; 1286 continue;
1274 #if defined(OS_WIN) 1287 #if defined(OS_WIN)
1275 if (family == uniscribe_family) 1288 if (family == uniscribe_family)
1276 continue; 1289 continue;
1277 #endif 1290 #endif
1278 FontRenderParamsQuery query(false); 1291 FontRenderParamsQuery query(false);
1279 query.families.push_back(family); 1292 query.families.push_back(family);
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1478 DCHECK(!update_layout_run_list_); 1491 DCHECK(!update_layout_run_list_);
1479 DCHECK(!update_display_run_list_); 1492 DCHECK(!update_display_run_list_);
1480 return text_elided() ? display_run_list_.get() : &layout_run_list_; 1493 return text_elided() ? display_run_list_.get() : &layout_run_list_;
1481 } 1494 }
1482 1495
1483 const internal::TextRunList* RenderTextHarfBuzz::GetRunList() const { 1496 const internal::TextRunList* RenderTextHarfBuzz::GetRunList() const {
1484 return const_cast<RenderTextHarfBuzz*>(this)->GetRunList(); 1497 return const_cast<RenderTextHarfBuzz*>(this)->GetRunList();
1485 } 1498 }
1486 1499
1487 } // namespace gfx 1500 } // namespace gfx
OLDNEW
« 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