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/platform_font_mac.h" | 5 #include "ui/gfx/platform_font_mac.h" |
6 | 6 |
7 #include <Cocoa/Cocoa.h> | 7 #include <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/scoped_nsobject.h" | 10 #include "base/memory/scoped_nsobject.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 56 } |
57 | 57 |
58 int PlatformFontMac::GetBaseline() const { | 58 int PlatformFontMac::GetBaseline() const { |
59 return ascent_; | 59 return ascent_; |
60 } | 60 } |
61 | 61 |
62 int PlatformFontMac::GetAverageCharacterWidth() const { | 62 int PlatformFontMac::GetAverageCharacterWidth() const { |
63 return average_width_; | 63 return average_width_; |
64 } | 64 } |
65 | 65 |
66 int PlatformFontMac::GetStringWidth(const string16& text) const { | 66 int PlatformFontMac::GetStringWidth(const base::string16& text) const { |
67 return Canvas::GetStringWidth(text, | 67 return Canvas::GetStringWidth(text, |
68 Font(const_cast<PlatformFontMac*>(this))); | 68 Font(const_cast<PlatformFontMac*>(this))); |
69 } | 69 } |
70 | 70 |
71 int PlatformFontMac::GetExpectedTextWidth(int length) const { | 71 int PlatformFontMac::GetExpectedTextWidth(int length) const { |
72 return length * average_width_; | 72 return length * average_width_; |
73 } | 73 } |
74 | 74 |
75 int PlatformFontMac::GetStyle() const { | 75 int PlatformFontMac::GetStyle() const { |
76 return style_; | 76 return style_; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 } | 146 } |
147 | 147 |
148 // static | 148 // static |
149 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, | 149 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, |
150 int font_size) { | 150 int font_size) { |
151 return new PlatformFontMac(font_name, font_size); | 151 return new PlatformFontMac(font_name, font_size); |
152 } | 152 } |
153 | 153 |
154 } // namespace gfx | 154 } // namespace gfx |
155 | 155 |
OLD | NEW |