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

Unified Diff: ui/gfx/render_text_harfbuzz.cc

Issue 1819753003: Allow various font weights in gfx. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Alexei's issues Created 4 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 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 590537ebe63c281f96724e670dc537190cdada03..59e82f82b6614841282196ff035719e3e82d4514 100644
--- a/ui/gfx/render_text_harfbuzz.cc
+++ b/ui/gfx/render_text_harfbuzz.cc
@@ -576,11 +576,11 @@ TextRunHarfBuzz::TextRunHarfBuzz()
font_size(0),
baseline_offset(0),
baseline_type(0),
- font_style(0),
+ italic(false),
+ weight(gfx::Font::Weight::NORMAL),
Alexei Svitkine (slow) 2016/04/05 16:38:53 Remove gfx::
strike(false),
diagonal_strike(false),
- underline(false) {
-}
+ underline(false) {}
TextRunHarfBuzz::~TextRunHarfBuzz() {}
@@ -1260,17 +1260,17 @@ 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(empty_colors, baselines(), weights(), 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->italic = style.style(ITALIC);
run->baseline_type = style.baseline();
run->strike = style.style(STRIKE);
run->diagonal_strike = style.style(DIAGONAL_STRIKE);
run->underline = style.style(UNDERLINE);
+ run->weight = style.weight();
int32_t script_item_break = 0;
bidi_iterator.GetLogicalRun(run_break, &script_item_break, &run->level);
CHECK_GT(static_cast<size_t>(script_item_break), run_break);
@@ -1435,7 +1435,7 @@ void RenderTextHarfBuzz::ShapeRun(const base::string16& text,
FontRenderParamsQuery query;
query.families.push_back(font_name);
query.pixel_size = run->font_size;
- query.style = run->font_style;
+ query.style = run->italic ? gfx::Font::ITALIC : 0;
Alexei Svitkine (slow) 2016/04/05 16:38:53 Remove gfx::
FontRenderParams fallback_render_params = GetFontRenderParams(query, NULL);
if (CompareFamily(text, font, fallback_render_params, run, &best_font,
&best_render_params, &best_missing_glyphs))
@@ -1456,7 +1456,7 @@ bool RenderTextHarfBuzz::ShapeRunWithFont(const base::string16& text,
const FontRenderParams& params,
internal::TextRunHarfBuzz* run) {
skia::RefPtr<SkTypeface> skia_face =
- internal::CreateSkiaTypeface(font, run->font_style);
+ internal::CreateSkiaTypeface(font, run->italic, run->weight);
if (skia_face == NULL)
return false;
run->skia_face = skia_face;

Powered by Google App Engine
This is Rietveld 408576698