Chromium Code Reviews| Index: ui/gfx/render_text.h |
| diff --git a/ui/gfx/render_text.h b/ui/gfx/render_text.h |
| index 6f56a697358781ba59b1bcfa12d82aa8e97c05ef..a677280c8965f3221759089c2dbddd1c61742082 100644 |
| --- a/ui/gfx/render_text.h |
| +++ b/ui/gfx/render_text.h |
| @@ -62,7 +62,7 @@ class GFX_EXPORT SkiaTextRenderer { |
| bool subpixel_rendering_suppressed); |
| void SetTypeface(SkTypeface* typeface); |
| void SetTextSize(SkScalar size); |
| - void SetFontWithStyle(const Font& font, int font_style); |
| + void SetFont(const Font& font, bool italic, gfx::Font::Weight weight); |
| void SetForegroundColor(SkColor foreground); |
| void SetShader(SkShader* shader); |
| // Sets underline metrics to use if the text will be drawn with an underline. |
| @@ -123,6 +123,7 @@ class StyleIterator { |
| public: |
| StyleIterator(const BreakList<SkColor>& colors, |
| const BreakList<BaselineStyle>& baselines, |
| + const BreakList<gfx::Font::Weight>& weights, |
| const std::vector<BreakList<bool>>& styles); |
| ~StyleIterator(); |
| @@ -130,6 +131,7 @@ class StyleIterator { |
| SkColor color() const { return color_->second; } |
| BaselineStyle baseline() const { return baseline_->second; } |
| bool style(TextStyle s) const { return style_[s]->second; } |
| + gfx::Font::Weight weight() const { return weight_->second; } |
| // Get the intersecting range of the current iterator set. |
| Range GetRange() const; |
| @@ -140,10 +142,12 @@ class StyleIterator { |
| private: |
| BreakList<SkColor> colors_; |
| BreakList<BaselineStyle> baselines_; |
| + BreakList<gfx::Font::Weight> weights_; |
| std::vector<BreakList<bool> > styles_; |
| BreakList<SkColor>::const_iterator color_; |
| BreakList<BaselineStyle>::const_iterator baseline_; |
| + BreakList<gfx::Font::Weight>::const_iterator weight_; |
| std::vector<BreakList<bool>::const_iterator> style_; |
| DISALLOW_COPY_AND_ASSIGN(StyleIterator); |
| @@ -186,9 +190,11 @@ struct Line { |
| int baseline; |
| }; |
| -// Creates an SkTypeface from a font and a |gfx::Font::FontStyle|. |
| +// Creates an SkTypeface from a font |gfx::Font::FontStyle| and weight. |
|
msw
2016/03/22 18:24:11
nit: now it takes a bool for italic, not |gfx::Fon
Mikus
2016/03/23 17:53:22
Done.
|
| // May return NULL. |
| -skia::RefPtr<SkTypeface> CreateSkiaTypeface(const gfx::Font& font, int style); |
| +skia::RefPtr<SkTypeface> CreateSkiaTypeface(const gfx::Font& font, |
| + bool italic, |
| + gfx::Font::Weight weight); |
| // Applies the given FontRenderParams to a Skia |paint|. |
| void ApplyRenderParams(const FontRenderParams& params, |
| @@ -363,6 +369,9 @@ class GFX_EXPORT RenderText { |
| void SetStyle(TextStyle style, bool value); |
| void ApplyStyle(TextStyle style, bool value, const Range& range); |
| + void SetWeight(gfx::Font::Weight weight); |
| + void ApplyWeight(gfx::Font::Weight weight, const Range& range); |
| + |
| // Returns whether this style is enabled consistently across the entire |
| // RenderText. |
| bool GetStyle(TextStyle style) const; |
| @@ -486,6 +495,7 @@ class GFX_EXPORT RenderText { |
| const BreakList<SkColor>& colors() const { return colors_; } |
| const BreakList<BaselineStyle>& baselines() const { return baselines_; } |
| + const BreakList<gfx::Font::Weight>& weights() const { return weights_; } |
| const std::vector<BreakList<bool> >& styles() const { return styles_; } |
| const std::vector<internal::Line>& lines() const { return lines_; } |
| @@ -741,6 +751,7 @@ class GFX_EXPORT RenderText { |
| // TODO(msw): Expand to support cursor, selection, background, etc. colors. |
| BreakList<SkColor> colors_; |
| BreakList<BaselineStyle> baselines_; |
| + BreakList<gfx::Font::Weight> weights_; |
| std::vector<BreakList<bool> > styles_; |
| // Breaks saved without temporary composition and selection styling. |