| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // Returns the cap height of the font. | 45 // Returns the cap height of the font. |
| 46 virtual int GetCapHeight() const = 0; | 46 virtual int GetCapHeight() const = 0; |
| 47 | 47 |
| 48 // Returns the average character width for the font. | 48 // Returns the average character width for the font. |
| 49 virtual int GetAverageCharacterWidth() const = 0; | 49 virtual int GetAverageCharacterWidth() const = 0; |
| 50 | 50 |
| 51 // Returns the number of horizontal pixels needed to display the specified | 51 // Returns the number of horizontal pixels needed to display the specified |
| 52 // string. | 52 // string. |
| 53 virtual int GetStringWidth(const base::string16& text) const = 0; | 53 virtual int GetStringWidth(const base::string16& text) const = 0; |
| 54 | 54 |
| 55 // Returns the pixel width needed to display the specified string. Note that |
| 56 // the fractional width might be returned in some platforms. |
| 57 virtual float GetStringWidthF(const base::string16& text) const = 0; |
| 58 |
| 55 // Returns the expected number of horizontal pixels needed to display the | 59 // Returns the expected number of horizontal pixels needed to display the |
| 56 // specified length of characters. Call GetStringWidth() to retrieve the | 60 // specified length of characters. Call GetStringWidth() to retrieve the |
| 57 // actual number. | 61 // actual number. |
| 58 virtual int GetExpectedTextWidth(int length) const = 0; | 62 virtual int GetExpectedTextWidth(int length) const = 0; |
| 59 | 63 |
| 60 // Returns the style of the font. | 64 // Returns the style of the font. |
| 61 virtual int GetStyle() const = 0; | 65 virtual int GetStyle() const = 0; |
| 62 | 66 |
| 63 // Returns the font name in UTF-8. | 67 // Returns the font name in UTF-8. |
| 64 virtual std::string GetFontName() const = 0; | 68 virtual std::string GetFontName() const = 0; |
| 65 | 69 |
| 66 // Returns the font size in pixels. | 70 // Returns the font size in pixels. |
| 67 virtual int GetFontSize() const = 0; | 71 virtual int GetFontSize() const = 0; |
| 68 | 72 |
| 69 // Returns the native font handle. | 73 // Returns the native font handle. |
| 70 virtual NativeFont GetNativeFont() const = 0; | 74 virtual NativeFont GetNativeFont() const = 0; |
| 71 | 75 |
| 72 protected: | 76 protected: |
| 73 virtual ~PlatformFont() {} | 77 virtual ~PlatformFont() {} |
| 74 | 78 |
| 75 private: | 79 private: |
| 76 friend class base::RefCounted<PlatformFont>; | 80 friend class base::RefCounted<PlatformFont>; |
| 77 }; | 81 }; |
| 78 | 82 |
| 79 } // namespace gfx | 83 } // namespace gfx |
| 80 | 84 |
| 81 #endif // UI_GFX_PLATFORM_FONT_H_ | 85 #endif // UI_GFX_PLATFORM_FONT_H_ |
| OLD | NEW |