1 /***************************************************************************/ 2 /* */ 3 /* ftgasp.h */ 4 /* */ 5 /* Access of TrueType's `gasp' table (specification). */ 6 /* */ 7 /* Copyright 2007-2018 by */ 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 /* */ 10 /* This file is part of the FreeType project, and may only be used, */ 11 /* modified, and distributed under the terms of the FreeType project */ 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 /* this file you indicate that you have read the license and */ 14 /* understand and accept it fully. */ 15 /* */ 16 /***************************************************************************/ 17 18 19 #ifndef FTGASP_H_ 20 #define FTGASP_H_ 21 22 #include <ft2build.h> 23 #include FT_FREETYPE_H 24 25 #ifdef FREETYPE_H 26 #error "freetype.h of FreeType 1 has been loaded!" 27 #error "Please fix the directory search order for header files" 28 #error "so that freetype.h of FreeType 2 is found first." 29 #endif 30 31 32 /*************************************************************************** 33 * 34 * @section: 35 * gasp_table 36 * 37 * @title: 38 * Gasp Table 39 * 40 * @abstract: 41 * Retrieving TrueType `gasp' table entries. 42 * 43 * @description: 44 * The function @FT_Get_Gasp can be used to query a TrueType or OpenType 45 * font for specific entries in its `gasp' table, if any. This is 46 * mainly useful when implementing native TrueType hinting with the 47 * bytecode interpreter to duplicate the Windows text rendering results. 48 */ 49 50 /************************************************************************* 51 * 52 * @enum: 53 * FT_GASP_XXX 54 * 55 * @description: 56 * A list of values and/or bit-flags returned by the @FT_Get_Gasp 57 * function. 58 * 59 * @values: 60 * FT_GASP_NO_TABLE :: 61 * This special value means that there is no GASP table in this face. 62 * It is up to the client to decide what to do. 63 * 64 * FT_GASP_DO_GRIDFIT :: 65 * Grid-fitting and hinting should be performed at the specified ppem. 66 * This *really* means TrueType bytecode interpretation. If this bit 67 * is not set, no hinting gets applied. 68 * 69 * FT_GASP_DO_GRAY :: 70 * Anti-aliased rendering should be performed at the specified ppem. 71 * If not set, do monochrome rendering. 72 * 73 * FT_GASP_SYMMETRIC_SMOOTHING :: 74 * If set, smoothing along multiple axes must be used with ClearType. 75 * 76 * FT_GASP_SYMMETRIC_GRIDFIT :: 77 * Grid-fitting must be used with ClearType's symmetric smoothing. 78 * 79 * @note: 80 * The bit-flags `FT_GASP_DO_GRIDFIT' and `FT_GASP_DO_GRAY' are to be 81 * used for standard font rasterization only. Independently of that, 82 * `FT_GASP_SYMMETRIC_SMOOTHING' and `FT_GASP_SYMMETRIC_GRIDFIT' are to 83 * be used if ClearType is enabled (and `FT_GASP_DO_GRIDFIT' and 84 * `FT_GASP_DO_GRAY' are consequently ignored). 85 * 86 * `ClearType' is Microsoft's implementation of LCD rendering, partly 87 * protected by patents. 88 * 89 * @since: 90 * 2.3.0 91 */ 92 #define FT_GASP_NO_TABLE -1 93 #define FT_GASP_DO_GRIDFIT 0x01 94 #define FT_GASP_DO_GRAY 0x02 95 #define FT_GASP_SYMMETRIC_GRIDFIT 0x04 96 #define FT_GASP_SYMMETRIC_SMOOTHING 0x08 97 98 99 /************************************************************************* 100 * 101 * @func: 102 * FT_Get_Gasp 103 * 104 * @description: 105 * For a TrueType or OpenType font file, return the rasterizer behaviour 106 * flags from the font's `gasp' table corresponding to a given 107 * character pixel size. 108 * 109 * @input: 110 * face :: The source face handle. 111 * 112 * ppem :: The vertical character pixel size. 113 * 114 * @return: 115 * Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE if there is no 116 * `gasp' table in the face. 117 * 118 * @note: 119 * If you want to use the MM functionality of OpenType variation fonts 120 * (i.e., using @FT_Set_Var_Design_Coordinates and friends), call this 121 * function *after* setting an instance since the return values can 122 * change. 123 * 124 * @since: 125 * 2.3.0 126 */ 127 FT_EXPORT( FT_Int ) 128 FT_Get_Gasp( FT_Face face, 129 FT_UInt ppem ); 130 131 /* */ 132 133 134 #endif /* FTGASP_H_ */ 135 136 137 /* END */ 138