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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/font_list_unittest.cc ('k') | ui/gfx/platform_font_fake.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/platform_font_fake.h
diff --git a/ui/gfx/platform_font_fake.h b/ui/gfx/platform_font_fake.h
new file mode 100644
index 0000000000000000000000000000000000000000..d352f48c469cc0f3606836c9e92a6cf10c8a59bc
--- /dev/null
+++ b/ui/gfx/platform_font_fake.h
@@ -0,0 +1,50 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_GFX_PLATFORM_FONT_FAKE_H_
+#define UI_GFX_PLATFORM_FONT_FAKE_H_
+
+#include "ui/gfx/platform_font.h"
+
+namespace gfx {
+
+// Fake font class for unit tests.
+class PlatformFontFake : public PlatformFont {
+ public:
+ PlatformFontFake();
+ PlatformFontFake(const std::string& font_name, int font_size);
+
+ // Overridden from PlatformFont:
+ virtual Font DeriveFont(int size_delta, int style) const OVERRIDE;
+ virtual int GetHeight() const OVERRIDE;
+ virtual int GetBaseline() const OVERRIDE;
+ virtual int GetAverageCharacterWidth() const OVERRIDE;
+ virtual int GetStringWidth(const base::string16& text) const OVERRIDE;
+ virtual int GetExpectedTextWidth(int length) const OVERRIDE;
+ virtual int GetStyle() const OVERRIDE;
+ virtual std::string GetFontName() const OVERRIDE;
+ virtual int GetFontSize() const OVERRIDE;
+ virtual NativeFont GetNativeFont() const OVERRIDE;
+
+ // Customizes the font metrics.
+ void SetHeight(int height);
+ void SetBaseline(int baseline);
+
+ private:
+ // Initializes this instance.
+ void InitWithNameAndSize(const std::string& font_name, int font_size);
+
+ std::string font_name_;
+ int font_size_;
+ int style_;
+ int height_;
+ int baseline_;
+ int average_character_width_;
+
+ DISALLOW_COPY_AND_ASSIGN(PlatformFontFake);
+};
+
+} // namespace gfx
+
+#endif // UI_GFX_PLATFORM_FONT_FAKE_H_
« 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