nuclear@0: /***************************************************************************/ nuclear@0: /* */ nuclear@0: /* ftincrem.h */ nuclear@0: /* */ nuclear@0: /* FreeType incremental loading (specification). */ nuclear@0: /* */ nuclear@0: /* Copyright 2002, 2003, 2006, 2007, 2008, 2010 by */ nuclear@0: /* David Turner, Robert Wilhelm, and Werner Lemberg. */ nuclear@0: /* */ nuclear@0: /* This file is part of the FreeType project, and may only be used, */ nuclear@0: /* modified, and distributed under the terms of the FreeType project */ nuclear@0: /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ nuclear@0: /* this file you indicate that you have read the license and */ nuclear@0: /* understand and accept it fully. */ nuclear@0: /* */ nuclear@0: /***************************************************************************/ nuclear@0: nuclear@0: nuclear@0: #ifndef __FTINCREM_H__ nuclear@0: #define __FTINCREM_H__ nuclear@0: nuclear@0: #include nuclear@0: #include FT_FREETYPE_H nuclear@0: nuclear@0: #ifdef FREETYPE_H nuclear@0: #error "freetype.h of FreeType 1 has been loaded!" nuclear@0: #error "Please fix the directory search order for header files" nuclear@0: #error "so that freetype.h of FreeType 2 is found first." nuclear@0: #endif nuclear@0: nuclear@0: nuclear@0: FT_BEGIN_HEADER nuclear@0: nuclear@0: /*************************************************************************** nuclear@0: * nuclear@0: * @section: nuclear@0: * incremental nuclear@0: * nuclear@0: * @title: nuclear@0: * Incremental Loading nuclear@0: * nuclear@0: * @abstract: nuclear@0: * Custom Glyph Loading. nuclear@0: * nuclear@0: * @description: nuclear@0: * This section contains various functions used to perform so-called nuclear@0: * `incremental' glyph loading. This is a mode where all glyphs loaded nuclear@0: * from a given @FT_Face are provided by the client application, nuclear@0: * nuclear@0: * Apart from that, all other tables are loaded normally from the font nuclear@0: * file. This mode is useful when FreeType is used within another nuclear@0: * engine, e.g., a PostScript Imaging Processor. nuclear@0: * nuclear@0: * To enable this mode, you must use @FT_Open_Face, passing an nuclear@0: * @FT_Parameter with the @FT_PARAM_TAG_INCREMENTAL tag and an nuclear@0: * @FT_Incremental_Interface value. See the comments for nuclear@0: * @FT_Incremental_InterfaceRec for an example. nuclear@0: * nuclear@0: */ nuclear@0: nuclear@0: nuclear@0: /*************************************************************************** nuclear@0: * nuclear@0: * @type: nuclear@0: * FT_Incremental nuclear@0: * nuclear@0: * @description: nuclear@0: * An opaque type describing a user-provided object used to implement nuclear@0: * `incremental' glyph loading within FreeType. This is used to support nuclear@0: * embedded fonts in certain environments (e.g., PostScript interpreters), nuclear@0: * where the glyph data isn't in the font file, or must be overridden by nuclear@0: * different values. nuclear@0: * nuclear@0: * @note: nuclear@0: * It is up to client applications to create and implement @FT_Incremental nuclear@0: * objects, as long as they provide implementations for the methods nuclear@0: * @FT_Incremental_GetGlyphDataFunc, @FT_Incremental_FreeGlyphDataFunc nuclear@0: * and @FT_Incremental_GetGlyphMetricsFunc. nuclear@0: * nuclear@0: * See the description of @FT_Incremental_InterfaceRec to understand how nuclear@0: * to use incremental objects with FreeType. nuclear@0: * nuclear@0: */ nuclear@0: typedef struct FT_IncrementalRec_* FT_Incremental; nuclear@0: nuclear@0: nuclear@0: /*************************************************************************** nuclear@0: * nuclear@0: * @struct: nuclear@0: * FT_Incremental_MetricsRec nuclear@0: * nuclear@0: * @description: nuclear@0: * A small structure used to contain the basic glyph metrics returned nuclear@0: * by the @FT_Incremental_GetGlyphMetricsFunc method. nuclear@0: * nuclear@0: * @fields: nuclear@0: * bearing_x :: nuclear@0: * Left bearing, in font units. nuclear@0: * nuclear@0: * bearing_y :: nuclear@0: * Top bearing, in font units. nuclear@0: * nuclear@0: * advance :: nuclear@0: * Horizontal component of glyph advance, in font units. nuclear@0: * nuclear@0: * advance_v :: nuclear@0: * Vertical component of glyph advance, in font units. nuclear@0: * nuclear@0: * @note: nuclear@0: * These correspond to horizontal or vertical metrics depending on the nuclear@0: * value of the `vertical' argument to the function nuclear@0: * @FT_Incremental_GetGlyphMetricsFunc. nuclear@0: * nuclear@0: */ nuclear@0: typedef struct FT_Incremental_MetricsRec_ nuclear@0: { nuclear@0: FT_Long bearing_x; nuclear@0: FT_Long bearing_y; nuclear@0: FT_Long advance; nuclear@0: FT_Long advance_v; /* since 2.3.12 */ nuclear@0: nuclear@0: } FT_Incremental_MetricsRec; nuclear@0: nuclear@0: nuclear@0: /*************************************************************************** nuclear@0: * nuclear@0: * @struct: nuclear@0: * FT_Incremental_Metrics nuclear@0: * nuclear@0: * @description: nuclear@0: * A handle to an @FT_Incremental_MetricsRec structure. nuclear@0: * nuclear@0: */ nuclear@0: typedef struct FT_Incremental_MetricsRec_* FT_Incremental_Metrics; nuclear@0: nuclear@0: nuclear@0: /*************************************************************************** nuclear@0: * nuclear@0: * @type: nuclear@0: * FT_Incremental_GetGlyphDataFunc nuclear@0: * nuclear@0: * @description: nuclear@0: * A function called by FreeType to access a given glyph's data bytes nuclear@0: * during @FT_Load_Glyph or @FT_Load_Char if incremental loading is nuclear@0: * enabled. nuclear@0: * nuclear@0: * Note that the format of the glyph's data bytes depends on the font nuclear@0: * file format. For TrueType, it must correspond to the raw bytes within nuclear@0: * the `glyf' table. For PostScript formats, it must correspond to the nuclear@0: * *unencrypted* charstring bytes, without any `lenIV' header. It is nuclear@0: * undefined for any other format. nuclear@0: * nuclear@0: * @input: nuclear@0: * incremental :: nuclear@0: * Handle to an opaque @FT_Incremental handle provided by the client nuclear@0: * application. nuclear@0: * nuclear@0: * glyph_index :: nuclear@0: * Index of relevant glyph. nuclear@0: * nuclear@0: * @output: nuclear@0: * adata :: nuclear@0: * A structure describing the returned glyph data bytes (which will be nuclear@0: * accessed as a read-only byte block). nuclear@0: * nuclear@0: * @return: nuclear@0: * FreeType error code. 0~means success. nuclear@0: * nuclear@0: * @note: nuclear@0: * If this function returns successfully the method nuclear@0: * @FT_Incremental_FreeGlyphDataFunc will be called later to release nuclear@0: * the data bytes. nuclear@0: * nuclear@0: * Nested calls to @FT_Incremental_GetGlyphDataFunc can happen for nuclear@0: * compound glyphs. nuclear@0: * nuclear@0: */ nuclear@0: typedef FT_Error nuclear@0: (*FT_Incremental_GetGlyphDataFunc)( FT_Incremental incremental, nuclear@0: FT_UInt glyph_index, nuclear@0: FT_Data* adata ); nuclear@0: nuclear@0: nuclear@0: /*************************************************************************** nuclear@0: * nuclear@0: * @type: nuclear@0: * FT_Incremental_FreeGlyphDataFunc nuclear@0: * nuclear@0: * @description: nuclear@0: * A function used to release the glyph data bytes returned by a nuclear@0: * successful call to @FT_Incremental_GetGlyphDataFunc. nuclear@0: * nuclear@0: * @input: nuclear@0: * incremental :: nuclear@0: * A handle to an opaque @FT_Incremental handle provided by the client nuclear@0: * application. nuclear@0: * nuclear@0: * data :: nuclear@0: * A structure describing the glyph data bytes (which will be accessed nuclear@0: * as a read-only byte block). nuclear@0: * nuclear@0: */ nuclear@0: typedef void nuclear@0: (*FT_Incremental_FreeGlyphDataFunc)( FT_Incremental incremental, nuclear@0: FT_Data* data ); nuclear@0: nuclear@0: nuclear@0: /*************************************************************************** nuclear@0: * nuclear@0: * @type: nuclear@0: * FT_Incremental_GetGlyphMetricsFunc nuclear@0: * nuclear@0: * @description: nuclear@0: * A function used to retrieve the basic metrics of a given glyph index nuclear@0: * before accessing its data. This is necessary because, in certain nuclear@0: * formats like TrueType, the metrics are stored in a different place from nuclear@0: * the glyph images proper. nuclear@0: * nuclear@0: * @input: nuclear@0: * incremental :: nuclear@0: * A handle to an opaque @FT_Incremental handle provided by the client nuclear@0: * application. nuclear@0: * nuclear@0: * glyph_index :: nuclear@0: * Index of relevant glyph. nuclear@0: * nuclear@0: * vertical :: nuclear@0: * If true, return vertical metrics. nuclear@0: * nuclear@0: * ametrics :: nuclear@0: * This parameter is used for both input and output. nuclear@0: * The original glyph metrics, if any, in font units. If metrics are nuclear@0: * not available all the values must be set to zero. nuclear@0: * nuclear@0: * @output: nuclear@0: * ametrics :: nuclear@0: * The replacement glyph metrics in font units. nuclear@0: * nuclear@0: */ nuclear@0: typedef FT_Error nuclear@0: (*FT_Incremental_GetGlyphMetricsFunc) nuclear@0: ( FT_Incremental incremental, nuclear@0: FT_UInt glyph_index, nuclear@0: FT_Bool vertical, nuclear@0: FT_Incremental_MetricsRec *ametrics ); nuclear@0: nuclear@0: nuclear@0: /************************************************************************** nuclear@0: * nuclear@0: * @struct: nuclear@0: * FT_Incremental_FuncsRec nuclear@0: * nuclear@0: * @description: nuclear@0: * A table of functions for accessing fonts that load data nuclear@0: * incrementally. Used in @FT_Incremental_InterfaceRec. nuclear@0: * nuclear@0: * @fields: nuclear@0: * get_glyph_data :: nuclear@0: * The function to get glyph data. Must not be null. nuclear@0: * nuclear@0: * free_glyph_data :: nuclear@0: * The function to release glyph data. Must not be null. nuclear@0: * nuclear@0: * get_glyph_metrics :: nuclear@0: * The function to get glyph metrics. May be null if the font does nuclear@0: * not provide overriding glyph metrics. nuclear@0: * nuclear@0: */ nuclear@0: typedef struct FT_Incremental_FuncsRec_ nuclear@0: { nuclear@0: FT_Incremental_GetGlyphDataFunc get_glyph_data; nuclear@0: FT_Incremental_FreeGlyphDataFunc free_glyph_data; nuclear@0: FT_Incremental_GetGlyphMetricsFunc get_glyph_metrics; nuclear@0: nuclear@0: } FT_Incremental_FuncsRec; nuclear@0: nuclear@0: nuclear@0: /*************************************************************************** nuclear@0: * nuclear@0: * @struct: nuclear@0: * FT_Incremental_InterfaceRec nuclear@0: * nuclear@0: * @description: nuclear@0: * A structure to be used with @FT_Open_Face to indicate that the user nuclear@0: * wants to support incremental glyph loading. You should use it with nuclear@0: * @FT_PARAM_TAG_INCREMENTAL as in the following example: nuclear@0: * nuclear@0: * { nuclear@0: * FT_Incremental_InterfaceRec inc_int; nuclear@0: * FT_Parameter parameter; nuclear@0: * FT_Open_Args open_args; nuclear@0: * nuclear@0: * nuclear@0: * // set up incremental descriptor nuclear@0: * inc_int.funcs = my_funcs; nuclear@0: * inc_int.object = my_object; nuclear@0: * nuclear@0: * // set up optional parameter nuclear@0: * parameter.tag = FT_PARAM_TAG_INCREMENTAL; nuclear@0: * parameter.data = &inc_int; nuclear@0: * nuclear@0: * // set up FT_Open_Args structure nuclear@0: * open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS; nuclear@0: * open_args.pathname = my_font_pathname; nuclear@0: * open_args.num_params = 1; nuclear@0: * open_args.params = ¶meter; // we use one optional argument nuclear@0: * nuclear@0: * // open the font nuclear@0: * error = FT_Open_Face( library, &open_args, index, &face ); nuclear@0: * ... nuclear@0: * } nuclear@0: * nuclear@0: */ nuclear@0: typedef struct FT_Incremental_InterfaceRec_ nuclear@0: { nuclear@0: const FT_Incremental_FuncsRec* funcs; nuclear@0: FT_Incremental object; nuclear@0: nuclear@0: } FT_Incremental_InterfaceRec; nuclear@0: nuclear@0: nuclear@0: /*************************************************************************** nuclear@0: * nuclear@0: * @type: nuclear@0: * FT_Incremental_Interface nuclear@0: * nuclear@0: * @description: nuclear@0: * A pointer to an @FT_Incremental_InterfaceRec structure. nuclear@0: * nuclear@0: */ nuclear@0: typedef FT_Incremental_InterfaceRec* FT_Incremental_Interface; nuclear@0: nuclear@0: nuclear@0: /*************************************************************************** nuclear@0: * nuclear@0: * @constant: nuclear@0: * FT_PARAM_TAG_INCREMENTAL nuclear@0: * nuclear@0: * @description: nuclear@0: * A constant used as the tag of @FT_Parameter structures to indicate nuclear@0: * an incremental loading object to be used by FreeType. nuclear@0: * nuclear@0: */ nuclear@0: #define FT_PARAM_TAG_INCREMENTAL FT_MAKE_TAG( 'i', 'n', 'c', 'r' ) nuclear@0: nuclear@0: /* */ nuclear@0: nuclear@0: FT_END_HEADER nuclear@0: nuclear@0: #endif /* __FTINCREM_H__ */ nuclear@0: nuclear@0: nuclear@0: /* END */