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
3 // found in the LICENSE file.
5 #ifndef UI_GFX_FONT_RENDER_PARAMS_H_
6 #define UI_GFX_FONT_RENDER_PARAMS_H_
11 #include "ui/gfx/gfx_export.h"
15 // A collection of parameters describing how text should be rendered on Linux.
16 struct GFX_EXPORT FontRenderParams
{
20 // Level of hinting to be applied.
28 // Different subpixel orders to be used for subpixel rendering.
29 enum SubpixelRendering
{
30 SUBPIXEL_RENDERING_NONE
= 0,
31 SUBPIXEL_RENDERING_RGB
,
32 SUBPIXEL_RENDERING_BGR
,
33 SUBPIXEL_RENDERING_VRGB
,
34 SUBPIXEL_RENDERING_VBGR
,
37 // Antialiasing (grayscale if |subpixel_rendering| is SUBPIXEL_RENDERING_NONE
38 // and RGBA otherwise).
41 // Should subpixel positioning (i.e. fractional X positions for glyphs) be
43 bool subpixel_positioning
;
45 // Should FreeType's autohinter be used (as opposed to Freetype's bytecode
46 // interpreter, which uses fonts' own hinting instructions)?
49 // Should embedded bitmaps in fonts should be used?
55 // Whether subpixel rendering should be used or not, and if so, the display's
57 SubpixelRendering subpixel_rendering
;
60 // Returns the system's default parameters for font rendering.
61 GFX_EXPORT
const FontRenderParams
& GetDefaultFontRenderParams();
63 // Returns the system's default parameters for WebKit font rendering.
64 // TODO(derat): Rename to GetDefaultFontRenderParamsForWebContents().
65 GFX_EXPORT
const FontRenderParams
& GetDefaultWebKitFontRenderParams();
67 // Returns the appropriate parameters for rendering the font described by the
68 // passed-in-arguments, any of which may be NULL. If |family_out| is non-NULL,
69 // it will be updated to contain the recommended font family from |family_list|.
70 // TODO(derat): Also accept the font style, so that its bold and italic states
71 // can be passed to Fontconfig in the Linux implementation.
72 GFX_EXPORT FontRenderParams
GetCustomFontRenderParams(
73 bool for_web_contents
,
74 const std::vector
<std::string
>* family_list
,
75 const int* pixel_size
,
76 const int* point_size
,
77 std::string
* family_out
);
81 #endif // UI_GFX_FONT_RENDER_PARAMS_H_