Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: ui/gfx/font_render_params.h

Issue 413003002: Add FontRenderParamsQuery. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_FONT_RENDER_PARAMS_H_ 5 #ifndef UI_GFX_FONT_RENDER_PARAMS_H_
6 #define UI_GFX_FONT_RENDER_PARAMS_H_ 6 #define UI_GFX_FONT_RENDER_PARAMS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 bool autohinter; 47 bool autohinter;
48 48
49 // Should embedded bitmaps in fonts should be used? 49 // Should embedded bitmaps in fonts should be used?
50 bool use_bitmaps; 50 bool use_bitmaps;
51 51
52 // Hinting level. 52 // Hinting level.
53 Hinting hinting; 53 Hinting hinting;
54 54
55 // Whether subpixel rendering should be used or not, and if so, the display's 55 // Whether subpixel rendering should be used or not, and if so, the display's
56 // subpixel order. 56 // subpixel order.
57 // TODO(derat): Remove this; we don't set it in the browser and mostly ignore
58 // it in Blink: http://crbug.com/396659
57 SubpixelRendering subpixel_rendering; 59 SubpixelRendering subpixel_rendering;
58 }; 60 };
59 61
60 // Returns the system's default parameters for font rendering. 62 // A query used to determine the appropriate FontRenderParams.
61 GFX_EXPORT const FontRenderParams& GetDefaultFontRenderParams(); 63 struct GFX_EXPORT FontRenderParamsQuery {
64 explicit FontRenderParamsQuery(bool for_web_contents);
65 ~FontRenderParamsQuery();
62 66
63 // Returns the system's default parameters for WebKit font rendering. 67 bool is_empty() const {
64 // TODO(derat): Rename to GetDefaultFontRenderParamsForWebContents(). 68 return families.empty() && pixel_size <= 0 && point_size <= 0 && style < 0;
65 GFX_EXPORT const FontRenderParams& GetDefaultWebKitFontRenderParams(); 69 }
66 70
67 // Returns the appropriate parameters for rendering the font described by the 71 // True if rendering text for the web.
68 // passed-in-arguments, any of which may be NULL. If |family_out| is non-NULL, 72 // TODO(derat): Remove this once FontRenderParams::subpixel_rendering is gone:
69 // it will be updated to contain the recommended font family from |family_list|. 73 // http://crbug.com/396659
70 // |style| optionally points to a bit field of Font::FontStyle values. 74 bool for_web_contents;
71 GFX_EXPORT FontRenderParams GetCustomFontRenderParams( 75
72 bool for_web_contents, 76 // Requested font families, or empty if unset.
73 const std::vector<std::string>* family_list, 77 std::vector<std::string> families;
74 const int* pixel_size, 78
75 const int* point_size, 79 // Font size in pixels or points, or 0 if unset.
76 const int* style, 80 int pixel_size;
81 int point_size;
82
83 // gfx::Font::FontStyle bit field, or -1 if unset.
Daniel Erat 2014/07/23 20:40:34 i don't love the -1 default here, because someone
84 int style;
85 };
86
87 // Returns the appropriate parameters for rendering the font described by
88 // |query|. If |family_out| is non-NULL, it will be updated to contain the
89 // recommended font family from |query.families|.
90 GFX_EXPORT FontRenderParams GetFontRenderParams(
91 const FontRenderParamsQuery& query,
77 std::string* family_out); 92 std::string* family_out);
78 93
79 } // namespace gfx 94 } // namespace gfx
80 95
81 #endif // UI_GFX_FONT_RENDER_PARAMS_H_ 96 #endif // UI_GFX_FONT_RENDER_PARAMS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698