OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 // Creates a font with the default name and style. | 32 // Creates a font with the default name and style. |
33 Font(); | 33 Font(); |
34 | 34 |
35 // Creates a font that is a clone of another font object. | 35 // Creates a font that is a clone of another font object. |
36 Font(const Font& other); | 36 Font(const Font& other); |
37 gfx::Font& operator=(const Font& other); | 37 gfx::Font& operator=(const Font& other); |
38 | 38 |
39 // Creates a font from the specified native font. | 39 // Creates a font from the specified native font. |
40 explicit Font(NativeFont native_font); | 40 explicit Font(NativeFont native_font); |
41 | 41 |
42 // Construct a Font object with the specified PlatformFont object. The Font | 42 // Constructs a Font object with the specified PlatformFont object. The Font |
43 // object takes ownership of the PlatformFont object. | 43 // object takes ownership of the PlatformFont object. |
44 explicit Font(PlatformFont* platform_font); | 44 explicit Font(PlatformFont* platform_font); |
45 | 45 |
46 // Creates a font with the specified name in UTF-8 and size in pixels. | 46 // Creates a font with the specified name in UTF-8 and size in pixels. |
47 Font(const std::string& font_name, int font_size); | 47 Font(const std::string& font_name, int font_size); |
48 | 48 |
49 ~Font(); | 49 ~Font(); |
50 | 50 |
51 // Returns a new Font derived from the existing font. | 51 // Returns a new Font derived from the existing font. |
52 // |size_deta| is the size in pixels to add to the current font. For example, | 52 // |size_deta| is the size in pixels to add to the current font. For example, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 // Returns the font size in pixels. | 91 // Returns the font size in pixels. |
92 int GetFontSize() const; | 92 int GetFontSize() const; |
93 | 93 |
94 // Returns the native font handle. | 94 // Returns the native font handle. |
95 // Lifetime lore: | 95 // Lifetime lore: |
96 // Windows: This handle is owned by the Font object, and should not be | 96 // Windows: This handle is owned by the Font object, and should not be |
97 // destroyed by the caller. | 97 // destroyed by the caller. |
98 // Mac: The object is owned by the system and should not be released. | 98 // Mac: The object is owned by the system and should not be released. |
99 // Gtk: This handle is created on demand, and must be freed by calling | 99 // Gtk: This handle is created on demand, and must be freed by calling |
100 // pango_font_description_free() when the caller is done using it. | 100 // pango_font_description_free() when the caller is done using it or |
| 101 // by using ScopedPangoFontDescription. |
101 NativeFont GetNativeFont() const; | 102 NativeFont GetNativeFont() const; |
102 | 103 |
103 // Raw access to the underlying platform font implementation. Can be | 104 // Raw access to the underlying platform font implementation. Can be |
104 // static_cast to a known implementation type if needed. | 105 // static_cast to a known implementation type if needed. |
105 PlatformFont* platform_font() const { return platform_font_.get(); } | 106 PlatformFont* platform_font() const { return platform_font_.get(); } |
106 | 107 |
107 private: | 108 private: |
108 // Wrapped platform font implementation. | 109 // Wrapped platform font implementation. |
109 scoped_refptr<PlatformFont> platform_font_; | 110 scoped_refptr<PlatformFont> platform_font_; |
110 }; | 111 }; |
111 | 112 |
112 } // namespace gfx | 113 } // namespace gfx |
113 | 114 |
114 #endif // UI_GFX_FONT_H_ | 115 #endif // UI_GFX_FONT_H_ |
OLD | NEW |