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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 } | 163 } |
164 | 164 |
165 base::scoped_nsobject<NSLayoutManager> layout_manager( | 165 base::scoped_nsobject<NSLayoutManager> layout_manager( |
166 [[NSLayoutManager alloc] init]); | 166 [[NSLayoutManager alloc] init]); |
167 height_ = SkScalarCeilToInt([layout_manager defaultLineHeightForFont:font]); | 167 height_ = SkScalarCeilToInt([layout_manager defaultLineHeightForFont:font]); |
168 ascent_ = SkScalarCeilToInt([font ascender]); | 168 ascent_ = SkScalarCeilToInt([font ascender]); |
169 cap_height_ = SkScalarCeilToInt([font capHeight]); | 169 cap_height_ = SkScalarCeilToInt([font capHeight]); |
170 average_width_ = | 170 average_width_ = |
171 NSWidth([font boundingRectForGlyph:[font glyphWithName:@"x"]]); | 171 NSWidth([font boundingRectForGlyph:[font glyphWithName:@"x"]]); |
172 | 172 |
173 FontRenderParamsQuery query(false); | 173 FontRenderParamsQuery query(); |
Daniel Erat
2015/04/06 12:23:29
nit: remove parentheses
stapelberg
2015/04/06 13:14:48
Done.
| |
174 query.families.push_back(font_name_); | 174 query.families.push_back(font_name_); |
175 query.pixel_size = font_size_; | 175 query.pixel_size = font_size_; |
176 query.style = font_style_; | 176 query.style = font_style_; |
177 render_params_ = gfx::GetFontRenderParams(query, NULL); | 177 render_params_ = gfx::GetFontRenderParams(query, NULL); |
178 } | 178 } |
179 | 179 |
180 //////////////////////////////////////////////////////////////////////////////// | 180 //////////////////////////////////////////////////////////////////////////////// |
181 // PlatformFont, public: | 181 // PlatformFont, public: |
182 | 182 |
183 // static | 183 // static |
184 PlatformFont* PlatformFont::CreateDefault() { | 184 PlatformFont* PlatformFont::CreateDefault() { |
185 return new PlatformFontMac; | 185 return new PlatformFontMac; |
186 } | 186 } |
187 | 187 |
188 // static | 188 // static |
189 PlatformFont* PlatformFont::CreateFromNativeFont(NativeFont native_font) { | 189 PlatformFont* PlatformFont::CreateFromNativeFont(NativeFont native_font) { |
190 return new PlatformFontMac(native_font); | 190 return new PlatformFontMac(native_font); |
191 } | 191 } |
192 | 192 |
193 // static | 193 // static |
194 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, | 194 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, |
195 int font_size) { | 195 int font_size) { |
196 return new PlatformFontMac(font_name, font_size); | 196 return new PlatformFontMac(font_name, font_size); |
197 } | 197 } |
198 | 198 |
199 } // namespace gfx | 199 } // namespace gfx |
OLD | NEW |