Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(941)

Side by Side Diff: ui/gfx/platform_font_fake.h

Issue 19352002: Fixes vertical alignment of RenderText. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adds platform_font_fake.{cc,h} Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/font_list_unittest.cc ('k') | ui/gfx/platform_font_fake.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_
OLDNEW
« no previous file with comments | « ui/gfx/font_list_unittest.cc ('k') | ui/gfx/platform_font_fake.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698