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_win.h" | 5 #include "ui/gfx/platform_font_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <dwrite.h> | 8 #include <dwrite.h> |
9 #include <math.h> | 9 #include <math.h> |
10 #include <windows.h> | 10 #include <windows.h> |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 return GetFontName(); | 306 return GetFontName(); |
307 return base::SysWideToUTF8(localized_font_name); | 307 return base::SysWideToUTF8(localized_font_name); |
308 } | 308 } |
309 | 309 |
310 int PlatformFontWin::GetFontSize() const { | 310 int PlatformFontWin::GetFontSize() const { |
311 return font_ref_->font_size(); | 311 return font_ref_->font_size(); |
312 } | 312 } |
313 | 313 |
314 const FontRenderParams& PlatformFontWin::GetFontRenderParams() const { | 314 const FontRenderParams& PlatformFontWin::GetFontRenderParams() const { |
315 CR_DEFINE_STATIC_LOCAL(const gfx::FontRenderParams, params, | 315 CR_DEFINE_STATIC_LOCAL(const gfx::FontRenderParams, params, |
316 (gfx::GetFontRenderParams(gfx::FontRenderParamsQuery(false), NULL))); | 316 (gfx::GetSystemFontRenderParams( |
| 317 gfx::FontRenderParamsQuery(false), NULL))); |
317 return params; | 318 return params; |
318 } | 319 } |
319 | 320 |
320 NativeFont PlatformFontWin::GetNativeFont() const { | 321 NativeFont PlatformFontWin::GetNativeFont() const { |
321 return font_ref_->hfont(); | 322 return font_ref_->hfont(); |
322 } | 323 } |
323 | 324 |
324 void PlatformFontWin::SetDirectWriteFactory(IDWriteFactory* factory) { | 325 void PlatformFontWin::SetDirectWriteFactory(IDWriteFactory* factory) { |
325 // We grab a reference on the DirectWrite factory. This reference is | 326 // We grab a reference on the DirectWrite factory. This reference is |
326 // leaked, which is ok because skia leaks it as well. | 327 // leaked, which is ok because skia leaks it as well. |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 return new PlatformFontWin(native_font); | 597 return new PlatformFontWin(native_font); |
597 } | 598 } |
598 | 599 |
599 // static | 600 // static |
600 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, | 601 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, |
601 int font_size) { | 602 int font_size) { |
602 return new PlatformFontWin(font_name, font_size); | 603 return new PlatformFontWin(font_name, font_size); |
603 } | 604 } |
604 | 605 |
605 } // namespace gfx | 606 } // namespace gfx |
OLD | NEW |