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

Unified 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, 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/font_render_params.h
diff --git a/ui/gfx/font_render_params.h b/ui/gfx/font_render_params.h
index 1b49e04220d5d594e8ec6f0086c2a6311914de9e..fb28700e1eef4e3b5d3966715a4ef6f82fba39ee 100644
--- a/ui/gfx/font_render_params.h
+++ b/ui/gfx/font_render_params.h
@@ -40,6 +40,8 @@ struct GFX_EXPORT FontRenderParams {
// Should subpixel positioning (i.e. fractional X positions for glyphs) be
// used?
+ // TODO(derat): Remove this; we don't set it in the browser and mostly ignore
+ // it in Blink: http://crbug.com/396659
bool subpixel_positioning;
// Should FreeType's autohinter be used (as opposed to Freetype's bytecode
@@ -57,23 +59,36 @@ struct GFX_EXPORT FontRenderParams {
SubpixelRendering subpixel_rendering;
};
-// Returns the system's default parameters for font rendering.
-GFX_EXPORT const FontRenderParams& GetDefaultFontRenderParams();
-
-// Returns the system's default parameters for WebKit font rendering.
-// TODO(derat): Rename to GetDefaultFontRenderParamsForWebContents().
-GFX_EXPORT const FontRenderParams& GetDefaultWebKitFontRenderParams();
-
-// Returns the appropriate parameters for rendering the font described by the
-// passed-in-arguments, any of which may be NULL. If |family_out| is non-NULL,
-// it will be updated to contain the recommended font family from |family_list|.
-// |style| optionally points to a bit field of Font::FontStyle values.
-GFX_EXPORT FontRenderParams GetCustomFontRenderParams(
- bool for_web_contents,
- const std::vector<std::string>* family_list,
- const int* pixel_size,
- const int* point_size,
- const int* style,
+// A query used to determine the appropriate FontRenderParams.
+struct GFX_EXPORT FontRenderParamsQuery {
+ explicit FontRenderParamsQuery(bool for_web_contents);
+ ~FontRenderParamsQuery();
+
+ bool is_empty() const {
+ return families.empty() && pixel_size <= 0 && point_size <= 0 && style < 0;
+ }
+
+ // True if rendering text for the web.
+ // TODO(derat): Remove this once FontRenderParams::subpixel_positioning is
+ // gone: http://crbug.com/396659
+ bool for_web_contents;
+
+ // Requested font families, or empty if unset.
+ std::vector<std::string> families;
+
+ // Font size in pixels or points, or 0 if unset.
+ int pixel_size;
+ int point_size;
+
+ // gfx::Font::FontStyle bit field, or -1 if unset.
+ int style;
+};
+
+// Returns the appropriate parameters for rendering the font described by
+// |query|. If |family_out| is non-NULL, it will be updated to contain the
+// recommended font family from |query.families|.
+GFX_EXPORT FontRenderParams GetFontRenderParams(
+ const FontRenderParamsQuery& query,
std::string* family_out);
} // namespace gfx
« 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