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 #ifndef UI_GFX_PLATFORM_FONT_WIN_H_ | 5 #ifndef UI_GFX_PLATFORM_FONT_WIN_H_ |
6 #define UI_GFX_PLATFORM_FONT_WIN_H_ | 6 #define UI_GFX_PLATFORM_FONT_WIN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "ui/base/ui_export.h" | 13 #include "ui/base/ui_export.h" |
14 #include "ui/gfx/platform_font.h" | 14 #include "ui/gfx/platform_font.h" |
15 | 15 |
16 namespace gfx { | 16 namespace gfx { |
17 | 17 |
18 class UI_EXPORT PlatformFontWin : public PlatformFont { | 18 class UI_EXPORT PlatformFontWin : public PlatformFont { |
19 public: | 19 public: |
20 PlatformFontWin(); | 20 PlatformFontWin(); |
21 explicit PlatformFontWin(const Font& other); | |
22 explicit PlatformFontWin(NativeFont native_font); | 21 explicit PlatformFontWin(NativeFont native_font); |
23 PlatformFontWin(const std::string& font_name, int font_size); | 22 PlatformFontWin(const std::string& font_name, int font_size); |
24 | 23 |
25 // Dialog units to pixels conversion. | 24 // Dialog units to pixels conversion. |
26 // See http://support.microsoft.com/kb/145994 for details. | 25 // See http://support.microsoft.com/kb/145994 for details. |
27 int horizontal_dlus_to_pixels(int dlus) const { | 26 int horizontal_dlus_to_pixels(int dlus) const { |
28 return dlus * font_ref_->GetDluBaseX() / 4; | 27 return dlus * font_ref_->GetDluBaseX() / 4; |
29 } | 28 } |
30 int vertical_dlus_to_pixels(int dlus) const { | 29 int vertical_dlus_to_pixels(int dlus) const { |
31 return dlus * font_ref_->height() / 8; | 30 return dlus * font_ref_->height() / 8; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 static HFontRef* base_font_ref_; | 133 static HFontRef* base_font_ref_; |
135 | 134 |
136 // Indirect reference to the HFontRef, which references the underlying HFONT. | 135 // Indirect reference to the HFontRef, which references the underlying HFONT. |
137 scoped_refptr<HFontRef> font_ref_; | 136 scoped_refptr<HFontRef> font_ref_; |
138 }; | 137 }; |
139 | 138 |
140 } // namespace gfx | 139 } // namespace gfx |
141 | 140 |
142 #endif // UI_GFX_PLATFORM_FONT_WIN_H_ | 141 #endif // UI_GFX_PLATFORM_FONT_WIN_H_ |
143 | 142 |
OLD | NEW |