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

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: Removed some debug code 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 f34dce7e3fb4d8182d76b59b6244dc06c7a036c8..7f6de1fa5d0808bd26070929e303f81297bd27d0 100644
--- a/ui/gfx/render_text_harfbuzz.cc
+++ b/ui/gfx/render_text_harfbuzz.cc
@@ -1167,13 +1167,15 @@ void RenderTextHarfBuzz::ItemizeTextToRuns(
DCHECK_LE(text.size(), baselines().max());
for (const BreakList<bool>& style : styles())
DCHECK_LE(text.size(), style.max());
- 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);
@@ -1242,7 +1244,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.

Powered by Google App Engine
This is Rietveld 408576698