modules/freetype2/include/ftttdrv.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/modules/freetype2/include/ftttdrv.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,170 @@
     1.4 +/***************************************************************************/
     1.5 +/*                                                                         */
     1.6 +/*  ftttdrv.h                                                              */
     1.7 +/*                                                                         */
     1.8 +/*    FreeType API for controlling the TrueType driver                     */
     1.9 +/*    (specification only).                                                */
    1.10 +/*                                                                         */
    1.11 +/*  Copyright 2013 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 __FTTTDRV_H__
    1.24 +#define __FTTTDRV_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 +   *
    1.41 +   * @section:
    1.42 +   *   tt_driver
    1.43 +   *
    1.44 +   * @title:
    1.45 +   *   The TrueType driver
    1.46 +   *
    1.47 +   * @abstract:
    1.48 +   *   Controlling the TrueType driver module.
    1.49 +   *
    1.50 +   * @description:
    1.51 +   *   While FreeType's TrueType driver doesn't expose API functions by
    1.52 +   *   itself, it is possible to control its behaviour with @FT_Property_Set
    1.53 +   *   and @FT_Property_Get.  The following lists the available properties
    1.54 +   *   together with the necessary macros and structures.
    1.55 +   *
    1.56 +   *   The TrueType driver's module name is `truetype'.
    1.57 +   *
    1.58 +   */
    1.59 +
    1.60 +
    1.61 +  /**************************************************************************
    1.62 +   *
    1.63 +   * @property:
    1.64 +   *   interpreter-version
    1.65 +   *
    1.66 +   * @description:
    1.67 +   *   Currently, two versions are available, representing the bytecode
    1.68 +   *   interpreter with and without subpixel hinting support,
    1.69 +   *   respectively.  The default is subpixel support if
    1.70 +   *   TT_CONFIG_OPTION_SUBPIXEL_HINTING is defined, and no subpixel
    1.71 +   *   support otherwise (since it isn't available then).
    1.72 +   *
    1.73 +   *   If subpixel hinting is on, many TrueType bytecode instructions
    1.74 +   *   behave differently compared to B/W or grayscale rendering.  The
    1.75 +   *   main idea is to render at a much increased horizontal resolution,
    1.76 +   *   then sampling down the created output to subpixel precision.
    1.77 +   *   However, many older fonts are not suited to this and must be
    1.78 +   *   specially taken care of by applying (hardcoded) font-specific
    1.79 +   *   tweaks.
    1.80 +   *
    1.81 +   *   Details on subpixel hinting and some of the necessary tweaks can be
    1.82 +   *   found in Greg Hitchcock's whitepaper at
    1.83 +   *   `http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx'.
    1.84 +   *
    1.85 +   *   The following example code demonstrates how to activate subpixel
    1.86 +   *   hinting (omitting the error handling).
    1.87 +   *
    1.88 +   *   {
    1.89 +   *     FT_Library  library;
    1.90 +   *     FT_Face     face;
    1.91 +   *     FT_UInt     interpreter_version = TT_INTERPRETER_VERSION_38;
    1.92 +   *
    1.93 +   *
    1.94 +   *     FT_Init_FreeType( &library );
    1.95 +   *
    1.96 +   *     FT_Property_Set( library, "truetype",
    1.97 +   *                               "interpreter-version",
    1.98 +   *                               &interpreter_version );
    1.99 +   *   }
   1.100 +   *
   1.101 +   * @note:
   1.102 +   *   This property can be used with @FT_Property_Get also.
   1.103 +   *
   1.104 +   */
   1.105 +
   1.106 +
   1.107 +  /**************************************************************************
   1.108 +   *
   1.109 +   * @enum:
   1.110 +   *   TT_INTERPRETER_VERSION_XXX
   1.111 +   *
   1.112 +   * @description:
   1.113 +   *   A list of constants used for the @interpreter-version property to
   1.114 +   *   select the hinting engine for Truetype fonts.
   1.115 +   *
   1.116 +   *   The numeric value in the constant names represents the version
   1.117 +   *   number as returned by the `GETINFO' bytecode instruction.
   1.118 +   *
   1.119 +   * @values:
   1.120 +   *   TT_INTERPRETER_VERSION_35 ::
   1.121 +   *     Version~35 corresponds to MS rasterizer v.1.7 as used e.g. in
   1.122 +   *     Windows~98; only grayscale and B/W rasterizing is supported.
   1.123 +   *
   1.124 +   *   TT_INTERPRETER_VERSION_38 ::
   1.125 +   *     Version~38 corresponds to MS rasterizer v.1.9; it is roughly
   1.126 +   *     equivalent to the hinting provided by DirectWrite ClearType (as
   1.127 +   *     can be found, for example, in the Internet Explorer~9 running on
   1.128 +   *     Windows~7).
   1.129 +   *
   1.130 +   * @note:
   1.131 +   *   This property controls the behaviour of the bytecode interpreter
   1.132 +   *   and thus how outlines get hinted.  It does *not* control how glyph
   1.133 +   *   get rasterized!  In particular, it does not control subpixel color
   1.134 +   *   filtering.
   1.135 +   *
   1.136 +   *   If FreeType has not been compiled with configuration option
   1.137 +   *   FT_CONFIG_OPTION_SUBPIXEL_HINTING, selecting version~38 causes an
   1.138 +   *   `FT_Err_Unimplemented_Feature' error.
   1.139 +   *
   1.140 +   *   Depending on the graphics framework, Microsoft uses different
   1.141 +   *   bytecode engines.  As a consequence, the version numbers returned by
   1.142 +   *   a call to the `GETINFO[1]' bytecode instruction are more convoluted
   1.143 +   *   than desired.
   1.144 +   *
   1.145 +   *   {
   1.146 +   *      framework   Windows version   result of GETINFO[1]
   1.147 +   *     ----------------------------------------------------
   1.148 +   *       GDI         before XP         35
   1.149 +   *       GDI         XP and later      37
   1.150 +   *       GDI+ old    before Vista      37
   1.151 +   *       GDI+ old    Vista, 7          38
   1.152 +   *       GDI+        after 7           40
   1.153 +   *       DWrite      before 8          39
   1.154 +   *       DWrite      8 and later       40
   1.155 +   *   }
   1.156 +   *
   1.157 +   *   Since FreeType doesn't provide all capabilities of DWrite ClearType,
   1.158 +   *   using version~38 seems justified.
   1.159 +   *
   1.160 +   */
   1.161 +#define TT_INTERPRETER_VERSION_35  35
   1.162 +#define TT_INTERPRETER_VERSION_38  38
   1.163 +
   1.164 +
   1.165 + /* */
   1.166 +
   1.167 +FT_END_HEADER
   1.168 +
   1.169 +
   1.170 +#endif /* __FTTTDRV_H__ */
   1.171 +
   1.172 +
   1.173 +/* END */

mercurial