| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/gfx/font.h" | 5 #include "ui/gfx/font.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "ui/gfx/canvas_skia.h" |
| 8 #include "ui/gfx/platform_font.h" | 9 #include "ui/gfx/platform_font.h" |
| 9 | 10 |
| 10 namespace gfx { | 11 namespace gfx { |
| 11 | 12 |
| 12 //////////////////////////////////////////////////////////////////////////////// | 13 //////////////////////////////////////////////////////////////////////////////// |
| 13 // Font, public: | 14 // Font, public: |
| 14 | 15 |
| 15 Font::Font() : platform_font_(PlatformFont::CreateDefault()) { | 16 Font::Font() : platform_font_(PlatformFont::CreateDefault()) { |
| 16 } | 17 } |
| 17 | 18 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 53 |
| 53 int Font::GetBaseline() const { | 54 int Font::GetBaseline() const { |
| 54 return platform_font_->GetBaseline(); | 55 return platform_font_->GetBaseline(); |
| 55 } | 56 } |
| 56 | 57 |
| 57 int Font::GetAverageCharacterWidth() const { | 58 int Font::GetAverageCharacterWidth() const { |
| 58 return platform_font_->GetAverageCharacterWidth(); | 59 return platform_font_->GetAverageCharacterWidth(); |
| 59 } | 60 } |
| 60 | 61 |
| 61 int Font::GetStringWidth(const string16& text) const { | 62 int Font::GetStringWidth(const string16& text) const { |
| 62 return platform_font_->GetStringWidth(text); | 63 return CanvasSkia::GetStringWidth(text, *this); |
| 63 } | 64 } |
| 64 | 65 |
| 65 int Font::GetExpectedTextWidth(int length) const { | 66 int Font::GetExpectedTextWidth(int length) const { |
| 66 return platform_font_->GetExpectedTextWidth(length); | 67 return platform_font_->GetExpectedTextWidth(length); |
| 67 } | 68 } |
| 68 | 69 |
| 69 int Font::GetStyle() const { | 70 int Font::GetStyle() const { |
| 70 return platform_font_->GetStyle(); | 71 return platform_font_->GetStyle(); |
| 71 } | 72 } |
| 72 | 73 |
| 73 std::string Font::GetFontName() const { | 74 std::string Font::GetFontName() const { |
| 74 return platform_font_->GetFontName(); | 75 return platform_font_->GetFontName(); |
| 75 } | 76 } |
| 76 | 77 |
| 77 int Font::GetFontSize() const { | 78 int Font::GetFontSize() const { |
| 78 return platform_font_->GetFontSize(); | 79 return platform_font_->GetFontSize(); |
| 79 } | 80 } |
| 80 | 81 |
| 81 NativeFont Font::GetNativeFont() const { | 82 NativeFont Font::GetNativeFont() const { |
| 82 return platform_font_->GetNativeFont(); | 83 return platform_font_->GetNativeFont(); |
| 83 } | 84 } |
| 84 | 85 |
| 85 } // namespace gfx | 86 } // namespace gfx |
| OLD | NEW |