michael@0: /***************************************************************************/ michael@0: /* */ michael@0: /* ftttdrv.h */ michael@0: /* */ michael@0: /* FreeType API for controlling the TrueType driver */ michael@0: /* (specification only). */ michael@0: /* */ michael@0: /* Copyright 2013 by */ michael@0: /* David Turner, Robert Wilhelm, and Werner Lemberg. */ michael@0: /* */ michael@0: /* This file is part of the FreeType project, and may only be used, */ michael@0: /* modified, and distributed under the terms of the FreeType project */ michael@0: /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ michael@0: /* this file you indicate that you have read the license and */ michael@0: /* understand and accept it fully. */ michael@0: /* */ michael@0: /***************************************************************************/ michael@0: michael@0: michael@0: #ifndef __FTTTDRV_H__ michael@0: #define __FTTTDRV_H__ michael@0: michael@0: #include michael@0: #include FT_FREETYPE_H michael@0: michael@0: #ifdef FREETYPE_H michael@0: #error "freetype.h of FreeType 1 has been loaded!" michael@0: #error "Please fix the directory search order for header files" michael@0: #error "so that freetype.h of FreeType 2 is found first." michael@0: #endif michael@0: michael@0: michael@0: FT_BEGIN_HEADER michael@0: michael@0: michael@0: /************************************************************************** michael@0: * michael@0: * @section: michael@0: * tt_driver michael@0: * michael@0: * @title: michael@0: * The TrueType driver michael@0: * michael@0: * @abstract: michael@0: * Controlling the TrueType driver module. michael@0: * michael@0: * @description: michael@0: * While FreeType's TrueType driver doesn't expose API functions by michael@0: * itself, it is possible to control its behaviour with @FT_Property_Set michael@0: * and @FT_Property_Get. The following lists the available properties michael@0: * together with the necessary macros and structures. michael@0: * michael@0: * The TrueType driver's module name is `truetype'. michael@0: * michael@0: */ michael@0: michael@0: michael@0: /************************************************************************** michael@0: * michael@0: * @property: michael@0: * interpreter-version michael@0: * michael@0: * @description: michael@0: * Currently, two versions are available, representing the bytecode michael@0: * interpreter with and without subpixel hinting support, michael@0: * respectively. The default is subpixel support if michael@0: * TT_CONFIG_OPTION_SUBPIXEL_HINTING is defined, and no subpixel michael@0: * support otherwise (since it isn't available then). michael@0: * michael@0: * If subpixel hinting is on, many TrueType bytecode instructions michael@0: * behave differently compared to B/W or grayscale rendering. The michael@0: * main idea is to render at a much increased horizontal resolution, michael@0: * then sampling down the created output to subpixel precision. michael@0: * However, many older fonts are not suited to this and must be michael@0: * specially taken care of by applying (hardcoded) font-specific michael@0: * tweaks. michael@0: * michael@0: * Details on subpixel hinting and some of the necessary tweaks can be michael@0: * found in Greg Hitchcock's whitepaper at michael@0: * `http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx'. michael@0: * michael@0: * The following example code demonstrates how to activate subpixel michael@0: * hinting (omitting the error handling). michael@0: * michael@0: * { michael@0: * FT_Library library; michael@0: * FT_Face face; michael@0: * FT_UInt interpreter_version = TT_INTERPRETER_VERSION_38; michael@0: * michael@0: * michael@0: * FT_Init_FreeType( &library ); michael@0: * michael@0: * FT_Property_Set( library, "truetype", michael@0: * "interpreter-version", michael@0: * &interpreter_version ); michael@0: * } michael@0: * michael@0: * @note: michael@0: * This property can be used with @FT_Property_Get also. michael@0: * michael@0: */ michael@0: michael@0: michael@0: /************************************************************************** michael@0: * michael@0: * @enum: michael@0: * TT_INTERPRETER_VERSION_XXX michael@0: * michael@0: * @description: michael@0: * A list of constants used for the @interpreter-version property to michael@0: * select the hinting engine for Truetype fonts. michael@0: * michael@0: * The numeric value in the constant names represents the version michael@0: * number as returned by the `GETINFO' bytecode instruction. michael@0: * michael@0: * @values: michael@0: * TT_INTERPRETER_VERSION_35 :: michael@0: * Version~35 corresponds to MS rasterizer v.1.7 as used e.g. in michael@0: * Windows~98; only grayscale and B/W rasterizing is supported. michael@0: * michael@0: * TT_INTERPRETER_VERSION_38 :: michael@0: * Version~38 corresponds to MS rasterizer v.1.9; it is roughly michael@0: * equivalent to the hinting provided by DirectWrite ClearType (as michael@0: * can be found, for example, in the Internet Explorer~9 running on michael@0: * Windows~7). michael@0: * michael@0: * @note: michael@0: * This property controls the behaviour of the bytecode interpreter michael@0: * and thus how outlines get hinted. It does *not* control how glyph michael@0: * get rasterized! In particular, it does not control subpixel color michael@0: * filtering. michael@0: * michael@0: * If FreeType has not been compiled with configuration option michael@0: * FT_CONFIG_OPTION_SUBPIXEL_HINTING, selecting version~38 causes an michael@0: * `FT_Err_Unimplemented_Feature' error. michael@0: * michael@0: * Depending on the graphics framework, Microsoft uses different michael@0: * bytecode engines. As a consequence, the version numbers returned by michael@0: * a call to the `GETINFO[1]' bytecode instruction are more convoluted michael@0: * than desired. michael@0: * michael@0: * { michael@0: * framework Windows version result of GETINFO[1] michael@0: * ---------------------------------------------------- michael@0: * GDI before XP 35 michael@0: * GDI XP and later 37 michael@0: * GDI+ old before Vista 37 michael@0: * GDI+ old Vista, 7 38 michael@0: * GDI+ after 7 40 michael@0: * DWrite before 8 39 michael@0: * DWrite 8 and later 40 michael@0: * } michael@0: * michael@0: * Since FreeType doesn't provide all capabilities of DWrite ClearType, michael@0: * using version~38 seems justified. michael@0: * michael@0: */ michael@0: #define TT_INTERPRETER_VERSION_35 35 michael@0: #define TT_INTERPRETER_VERSION_38 38 michael@0: michael@0: michael@0: /* */ michael@0: michael@0: FT_END_HEADER michael@0: michael@0: michael@0: #endif /* __FTTTDRV_H__ */ michael@0: michael@0: michael@0: /* END */