OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/platform_font.h" | 8 #include "ui/gfx/platform_font.h" |
9 | 9 |
10 namespace gfx { | 10 namespace gfx { |
(...skipping 24 matching lines...) Expand all Loading... |
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 } |
44 | 44 |
| 45 Font Font::DeriveFontScaled(float size_scale) const { |
| 46 return DeriveFont(static_cast<int>((size_scale-1.0)*GetFontSize())); |
| 47 } |
| 48 |
45 Font Font::DeriveFont(int size_delta, int style) const { | 49 Font Font::DeriveFont(int size_delta, int style) const { |
46 return platform_font_->DeriveFont(size_delta, style); | 50 return platform_font_->DeriveFont(size_delta, style); |
47 } | 51 } |
48 | 52 |
49 int Font::GetHeight() const { | 53 int Font::GetHeight() const { |
50 return platform_font_->GetHeight(); | 54 return platform_font_->GetHeight(); |
51 } | 55 } |
52 | 56 |
53 int Font::GetBaseline() const { | 57 int Font::GetBaseline() const { |
54 return platform_font_->GetBaseline(); | 58 return platform_font_->GetBaseline(); |
(...skipping 21 matching lines...) Expand all Loading... |
76 | 80 |
77 int Font::GetFontSize() const { | 81 int Font::GetFontSize() const { |
78 return platform_font_->GetFontSize(); | 82 return platform_font_->GetFontSize(); |
79 } | 83 } |
80 | 84 |
81 NativeFont Font::GetNativeFont() const { | 85 NativeFont Font::GetNativeFont() const { |
82 return platform_font_->GetNativeFont(); | 86 return platform_font_->GetNativeFont(); |
83 } | 87 } |
84 | 88 |
85 } // namespace gfx | 89 } // namespace gfx |
OLD | NEW |