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

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: update PlatformFontWin::GetFontRenderParams() to use a static Created 6 years, 4 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
« no previous file with comments | « content/browser/renderer_host/sandbox_ipc_linux.cc ('k') | ui/gfx/font_render_params.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 22 matching lines...) Expand all
33 SUBPIXEL_RENDERING_VRGB, 33 SUBPIXEL_RENDERING_VRGB,
34 SUBPIXEL_RENDERING_VBGR, 34 SUBPIXEL_RENDERING_VBGR,
35 }; 35 };
36 36
37 // Antialiasing (grayscale if |subpixel_rendering| is SUBPIXEL_RENDERING_NONE 37 // Antialiasing (grayscale if |subpixel_rendering| is SUBPIXEL_RENDERING_NONE
38 // and RGBA otherwise). 38 // and RGBA otherwise).
39 bool antialiasing; 39 bool antialiasing;
40 40
41 // Should subpixel positioning (i.e. fractional X positions for glyphs) be 41 // Should subpixel positioning (i.e. fractional X positions for glyphs) be
42 // used? 42 // used?
43 // TODO(derat): Remove this; we don't set it in the browser and mostly ignore
44 // it in Blink: http://crbug.com/396659
43 bool subpixel_positioning; 45 bool subpixel_positioning;
44 46
45 // Should FreeType's autohinter be used (as opposed to Freetype's bytecode 47 // Should FreeType's autohinter be used (as opposed to Freetype's bytecode
46 // interpreter, which uses fonts' own hinting instructions)? 48 // interpreter, which uses fonts' own hinting instructions)?
47 bool autohinter; 49 bool autohinter;
48 50
49 // Should embedded bitmaps in fonts should be used? 51 // Should embedded bitmaps in fonts should be used?
50 bool use_bitmaps; 52 bool use_bitmaps;
51 53
52 // Hinting level. 54 // Hinting level.
53 Hinting hinting; 55 Hinting hinting;
54 56
55 // Whether subpixel rendering should be used or not, and if so, the display's 57 // Whether subpixel rendering should be used or not, and if so, the display's
56 // subpixel order. 58 // subpixel order.
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_positioning is
69 // it will be updated to contain the recommended font family from |family_list|. 73 // gone: 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.
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
« no previous file with comments | « content/browser/renderer_host/sandbox_ipc_linux.cc ('k') | ui/gfx/font_render_params.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698