| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_GFX_PLATFORM_FONT_FAKE_H_ |
| 6 #define UI_GFX_PLATFORM_FONT_FAKE_H_ |
| 7 |
| 8 #include "ui/gfx/platform_font.h" |
| 9 |
| 10 namespace gfx { |
| 11 |
| 12 // Fake font class for unit tests. |
| 13 class PlatformFontFake : public PlatformFont { |
| 14 public: |
| 15 PlatformFontFake(); |
| 16 PlatformFontFake(const std::string& font_name, int font_size); |
| 17 |
| 18 // Overridden from PlatformFont: |
| 19 virtual Font DeriveFont(int size_delta, int style) const OVERRIDE; |
| 20 virtual int GetHeight() const OVERRIDE; |
| 21 virtual int GetBaseline() const OVERRIDE; |
| 22 virtual int GetAverageCharacterWidth() const OVERRIDE; |
| 23 virtual int GetStringWidth(const base::string16& text) const OVERRIDE; |
| 24 virtual int GetExpectedTextWidth(int length) const OVERRIDE; |
| 25 virtual int GetStyle() const OVERRIDE; |
| 26 virtual std::string GetFontName() const OVERRIDE; |
| 27 virtual int GetFontSize() const OVERRIDE; |
| 28 virtual NativeFont GetNativeFont() const OVERRIDE; |
| 29 |
| 30 // Customizes the font metrics. |
| 31 void SetHeight(int height); |
| 32 void SetBaseline(int baseline); |
| 33 |
| 34 private: |
| 35 // Initializes this instance. |
| 36 void InitWithNameAndSize(const std::string& font_name, int font_size); |
| 37 |
| 38 std::string font_name_; |
| 39 int font_size_; |
| 40 int style_; |
| 41 int height_; |
| 42 int baseline_; |
| 43 int average_character_width_; |
| 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(PlatformFontFake); |
| 46 }; |
| 47 |
| 48 } // namespace gfx |
| 49 |
| 50 #endif // UI_GFX_PLATFORM_FONT_FAKE_H_ |
| OLD | NEW |