Modified incremental loading interface to be closer to David Turner's

preferences. The header freetype.h is not now affected, the interface is
specified via an FT_Parameter, the pointer to the interface is hidden in an
internal part of the face record, and all the definitions are in ftincrem.h.
This commit is contained in:
Graham Asher 2002-08-01 15:29:17 +00:00
parent f52165cc06
commit ce12182cfc
9 changed files with 175 additions and 293 deletions

View File

@ -499,6 +499,8 @@
#define FT_XFREE86_H <freetype/ftxf86.h>
#define FT_INCREMENTAL_H <freetype/ftincrem.h>
/* now include internal headers definitions from <freetype/internal/...> */
#define FT_INTERNAL_INTERNAL_H <freetype/internal/internal.h>

View File

@ -199,35 +199,6 @@ FT_BEGIN_HEADER
} FT_Glyph_Metrics;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Basic_Glyph_Metrics */
/* */
/* <Description> */
/* A small glyph metrics structure used to return information for */
/* incrementally defined fonts (see @FT_Incremental_Interface). */
/* */
/* <Fields> */
/* bearing_x :: Left side bearing in font units. */
/* */
/* bearing_y :: Top side bearing in font units. */
/* */
/* advance :: Advance in font units. */
/* */
typedef struct FT_Basic_Glyph_Metrics_
{
FT_Long bearing_x;
FT_Long bearing_y;
FT_Long advance;
} FT_Basic_Glyph_Metrics;
#endif /* #ifdef FT_CONFIG_OPTION_INCREMENTAL */
/*************************************************************************/
/* */
/* <Struct> */
@ -508,126 +479,6 @@ FT_BEGIN_HEADER
} FT_CharMapRec;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/*************************************************************************/
/* */
/* <Type> */
/* FT_Get_Glyph_Data_Func */
/* */
/* <Description> */
/* A type definition for a function to get glyph data from a face */
/* that supplies glyph data incrementally, after the face object has */
/* been created. */
/* */
/* <Input> */
/* object :: A pointer to the user's data, specified by the `object' */
/* field in @FT_Incremental_Interface. */
/* */
/* index :: The glyph index. */
/* */
/* <Output> */
/* data :: The position and length of the data. */
/* */
/* <Return> */
/* FreeType error code. O means success. */
/* */
typedef FT_Error
(*FT_Get_Glyph_Data_Func)( void* object,
FT_UInt index,
FT_Data* data );
/*************************************************************************/
/* */
/* <Type> */
/* FT_Get_Glyph_Metrics_Func */
/* */
/* <Description> */
/* A type definition for a function to get glyph metrics from a face */
/* that supplies glyph metrics incrementally, after the face object */
/* has been created. */
/* */
/* <Input> */
/* object :: A pointer to the user's data, specified by the */
/* `object' field in @FT_Incremental_Interface. */
/* */
/* index :: The glyph index. */
/* */
/* vertical :: True for vertical layout, false for horizontal layout. */
/* */
/* <Output> */
/* metrics :: The glyph metrics in font units. */
/* */
/* <Return> */
/* FreeType error code. O means success. */
/* */
typedef FT_Error
(*FT_Get_Glyph_Metrics_Func)( void* object,
FT_UInt index,
FT_Bool vertical,
FT_Basic_Glyph_Metrics* metrics,
FT_Bool* found );
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Incremental_Interface_Funcs */
/* */
/* <Description> */
/* A table of functions for accessing fonts that load data */
/* incrementally. Used in @FT_Incremental_Interface. */
/* */
/* <Fields> */
/* get_glyph_data :: The function to get glyph data. Must not be */
/* null. */
/* */
/* get_glyph_metrics :: The function to get glyph metrics. May be */
/* null if the font does not provide */
/* overriding glyph metrics. */
/* */
typedef struct FT_Incremental_Interface_Funcs_
{
FT_Get_Glyph_Data_Func get_glyph_data;
FT_Get_Glyph_Metrics_Func get_glyph_metrics;
} FT_Incremental_Interface_Funcs;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Incremental_Interface */
/* */
/* <Description> */
/* This interface structure is provided to @FT_Open_Face to allow */
/* incremental faces to be opened. */
/* */
/* An incremental face supplies no glyph data when it is opened. */
/* Instead, the glyph data is supplied using a callback function. */
/* Optionally, metrics that override the metrics in the typeface data */
/* can also be supplied using another callback function. */
/* */
/* <Fields> */
/* funcs :: The table of functions. */
/* */
/* object :: The pointer passed to the functions. Usually it points */
/* to the object from which glyph and metric data is */
/* obtained. */
/* */
typedef struct FT_Incremental_Interface_
{
const FT_Incremental_Interface_Funcs* funcs;
void* object;
} FT_Incremental_Interface;
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
/*************************************************************************/
/*************************************************************************/
/* */
@ -859,10 +710,6 @@ FT_BEGIN_HEADER
FT_Face_Internal internal;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
FT_Incremental_Interface* incremental_interface;
#endif
/*@private end */
} FT_FaceRec;
@ -1601,10 +1448,6 @@ FT_BEGIN_HEADER
/* */
/* ft_open_params :: Use the `num_params' & `params' field. */
/* */
/* ft_open_incremental :: Use the 'incremental_interface' field. */
/* (Available if @FT_CONFIG_OPTION_INCREMENTAL */
/* is defined.) */
/* */
/* <Note> */
/* The `ft_open_memory', `ft_open_stream', and `ft_open_pathname' */
/* flags are mutually exclusive. */
@ -1616,9 +1459,6 @@ FT_BEGIN_HEADER
ft_open_pathname = 4,
ft_open_driver = 8,
ft_open_params = 16
#ifdef FT_CONFIG_OPTION_INCREMENTAL
,ft_open_incremental = 32
#endif
} FT_Open_Flags;
@ -1680,11 +1520,6 @@ FT_BEGIN_HEADER
/* params :: Extra parameters passed to the font driver when */
/* opening a new face. */
/* */
/* incremental_interface :: */
/* If non-null, an interface used to implement */
/* incremental font loading. This field exists only */
/* if @FT_CONFIG_OPTION_INCREMENTAL is defined. */
/* */
/* <Note> */
/* The stream type is determined by the contents of `flags' which */
/* are tested in the following order by @FT_Open_Face: */
@ -1705,10 +1540,6 @@ FT_BEGIN_HEADER
/* `num_params' and `params' will be used. They are ignored */
/* otherwise. */
/* */
/* If the `ft_open_incremental' bit is set 'incremental_interface' */
/* will be used, else it is ignored. This feature is available only */
/* if @FT_CONFIG_OPTION_INCREMENTAL is defined. */
/* */
typedef struct FT_Open_Args_
{
FT_Open_Flags flags;
@ -1719,9 +1550,6 @@ FT_BEGIN_HEADER
FT_Module driver;
FT_Int num_params;
FT_Parameter* params;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
FT_Incremental_Interface* incremental_interface;
#endif
} FT_Open_Args;

