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