blob: ac8323ceade38d2cec7aab0a20ca20c736f2f98d [file] [log] [blame]
Torne (Richard Coles)58218062012-11-14 11:43:16 +00001// 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
3// found in the LICENSE file.
4
5#ifndef UI_GFX_FONT_RENDER_PARAMS_LINUX_H_
6#define UI_GFX_FONT_RENDER_PARAMS_LINUX_H_
7
Torne (Richard Coles)58537e22013-09-12 12:10:22 +01008#include "ui/gfx/gfx_export.h"
Torne (Richard Coles)58218062012-11-14 11:43:16 +00009
10namespace gfx {
11
12// A collection of parameters describing how text should be rendered on Linux.
Torne (Richard Coles)4e180b62013-10-18 15:46:22 +010013struct GFX_EXPORT FontRenderParams {
Torne (Richard Coles)58218062012-11-14 11:43:16 +000014 // No constructor to avoid static initialization.
15
16 // Level of hinting to be applied.
17 enum Hinting {
18 HINTING_NONE = 0,
19 HINTING_SLIGHT,
20 HINTING_MEDIUM,
21 HINTING_FULL,
22 };
23
24 // Different subpixel orders to be used for subpixel rendering.
25 enum SubpixelRendering {
26 SUBPIXEL_RENDERING_NONE = 0,
27 SUBPIXEL_RENDERING_RGB,
28 SUBPIXEL_RENDERING_BGR,
29 SUBPIXEL_RENDERING_VRGB,
30 SUBPIXEL_RENDERING_VBGR,
31 };
32
33 // Antialiasing (grayscale if |subpixel_rendering| is SUBPIXEL_RENDERING_NONE
34 // and RGBA otherwise).
35 bool antialiasing;
36
37 // Should subpixel positioning (i.e. fractional X positions for glyphs) be
38 // used?
39 bool subpixel_positioning;
40
41 // Should FreeType's autohinter be used (as opposed to Freetype's bytecode
42 // interpreter, which uses fonts' own hinting instructions)?
43 bool autohinter;
44
45 // Should embedded bitmaps in fonts should be used?
46 bool use_bitmaps;
47
48 // Hinting level.
49 Hinting hinting;
50
51 // Whether subpixel rendering should be used or not, and if so, the display's
52 // subpixel order.
53 SubpixelRendering subpixel_rendering;
54};
55
56// Returns the system's default parameters for font rendering.
Torne (Richard Coles)4e180b62013-10-18 15:46:22 +010057GFX_EXPORT const FontRenderParams& GetDefaultFontRenderParams();
Torne (Richard Coles)58218062012-11-14 11:43:16 +000058
59// Returns the system's default parameters for WebKit font rendering.
Torne (Richard Coles)4e180b62013-10-18 15:46:22 +010060GFX_EXPORT const FontRenderParams& GetDefaultWebKitFontRenderParams();
Torne (Richard Coles)58218062012-11-14 11:43:16 +000061
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000062// Returns the system's default parameters for WebKit subpixel positioning.
63// Subpixel positioning is special since neither GTK nor FontConfig currently
64// track it as a preference.
65// See https://bugs.freedesktop.org/show_bug.cgi?id=50736
Torne (Richard Coles)4e180b62013-10-18 15:46:22 +010066GFX_EXPORT bool GetDefaultWebkitSubpixelPositioning();
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000067
Torne (Richard Coles)58218062012-11-14 11:43:16 +000068} // namespace gfx
69
70#endif // UI_GFX_FONT_RENDER_PARAMS_LINUX_H_