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 <windows.h> | 7 #include <windows.h> |
8 #include <math.h> | 8 #include <math.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/macros.h" |
14 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
15 #include "base/strings/sys_string_conversions.h" | 16 #include "base/strings/sys_string_conversions.h" |
16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
17 #include "base/win/scoped_gdi_object.h" | 18 #include "base/win/scoped_gdi_object.h" |
18 #include "base/win/scoped_hdc.h" | 19 #include "base/win/scoped_hdc.h" |
19 #include "base/win/scoped_select_object.h" | 20 #include "base/win/scoped_select_object.h" |
20 #include "base/win/win_util.h" | 21 #include "base/win/win_util.h" |
21 #include "ui/gfx/canvas.h" | 22 #include "ui/gfx/canvas.h" |
22 #include "ui/gfx/font.h" | 23 #include "ui/gfx/font.h" |
23 #include "ui/gfx/font_render_params.h" | 24 #include "ui/gfx/font_render_params.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 if (length <= 0) | 187 if (length <= 0) |
187 return GetFontName(); | 188 return GetFontName(); |
188 return base::SysWideToUTF8(localized_font_name); | 189 return base::SysWideToUTF8(localized_font_name); |
189 } | 190 } |
190 | 191 |
191 int PlatformFontWin::GetFontSize() const { | 192 int PlatformFontWin::GetFontSize() const { |
192 return font_ref_->font_size(); | 193 return font_ref_->font_size(); |
193 } | 194 } |
194 | 195 |
195 const FontRenderParams& PlatformFontWin::GetFontRenderParams() const { | 196 const FontRenderParams& PlatformFontWin::GetFontRenderParams() const { |
196 return GetDefaultFontRenderParams(); | 197 CR_DEFINE_STATIC_LOCAL(const gfx::FontRenderParams, params, |
| 198 (gfx::GetFontRenderParams(gfx::FontRenderParamsQuery(false), NULL))); |
| 199 return params; |
197 } | 200 } |
198 | 201 |
199 NativeFont PlatformFontWin::GetNativeFont() const { | 202 NativeFont PlatformFontWin::GetNativeFont() const { |
200 return font_ref_->hfont(); | 203 return font_ref_->hfont(); |
201 } | 204 } |
202 | 205 |
203 //////////////////////////////////////////////////////////////////////////////// | 206 //////////////////////////////////////////////////////////////////////////////// |
204 // Font, private: | 207 // Font, private: |
205 | 208 |
206 void PlatformFontWin::InitWithCopyOfHFONT(HFONT hfont) { | 209 void PlatformFontWin::InitWithCopyOfHFONT(HFONT hfont) { |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 return new PlatformFontWin(native_font); | 377 return new PlatformFontWin(native_font); |
375 } | 378 } |
376 | 379 |
377 // static | 380 // static |
378 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, | 381 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, |
379 int font_size) { | 382 int font_size) { |
380 return new PlatformFontWin(font_name, font_size); | 383 return new PlatformFontWin(font_name, font_size); |
381 } | 384 } |
382 | 385 |
383 } // namespace gfx | 386 } // namespace gfx |
OLD | NEW |