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" |
11 #include "base/strings/sys_string_conversions.h" | 11 #include "base/strings/sys_string_conversions.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "ui/gfx/canvas.h" | 13 #include "ui/gfx/canvas.h" |
14 #include "ui/gfx/font.h" | 14 #include "ui/gfx/font.h" |
| 15 #include "ui/gfx/font_render_params.h" |
15 | 16 |
16 namespace gfx { | 17 namespace gfx { |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 // Returns an autoreleased NSFont created with the passed-in specifications. | 21 // Returns an autoreleased NSFont created with the passed-in specifications. |
21 NSFont* NSFontWithSpec(const std::string& font_name, | 22 NSFont* NSFontWithSpec(const std::string& font_name, |
22 int font_size, | 23 int font_size, |
23 int font_style) { | 24 int font_style) { |
24 NSFontSymbolicTraits trait_bits = 0; | 25 NSFontSymbolicTraits trait_bits = 0; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 } | 119 } |
119 | 120 |
120 std::string PlatformFontMac::GetActualFontNameForTesting() const { | 121 std::string PlatformFontMac::GetActualFontNameForTesting() const { |
121 return base::SysNSStringToUTF8([native_font_ familyName]); | 122 return base::SysNSStringToUTF8([native_font_ familyName]); |
122 } | 123 } |
123 | 124 |
124 int PlatformFontMac::GetFontSize() const { | 125 int PlatformFontMac::GetFontSize() const { |
125 return font_size_; | 126 return font_size_; |
126 } | 127 } |
127 | 128 |
| 129 const FontRenderParams& PlatformFontMac::GetFontRenderParams() const { |
| 130 NOTIMPLEMENTED(); |
| 131 static FontRenderParams params; |
| 132 return params; |
| 133 } |
| 134 |
128 NativeFont PlatformFontMac::GetNativeFont() const { | 135 NativeFont PlatformFontMac::GetNativeFont() const { |
129 return [[native_font_.get() retain] autorelease]; | 136 return [[native_font_.get() retain] autorelease]; |
130 } | 137 } |
131 | 138 |
132 //////////////////////////////////////////////////////////////////////////////// | 139 //////////////////////////////////////////////////////////////////////////////// |
133 // PlatformFontMac, private: | 140 // PlatformFontMac, private: |
134 | 141 |
135 PlatformFontMac::PlatformFontMac(const std::string& font_name, | 142 PlatformFontMac::PlatformFontMac(const std::string& font_name, |
136 int font_size, | 143 int font_size, |
137 int font_style) | 144 int font_style) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 return new PlatformFontMac(native_font); | 186 return new PlatformFontMac(native_font); |
180 } | 187 } |
181 | 188 |
182 // static | 189 // static |
183 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, | 190 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, |
184 int font_size) { | 191 int font_size) { |
185 return new PlatformFontMac(font_name, font_size); | 192 return new PlatformFontMac(font_name, font_size); |
186 } | 193 } |
187 | 194 |
188 } // namespace gfx | 195 } // namespace gfx |
OLD | NEW |