Chromium Code Reviews| Index: ui/gfx/font_list.h |
| diff --git a/ui/gfx/font_list.h b/ui/gfx/font_list.h |
| index 2b67c4a13e2cf2e5b7bc6e93c93eac128ef5a3fa..a11409e9cc45cb1ca73b63db349d69f09a4d7fa5 100644 |
| --- a/ui/gfx/font_list.h |
| +++ b/ui/gfx/font_list.h |
| @@ -28,11 +28,12 @@ class FontListImpl; |
| // The format is "<FONT_FAMILY_LIST>,[STYLES] <SIZE>", where: |
| // - FONT_FAMILY_LIST is a comma-separated list of font family names, |
| // - STYLES is an optional space-separated list of style names (case-sensitive |
| -// "Bold" and "Italic" are supported), and |
| -// - SIZE is an integer font size in pixels with the suffix "px". |
| +// "Italic Ultra-Light Light Normal Semi-Bold Bold Ultra-Bold Heavy" are |
|
msw
2016/03/22 01:53:43
nit: use quotes for each style, right? (ie. "Itali
Mikus
2016/03/22 14:19:51
Done.
|
| +// supported), and |
| +// - SIZE is an integer font size in pixels with the suffix "px" |
| // |
| // Here are examples of valid font description strings: |
| -// - "Arial, Helvetica, Bold Italic 14px" |
| +// - "Arial, Helvetica, Italic Semi-Bold 14px" |
| // - "Arial, 14px" |
| class GFX_EXPORT FontList { |
| public: |
| @@ -42,7 +43,8 @@ class GFX_EXPORT FontList { |
| static bool ParseDescription(const std::string& description, |
| std::vector<std::string>* families_out, |
| int* style_out, |
| - int* size_pixels_out); |
| + int* size_pixels_out, |
| + gfx::Font::FontWeight* weight); |
|
msw
2016/03/22 01:53:43
nit: rename |weight_out|, and mention it in the co
Mikus
2016/03/22 14:19:51
Done.
|
| // Creates a font list with default font names, size and style, which are |
| // specified by SetDefaultFontDescription(). |
| @@ -58,7 +60,8 @@ class GFX_EXPORT FontList { |
| // Creates a font list from font names, styles and size. |
|
msw
2016/03/22 01:53:43
nit: "styles, size, and weight."
|
| FontList(const std::vector<std::string>& font_names, |
| int font_style, |
| - int font_size); |
| + int font_size, |
| + int font_weight); |
| // Creates a font list from a Font vector. |
| // All fonts in this vector should have the same style and size. |
| @@ -85,18 +88,24 @@ class GFX_EXPORT FontList { |
| // Returns a new FontList with the same font names but resized and the given |
|
msw
2016/03/22 01:53:43
nit: "and with the given style and weight"
Mikus
2016/03/22 14:19:51
Done.
|
| // style. |size_delta| is the size in pixels to add to the current font size. |
| // |font_style| specifies the new style, which is a bitmask of the values: |
| - // Font::BOLD, Font::ITALIC and Font::UNDERLINE. |
| - FontList Derive(int size_delta, int font_style) const; |
| + // Font::ITALIC and Font::UNDERLINE. |
| + FontList Derive(int size_delta, |
| + int font_style, |
| + gfx::Font::FontWeight weight) const; |
| // Returns a new FontList with the same font names and style but resized. |
| // |size_delta| is the size in pixels to add to the current font size. |
| FontList DeriveWithSizeDelta(int size_delta) const; |
| - // Returns a new FontList with the same font names and size but the given |
| - // style. |font_style| specifies the new style, which is a bitmask of the |
| - // values: Font::BOLD, Font::ITALIC and Font::UNDERLINE. |
| + // Returns a new FontList with the same font names, weight and size but the |
| + // given style. |font_style| specifies the new style, which is a bitmask of |
| + // the values: Font::ITALIC and Font::UNDERLINE. |
| FontList DeriveWithStyle(int font_style) const; |
| + // Returns a new FontList with the same font name, size and style but with |
| + // the given weight. |
| + FontList DeriveWithWeight(gfx::Font::FontWeight weight) const; |
| + |
| // Shrinks the font size until the font list fits within |height| while |
| // having its cap height vertically centered. Returns a new FontList with |
| // the correct height. |
| @@ -145,6 +154,9 @@ class GFX_EXPORT FontList { |
| // Returns the font size in pixels. |
| int GetFontSize() const; |
| + // Returns the font weight. |
| + gfx::Font::FontWeight GetFontWeight() const; |
| + |
| // Returns the Font vector. |
| const std::vector<Font>& GetFonts() const; |