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

Side by Side Diff: gfx/font.cc

Issue 3083022: Rework gfx::Font by moving platform-specific code into inner classes.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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 | « gfx/font.h ('k') | gfx/font_gtk.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) 2006-2008 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 #include "gfx/font.h"
6
7 #include "gfx/platform_font.h"
8
9 namespace gfx {
10
11 ////////////////////////////////////////////////////////////////////////////////
12 // Font, public:
13
14 Font::Font() : platform_font_(PlatformFont::CreateDefault()) {
15 }
16
17 Font::Font(const Font& other) : platform_font_(other.platform_font_) {
18 }
19
20 gfx::Font& Font::operator=(const Font& other) {
21 platform_font_ = other.platform_font_;
22 return *this;
23 }
24
25 Font::Font(NativeFont native_font)
26 : platform_font_(PlatformFont::CreateFromNativeFont(native_font)) {
27 }
28
29 Font::Font(PlatformFont* platform_font) : platform_font_(platform_font) {
30 }
31
32 Font::Font(const std::wstring& font_name, int font_size)
33 : platform_font_(PlatformFont::CreateFromNameAndSize(font_name,
34 font_size)) {
35 }
36
37 Font::~Font() {
38 }
39
40 Font Font::DeriveFont(int size_delta) const {
41 return DeriveFont(size_delta, GetStyle());
42 }
43
44 Font Font::DeriveFont(int size_delta, int style) const {
45 return platform_font_->DeriveFont(size_delta, style);
46 }
47
48 int Font::GetHeight() const {
49 return platform_font_->GetHeight();
50 }
51
52 int Font::GetBaseline() const {
53 return platform_font_->GetBaseline();
54 }
55
56 int Font::GetAverageCharacterWidth() const {
57 return platform_font_->GetAverageCharacterWidth();
58 }
59
60 int Font::GetStringWidth(const std::wstring& text) const {
61 return platform_font_->GetStringWidth(text);
62 }
63
64 int Font::GetExpectedTextWidth(int length) const {
65 return platform_font_->GetExpectedTextWidth(length);
66 }
67
68 int Font::GetStyle() const {
69 return platform_font_->GetStyle();
70 }
71
72 const std::wstring& Font::GetFontName() const {
73 return platform_font_->GetFontName();
74 }
75
76 int Font::GetFontSize() const {
77 return platform_font_->GetFontSize();
78 }
79
80 NativeFont Font::GetNativeFont() const {
81 return platform_font_->GetNativeFont();
82 }
83
84 } // namespace gfx
85
OLDNEW
« no previous file with comments | « gfx/font.h ('k') | gfx/font_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698