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

Side by Side Diff: ui/gfx/render_text_harfbuzz.cc

Issue 1038073002: Reverting "Merging to M41 (2272):", jumped the gun. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2272
Patch Set: Created 5 years, 8 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 #include <map> 8 #include <map>
9 9
10 #include "base/i18n/bidi_line_iterator.h" 10 #include "base/i18n/bidi_line_iterator.h"
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 #if defined(OS_WIN) 1187 #if defined(OS_WIN)
1188 // Append fonts in the fallback list of the Uniscribe font. 1188 // Append fonts in the fallback list of the Uniscribe font.
1189 if (!uniscribe_family.empty()) { 1189 if (!uniscribe_family.empty()) {
1190 std::vector<std::string> uniscribe_fallbacks = 1190 std::vector<std::string> uniscribe_fallbacks =
1191 GetFallbackFontFamilies(uniscribe_family); 1191 GetFallbackFontFamilies(uniscribe_family);
1192 fallback_families.insert(fallback_families.end(), 1192 fallback_families.insert(fallback_families.end(),
1193 uniscribe_fallbacks.begin(), uniscribe_fallbacks.end()); 1193 uniscribe_fallbacks.begin(), uniscribe_fallbacks.end());
1194 } 1194 }
1195 #endif 1195 #endif
1196 1196
1197 // Get rid of duplicate fonts in the fallback list. We use the std::unique
1198 // algorithm for this. However for this function to work we need to sort
1199 // the font list as the unique algorithm relies on duplicates being adjacent.
1200 // TODO(ananta)
1201 // Sorting the list changes the order in which fonts are evaluated. This may
1202 // cause problems in the way some characters appear. It may be best to do
1203 // font fallback on the same lines as blink or skia which do this based on
1204 // character glyph mapping.
1205 std::sort(fallback_families.begin(), fallback_families.end());
1206 fallback_families.erase(std::unique(
1207 fallback_families.begin(), fallback_families.end()),
1208 fallback_families.end());
1209
1210 // Try shaping with the fallback fonts. 1197 // Try shaping with the fallback fonts.
1211 for (const auto& family : fallback_families) { 1198 for (const auto& family : fallback_families) {
1212 if (family == primary_family) 1199 if (family == primary_family)
1213 continue; 1200 continue;
1214 #if defined(OS_WIN) 1201 #if defined(OS_WIN)
1215 if (family == uniscribe_family) 1202 if (family == uniscribe_family)
1216 continue; 1203 continue;
1217 #endif 1204 #endif
1218 FontRenderParamsQuery query(false); 1205 FontRenderParamsQuery query(false);
1219 query.families.push_back(family); 1206 query.families.push_back(family);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1342 if (!run->render_params.subpixel_positioning) 1329 if (!run->render_params.subpixel_positioning)
1343 run->width = std::floor(run->width + 0.5f); 1330 run->width = std::floor(run->width + 0.5f);
1344 } 1331 }
1345 1332
1346 hb_buffer_destroy(buffer); 1333 hb_buffer_destroy(buffer);
1347 hb_font_destroy(harfbuzz_font); 1334 hb_font_destroy(harfbuzz_font);
1348 return true; 1335 return true;
1349 } 1336 }
1350 1337
1351 } // namespace gfx 1338 } // 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