Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: ui/gfx/platform_font_mac.mm

Issue 789583002: Updates subpixel positioning and hinting when DSF is changed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: GN Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(false);
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::GetSystemFontRenderParams(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
OLDNEW
« ui/gfx/font_render_params.h ('K') | « ui/gfx/gfx.gyp ('k') | ui/gfx/platform_font_pango.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698