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