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

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

Issue 678683003: Make RenderTextHarfBuzz examine full font list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 | ui/gfx/render_text_unittest.cc » ('j') | ui/gfx/render_text_unittest.cc » ('J')
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 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 } 1090 }
1091 1091
1092 void RenderTextHarfBuzz::ShapeRun(internal::TextRunHarfBuzz* run) { 1092 void RenderTextHarfBuzz::ShapeRun(internal::TextRunHarfBuzz* run) {
1093 const Font& primary_font = font_list().GetPrimaryFont(); 1093 const Font& primary_font = font_list().GetPrimaryFont();
1094 run->font_size = primary_font.GetFontSize(); 1094 run->font_size = primary_font.GetFontSize();
1095 1095
1096 std::string best_family; 1096 std::string best_family;
1097 FontRenderParams best_render_params; 1097 FontRenderParams best_render_params;
1098 size_t best_missing_glyphs = std::numeric_limits<size_t>::max(); 1098 size_t best_missing_glyphs = std::numeric_limits<size_t>::max();
1099 1099
1100 if (CompareFamily(run, primary_font.GetFontName(), 1100 for (const Font& font : font_list().GetFonts()) {
1101 primary_font.GetFontRenderParams(), 1101 if (CompareFamily(run, font.GetFontName(), font.GetFontRenderParams(),
1102 &best_family, &best_render_params, &best_missing_glyphs)) 1102 &best_family, &best_render_params, &best_missing_glyphs))
1103 return; 1103 return;
1104 }
1104 1105
1105 #if defined(OS_WIN) 1106 #if defined(OS_WIN)
1106 Font uniscribe_font; 1107 Font uniscribe_font;
1107 const base::char16* run_text = &(GetLayoutText()[run->range.start()]); 1108 const base::char16* run_text = &(GetLayoutText()[run->range.start()]);
1108 if (GetUniscribeFallbackFont(primary_font, run_text, run->range.length(), 1109 if (GetUniscribeFallbackFont(primary_font, run_text, run->range.length(),
1109 &uniscribe_font) && 1110 &uniscribe_font) &&
1110 CompareFamily(run, uniscribe_font.GetFontName(), 1111 CompareFamily(run, uniscribe_font.GetFontName(),
1111 uniscribe_font.GetFontRenderParams(), 1112 uniscribe_font.GetFontRenderParams(),
1112 &best_family, &best_render_params, &best_missing_glyphs)) 1113 &best_family, &best_render_params, &best_missing_glyphs))
1113 return; 1114 return;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 run->width = std::floor(run->width + 0.5f); 1191 run->width = std::floor(run->width + 0.5f);
1191 #endif 1192 #endif
1192 } 1193 }
1193 1194
1194 hb_buffer_destroy(buffer); 1195 hb_buffer_destroy(buffer);
1195 hb_font_destroy(harfbuzz_font); 1196 hb_font_destroy(harfbuzz_font);
1196 return true; 1197 return true;
1197 } 1198 }
1198 1199
1199 } // namespace gfx 1200 } // namespace gfx
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/render_text_unittest.cc » ('j') | ui/gfx/render_text_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698