| Index: ui/gfx/font.h
|
| diff --git a/ui/gfx/font.h b/ui/gfx/font.h
|
| index b7a7f9da4bde09a46d90a5d22ff72562e5bfe7f9..e33bb680f6a690de88499a4483a3630a04220fd9 100644
|
| --- a/ui/gfx/font.h
|
| +++ b/ui/gfx/font.h
|
| @@ -34,9 +34,23 @@ class GFX_EXPORT Font {
|
| // The following constants indicate the font style.
|
| enum FontStyle {
|
| NORMAL = 0,
|
| - BOLD = 1,
|
| - ITALIC = 2,
|
| - UNDERLINE = 4,
|
| + ITALIC = 1,
|
| + UNDERLINE = 2,
|
| + };
|
| +
|
| + // Standard font weights as used in Pango and Windows. The values must match
|
| + // https://msdn.microsoft.com/en-us/library/system.windows.fontweights(v=vs.110).aspx
|
| + enum class Weight {
|
| + INVALID = -1,
|
| + THIN = 100,
|
| + EXTRA_LIGHT = 200,
|
| + LIGHT = 300,
|
| + NORMAL = 400,
|
| + MEDIUM = 500,
|
| + SEMIBOLD = 600,
|
| + BOLD = 700,
|
| + EXTRA_BOLD = 800,
|
| + BLACK = 900,
|
| };
|
|
|
| // Creates a font with the default name and style.
|
| @@ -64,8 +78,8 @@ class GFX_EXPORT Font {
|
| // |size_delta| is the size in pixels to add to the current font. For example,
|
| // a value of 5 results in a font 5 pixels bigger than this font.
|
| // The style parameter specifies the new style for the font, and is a
|
| - // bitmask of the values: BOLD, ITALIC and UNDERLINE.
|
| - Font Derive(int size_delta, int style) const;
|
| + // bitmask of the values: ITALIC and UNDERLINE.
|
| + Font Derive(int size_delta, int style, Font::Weight weight) const;
|
|
|
| // Returns the number of vertical pixels needed to display characters from
|
| // the specified font. This may include some leading, i.e. height may be
|
| @@ -74,6 +88,9 @@ class GFX_EXPORT Font {
|
| // need to be revisited in the future.
|
| int GetHeight() const;
|
|
|
| + // Returns the font weight.
|
| + Font::Weight GetWeight() const;
|
| +
|
| // Returns the baseline, or ascent, of the font.
|
| int GetBaseline() const;
|
|
|
| @@ -118,6 +135,11 @@ class GFX_EXPORT Font {
|
| scoped_refptr<PlatformFont> platform_font_;
|
| };
|
|
|
| +#ifndef NDEBUG
|
| +GFX_EXPORT std::ostream& operator<<(std::ostream& stream,
|
| + const Font::Weight weight);
|
| +#endif
|
| +
|
| } // namespace gfx
|
|
|
| #endif // UI_GFX_FONT_H_
|
|
|