View File

@ -11,20 +11,20 @@ FT_BEGIN_HEADER
* @type: FT_Incremental
*
* @description:
* an opaque type describing a user-provided object used to implement
* An opaque type describing a user-provided object used to implement
* "incremental" glyph loading within FreeType. This is used to support
* embedded fonts in certain environments (e.g. Postscript interpreters),
* where the glyph data isn't in the font file, or must be over-ridden by
* where the glyph data isn't in the font file, or must be overridden by
* different values.
*
* @note:
* it's up to client applications to create and implement @FT_Incremental
* It is up to client applications to create and implement @FT_Incremental
* objects, as long as they provide implementations for the methods
* @FT_Incremental_GetGlyphDataFunc, @FT_Incremental_FreeGlyphDataFunc
* and @FT_Incremental_GetGlyphMetricsFunc
*
* see the description of @FT_Incremental_ServiceRec to understand how to
* use incremental objects with FreeType.
* see the description of @FT_Incremental_InterfaceRec to understand how
* to use incremental objects with FreeType.
*/
typedef struct FT_IncrementalRec_* FT_Incremental;
@ -34,17 +34,17 @@ FT_BEGIN_HEADER
* @struct: FT_Incremental_Metrics
*
* @description:
* a small structure used to model the basic glyph metrics returned
* A small structure used to contain the basic glyph metrics returned
* by the @FT_Incremental_GetGlyphMetricsFunc method
*
* @fields:
* bearing_x :: left-most bearing, in font units.
* bearing_y :: top-most bearing, in font units.
* bearing_x :: left bearing, in font units.
* bearing_y :: top bearing, in font units.
* advance :: glyph advance, in font units
*
* @note:
* these correspond to horizontal or vertical metrics depending on the
* value of the 'vertical' parameter of the method
* These correspond to horizontal or vertical metrics depending on the
* value of the 'vertical' argument to the function
* @FT_Incremental_GetGlyphMetricsFunc
*/
typedef struct FT_Incremental_MetricsRec_
@ -61,14 +61,14 @@ FT_BEGIN_HEADER
* @type: FT_Incremental_GetGlyphDataFunc
*
* @description:
* a function called by FreeType to access a given glyph's data bytes
* during @FT_Load_Glyph or @FT_Load_Char, when incremental loading is
* enable.
* 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.
*
* note that the format of the glyph's data bytes depends on the font
* Note that the format of the glyph's data bytes depends on the font
* file format. For TrueType, it must correspond to the raw bytes within
* the 'glyf' table. For Postscript formats, it must correspond to the
* *unencrypted* charstrings bytes, without any 'lenIV' header. It is
* *unencrypted* charstring bytes, without any 'lenIV' header. It is
* undefined for any other format.
*
* @input:
@ -85,24 +85,24 @@ FT_BEGIN_HEADER
* FreeType error code. 0 means success
*
* @note:
* if this function returns succesfully, the method
* @FT_Incremental_FreeGlyphDataFunc will be called later to "release"
* the se bytes.
* If this function returns succesfully the method
* @FT_Incremental_FreeGlyphDataFunc will be called later to release
* the data bytes.
*
* nested @FT_Incremental_GetGlyphDataFunc can happen, in the case of
* compound glyphs !!
* Nested calls to @FT_Incremental_GetGlyphDataFunc can happen for
* compound glyphs.
*/
typedef FT_Error (*FT_Incremental_GetGlyphDataFunc)
( FT_Incremental incremental,
FT_UInt glyph_index,
FT_DataRec *adata );
FT_Data* adata );
/**************************************************************************
*
* @type: FT_Incremental_FreeGlyphDataFunc
*
* @description:
* a function used to "release" the glyph data bytes returned by a
* A function used to release the glyph data bytes returned by a
* successful call to @FT_Incremental_GetGlyphDataFunc.
*
* @input:
@ -113,7 +113,7 @@ FT_BEGIN_HEADER
*/
typedef void (*FT_Incremental_FreeGlyphDataFunc)
( FT_Incremental incremental,
FT_DataRec* data );
FT_Data* data );
/**************************************************************************
@ -121,9 +121,9 @@ FT_BEGIN_HEADER
* @type: FT_Incremental_GetGlyphMetricsFunc
*
* @description:
* a function used to retrieve the basic metrics of a given glyph index
* A function used to retrieve the basic metrics of a given glyph index
* before accessing its data. This is necessary because, in certain formats
* like TrueType, the metrics are stored in a different place than the
* like TrueType, the metrics are stored in a different place from the
* glyph images proper.
*
* @input:
@ -139,32 +139,58 @@ FT_BEGIN_HEADER
FT_Bool *afound );
/*************************************************************************
*
* @struct: FT_Incremental_FuncsRec
*
* @description:
* A table of functions for accessing fonts that load data
* incrementally. Used in @FT_Incremental_Interface.
*
* @fields:
* get_glyph_data :: The function to get glyph data. Must not be
* null.
*
* free_glyph_data :: The function to release glyph data. Must not
* be null.
*
* get_glyph_metrics :: The function to get glyph metrics. May be
* null if the font does not provide
* overriding glyph metrics.
*/
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;
/**************************************************************************
*
* @struct: FT_Incremental_ServiceRec
* @struct: FT_Incremental_InterfaceRec
*
* @description:
* a structure to be used with @FT_Open_Face to indicate that the user
* wants to support "incremental" glyph loading. You should use it with
* A structure to be used with @FT_Open_Face to indicate that the user
* wants to support incremental glyph loading. You should use it with
* @FT_PARAM_TAG_INCREMENTAL as in the following example:
*
* {
* FT_Incremental_ServiceRec incr_service;
* FT_Parameter parameter;
* FT_Open_Args open_args;
* FT_Incremental_InterfaceRec inc_int;
* FT_Parameter parameter;
* FT_Open_Args open_args;
*
* // set up incremental descriptor
* incr_service.incremental = my_object;
* incr_service.get_glyph_metrics = my_get_glyph_metrics;
* incr_service.get_glyph_data = my_get_glyph_data;
* incr_service.free_glyph_data = my_free_glyph_data;
* inc_int.funcs = my_funcs;
* inc_int.object = my_object;
*
* // set up optional parameter
* parameter.tag = FT_PARAM_TAG_INCREMENTAL;
* parameter.data = &incr_service;
* parameter.data = &inc_int;
*
* // set up FT_Open_Args structure
* open_args.flags = ft_open_flag_pathname;
* open_args.flags = (FT_Open_Flags)(ft_open_pathname | ft_open_params);
* open_args.pathname = my_font_pathname;
* open_args.num_params = 1;
* open_args.params = &parameter; // we use one optional argument
@ -174,25 +200,21 @@ FT_BEGIN_HEADER
* ....
* }
*/
typedef struct FT_IncrementalParamsRec_
typedef struct FT_Incremental_InterfaceRec_
{
FT_Incremental incremental;
FT_Incremental_GetGlyphMetricsFunc get_glyph_metrics;
FT_Incremental_GetGlyphDataFunc get_glyph_data;
FT_Incremental_FreeGlyphDataFunc free_glyph_data;
const FT_Incremental_FuncsRec* funcs;
FT_Incremental object;
} FT_IncrementalParamsRec, *FT_IncrementalParams;
} FT_Incremental_InterfaceRec;
/**************************************************************************
*
* @constant: FT_PARAM_TAG_INCREMENTAL
*
* @description:
* a constant used as the tag of @FT_Parameter structures to indicate
* an incremental loading object to be used by FreeType
* A constant used as the tag of @FT_Parameter structures to indicate
* an incremental loading object to be used by FreeType.
*
* see the node for @FT_IncrementalParamsRec
*/
#define FT_PARAM_TAG_INCREMENTAL FT_MAKE_TAG('i','n','c','r')

