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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 PlatformFontWin::adjust_font_callback = NULL; | 59 PlatformFontWin::adjust_font_callback = NULL; |
60 PlatformFontWin::GetMinimumFontSizeCallback | 60 PlatformFontWin::GetMinimumFontSizeCallback |
61 PlatformFontWin::get_minimum_font_size_callback = NULL; | 61 PlatformFontWin::get_minimum_font_size_callback = NULL; |
62 | 62 |
63 //////////////////////////////////////////////////////////////////////////////// | 63 //////////////////////////////////////////////////////////////////////////////// |
64 // PlatformFontWin, public | 64 // PlatformFontWin, public |
65 | 65 |
66 PlatformFontWin::PlatformFontWin() : font_ref_(GetBaseFontRef()) { | 66 PlatformFontWin::PlatformFontWin() : font_ref_(GetBaseFontRef()) { |
67 } | 67 } |
68 | 68 |
69 PlatformFontWin::PlatformFontWin(const Font& other) { | |
70 InitWithCopyOfHFONT(other.GetNativeFont()); | |
71 } | |
72 | |
73 PlatformFontWin::PlatformFontWin(NativeFont native_font) { | 69 PlatformFontWin::PlatformFontWin(NativeFont native_font) { |
74 InitWithCopyOfHFONT(native_font); | 70 InitWithCopyOfHFONT(native_font); |
75 } | 71 } |
76 | 72 |
77 PlatformFontWin::PlatformFontWin(const std::string& font_name, | 73 PlatformFontWin::PlatformFontWin(const std::string& font_name, |
78 int font_size) { | 74 int font_size) { |
79 InitWithFontNameAndSize(font_name, font_size); | 75 InitWithFontNameAndSize(font_name, font_size); |
80 } | 76 } |
81 | 77 |
82 //////////////////////////////////////////////////////////////////////////////// | 78 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 258 |
263 //////////////////////////////////////////////////////////////////////////////// | 259 //////////////////////////////////////////////////////////////////////////////// |
264 // PlatformFont, public: | 260 // PlatformFont, public: |
265 | 261 |
266 // static | 262 // static |
267 PlatformFont* PlatformFont::CreateDefault() { | 263 PlatformFont* PlatformFont::CreateDefault() { |
268 return new PlatformFontWin; | 264 return new PlatformFontWin; |
269 } | 265 } |
270 | 266 |
271 // static | 267 // static |
272 PlatformFont* PlatformFont::CreateFromFont(const Font& other) { | |
273 return new PlatformFontWin(other); | |
274 } | |
275 | |
276 // static | |
277 PlatformFont* PlatformFont::CreateFromNativeFont(NativeFont native_font) { | 268 PlatformFont* PlatformFont::CreateFromNativeFont(NativeFont native_font) { |
278 return new PlatformFontWin(native_font); | 269 return new PlatformFontWin(native_font); |
279 } | 270 } |
280 | 271 |
281 // static | 272 // static |
282 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, | 273 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, |
283 int font_size) { | 274 int font_size) { |
284 return new PlatformFontWin(font_name, font_size); | 275 return new PlatformFontWin(font_name, font_size); |
285 } | 276 } |
286 | 277 |
287 } // namespace gfx | 278 } // namespace gfx |
OLD | NEW |