| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 static HFontRef* GetBaseFontRef(); | 165 static HFontRef* GetBaseFontRef(); |
| 166 | 166 |
| 167 // Creates and returns a new HFontRef from the specified HFONT. | 167 // Creates and returns a new HFontRef from the specified HFONT. |
| 168 static HFontRef* CreateHFontRef(HFONT font); | 168 static HFontRef* CreateHFontRef(HFONT font); |
| 169 | 169 |
| 170 // Creates and returns a new HFontRef from the specified HFONT. Uses provided | 170 // Creates and returns a new HFontRef from the specified HFONT. Uses provided |
| 171 // |font_metrics| instead of calculating new one. | 171 // |font_metrics| instead of calculating new one. |
| 172 static HFontRef* CreateHFontRefFromGDI(HFONT font, | 172 static HFontRef* CreateHFontRefFromGDI(HFONT font, |
| 173 const TEXTMETRIC& font_metrics); | 173 const TEXTMETRIC& font_metrics); |
| 174 | 174 |
| 175 // Returns a largest derived Font whose height does not exceed the height of |
| 176 // |base_font|. |
| 177 static Font DeriveWithCorrectedSize(HFONT base_font); |
| 178 |
| 175 // Creates and returns a new HFontRef from the specified HFONT using metrics | 179 // Creates and returns a new HFontRef from the specified HFONT using metrics |
| 176 // from skia. Currently this is only used if we use DirectWrite for font | 180 // from skia. Currently this is only used if we use DirectWrite for font |
| 177 // metrics. | 181 // metrics. |
| 178 // |gdi_font| : Handle to the GDI font created via CreateFontIndirect. | 182 // |gdi_font| : Handle to the GDI font created via CreateFontIndirect. |
| 179 // |font_metrics| : The GDI font metrics retrieved via the GetTextMetrics | 183 // |font_metrics| : The GDI font metrics retrieved via the GetTextMetrics |
| 180 // API. This is currently used to calculate the correct height of the font | 184 // API. This is currently used to calculate the correct height of the font |
| 181 // in case we get a font created with a positive height. | 185 // in case we get a font created with a positive height. |
| 182 // A positive height represents the cell height (ascent + descent). | 186 // A positive height represents the cell height (ascent + descent). |
| 183 // A negative height represents the character Em height which is cell | 187 // A negative height represents the character Em height which is cell |
| 184 // height minus the internal leading value. | 188 // height minus the internal leading value. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 198 | 202 |
| 199 // Pointer to the global IDWriteFactory interface. | 203 // Pointer to the global IDWriteFactory interface. |
| 200 static IDWriteFactory* direct_write_factory_; | 204 static IDWriteFactory* direct_write_factory_; |
| 201 | 205 |
| 202 DISALLOW_COPY_AND_ASSIGN(PlatformFontWin); | 206 DISALLOW_COPY_AND_ASSIGN(PlatformFontWin); |
| 203 }; | 207 }; |
| 204 | 208 |
| 205 } // namespace gfx | 209 } // namespace gfx |
| 206 | 210 |
| 207 #endif // UI_GFX_PLATFORM_FONT_WIN_H_ | 211 #endif // UI_GFX_PLATFORM_FONT_WIN_H_ |
| OLD | NEW |