vrshoot
diff libs/ft2static/freetype/ftincrem.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/ftincrem.h Sat Feb 01 19:58:19 2014 +0200 1.3 @@ -0,0 +1,353 @@ 1.4 +/***************************************************************************/ 1.5 +/* */ 1.6 +/* ftincrem.h */ 1.7 +/* */ 1.8 +/* FreeType incremental loading (specification). */ 1.9 +/* */ 1.10 +/* Copyright 2002, 2003, 2006, 2007, 2008, 2010 by */ 1.11 +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ 1.12 +/* */ 1.13 +/* This file is part of the FreeType project, and may only be used, */ 1.14 +/* modified, and distributed under the terms of the FreeType project */ 1.15 +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 1.16 +/* this file you indicate that you have read the license and */ 1.17 +/* understand and accept it fully. */ 1.18 +/* */ 1.19 +/***************************************************************************/ 1.20 + 1.21 + 1.22 +#ifndef __FTINCREM_H__ 1.23 +#define __FTINCREM_H__ 1.24 + 1.25 +#include <ft2build.h> 1.26 +#include FT_FREETYPE_H 1.27 + 1.28 +#ifdef FREETYPE_H 1.29 +#error "freetype.h of FreeType 1 has been loaded!" 1.30 +#error "Please fix the directory search order for header files" 1.31 +#error "so that freetype.h of FreeType 2 is found first." 1.32 +#endif 1.33 + 1.34 + 1.35 +FT_BEGIN_HEADER 1.36 + 1.37 + /*************************************************************************** 1.38 + * 1.39 + * @section: 1.40 + * incremental 1.41 + * 1.42 + * @title: 1.43 + * Incremental Loading 1.44 + * 1.45 + * @abstract: 1.46 + * Custom Glyph Loading. 1.47 + * 1.48 + * @description: 1.49 + * This section contains various functions used to perform so-called 1.50 + * `incremental' glyph loading. This is a mode where all glyphs loaded 1.51 + * from a given @FT_Face are provided by the client application, 1.52 + * 1.53 + * Apart from that, all other tables are loaded normally from the font 1.54 + * file. This mode is useful when FreeType is used within another 1.55 + * engine, e.g., a PostScript Imaging Processor. 1.56 + * 1.57 + * To enable this mode, you must use @FT_Open_Face, passing an 1.58 + * @FT_Parameter with the @FT_PARAM_TAG_INCREMENTAL tag and an 1.59 + * @FT_Incremental_Interface value. See the comments for 1.60 + * @FT_Incremental_InterfaceRec for an example. 1.61 + * 1.62 + */ 1.63 + 1.64 + 1.65 + /*************************************************************************** 1.66 + * 1.67 + * @type: 1.68 + * FT_Incremental 1.69 + * 1.70 + * @description: 1.71 + * An opaque type describing a user-provided object used to implement 1.72 + * `incremental' glyph loading within FreeType. This is used to support 1.73 + * embedded fonts in certain environments (e.g., PostScript interpreters), 1.74 + * where the glyph data isn't in the font file, or must be overridden by 1.75 + * different values. 1.76 + * 1.77 + * @note: 1.78 + * It is up to client applications to create and implement @FT_Incremental 1.79 + * objects, as long as they provide implementations for the methods 1.80 + * @FT_Incremental_GetGlyphDataFunc, @FT_Incremental_FreeGlyphDataFunc 1.81 + * and @FT_Incremental_GetGlyphMetricsFunc. 1.82 + * 1.83 + * See the description of @FT_Incremental_InterfaceRec to understand how 1.84 + * to use incremental objects with FreeType. 1.85 + * 1.86 + */ 1.87 + typedef struct FT_IncrementalRec_* FT_Incremental; 1.88 + 1.89 + 1.90 + /*************************************************************************** 1.91 + * 1.92 + * @struct: 1.93 + * FT_Incremental_MetricsRec 1.94 + * 1.95 + * @description: 1.96 + * A small structure used to contain the basic glyph metrics returned 1.97 + * by the @FT_Incremental_GetGlyphMetricsFunc method. 1.98 + * 1.99 + * @fields: 1.100 + * bearing_x :: 1.101 + * Left bearing, in font units. 1.102 + * 1.103 + * bearing_y :: 1.104 + * Top bearing, in font units. 1.105 + * 1.106 + * advance :: 1.107 + * Horizontal component of glyph advance, in font units. 1.108 + * 1.109 + * advance_v :: 1.110 + * Vertical component of glyph advance, in font units. 1.111 + * 1.112 + * @note: 1.113 + * These correspond to horizontal or vertical metrics depending on the 1.114 + * value of the `vertical' argument to the function 1.115 + * @FT_Incremental_GetGlyphMetricsFunc. 1.116 + * 1.117 + */ 1.118 + typedef struct FT_Incremental_MetricsRec_ 1.119 + { 1.120 + FT_Long bearing_x; 1.121 + FT_Long bearing_y; 1.122 + FT_Long advance; 1.123 + FT_Long advance_v; /* since 2.3.12 */ 1.124 + 1.125 + } FT_Incremental_MetricsRec; 1.126 + 1.127 + 1.128 + /*************************************************************************** 1.129 + * 1.130 + * @struct: 1.131 + * FT_Incremental_Metrics 1.132 + * 1.133 + * @description: 1.134 + * A handle to an @FT_Incremental_MetricsRec structure. 1.135 + * 1.136 + */ 1.137 + typedef struct FT_Incremental_MetricsRec_* FT_Incremental_Metrics; 1.138 + 1.139 + 1.140 + /*************************************************************************** 1.141 + * 1.142 + * @type: 1.143 + * FT_Incremental_GetGlyphDataFunc 1.144 + * 1.145 + * @description: 1.146 + * A function called by FreeType to access a given glyph's data bytes 1.147 + * during @FT_Load_Glyph or @FT_Load_Char if incremental loading is 1.148 + * enabled. 1.149 + * 1.150 + * Note that the format of the glyph's data bytes depends on the font 1.151 + * file format. For TrueType, it must correspond to the raw bytes within 1.152 + * the `glyf' table. For PostScript formats, it must correspond to the 1.153 + * *unencrypted* charstring bytes, without any `lenIV' header. It is 1.154 + * undefined for any other format. 1.155 + * 1.156 + * @input: 1.157 + * incremental :: 1.158 + * Handle to an opaque @FT_Incremental handle provided by the client 1.159 + * application. 1.160 + * 1.161 + * glyph_index :: 1.162 + * Index of relevant glyph. 1.163 + * 1.164 + * @output: 1.165 + * adata :: 1.166 + * A structure describing the returned glyph data bytes (which will be 1.167 + * accessed as a read-only byte block). 1.168 + * 1.169 + * @return: 1.170 + * FreeType error code. 0~means success. 1.171 + * 1.172 + * @note: 1.173 + * If this function returns successfully the method 1.174 + * @FT_Incremental_FreeGlyphDataFunc will be called later to release 1.175 + * the data bytes. 1.176 + * 1.177 + * Nested calls to @FT_Incremental_GetGlyphDataFunc can happen for 1.178 + * compound glyphs. 1.179 + * 1.180 + */ 1.181 + typedef FT_Error 1.182 + (*FT_Incremental_GetGlyphDataFunc)( FT_Incremental incremental, 1.183 + FT_UInt glyph_index, 1.184 + FT_Data* adata ); 1.185 + 1.186 + 1.187 + /*************************************************************************** 1.188 + * 1.189 + * @type: 1.190 + * FT_Incremental_FreeGlyphDataFunc 1.191 + * 1.192 + * @description: 1.193 + * A function used to release the glyph data bytes returned by a 1.194 + * successful call to @FT_Incremental_GetGlyphDataFunc. 1.195 + * 1.196 + * @input: 1.197 + * incremental :: 1.198 + * A handle to an opaque @FT_Incremental handle provided by the client 1.199 + * application. 1.200 + * 1.201 + * data :: 1.202 + * A structure describing the glyph data bytes (which will be accessed 1.203 + * as a read-only byte block). 1.204 + * 1.205 + */ 1.206 + typedef void 1.207 + (*FT_Incremental_FreeGlyphDataFunc)( FT_Incremental incremental, 1.208 + FT_Data* data ); 1.209 + 1.210 + 1.211 + /*************************************************************************** 1.212 + * 1.213 + * @type: 1.214 + * FT_Incremental_GetGlyphMetricsFunc 1.215 + * 1.216 + * @description: 1.217 + * A function used to retrieve the basic metrics of a given glyph index 1.218 + * before accessing its data. This is necessary because, in certain 1.219 + * formats like TrueType, the metrics are stored in a different place from 1.220 + * the glyph images proper. 1.221 + * 1.222 + * @input: 1.223 + * incremental :: 1.224 + * A handle to an opaque @FT_Incremental handle provided by the client 1.225 + * application. 1.226 + * 1.227 + * glyph_index :: 1.228 + * Index of relevant glyph. 1.229 + * 1.230 + * vertical :: 1.231 + * If true, return vertical metrics. 1.232 + * 1.233 + * ametrics :: 1.234 + * This parameter is used for both input and output. 1.235 + * The original glyph metrics, if any, in font units. If metrics are 1.236 + * not available all the values must be set to zero. 1.237 + * 1.238 + * @output: 1.239 + * ametrics :: 1.240 + * The replacement glyph metrics in font units. 1.241 + * 1.242 + */ 1.243 + typedef FT_Error 1.244 + (*FT_Incremental_GetGlyphMetricsFunc) 1.245 + ( FT_Incremental incremental, 1.246 + FT_UInt glyph_index, 1.247 + FT_Bool vertical, 1.248 + FT_Incremental_MetricsRec *ametrics ); 1.249 + 1.250 + 1.251 + /************************************************************************** 1.252 + * 1.253 + * @struct: 1.254 + * FT_Incremental_FuncsRec 1.255 + * 1.256 + * @description: 1.257 + * A table of functions for accessing fonts that load data 1.258 + * incrementally. Used in @FT_Incremental_InterfaceRec. 1.259 + * 1.260 + * @fields: 1.261 + * get_glyph_data :: 1.262 + * The function to get glyph data. Must not be null. 1.263 + * 1.264 + * free_glyph_data :: 1.265 + * The function to release glyph data. Must not be null. 1.266 + * 1.267 + * get_glyph_metrics :: 1.268 + * The function to get glyph metrics. May be null if the font does 1.269 + * not provide overriding glyph metrics. 1.270 + * 1.271 + */ 1.272 + typedef struct FT_Incremental_FuncsRec_ 1.273 + { 1.274 + FT_Incremental_GetGlyphDataFunc get_glyph_data; 1.275 + FT_Incremental_FreeGlyphDataFunc free_glyph_data; 1.276 + FT_Incremental_GetGlyphMetricsFunc get_glyph_metrics; 1.277 + 1.278 + } FT_Incremental_FuncsRec; 1.279 + 1.280 + 1.281 + /*************************************************************************** 1.282 + * 1.283 + * @struct: 1.284 + * FT_Incremental_InterfaceRec 1.285 + * 1.286 + * @description: 1.287 + * A structure to be used with @FT_Open_Face to indicate that the user 1.288 + * wants to support incremental glyph loading. You should use it with 1.289 + * @FT_PARAM_TAG_INCREMENTAL as in the following example: 1.290 + * 1.291 + * { 1.292 + * FT_Incremental_InterfaceRec inc_int; 1.293 + * FT_Parameter parameter; 1.294 + * FT_Open_Args open_args; 1.295 + * 1.296 + * 1.297 + * // set up incremental descriptor 1.298 + * inc_int.funcs = my_funcs; 1.299 + * inc_int.object = my_object; 1.300 + * 1.301 + * // set up optional parameter 1.302 + * parameter.tag = FT_PARAM_TAG_INCREMENTAL; 1.303 + * parameter.data = &inc_int; 1.304 + * 1.305 + * // set up FT_Open_Args structure 1.306 + * open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS; 1.307 + * open_args.pathname = my_font_pathname; 1.308 + * open_args.num_params = 1; 1.309 + * open_args.params = ¶meter; // we use one optional argument 1.310 + * 1.311 + * // open the font 1.312 + * error = FT_Open_Face( library, &open_args, index, &face ); 1.313 + * ... 1.314 + * } 1.315 + * 1.316 + */ 1.317 + typedef struct FT_Incremental_InterfaceRec_ 1.318 + { 1.319 + const FT_Incremental_FuncsRec* funcs; 1.320 + FT_Incremental object; 1.321 + 1.322 + } FT_Incremental_InterfaceRec; 1.323 + 1.324 + 1.325 + /*************************************************************************** 1.326 + * 1.327 + * @type: 1.328 + * FT_Incremental_Interface 1.329 + * 1.330 + * @description: 1.331 + * A pointer to an @FT_Incremental_InterfaceRec structure. 1.332 + * 1.333 + */ 1.334 + typedef FT_Incremental_InterfaceRec* FT_Incremental_Interface; 1.335 + 1.336 + 1.337 + /*************************************************************************** 1.338 + * 1.339 + * @constant: 1.340 + * FT_PARAM_TAG_INCREMENTAL 1.341 + * 1.342 + * @description: 1.343 + * A constant used as the tag of @FT_Parameter structures to indicate 1.344 + * an incremental loading object to be used by FreeType. 1.345 + * 1.346 + */ 1.347 +#define FT_PARAM_TAG_INCREMENTAL FT_MAKE_TAG( 'i', 'n', 'c', 'r' ) 1.348 + 1.349 + /* */ 1.350 + 1.351 +FT_END_HEADER 1.352 + 1.353 +#endif /* __FTINCREM_H__ */ 1.354 + 1.355 + 1.356 +/* END */