| 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> |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 194 |
| 195 void PlatformFontWin::InitWithCopyOfHFONT(HFONT hfont) { | 195 void PlatformFontWin::InitWithCopyOfHFONT(HFONT hfont) { |
| 196 DCHECK(hfont); | 196 DCHECK(hfont); |
| 197 LOGFONT font_info; | 197 LOGFONT font_info; |
| 198 GetObject(hfont, sizeof(LOGFONT), &font_info); | 198 GetObject(hfont, sizeof(LOGFONT), &font_info); |
| 199 font_ref_ = CreateHFontRef(CreateFontIndirect(&font_info)); | 199 font_ref_ = CreateHFontRef(CreateFontIndirect(&font_info)); |
| 200 } | 200 } |
| 201 | 201 |
| 202 void PlatformFontWin::InitWithFontNameAndSize(const std::string& font_name, | 202 void PlatformFontWin::InitWithFontNameAndSize(const std::string& font_name, |
| 203 int font_size) { | 203 int font_size) { |
| 204 HFONT hf = ::CreateFont(-font_size, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, | 204 HFONT hf = ::CreateFont(-font_size, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 205 DEFAULT_CHARSET, | |
| 206 OUT_DEFAULT_PRECIS, | |
| 207 CLIP_DEFAULT_PRECIS, | |
| 208 DEFAULT_QUALITY, | |
| 209 DEFAULT_PITCH | FF_DONTCARE, | |
| 210 base::UTF8ToUTF16(font_name).c_str()); | 205 base::UTF8ToUTF16(font_name).c_str()); |
| 211 font_ref_ = CreateHFontRef(hf); | 206 font_ref_ = CreateHFontRef(hf); |
| 212 } | 207 } |
| 213 | 208 |
| 214 // static | 209 // static |
| 215 PlatformFontWin::HFontRef* PlatformFontWin::GetBaseFontRef() { | 210 PlatformFontWin::HFontRef* PlatformFontWin::GetBaseFontRef() { |
| 216 if (base_font_ref_ == NULL) { | 211 if (base_font_ref_ == NULL) { |
| 217 NONCLIENTMETRICS metrics; | 212 NONCLIENTMETRICS metrics; |
| 218 base::win::GetNonClientMetrics(&metrics); | 213 base::win::GetNonClientMetrics(&metrics); |
| 219 | 214 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 return new PlatformFontWin(native_font); | 322 return new PlatformFontWin(native_font); |
| 328 } | 323 } |
| 329 | 324 |
| 330 // static | 325 // static |
| 331 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, | 326 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, |
| 332 int font_size) { | 327 int font_size) { |
| 333 return new PlatformFontWin(font_name, font_size); | 328 return new PlatformFontWin(font_name, font_size); |
| 334 } | 329 } |
| 335 | 330 |
| 336 } // namespace gfx | 331 } // namespace gfx |
| OLD | NEW |