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

Unified Diff: ui/gfx/font.h

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/font.h
diff --git a/ui/gfx/font.h b/ui/gfx/font.h
index b7a7f9da4bde09a46d90a5d22ff72562e5bfe7f9..6386aab1f191660893873c1f5384f8f905ac2fa4 100644
--- a/ui/gfx/font.h
+++ b/ui/gfx/font.h
@@ -34,9 +34,21 @@ 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,
+ };
+
+ enum FontWeight {
sky 2016/03/21 17:13:22 enum class and just Weight. When you move to enum
+ WEIGHT_INVALID = -1,
+ WEIGHT_THIN = 100,
+ WEIGHT_EXTRA_LIGHT = 200,
+ WEIGHT_LIGHT = 300,
+ WEIGHT_NORMAL = 400,
+ WEIGHT_MEDIUM = 500,
+ WEIGHT_SEMIBOLD = 600,
+ WEIGHT_BOLD = 700,
+ WEIGHT_EXTRA_BOLD = 800,
+ WEIGHT_BLACK = 900
};
// Creates a font with the default name and style.
@@ -64,8 +76,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, gfx::Font::FontWeight 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 +86,9 @@ class GFX_EXPORT Font {
// need to be revisited in the future.
int GetHeight() const;
+ // Returns the font weight.
+ gfx::Font::FontWeight GetWeight() const;
+
// Returns the baseline, or ascent, of the font.
int GetBaseline() const;

Powered by Google App Engine
This is Rietveld 408576698