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/mac/scoped_nsobject.h" | 10 #include "base/mac/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::GetCapHeight() const { | 62 int PlatformFontMac::GetCapHeight() const { |
63 return cap_height_; | 63 return cap_height_; |
64 } | 64 } |
65 | 65 |
66 int PlatformFontMac::GetAverageCharacterWidth() const { | 66 float PlatformFontMac::GetAverageCharacterWidth() const { |
67 return average_width_; | 67 return average_width_; |
68 } | 68 } |
69 | 69 |
70 int PlatformFontMac::GetStringWidth(const base::string16& text) const { | 70 float PlatformFontMac::GetStringWidth(const base::string16& text) const { |
71 return Canvas::GetStringWidth(text, | 71 return Canvas::GetStringWidth(text, |
72 Font(const_cast<PlatformFontMac*>(this))); | 72 Font(const_cast<PlatformFontMac*>(this))); |
73 } | 73 } |
74 | 74 |
75 int PlatformFontMac::GetExpectedTextWidth(int length) const { | 75 float PlatformFontMac::GetExpectedTextWidth(int length) const { |
76 return length * average_width_; | 76 return length * average_width_; |
77 } | 77 } |
78 | 78 |
79 int PlatformFontMac::GetStyle() const { | 79 int PlatformFontMac::GetStyle() const { |
80 return style_; | 80 return style_; |
81 } | 81 } |
82 | 82 |
83 std::string PlatformFontMac::GetFontName() const { | 83 std::string PlatformFontMac::GetFontName() const { |
84 return font_name_; | 84 return font_name_; |
85 } | 85 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 return new PlatformFontMac(native_font); | 150 return new PlatformFontMac(native_font); |
151 } | 151 } |
152 | 152 |
153 // static | 153 // static |
154 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, | 154 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, |
155 int font_size) { | 155 int font_size) { |
156 return new PlatformFontMac(font_name, font_size); | 156 return new PlatformFontMac(font_name, font_size); |
157 } | 157 } |
158 | 158 |
159 } // namespace gfx | 159 } // namespace gfx |
OLD | NEW |