vrshoot

diff libs/ft2static/freetype/ftlcdfil.h @ 0:b2f14e535253

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 01 Feb 2014 19:58:19 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libs/ft2static/freetype/ftlcdfil.h	Sat Feb 01 19:58:19 2014 +0200
     1.3 @@ -0,0 +1,213 @@
     1.4 +/***************************************************************************/
     1.5 +/*                                                                         */
     1.6 +/*  ftlcdfil.h                                                             */
     1.7 +/*                                                                         */
     1.8 +/*    FreeType API for color filtering of subpixel bitmap glyphs           */
     1.9 +/*    (specification).                                                     */
    1.10 +/*                                                                         */
    1.11 +/*  Copyright 2006, 2007, 2008, 2010 by                                    */
    1.12 +/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
    1.13 +/*                                                                         */
    1.14 +/*  This file is part of the FreeType project, and may only be used,       */
    1.15 +/*  modified, and distributed under the terms of the FreeType project      */
    1.16 +/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
    1.17 +/*  this file you indicate that you have read the license and              */
    1.18 +/*  understand and accept it fully.                                        */
    1.19 +/*                                                                         */
    1.20 +/***************************************************************************/
    1.21 +
    1.22 +
    1.23 +#ifndef __FT_LCD_FILTER_H__
    1.24 +#define __FT_LCD_FILTER_H__
    1.25 +
    1.26 +#include <ft2build.h>
    1.27 +#include FT_FREETYPE_H
    1.28 +
    1.29 +#ifdef FREETYPE_H
    1.30 +#error "freetype.h of FreeType 1 has been loaded!"
    1.31 +#error "Please fix the directory search order for header files"
    1.32 +#error "so that freetype.h of FreeType 2 is found first."
    1.33 +#endif
    1.34 +
    1.35 +
    1.36 +FT_BEGIN_HEADER
    1.37 +
    1.38 +  /***************************************************************************
    1.39 +   *
    1.40 +   * @section:
    1.41 +   *   lcd_filtering
    1.42 +   *
    1.43 +   * @title:
    1.44 +   *   LCD Filtering
    1.45 +   *
    1.46 +   * @abstract:
    1.47 +   *   Reduce color fringes of LCD-optimized bitmaps.
    1.48 +   *
    1.49 +   * @description:
    1.50 +   *   The @FT_Library_SetLcdFilter API can be used to specify a low-pass
    1.51 +   *   filter which is then applied to LCD-optimized bitmaps generated
    1.52 +   *   through @FT_Render_Glyph.  This is useful to reduce color fringes
    1.53 +   *   which would occur with unfiltered rendering.
    1.54 +   *
    1.55 +   *   Note that no filter is active by default, and that this function is
    1.56 +   *   *not* implemented in default builds of the library.  You need to
    1.57 +   *   #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your `ftoption.h' file
    1.58 +   *   in order to activate it.
    1.59 +   */
    1.60 +
    1.61 +
    1.62 +  /****************************************************************************
    1.63 +   *
    1.64 +   * @enum:
    1.65 +   *   FT_LcdFilter
    1.66 +   *
    1.67 +   * @description:
    1.68 +   *   A list of values to identify various types of LCD filters.
    1.69 +   *
    1.70 +   * @values:
    1.71 +   *   FT_LCD_FILTER_NONE ::
    1.72 +   *     Do not perform filtering.  When used with subpixel rendering, this
    1.73 +   *     results in sometimes severe color fringes.
    1.74 +   *
    1.75 +   *   FT_LCD_FILTER_DEFAULT ::
    1.76 +   *     The default filter reduces color fringes considerably, at the cost
    1.77 +   *     of a slight blurriness in the output.
    1.78 +   *
    1.79 +   *   FT_LCD_FILTER_LIGHT ::
    1.80 +   *     The light filter is a variant that produces less blurriness at the
    1.81 +   *     cost of slightly more color fringes than the default one.  It might
    1.82 +   *     be better, depending on taste, your monitor, or your personal vision.
    1.83 +   *
    1.84 +   *   FT_LCD_FILTER_LEGACY ::
    1.85 +   *     This filter corresponds to the original libXft color filter.  It
    1.86 +   *     provides high contrast output but can exhibit really bad color
    1.87 +   *     fringes if glyphs are not extremely well hinted to the pixel grid.
    1.88 +   *     In other words, it only works well if the TrueType bytecode
    1.89 +   *     interpreter is enabled *and* high-quality hinted fonts are used.
    1.90 +   *
    1.91 +   *     This filter is only provided for comparison purposes, and might be
    1.92 +   *     disabled or stay unsupported in the future.
    1.93 +   *
    1.94 +   * @since:
    1.95 +   *   2.3.0
    1.96 +   */
    1.97 +  typedef enum  FT_LcdFilter_
    1.98 +  {
    1.99 +    FT_LCD_FILTER_NONE    = 0,
   1.100 +    FT_LCD_FILTER_DEFAULT = 1,
   1.101 +    FT_LCD_FILTER_LIGHT   = 2,
   1.102 +    FT_LCD_FILTER_LEGACY  = 16,
   1.103 +
   1.104 +    FT_LCD_FILTER_MAX   /* do not remove */
   1.105 +
   1.106 +  } FT_LcdFilter;
   1.107 +
   1.108 +
   1.109 +  /**************************************************************************
   1.110 +   *
   1.111 +   * @func:
   1.112 +   *   FT_Library_SetLcdFilter
   1.113 +   *
   1.114 +   * @description:
   1.115 +   *   This function is used to apply color filtering to LCD decimated
   1.116 +   *   bitmaps, like the ones used when calling @FT_Render_Glyph with
   1.117 +   *   @FT_RENDER_MODE_LCD or @FT_RENDER_MODE_LCD_V.
   1.118 +   *
   1.119 +   * @input:
   1.120 +   *   library ::
   1.121 +   *     A handle to the target library instance.
   1.122 +   *
   1.123 +   *   filter ::
   1.124 +   *     The filter type.
   1.125 +   *
   1.126 +   *     You can use @FT_LCD_FILTER_NONE here to disable this feature, or
   1.127 +   *     @FT_LCD_FILTER_DEFAULT to use a default filter that should work
   1.128 +   *     well on most LCD screens.
   1.129 +   *
   1.130 +   * @return:
   1.131 +   *   FreeType error code.  0~means success.
   1.132 +   *
   1.133 +   * @note:
   1.134 +   *   This feature is always disabled by default.  Clients must make an
   1.135 +   *   explicit call to this function with a `filter' value other than
   1.136 +   *   @FT_LCD_FILTER_NONE in order to enable it.
   1.137 +   *
   1.138 +   *   Due to *PATENTS* covering subpixel rendering, this function doesn't
   1.139 +   *   do anything except returning `FT_Err_Unimplemented_Feature' if the
   1.140 +   *   configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not
   1.141 +   *   defined in your build of the library, which should correspond to all
   1.142 +   *   default builds of FreeType.
   1.143 +   *
   1.144 +   *   The filter affects glyph bitmaps rendered through @FT_Render_Glyph,
   1.145 +   *   @FT_Outline_Get_Bitmap, @FT_Load_Glyph, and @FT_Load_Char.
   1.146 +   *
   1.147 +   *   It does _not_ affect the output of @FT_Outline_Render and
   1.148 +   *   @FT_Outline_Get_Bitmap.
   1.149 +   *
   1.150 +   *   If this feature is activated, the dimensions of LCD glyph bitmaps are
   1.151 +   *   either larger or taller than the dimensions of the corresponding
   1.152 +   *   outline with regards to the pixel grid.  For example, for
   1.153 +   *   @FT_RENDER_MODE_LCD, the filter adds up to 3~pixels to the left, and
   1.154 +   *   up to 3~pixels to the right.
   1.155 +   *
   1.156 +   *   The bitmap offset values are adjusted correctly, so clients shouldn't
   1.157 +   *   need to modify their layout and glyph positioning code when enabling
   1.158 +   *   the filter.
   1.159 +   *
   1.160 +   * @since:
   1.161 +   *   2.3.0
   1.162 +   */
   1.163 +  FT_EXPORT( FT_Error )
   1.164 +  FT_Library_SetLcdFilter( FT_Library    library,
   1.165 +                           FT_LcdFilter  filter );
   1.166 +
   1.167 +
   1.168 +  /**************************************************************************
   1.169 +   *
   1.170 +   * @func:
   1.171 +   *   FT_Library_SetLcdFilterWeights
   1.172 +   *
   1.173 +   * @description:
   1.174 +   *   Use this function to override the filter weights selected by
   1.175 +   *   @FT_Library_SetLcdFilter.  By default, FreeType uses the quintuple
   1.176 +   *   (0x00, 0x55, 0x56, 0x55, 0x00) for FT_LCD_FILTER_LIGHT, and (0x10,
   1.177 +   *   0x40, 0x70, 0x40, 0x10) for FT_LCD_FILTER_DEFAULT and
   1.178 +   *   FT_LCD_FILTER_LEGACY.
   1.179 +   *
   1.180 +   * @input:
   1.181 +   *   library ::
   1.182 +   *     A handle to the target library instance.
   1.183 +   *
   1.184 +   *   weights ::
   1.185 +   *     A pointer to an array; the function copies the first five bytes and
   1.186 +   *     uses them to specify the filter weights.
   1.187 +   *
   1.188 +   * @return:
   1.189 +   *   FreeType error code.  0~means success.
   1.190 +   *
   1.191 +   * @note:
   1.192 +   *   Due to *PATENTS* covering subpixel rendering, this function doesn't
   1.193 +   *   do anything except returning `FT_Err_Unimplemented_Feature' if the
   1.194 +   *   configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not
   1.195 +   *   defined in your build of the library, which should correspond to all
   1.196 +   *   default builds of FreeType.
   1.197 +   *
   1.198 +   *   This function must be called after @FT_Library_SetLcdFilter to have
   1.199 +   *   any effect.
   1.200 +   *
   1.201 +   * @since:
   1.202 +   *   2.4.0
   1.203 +   */
   1.204 +  FT_EXPORT( FT_Error )
   1.205 +  FT_Library_SetLcdFilterWeights( FT_Library      library,
   1.206 +                                  unsigned char  *weights );
   1.207 +
   1.208 +  /* */
   1.209 +
   1.210 +
   1.211 +FT_END_HEADER
   1.212 +
   1.213 +#endif /* __FT_LCD_FILTER_H__ */
   1.214 +
   1.215 +
   1.216 +/* END */