| 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_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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 // implementations include leading and the Linux one does not. This may | 40 // implementations include leading and the Linux one does not. This may |
| 41 // need to be revisited in the future. | 41 // need to be revisited in the future. |
| 42 virtual int GetHeight() const = 0; | 42 virtual int GetHeight() const = 0; |
| 43 | 43 |
| 44 // Returns the baseline, or ascent, of the font. | 44 // Returns the baseline, or ascent, of the font. |
| 45 virtual int GetBaseline() const = 0; | 45 virtual int GetBaseline() const = 0; |
| 46 | 46 |
| 47 // Returns the average character width for the font. | 47 // Returns the average character width for the font. |
| 48 virtual int GetAverageCharacterWidth() const = 0; | 48 virtual int GetAverageCharacterWidth() const = 0; |
| 49 | 49 |
| 50 // Returns the number of horizontal pixels needed to display the specified | |
| 51 // string. | |
| 52 virtual int GetStringWidth(const string16& text) const = 0; | |
| 53 | |
| 54 // Returns the expected number of horizontal pixels needed to display the | 50 // Returns the expected number of horizontal pixels needed to display the |
| 55 // specified length of characters. Call GetStringWidth() to retrieve the | 51 // specified length of characters. Call GetStringWidth() to retrieve the |
| 56 // actual number. | 52 // actual number. |
| 57 virtual int GetExpectedTextWidth(int length) const = 0; | 53 virtual int GetExpectedTextWidth(int length) const = 0; |
| 58 | 54 |
| 59 // Returns the style of the font. | 55 // Returns the style of the font. |
| 60 virtual int GetStyle() const = 0; | 56 virtual int GetStyle() const = 0; |
| 61 | 57 |
| 62 // Returns the font name in UTF-8. | 58 // Returns the font name in UTF-8. |
| 63 virtual std::string GetFontName() const = 0; | 59 virtual std::string GetFontName() const = 0; |
| 64 | 60 |
| 65 // Returns the font size in pixels. | 61 // Returns the font size in pixels. |
| 66 virtual int GetFontSize() const = 0; | 62 virtual int GetFontSize() const = 0; |
| 67 | 63 |
| 68 // Returns the native font handle. | 64 // Returns the native font handle. |
| 69 virtual NativeFont GetNativeFont() const = 0; | 65 virtual NativeFont GetNativeFont() const = 0; |
| 70 | 66 |
| 71 protected: | 67 protected: |
| 72 virtual ~PlatformFont() {} | 68 virtual ~PlatformFont() {} |
| 73 | 69 |
| 74 private: | 70 private: |
| 75 friend class base::RefCounted<PlatformFont>; | 71 friend class base::RefCounted<PlatformFont>; |
| 76 }; | 72 }; |
| 77 | 73 |
| 78 } // namespace gfx | 74 } // namespace gfx |
| 79 | 75 |
| 80 #endif // UI_GFX_PLATFORM_FONT_H_ | 76 #endif // UI_GFX_PLATFORM_FONT_H_ |
| 81 | 77 |
| OLD | NEW |