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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 // Returns the GDI metrics for the font passed in. | 74 // Returns the GDI metrics for the font passed in. |
75 static void GetTextMetricsForFont(HDC hdc, | 75 static void GetTextMetricsForFont(HDC hdc, |
76 HFONT font, | 76 HFONT font, |
77 TEXTMETRIC* text_metrics); | 77 TEXTMETRIC* text_metrics); |
78 | 78 |
79 // Returns the size of the font based on the font information passed in. | 79 // Returns the size of the font based on the font information passed in. |
80 static int GetFontSize(const LOGFONT& font_info); | 80 static int GetFontSize(const LOGFONT& font_info); |
81 | 81 |
82 private: | 82 private: |
83 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_UniscribeFallback); | 83 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, HarfBuzz_UniscribeFallback); |
84 FRIEND_TEST_ALL_PREFIXES(PlatformFontWinTest, Metrics_SkiaVersusGDI); | 84 FRIEND_TEST_ALL_PREFIXES(PlatformFontWinTest, Metrics_SkiaVersusGDI); |
85 FRIEND_TEST_ALL_PREFIXES(PlatformFontWinTest, DirectWriteFontSubstitution); | 85 FRIEND_TEST_ALL_PREFIXES(PlatformFontWinTest, DirectWriteFontSubstitution); |
86 | 86 |
87 ~PlatformFontWin() override; | 87 ~PlatformFontWin() override; |
88 | 88 |
89 // Chrome text drawing bottoms out in the Windows GDI functions that take an | 89 // Chrome text drawing bottoms out in the Windows GDI functions that take an |
90 // HFONT (an opaque handle into Windows). To avoid lots of GDI object | 90 // HFONT (an opaque handle into Windows). To avoid lots of GDI object |
91 // allocation and destruction, Font indirectly refers to the HFONT by way of | 91 // allocation and destruction, Font indirectly refers to the HFONT by way of |
92 // an HFontRef. That is, every Font has an HFontRef, which has an HFONT. | 92 // an HFontRef. That is, every Font has an HFontRef, which has an HFONT. |
93 // | 93 // |
(...skipping 27 matching lines...) Expand all Loading... |
121 | 121 |
122 // Returns the average character width in dialog units. | 122 // Returns the average character width in dialog units. |
123 int GetDluBaseX(); | 123 int GetDluBaseX(); |
124 | 124 |
125 // Helper to return the average character width using the text extent | 125 // Helper to return the average character width using the text extent |
126 // technique mentioned here. http://support.microsoft.com/kb/125681. | 126 // technique mentioned here. http://support.microsoft.com/kb/125681. |
127 static int GetAverageCharWidthInDialogUnits(HFONT gdi_font); | 127 static int GetAverageCharWidthInDialogUnits(HFONT gdi_font); |
128 | 128 |
129 private: | 129 private: |
130 friend class base::RefCounted<HFontRef>; | 130 friend class base::RefCounted<HFontRef>; |
131 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_UniscribeFallback); | 131 FRIEND_TEST_ALL_PREFIXES(RenderTextHarfBuzzTest, |
| 132 HarfBuzz_UniscribeFallback); |
132 FRIEND_TEST_ALL_PREFIXES(PlatformFontWinTest, Metrics_SkiaVersusGDI); | 133 FRIEND_TEST_ALL_PREFIXES(PlatformFontWinTest, Metrics_SkiaVersusGDI); |
133 FRIEND_TEST_ALL_PREFIXES(PlatformFontWinTest, DirectWriteFontSubstitution); | 134 FRIEND_TEST_ALL_PREFIXES(PlatformFontWinTest, DirectWriteFontSubstitution); |
134 | 135 |
135 ~HFontRef(); | 136 ~HFontRef(); |
136 | 137 |
137 const HFONT hfont_; | 138 const HFONT hfont_; |
138 const int font_size_; | 139 const int font_size_; |
139 const int height_; | 140 const int height_; |
140 const int baseline_; | 141 const int baseline_; |
141 const int cap_height_; | 142 const int cap_height_; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 208 |
208 // Returns the family name for the |IDWriteFont| interface passed in. | 209 // Returns the family name for the |IDWriteFont| interface passed in. |
209 // The family name is returned in the |family_name| parameter. | 210 // The family name is returned in the |family_name| parameter. |
210 // Returns S_OK on success. | 211 // Returns S_OK on success. |
211 HRESULT GetFamilyNameFromDirectWriteFont(IDWriteFont* dwrite_font, | 212 HRESULT GetFamilyNameFromDirectWriteFont(IDWriteFont* dwrite_font, |
212 base::string16* family_name); | 213 base::string16* family_name); |
213 | 214 |
214 } // namespace gfx | 215 } // namespace gfx |
215 | 216 |
216 #endif // UI_GFX_PLATFORM_FONT_WIN_H_ | 217 #endif // UI_GFX_PLATFORM_FONT_WIN_H_ |
OLD | NEW |