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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 // performed other than clamping to a minimum font height if | 42 // performed other than clamping to a minimum font height if |
43 // |get_minimum_font_size_callback| is specified. | 43 // |get_minimum_font_size_callback| is specified. |
44 typedef void (*AdjustFontCallback)(LOGFONT* lf); | 44 typedef void (*AdjustFontCallback)(LOGFONT* lf); |
45 static AdjustFontCallback adjust_font_callback; | 45 static AdjustFontCallback adjust_font_callback; |
46 | 46 |
47 // Returns the font name for the system locale. Some fonts, particularly | 47 // Returns the font name for the system locale. Some fonts, particularly |
48 // East Asian fonts, have different names per locale. If the localized font | 48 // East Asian fonts, have different names per locale. If the localized font |
49 // name could not be retrieved, returns GetFontName(). | 49 // name could not be retrieved, returns GetFontName(). |
50 std::string GetLocalizedFontName() const; | 50 std::string GetLocalizedFontName() const; |
51 | 51 |
52 // Returns a derived Font with the specified |style| and with height at most | 52 // Returns a derived Font with the specified |style| and with height at most |
msw
2015/01/13 21:59:57
Update this comment to something like:
// Return
ananta
2015/01/13 22:21:46
Done.
| |
53 // |height|. If the height and style of the receiver already match, it is | 53 // |height|. If the height and style of the receiver already match, it is |
54 // returned. Otherwise, the returned Font will have the largest size such that | 54 // returned. Otherwise, the returned Font will have the largest size such that |
55 // its height is less than or equal to |height| (since there may not exist a | 55 // its height is less than or equal to |height| (since there may not exist a |
56 // size that matches the exact |height| specified). | 56 // size that matches the exact |height| specified). |
57 Font DeriveFontWithHeight(int height, int style); | 57 Font DeriveFontWithHeight(int height, int style); |
58 | 58 |
59 // Overridden from PlatformFont: | 59 // Overridden from PlatformFont: |
60 virtual Font DeriveFont(int size_delta, int style) const override; | 60 virtual Font DeriveFont(int size_delta, int style) const override; |
61 virtual int GetHeight() const override; | 61 virtual int GetHeight() const override; |
62 virtual int GetBaseline() const override; | 62 virtual int GetBaseline() const override; |
(...skipping 102 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 | |
179 // Creates and returns a new HFontRef from the specified HFONT using metrics | 175 // Creates and returns a new HFontRef from the specified HFONT using metrics |
180 // from skia. Currently this is only used if we use DirectWrite for font | 176 // from skia. Currently this is only used if we use DirectWrite for font |
181 // metrics. | 177 // metrics. |
182 // |gdi_font| : Handle to the GDI font created via CreateFontIndirect. | 178 // |gdi_font| : Handle to the GDI font created via CreateFontIndirect. |
183 // |font_metrics| : The GDI font metrics retrieved via the GetTextMetrics | 179 // |font_metrics| : The GDI font metrics retrieved via the GetTextMetrics |
184 // API. This is currently used to calculate the correct height of the font | 180 // API. This is currently used to calculate the correct height of the font |
185 // in case we get a font created with a positive height. | 181 // in case we get a font created with a positive height. |
186 // A positive height represents the cell height (ascent + descent). | 182 // A positive height represents the cell height (ascent + descent). |
187 // A negative height represents the character Em height which is cell | 183 // A negative height represents the character Em height which is cell |
188 // height minus the internal leading value. | 184 // height minus the internal leading value. |
(...skipping 13 matching lines...) Expand all Loading... | |
202 | 198 |
203 // Pointer to the global IDWriteFactory interface. | 199 // Pointer to the global IDWriteFactory interface. |
204 static IDWriteFactory* direct_write_factory_; | 200 static IDWriteFactory* direct_write_factory_; |
205 | 201 |
206 DISALLOW_COPY_AND_ASSIGN(PlatformFontWin); | 202 DISALLOW_COPY_AND_ASSIGN(PlatformFontWin); |
207 }; | 203 }; |
208 | 204 |
209 } // namespace gfx | 205 } // namespace gfx |
210 | 206 |
211 #endif // UI_GFX_PLATFORM_FONT_WIN_H_ | 207 #endif // UI_GFX_PLATFORM_FONT_WIN_H_ |
OLD | NEW |