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 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 void InitWithFontNameAndSize(const std::string& font_name, | 135 void InitWithFontNameAndSize(const std::string& font_name, |
136 int font_size); | 136 int font_size); |
137 | 137 |
138 // Returns the base font ref. This should ONLY be invoked on the | 138 // Returns the base font ref. This should ONLY be invoked on the |
139 // UI thread. | 139 // UI thread. |
140 static HFontRef* GetBaseFontRef(); | 140 static HFontRef* GetBaseFontRef(); |
141 | 141 |
142 // Creates and returns a new HFONTRef from the specified HFONT. | 142 // Creates and returns a new HFONTRef from the specified HFONT. |
143 static HFontRef* CreateHFontRef(HFONT font); | 143 static HFontRef* CreateHFontRef(HFONT font); |
144 | 144 |
| 145 // Creates and returns a new HFONTRef from the specified HFONT. Uses provided |
| 146 // |font_metrics| instead of calculating new one. |
| 147 static HFontRef* CreateHFontRef(HFONT font, const TEXTMETRIC& font_metrics); |
| 148 |
| 149 // Returns a largest derived Font whose height does not exceed the height of |
| 150 // |base_font|. |
| 151 static Font DeriveWithCorrectedSize(HFONT base_font); |
| 152 |
145 // Creates a new PlatformFontWin with the specified HFontRef. Used when | 153 // Creates a new PlatformFontWin with the specified HFontRef. Used when |
146 // constructing a Font from a HFONT we don't want to copy. | 154 // constructing a Font from a HFONT we don't want to copy. |
147 explicit PlatformFontWin(HFontRef* hfont_ref); | 155 explicit PlatformFontWin(HFontRef* hfont_ref); |
148 | 156 |
149 // Reference to the base font all fonts are derived from. | 157 // Reference to the base font all fonts are derived from. |
150 static HFontRef* base_font_ref_; | 158 static HFontRef* base_font_ref_; |
151 | 159 |
152 // Indirect reference to the HFontRef, which references the underlying HFONT. | 160 // Indirect reference to the HFontRef, which references the underlying HFONT. |
153 scoped_refptr<HFontRef> font_ref_; | 161 scoped_refptr<HFontRef> font_ref_; |
154 | 162 |
155 DISALLOW_COPY_AND_ASSIGN(PlatformFontWin); | 163 DISALLOW_COPY_AND_ASSIGN(PlatformFontWin); |
156 }; | 164 }; |
157 | 165 |
158 } // namespace gfx | 166 } // namespace gfx |
159 | 167 |
160 #endif // UI_GFX_PLATFORM_FONT_WIN_H_ | 168 #endif // UI_GFX_PLATFORM_FONT_WIN_H_ |
OLD | NEW |