OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_GFX_FONT_H_ | 5 #ifndef UI_GFX_FONT_H_ |
6 #define UI_GFX_FONT_H_ | 6 #define UI_GFX_FONT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 Font(const std::string& font_name, int font_size); | 46 Font(const std::string& font_name, int font_size); |
47 | 47 |
48 ~Font(); | 48 ~Font(); |
49 | 49 |
50 // Returns a new Font derived from the existing font. | 50 // Returns a new Font derived from the existing font. |
51 // |size_deta| is the size in pixels to add to the current font. For example, | 51 // |size_deta| is the size in pixels to add to the current font. For example, |
52 // a value of 5 results in a font 5 pixels bigger than this font. | 52 // a value of 5 results in a font 5 pixels bigger than this font. |
53 Font DeriveFont(int size_delta) const; | 53 Font DeriveFont(int size_delta) const; |
54 | 54 |
55 // Returns a new Font derived from the existing font. | 55 // Returns a new Font derived from the existing font. |
| 56 // |size_scale| is the relative scaling of the new font. For example, a value |
| 57 // a value of 1.2 results in a font 20 percent bigger than this font. |
| 58 Font DeriveFontScaled(float size_scale) const; |
| 59 |
| 60 // Returns a new Font derived from the existing font. |
56 // |size_delta| is the size in pixels to add to the current font. See the | 61 // |size_delta| is the size in pixels to add to the current font. See the |
57 // single argument version of this method for an example. | 62 // single argument version of this method for an example. |
58 // The style parameter specifies the new style for the font, and is a | 63 // The style parameter specifies the new style for the font, and is a |
59 // bitmask of the values: BOLD, ITALIC and UNDERLINE. | 64 // bitmask of the values: BOLD, ITALIC and UNDERLINE. |
60 Font DeriveFont(int size_delta, int style) const; | 65 Font DeriveFont(int size_delta, int style) const; |
61 | 66 |
62 // Returns the number of vertical pixels needed to display characters from | 67 // Returns the number of vertical pixels needed to display characters from |
63 // the specified font. This may include some leading, i.e. height may be | 68 // the specified font. This may include some leading, i.e. height may be |
64 // greater than just ascent + descent. Specifically, the Windows and Mac | 69 // greater than just ascent + descent. Specifically, the Windows and Mac |
65 // implementations include leading and the Linux one does not. This may | 70 // implementations include leading and the Linux one does not. This may |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 PlatformFont* platform_font() const { return platform_font_.get(); } | 110 PlatformFont* platform_font() const { return platform_font_.get(); } |
106 | 111 |
107 private: | 112 private: |
108 // Wrapped platform font implementation. | 113 // Wrapped platform font implementation. |
109 scoped_refptr<PlatformFont> platform_font_; | 114 scoped_refptr<PlatformFont> platform_font_; |
110 }; | 115 }; |
111 | 116 |
112 } // namespace gfx | 117 } // namespace gfx |
113 | 118 |
114 #endif // UI_GFX_FONT_H_ | 119 #endif // UI_GFX_FONT_H_ |
OLD | NEW |