View File

@ -36,6 +36,10 @@
#include FT_INTERNAL_AUTOHINT_H
#include FT_INTERNAL_OBJECT_H
#ifdef FT_CONFIG_OPTION_INCREMENTAL
#include FT_INCREMENTAL_H
#endif
FT_BEGIN_HEADER
@ -296,6 +300,13 @@ FT_BEGIN_HEADER
/* */
/* postscript_name :: Postscript font name for this face. */
/* */
/* incremental_interface :: If non-null, the interface through */
/* which glyph data and metrics are loaded */
/* incrementally for faces that do not provide */
/* all of this data when first opened. */
/* This field exists only if */
/* @FT_CONFIG_OPTION_INCREMENTAL is defined. */
/* */
typedef struct FT_Face_InternalRec_
{
FT_UShort max_points;
@ -309,6 +320,10 @@ FT_BEGIN_HEADER
const char* postscript_name;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
FT_Incremental_InterfaceRec* incremental_interface;
#endif
} FT_Face_InternalRec;

View File

@ -25,7 +25,6 @@
#include FT_TRUETYPE_TABLES_H
#include FT_OUTLINE_H
FT_BASE_DEF( void )
ft_validator_init( FT_Validator valid,
const FT_Byte* base,
@ -700,11 +699,6 @@
FT_Long face_index,
FT_Int num_params,
FT_Parameter* params,
#ifdef FT_CONFIG_OPTION_INCREMENTAL
FT_Incremental_Interface* incremental_interface,
#endif
FT_Face* aface )
{
FT_Memory memory;
@ -713,7 +707,6 @@
FT_Error error;
FT_Face_Internal internal;
clazz = driver->clazz;
memory = driver->root.memory;
@ -729,8 +722,15 @@
face->driver = driver;
face->memory = memory;
face->stream = stream;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
face->incremental_interface = incremental_interface;
{
int i;
face->internal->incremental_interface = 0;
for (i = 0; i < num_params && !face->internal->incremental_interface; i++)
if (params[i].tag == FT_PARAM_TAG_INCREMENTAL)
face->internal->incremental_interface = params[i].data;
}
#endif
error = clazz->init_face( stream,
@ -874,14 +874,8 @@
/* not all modules are drivers, so check... */
if ( FT_MODULE_IS_DRIVER( driver ) )
{
FT_Int num_params = 0;
FT_Parameter* params = 0;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
FT_Incremental_Interface* incremental_interface =
( args->flags & ft_open_incremental ) ? args->incremental_interface
: 0;
#endif
FT_Int num_params = 0;
FT_Parameter* params = 0;
if ( args->flags & ft_open_params )
{
@ -889,14 +883,8 @@
params = args->params;
}
#ifdef FT_CONFIG_OPTION_INCREMENTAL
error = open_face( driver, stream, face_index,
num_params, params, incremental_interface, &face );
#else
error = open_face( driver, stream, face_index,
num_params, params, &face );
#endif
if ( !error )
goto Success;
}
@ -921,12 +909,6 @@
FT_Int num_params = 0;
FT_Parameter* params = 0;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
FT_Incremental_Interface* incremental_interface =
( args->flags & ft_open_incremental ) ? args->incremental_interface
: 0;
#endif
driver = FT_DRIVER( cur[0] );
if ( args->flags & ft_open_params )
@ -935,14 +917,8 @@
params = args->params;
}
#ifdef FT_CONFIG_OPTION_INCREMENTAL
error = open_face( driver, stream, face_index,
num_params, params, incremental_interface, &face );
#else
error = open_face( driver, stream, face_index,
num_params, params, &face );
#endif
if ( !error )
goto Success;

View File

@ -433,7 +433,7 @@
/* do we have outlines in there? */
#ifdef FT_CONFIG_OPTION_INCREMENTAL
has_outline = FT_BOOL( face->root.incremental_interface != 0 ||
has_outline = FT_BOOL( face->root.internal->incremental_interface != 0 ||
TT_LookUp_Table( face, TTAG_glyf ) != 0 ||
TT_LookUp_Table( face, TTAG_CFF ) != 0 );
#else

View File

@ -756,7 +756,9 @@
FT_Bool opened_frame = 0;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
struct FT_StreamRec_ inc_stream;
struct FT_StreamRec_ inc_stream;
FT_Data glyph_data;
FT_Bool glyph_data_loaded = 0;
#endif
@ -789,14 +791,14 @@
/* If this is an incrementally loaded font see if there are */
/* overriding metrics for this glyph. */
if ( face->root.incremental_interface &&
face->root.incremental_interface->funcs->get_glyph_metrics )
if ( face->root.internal->incremental_interface &&
face->root.internal->incremental_interface->funcs->get_glyph_metrics )
{
FT_Basic_Glyph_Metrics m;
FT_Incremental_MetricsRec m;
error = face->root.incremental_interface->funcs->get_glyph_metrics(
face->root.incremental_interface->object,
error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
face->root.internal->incremental_interface->object,
glyph_index, FALSE, &m, &metrics_found );
if ( error )
goto Exit;
@ -841,21 +843,19 @@
/* the loader stream to a memory stream reading the data returned */
/* by the interface. */
if ( face->root.incremental_interface )
if ( face->root.internal->incremental_interface )
{
FT_Data data;
error = face->root.incremental_interface->funcs->get_glyph_data(
face->root.incremental_interface->object,
glyph_index, &data );
error = face->root.internal->incremental_interface->funcs->get_glyph_data(
face->root.internal->incremental_interface->object,
glyph_index, &glyph_data );
if ( error )
goto Exit;
glyph_data_loaded = 1;
offset = 0;
count = data.length;
count = glyph_data.length;
FT_MEM_ZERO( &inc_stream, sizeof ( inc_stream ) );
FT_Stream_OpenMemory( &inc_stream, data.pointer, data.length );
FT_Stream_OpenMemory( &inc_stream, glyph_data.pointer, glyph_data.length );
loader->stream = &inc_stream;
}
@ -1264,6 +1264,14 @@
face->forget_glyph_frame( loader );
Exit:
#ifdef FT_CONFIG_OPTION_INCREMENTAL
if (glyph_data_loaded)
face->root.internal->incremental_interface->funcs->free_glyph_data(
face->root.internal->incremental_interface->object,
&glyph_data );
#endif
return error;
}
@ -1353,13 +1361,13 @@
/* If this is an incrementally loaded font see if there are */
/* overriding metrics for this glyph. */
if ( face->root.incremental_interface &&
face->root.incremental_interface->funcs->get_glyph_metrics )
if ( face->root.internal->incremental_interface &&
face->root.internal->incremental_interface->funcs->get_glyph_metrics )
{
FT_Basic_Glyph_Metrics m;
FT_Error error =
face->root.incremental_interface->funcs->get_glyph_metrics(
face->root.incremental_interface->object,
FT_Incremental_MetricsRec m;
FT_Error error =
face->root.internal->incremental_interface->funcs->get_glyph_metrics(
face->root.internal->incremental_interface->object,
glyph_index, TRUE, &m, &metrics_found );
@ -1595,7 +1603,7 @@
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/* Don't look for the glyph table if this is an incremental font. */
if ( !face->root.incremental_interface )
if ( !face->root.internal->incremental_interface )
#endif
@ -1656,7 +1664,7 @@
#ifdef FT_CONFIG_OPTION_INCREMENTAL
if ( face->root.incremental_interface )
if ( face->root.internal->incremental_interface )
loader.glyf_offset = 0;
else

View File

@ -201,7 +201,7 @@
#ifdef FT_CONFIG_OPTION_INCREMENTAL
if ( !face->root.incremental_interface )
if ( !face->root.internal->incremental_interface )
error = TT_Load_Locations( face, stream );
if ( !error )
error = TT_Load_CVT ( face, stream ) ||

View File

@ -70,9 +70,9 @@
/* For incremental fonts get the character data using the */
/* callback function. */
if ( face->root.incremental_interface )
error = face->root.incremental_interface->funcs->get_glyph_data(
face->root.incremental_interface->object,
if ( face->root.internal->incremental_interface )
error = face->root.internal->incremental_interface->funcs->get_glyph_data(
face->root.internal->incremental_interface->object,
glyph_index, char_string );
else
@ -92,15 +92,15 @@
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/* Incremental fonts can optionally override the metrics. */
if ( !error && face->root.incremental_interface &&
face->root.incremental_interface->funcs->get_glyph_metrics )
if ( !error && face->root.internal->incremental_interface &&
face->root.internal->incremental_interface->funcs->get_glyph_metrics )
{
FT_Bool found = FALSE;
FT_Basic_Glyph_Metrics metrics;
FT_Bool found = FALSE;
FT_Incremental_MetricsRec metrics;
error = face->root.incremental_interface->funcs->get_glyph_metrics(
face->root.incremental_interface->object,
error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
face->root.internal->incremental_interface->object,
glyph_index, FALSE, &metrics, &found );
if ( found )
{
@ -121,10 +121,23 @@
T1_Parse_Glyph( T1_Decoder decoder,
FT_UInt glyph_index )
{
FT_Data data;
FT_Data glyph_data;
FT_Error error = T1_Parse_Glyph_And_Get_Char_String( decoder, glyph_index, &glyph_data );
#ifdef FT_CONFIG_OPTION_INCREMENTAL
if ( !error)
{
T1_Face face = (T1_Face)decoder->builder.face;
return T1_Parse_Glyph_And_Get_Char_String( decoder, glyph_index, &data );
if ( face->root.internal->incremental_interface )
face->root.internal->incremental_interface->funcs->free_glyph_data(
face->root.internal->incremental_interface->object,
&glyph_data );
}
#endif
return error;
}
@ -211,7 +224,8 @@
FT_Matrix font_matrix;
FT_Vector font_offset;
FT_Data char_string;
FT_Data glyph_data;
FT_Bool glyph_data_loaded = 0;
if ( load_flags & FT_LOAD_NO_RECURSE )
load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
@ -247,9 +261,10 @@
/* now load the unscaled outline */
error = T1_Parse_Glyph_And_Get_Char_String( &decoder, glyph_index,
&char_string );
&glyph_data );
if ( error )
goto Exit;
glyph_data_loaded = 1;
font_matrix = decoder.font_matrix;
font_offset = decoder.font_offset;
@ -368,11 +383,27 @@
/* Set control data to the glyph charstrings. Note that this is */
/* _not_ zero-terminated. */
glyph->root.control_data = (FT_Byte*)char_string.pointer;
glyph->root.control_len = char_string.length;
glyph->root.control_data = (FT_Byte*)glyph_data.pointer;
glyph->root.control_len = glyph_data.length;
}
Exit:
#ifdef FT_CONFIG_OPTION_INCREMENTAL
if ( glyph_data_loaded && face->root.internal->incremental_interface )
{
face->root.internal->incremental_interface->funcs->free_glyph_data(
face->root.internal->incremental_interface->object,
&glyph_data );
/* Set the control data to null - it is no longer available if */
/* loaded incrementally. */
glyph->root.control_data = 0;
glyph->root.control_len = 0;
}
#endif
return error;
}