Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 1 | // 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) | 58537e2 | 2013-09-12 12:10:22 +0100 | [diff] [blame] | 8 | #include "ui/gfx/gfx_export.h" |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 9 | |
| 10 | namespace gfx { |
| 11 | |
| 12 | // A collection of parameters describing how text should be rendered on Linux. |
Torne (Richard Coles) | 4e180b6 | 2013-10-18 15:46:22 +0100 | [diff] [blame^] | 13 | struct GFX_EXPORT FontRenderParams { |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 14 | // 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) | 4e180b6 | 2013-10-18 15:46:22 +0100 | [diff] [blame^] | 57 | GFX_EXPORT const FontRenderParams& GetDefaultFontRenderParams(); |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 58 | |
| 59 | // Returns the system's default parameters for WebKit font rendering. |
Torne (Richard Coles) | 4e180b6 | 2013-10-18 15:46:22 +0100 | [diff] [blame^] | 60 | GFX_EXPORT const FontRenderParams& GetDefaultWebKitFontRenderParams(); |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 61 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 62 | // 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) | 4e180b6 | 2013-10-18 15:46:22 +0100 | [diff] [blame^] | 66 | GFX_EXPORT bool GetDefaultWebkitSubpixelPositioning(); |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 67 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 68 | } // namespace gfx |
| 69 | |
| 70 | #endif // UI_GFX_FONT_RENDER_PARAMS_LINUX_H_ |