Home | History | Annotate | Download | only in gfx
      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 
      8 #include "ui/gfx/gfx_export.h"
      9 
     10 namespace gfx {
     11 
     12 // A collection of parameters describing how text should be rendered on Linux.
     13 struct GFX_EXPORT FontRenderParams {
     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.
     57 GFX_EXPORT const FontRenderParams& GetDefaultFontRenderParams();
     58 
     59 // Returns the system's default parameters for WebKit font rendering.
     60 GFX_EXPORT const FontRenderParams& GetDefaultWebKitFontRenderParams();
     61 
     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
     66 GFX_EXPORT bool GetDefaultWebkitSubpixelPositioning();
     67 
     68 }  // namespace gfx
     69 
     70 #endif  // UI_GFX_FONT_RENDER_PARAMS_LINUX_H_
     71