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

Unified Diff: ui/gfx/render_text_harfbuzz.cc

Issue 1020853018: DNCI [RenderText] Added font size options in RenderText. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added font sizes to mac font style iterator 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
Index: ui/gfx/render_text_harfbuzz.cc
diff --git a/ui/gfx/render_text_harfbuzz.cc b/ui/gfx/render_text_harfbuzz.cc
index 63b0e4e0cd79d009e83cb9989e680f987def1e06..8b503d1bfa7f8d8deca37486430f332965d23571 100644
--- a/ui/gfx/render_text_harfbuzz.cc
+++ b/ui/gfx/render_text_harfbuzz.cc
@@ -1153,13 +1153,15 @@ void RenderTextHarfBuzz::ItemizeTextToRuns(
// Use an empty color BreakList to avoid breaking runs at color boundaries.
BreakList<SkColor> empty_colors;
empty_colors.SetMax(text.length());
- internal::StyleIterator style(empty_colors, baselines(), styles());
+ internal::StyleIterator style(font_sizes(), empty_colors, baselines(),
+ styles());
for (size_t run_break = 0; run_break < text.length();) {
internal::TextRunHarfBuzz* run = new internal::TextRunHarfBuzz;
run->range.set_start(run_break);
run->font_style = (style.style(BOLD) ? Font::BOLD : 0) |
(style.style(ITALIC) ? Font::ITALIC : 0);
+ run->font_size = style.font_size();
run->baseline_type = style.baseline();
run->strike = style.style(STRIKE);
run->diagonal_strike = style.style(DIAGONAL_STRIKE);
@@ -1228,7 +1230,8 @@ void RenderTextHarfBuzz::ShapeRun(const base::string16& text,
internal::TextRunHarfBuzz* run) {
const Font& primary_font = font_list().GetPrimaryFont();
const std::string primary_family = primary_font.GetFontName();
- run->font_size = primary_font.GetFontSize();
+ if (run->font_size == 0)
+ run->font_size = primary_font.GetFontSize();
run->baseline_offset = 0;
if (run->baseline_type != NORMAL_BASELINE) {
// Calculate a slightly smaller font. The ratio here is somewhat arbitrary.
« ui/gfx/render_text.h ('K') | « ui/gfx/render_text.cc ('k') | ui/gfx/render_text_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698