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_PLATFORM_FONT_H_ | 5 #ifndef UI_GFX_PLATFORM_FONT_H_ |
6 #define UI_GFX_PLATFORM_FONT_H_ | 6 #define UI_GFX_PLATFORM_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 11 matching lines...) Expand all Loading... |
22 static PlatformFont* CreateDefault(); | 22 static PlatformFont* CreateDefault(); |
23 static PlatformFont* CreateFromNativeFont(NativeFont native_font); | 23 static PlatformFont* CreateFromNativeFont(NativeFont native_font); |
24 // Creates a PlatformFont implementation with the specified |font_name| | 24 // Creates a PlatformFont implementation with the specified |font_name| |
25 // (encoded in UTF-8) and |font_size| in pixels. | 25 // (encoded in UTF-8) and |font_size| in pixels. |
26 static PlatformFont* CreateFromNameAndSize(const std::string& font_name, | 26 static PlatformFont* CreateFromNameAndSize(const std::string& font_name, |
27 int font_size); | 27 int font_size); |
28 | 28 |
29 // Returns a new Font derived from the existing font. | 29 // Returns a new Font derived from the existing font. |
30 // |size_delta| is the size in pixels to add to the current font. | 30 // |size_delta| is the size in pixels to add to the current font. |
31 // The style parameter specifies the new style for the font, and is a | 31 // The style parameter specifies the new style for the font, and is a |
32 // bitmask of the values: BOLD, ITALIC and UNDERLINED. | 32 // bitmask of the values: BOLD, ITALIC and UNDERLINE. |
33 virtual Font DeriveFont(int size_delta, int style) const = 0; | 33 virtual Font DeriveFont(int size_delta, int style) const = 0; |
34 | 34 |
35 // Returns the number of vertical pixels needed to display characters from | 35 // Returns the number of vertical pixels needed to display characters from |
36 // the specified font. This may include some leading, i.e. height may be | 36 // the specified font. This may include some leading, i.e. height may be |
37 // greater than just ascent + descent. Specifically, the Windows and Mac | 37 // greater than just ascent + descent. Specifically, the Windows and Mac |
38 // implementations include leading and the Linux one does not. This may | 38 // implementations include leading and the Linux one does not. This may |
39 // need to be revisited in the future. | 39 // need to be revisited in the future. |
40 virtual int GetHeight() const = 0; | 40 virtual int GetHeight() const = 0; |
41 | 41 |
42 // Returns the baseline, or ascent, of the font. | 42 // Returns the baseline, or ascent, of the font. |
(...skipping 27 matching lines...) Expand all Loading... |
70 virtual ~PlatformFont() {} | 70 virtual ~PlatformFont() {} |
71 | 71 |
72 private: | 72 private: |
73 friend class base::RefCounted<PlatformFont>; | 73 friend class base::RefCounted<PlatformFont>; |
74 }; | 74 }; |
75 | 75 |
76 } // namespace gfx | 76 } // namespace gfx |
77 | 77 |
78 #endif // UI_GFX_PLATFORM_FONT_H_ | 78 #endif // UI_GFX_PLATFORM_FONT_H_ |
79 | 79 |
OLD | NEW |