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

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: Created 4 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 a9a05ef7d153ca44d72278555677de847ae2d403..4f8a23730addff9283ea391b87db9ea0cd44ee4c 100644
--- a/ui/gfx/render_text_harfbuzz.cc
+++ b/ui/gfx/render_text_harfbuzz.cc
@@ -576,10 +576,10 @@ TextRunHarfBuzz::TextRunHarfBuzz()
baseline_offset(0),
baseline_type(0),
font_style(0),
+ weight(gfx::Font::WEIGHT_NORMAL),
strike(false),
diagonal_strike(false),
- underline(false) {
-}
+ underline(false) {}
TextRunHarfBuzz::~TextRunHarfBuzz() {}
@@ -1259,17 +1259,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->font_style = (style.style(ITALIC) ? Font::ITALIC : 0);
msw 2016/03/22 01:53:44 nit: convert to bool flag for italic.
Mikus 2016/03/22 14:19:51 Done.
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);
@@ -1455,7 +1455,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->font_style, run->weight);
if (skia_face == NULL)
return false;
run->skia_face = skia_face;

Powered by Google App Engine
This is Rietveld 408576698