| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 int GetStringWidth(const base::string16& text) const; | 89 int GetStringWidth(const base::string16& text) const; |
| 90 | 90 |
| 91 // Returns the expected number of horizontal pixels needed to display the | 91 // Returns the expected number of horizontal pixels needed to display the |
| 92 // specified length of characters. Call GetStringWidth() to retrieve the | 92 // specified length of characters. Call GetStringWidth() to retrieve the |
| 93 // actual number. | 93 // actual number. |
| 94 int GetExpectedTextWidth(int length) const; | 94 int GetExpectedTextWidth(int length) const; |
| 95 | 95 |
| 96 // Returns the style of the font. | 96 // Returns the style of the font. |
| 97 int GetStyle() const; | 97 int GetStyle() const; |
| 98 | 98 |
| 99 // Returns the font name in UTF-8. | 99 // Returns the specified font name in UTF-8. |
| 100 std::string GetFontName() const; | 100 std::string GetFontName() const; |
| 101 | 101 |
| 102 // Returns the actually used font name in UTF-8. |
| 103 std::string GetActualFontNameForTesting() const; |
| 104 |
| 102 // Returns the font size in pixels. | 105 // Returns the font size in pixels. |
| 103 int GetFontSize() const; | 106 int GetFontSize() const; |
| 104 | 107 |
| 105 // Returns the native font handle. | 108 // Returns the native font handle. |
| 106 // Lifetime lore: | 109 // Lifetime lore: |
| 107 // Windows: This handle is owned by the Font object, and should not be | 110 // Windows: This handle is owned by the Font object, and should not be |
| 108 // destroyed by the caller. | 111 // destroyed by the caller. |
| 109 // Mac: The object is owned by the system and should not be released. | 112 // Mac: The object is owned by the system and should not be released. |
| 110 // Gtk: This handle is created on demand, and must be freed by calling | 113 // Gtk: This handle is created on demand, and must be freed by calling |
| 111 // pango_font_description_free() when the caller is done using it or | 114 // pango_font_description_free() when the caller is done using it or |
| 112 // by using ScopedPangoFontDescription. | 115 // by using ScopedPangoFontDescription. |
| 113 NativeFont GetNativeFont() const; | 116 NativeFont GetNativeFont() const; |
| 114 | 117 |
| 115 // Raw access to the underlying platform font implementation. Can be | 118 // Raw access to the underlying platform font implementation. Can be |
| 116 // static_cast to a known implementation type if needed. | 119 // static_cast to a known implementation type if needed. |
| 117 PlatformFont* platform_font() const { return platform_font_.get(); } | 120 PlatformFont* platform_font() const { return platform_font_.get(); } |
| 118 | 121 |
| 119 private: | 122 private: |
| 120 // Wrapped platform font implementation. | 123 // Wrapped platform font implementation. |
| 121 scoped_refptr<PlatformFont> platform_font_; | 124 scoped_refptr<PlatformFont> platform_font_; |
| 122 }; | 125 }; |
| 123 | 126 |
| 124 } // namespace gfx | 127 } // namespace gfx |
| 125 | 128 |
| 126 #endif // UI_GFX_FONT_H_ | 129 #endif // UI_GFX_FONT_H_ |
| OLD | NEW |