| 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 CLIP_DEFAULT_PRECIS, | 221 CLIP_DEFAULT_PRECIS, |
| 222 DEFAULT_QUALITY, | 222 DEFAULT_QUALITY, |
| 223 DEFAULT_PITCH | FF_DONTCARE, | 223 DEFAULT_PITCH | FF_DONTCARE, |
| 224 base::UTF8ToUTF16(font_name).c_str()); | 224 base::UTF8ToUTF16(font_name).c_str()); |
| 225 font_ref_ = CreateHFontRef(hf); | 225 font_ref_ = CreateHFontRef(hf); |
| 226 } | 226 } |
| 227 | 227 |
| 228 // static | 228 // static |
| 229 PlatformFontWin::HFontRef* PlatformFontWin::GetBaseFontRef() { | 229 PlatformFontWin::HFontRef* PlatformFontWin::GetBaseFontRef() { |
| 230 if (base_font_ref_ == NULL) { | 230 if (base_font_ref_ == NULL) { |
| 231 NONCLIENTMETRICS metrics; | 231 NONCLIENTMETRICS_XP metrics; |
| 232 base::win::GetNonClientMetrics(&metrics); | 232 base::win::GetNonClientMetrics(&metrics); |
| 233 | 233 |
| 234 if (adjust_font_callback) | 234 if (adjust_font_callback) |
| 235 adjust_font_callback(&metrics.lfMessageFont); | 235 adjust_font_callback(&metrics.lfMessageFont); |
| 236 metrics.lfMessageFont.lfHeight = | 236 metrics.lfMessageFont.lfHeight = |
| 237 AdjustFontSize(metrics.lfMessageFont.lfHeight, 0); | 237 AdjustFontSize(metrics.lfMessageFont.lfHeight, 0); |
| 238 HFONT font = CreateFontIndirect(&metrics.lfMessageFont); | 238 HFONT font = CreateFontIndirect(&metrics.lfMessageFont); |
| 239 DLOG_ASSERT(font); | 239 DLOG_ASSERT(font); |
| 240 base_font_ref_ = PlatformFontWin::CreateHFontRef(font); | 240 base_font_ref_ = PlatformFontWin::CreateHFontRef(font); |
| 241 // base_font_ref_ is global, up the ref count so it's never deleted. | 241 // base_font_ref_ is global, up the ref count so it's never deleted. |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 return new PlatformFontWin(native_font); | 377 return new PlatformFontWin(native_font); |
| 378 } | 378 } |
| 379 | 379 |
| 380 // static | 380 // static |
| 381 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, | 381 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, |
| 382 int font_size) { | 382 int font_size) { |
| 383 return new PlatformFontWin(font_name, font_size); | 383 return new PlatformFontWin(font_name, font_size); |
| 384 } | 384 } |
| 385 | 385 |
| 386 } // namespace gfx | 386 } // namespace gfx |
| OLD | NEW |