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" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "ui/gfx/font_render_params.h" |
12 #include "ui/gfx/gfx_export.h" | 13 #include "ui/gfx/gfx_export.h" |
13 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
14 | 15 |
15 namespace gfx { | 16 namespace gfx { |
16 | 17 |
17 struct FontRenderParams; | 18 struct FontRenderParams; |
18 class PlatformFont; | 19 class PlatformFont; |
19 | 20 |
20 // Font provides a wrapper around an underlying font. Copy and assignment | 21 // Font provides a wrapper around an underlying font. Copy and assignment |
21 // operators are explicitly allowed, and cheap. | 22 // operators are explicitly allowed, and cheap. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // Returns the specified font name in UTF-8. | 89 // Returns the specified font name in UTF-8. |
89 std::string GetFontName() const; | 90 std::string GetFontName() const; |
90 | 91 |
91 // Returns the actually used font name in UTF-8. | 92 // Returns the actually used font name in UTF-8. |
92 std::string GetActualFontNameForTesting() const; | 93 std::string GetActualFontNameForTesting() const; |
93 | 94 |
94 // Returns the font size in pixels. | 95 // Returns the font size in pixels. |
95 int GetFontSize() const; | 96 int GetFontSize() const; |
96 | 97 |
97 // Returns an object describing how the font should be rendered. | 98 // Returns an object describing how the font should be rendered. |
98 const FontRenderParams& GetFontRenderParams() const; | 99 FontRenderParams GetFontRenderParams() const; |
99 | 100 |
100 // Returns the native font handle. | 101 // Returns the native font handle. |
101 // Lifetime lore: | 102 // Lifetime lore: |
102 // Windows: This handle is owned by the Font object, and should not be | 103 // Windows: This handle is owned by the Font object, and should not be |
103 // destroyed by the caller. | 104 // destroyed by the caller. |
104 // Mac: The object is owned by the system and should not be released. | 105 // Mac: The object is owned by the system and should not be released. |
105 // Gtk: This handle is created on demand, and must be freed by calling | 106 // Gtk: This handle is created on demand, and must be freed by calling |
106 // pango_font_description_free() when the caller is done using it or | 107 // pango_font_description_free() when the caller is done using it or |
107 // by using ScopedPangoFontDescription. | 108 // by using ScopedPangoFontDescription. |
108 NativeFont GetNativeFont() const; | 109 NativeFont GetNativeFont() const; |
109 | 110 |
110 // Raw access to the underlying platform font implementation. Can be | 111 // Raw access to the underlying platform font implementation. Can be |
111 // static_cast to a known implementation type if needed. | 112 // static_cast to a known implementation type if needed. |
112 PlatformFont* platform_font() const { return platform_font_.get(); } | 113 PlatformFont* platform_font() const { return platform_font_.get(); } |
113 | 114 |
114 private: | 115 private: |
115 // Wrapped platform font implementation. | 116 // Wrapped platform font implementation. |
116 scoped_refptr<PlatformFont> platform_font_; | 117 scoped_refptr<PlatformFont> platform_font_; |
117 }; | 118 }; |
118 | 119 |
119 } // namespace gfx | 120 } // namespace gfx |
120 | 121 |
121 #endif // UI_GFX_FONT_H_ | 122 #endif // UI_GFX_FONT_H_ |
OLD | NEW |