| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 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 | 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 #include "gfx/font.h" | 5 #include "gfx/font.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "gfx/platform_font.h" | 8 #include "gfx/platform_font.h" |
| 9 | 9 |
| 10 namespace gfx { | 10 namespace gfx { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 return *this; | 23 return *this; |
| 24 } | 24 } |
| 25 | 25 |
| 26 Font::Font(NativeFont native_font) | 26 Font::Font(NativeFont native_font) |
| 27 : platform_font_(PlatformFont::CreateFromNativeFont(native_font)) { | 27 : platform_font_(PlatformFont::CreateFromNativeFont(native_font)) { |
| 28 } | 28 } |
| 29 | 29 |
| 30 Font::Font(PlatformFont* platform_font) : platform_font_(platform_font) { | 30 Font::Font(PlatformFont* platform_font) : platform_font_(platform_font) { |
| 31 } | 31 } |
| 32 | 32 |
| 33 Font::Font(const string16& font_name, int font_size) | 33 Font::Font(const std::wstring& font_name, int font_size) |
| 34 : platform_font_(PlatformFont::CreateFromNameAndSize(font_name, | 34 : platform_font_(PlatformFont::CreateFromNameAndSize(font_name, |
| 35 font_size)) { | 35 font_size)) { |
| 36 } | 36 } |
| 37 | 37 |
| 38 Font::~Font() { | 38 Font::~Font() { |
| 39 } | 39 } |
| 40 | 40 |
| 41 Font Font::DeriveFont(int size_delta) const { | 41 Font Font::DeriveFont(int size_delta) const { |
| 42 return DeriveFont(size_delta, GetStyle()); | 42 return DeriveFont(size_delta, GetStyle()); |
| 43 } | 43 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 63 } | 63 } |
| 64 | 64 |
| 65 int Font::GetExpectedTextWidth(int length) const { | 65 int Font::GetExpectedTextWidth(int length) const { |
| 66 return platform_font_->GetExpectedTextWidth(length); | 66 return platform_font_->GetExpectedTextWidth(length); |
| 67 } | 67 } |
| 68 | 68 |
| 69 int Font::GetStyle() const { | 69 int Font::GetStyle() const { |
| 70 return platform_font_->GetStyle(); | 70 return platform_font_->GetStyle(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 string16 Font::GetFontName() const { | 73 const std::wstring& Font::GetFontName() const { |
| 74 return platform_font_->GetFontName(); | 74 return platform_font_->GetFontName(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 int Font::GetFontSize() const { | 77 int Font::GetFontSize() const { |
| 78 return platform_font_->GetFontSize(); | 78 return platform_font_->GetFontSize(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 NativeFont Font::GetNativeFont() const { | 81 NativeFont Font::GetNativeFont() const { |
| 82 return platform_font_->GetNativeFont(); | 82 return platform_font_->GetNativeFont(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // namespace gfx | 85 } // namespace gfx |
| 86 | 86 |
| OLD | NEW |