* include/freetype/internal/ftdebug.h, src/base/ftdebug.c: modified
the debug sub-system initialization. trace levels can now be specified within the "FT2_DEBUG" environment variable. See the comments within "ftdebug.c" for more details * include/freetype/internal/fttrace.h: new file to define the trace levels used for debugging. it is used both to define enums and toggle names for FT2_DEBUG * src/base/ftobjs.c, src/base/ftstream.c: FT_Assert renamed to FT_ASSERT * include/freetype/internal/ftextend.h, src/base/ftextend.c, src/base/Jamfile, src/base/rules.mk: removing "ftextend" from the library, since it is now completely obsolete..
This commit is contained in:
parent
90839fa969
commit
222cec8c20
31
ChangeLog
31
ChangeLog
|
@ -1,8 +1,39 @@
|
|||
2002-02-21 David Turner <david@freetype.org>
|
||||
|
||||
* include/freetype/internal/ftdebug.h, src/base/ftdebug.c: modified
|
||||
the debug sub-system initialization. trace levels can now be specified
|
||||
within the "FT2_DEBUG" environment variable. See the comments within
|
||||
"ftdebug.c" for more details
|
||||
|
||||
* include/freetype/internal/fttrace.h: new file to define the trace
|
||||
levels used for debugging. it is used both to define enums and
|
||||
toggle names for FT2_DEBUG
|
||||
|
||||
* src/base/ftobjs.c, src/base/ftstream.c: FT_Assert renamed to
|
||||
FT_ASSERT
|
||||
|
||||
* include/freetype/internal/ftextend.h, src/base/ftextend.c,
|
||||
src/base/Jamfile, src/base/rules.mk: removing "ftextend" from the
|
||||
library, since it is now completely obsolete..
|
||||
|
||||
* include/freetype/fterrors.h: adding "#undef FT_ERR_CAT" to avoid
|
||||
warnings with certain compilers (like LCC)
|
||||
|
||||
* src/pshinter/pshalgo2.c: renaming 'print_zone' to 'psh2_print_zone'
|
||||
to avoid errors during compilation of debug library
|
||||
|
||||
|
||||
2002-02-20 David Turner <david@freetype.org>
|
||||
|
||||
* README: adding "devel@freetype.org" address for bug reports..
|
||||
|
||||
|
||||
2002-02-20 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
* builds/unix/install.mk (check): New dummy target.
|
||||
(.PHONY): Add it.
|
||||
|
||||
|
||||
2002-02-19 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
* builds/freetype.mk (FT_CFLAGS): Use $(INCLUDE_FLAGS) first.
|
||||
|
|
|
@ -250,7 +250,7 @@ FT_BEGIN_HEADER
|
|||
/* Don't define any of these macros to compile in `release' mode! */
|
||||
/* */
|
||||
#undef FT_DEBUG_LEVEL_ERROR
|
||||
#undef FT_DEBUG_LEVEL_TRACE
|
||||
#define FT_DEBUG_LEVEL_TRACE
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
|
|
@ -105,6 +105,10 @@
|
|||
|
||||
|
||||
#undef FT_NEED_EXTERN_C
|
||||
|
||||
#undef FT_ERR_XCAT
|
||||
#undef FT_ERR_CAT
|
||||
|
||||
#define FT_ERR_XCAT( x, y ) x ## y
|
||||
#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y )
|
||||
|
||||
|
@ -192,6 +196,11 @@
|
|||
"invalid argument" )
|
||||
FT_ERRORDEF_( Unimplemented_Feature, 0x07, \
|
||||
"unimplemented feature" )
|
||||
FT_ERRORDEF_( Invalid_Table, 0x08, \
|
||||
"broken table" )
|
||||
FT_ERRORDEF_( Invalid_Offset, 0x09, \
|
||||
"broken offset within table" )
|
||||
|
||||
|
||||
/* glyph/character errors */
|
||||
|
||||
|
|
|
@ -27,99 +27,48 @@
|
|||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
/* force the definition of FT_DEBUG_LEVEL_ERROR if FT_DEBUG_LEVEL_TRACE */
|
||||
/* is already defined.. this simplifies the following #ifdefs.. */
|
||||
/* */
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
# undef FT_DEBUG_LEVEL_ERROR
|
||||
# define FT_DEBUG_LEVEL_ERROR
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define the trace enums as well as the trace levels array when */
|
||||
/* they're needed */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
|
||||
# define FT_TRACE_DEF(x) trace_ ## x ,
|
||||
|
||||
/* note that not all levels are used currently */
|
||||
|
||||
typedef enum FT_Trace_
|
||||
/* defining the enums */
|
||||
typedef enum
|
||||
{
|
||||
/* the first level must always be `trace_any' */
|
||||
trace_any = 0,
|
||||
|
||||
/* base components */
|
||||
trace_aaraster, /* anti-aliasing raster (ftgrays.c) */
|
||||
trace_calc, /* calculations (ftcalc.c) */
|
||||
trace_extend, /* extension manager (ftextend.c) */
|
||||
trace_glyph, /* glyph manager (ftglyph.c) */
|
||||
trace_io, /* i/o monitoring (ftsystem.c) */
|
||||
trace_init, /* initialization (ftinit.c) */
|
||||
trace_list, /* list manager (ftlist.c) */
|
||||
trace_memory, /* memory manager (ftobjs.c) */
|
||||
trace_mm, /* MM interface (ftmm.c) */
|
||||
trace_objs, /* base objects (ftobjs.c) */
|
||||
trace_outline, /* outline management (ftoutln.c) */
|
||||
trace_raster, /* rasterizer (ftraster.c) */
|
||||
trace_stream, /* stream manager (ftstream.c) */
|
||||
|
||||
/* Cache sub-system */
|
||||
trace_cache,
|
||||
|
||||
/* SFNT driver components */
|
||||
trace_sfobjs, /* SFNT object handler (sfobjs.c) */
|
||||
trace_ttcmap, /* charmap handler (ttcmap.c) */
|
||||
trace_ttload, /* basic TrueType tables (ttload.c) */
|
||||
trace_ttpost, /* PS table processing (ttpost.c) */
|
||||
trace_ttsbit, /* TrueType sbit handling (ttsbit.c) */
|
||||
|
||||
/* TrueType driver components */
|
||||
trace_ttdriver, /* TT font driver (ttdriver.c) */
|
||||
trace_ttgload, /* TT glyph loader (ttgload.c) */
|
||||
trace_ttinterp, /* bytecode interpreter (ttinterp.c) */
|
||||
trace_ttobjs, /* TT objects manager (ttobjs.c) */
|
||||
trace_ttpload, /* TT data/program loader (ttpload.c) */
|
||||
|
||||
/* Type 1 driver components */
|
||||
trace_t1driver,
|
||||
trace_t1gload,
|
||||
trace_t1hint,
|
||||
trace_t1load,
|
||||
trace_t1objs,
|
||||
trace_t1parse,
|
||||
|
||||
/* PostScript helper module `psaux' */
|
||||
trace_t1decode,
|
||||
trace_psobjs,
|
||||
|
||||
/* PostScript hinting module `pshinter' */
|
||||
trace_pshrec,
|
||||
trace_pshalgo1,
|
||||
trace_pshalgo2,
|
||||
|
||||
/* Type 2 driver components */
|
||||
trace_cffdriver,
|
||||
trace_cffgload,
|
||||
trace_cffload,
|
||||
trace_cffobjs,
|
||||
trace_cffparse,
|
||||
|
||||
/* CID driver components */
|
||||
trace_cidafm,
|
||||
trace_ciddriver,
|
||||
trace_cidgload,
|
||||
trace_cidload,
|
||||
trace_cidobjs,
|
||||
trace_cidparse,
|
||||
|
||||
/* Windows fonts component */
|
||||
trace_winfnt,
|
||||
|
||||
/* PCF fonts component */
|
||||
trace_pcfdriver,
|
||||
trace_pcfread,
|
||||
|
||||
/* the last level must always be `trace_max' */
|
||||
trace_max
|
||||
# include FT_INTERNAL_TRACE_H
|
||||
trace_count,
|
||||
|
||||
} FT_Trace;
|
||||
|
||||
|
||||
/* declared in ftdebug.c */
|
||||
extern char ft_trace_levels[trace_max];
|
||||
/* defining the array of trace levels, provided by 'src/base/ftdebug.c' */
|
||||
extern int ft_trace_levels [ trace_count ];
|
||||
|
||||
# undef FT_TRACE_DEF
|
||||
|
||||
#endif /* FT_DEBUG_LEVEL_TRACE */
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define the FT_TRACE macro */
|
||||
/* */
|
||||
/* IMPORTANT! */
|
||||
/* */
|
||||
/* Each component must define the macro FT_COMPONENT to a valid FT_Trace */
|
||||
|
@ -127,90 +76,20 @@ FT_BEGIN_HEADER
|
|||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
|
||||
#define FT_TRACE( level, varformat ) \
|
||||
# define FT_TRACE( level, varformat ) \
|
||||
do \
|
||||
{ \
|
||||
if ( ft_trace_levels[FT_COMPONENT] >= level ) \
|
||||
FT_Message varformat; \
|
||||
} while ( 0 )
|
||||
|
||||
#else /* !FT_DEBUG_LEVEL_TRACE */
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* FT_SetTraceLevel */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Sets the trace level for debugging. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* component :: The component which should be traced. See above for */
|
||||
/* a complete list. If set to `trace_any', all */
|
||||
/* components will be traced. */
|
||||
/* */
|
||||
/* level :: The tracing level. */
|
||||
/* */
|
||||
FT_EXPORT( void )
|
||||
FT_SetTraceLevel( FT_Trace component,
|
||||
char level );
|
||||
|
||||
|
||||
#elif defined( FT_DEBUG_LEVEL_ERROR )
|
||||
|
||||
|
||||
#define FT_TRACE( level, varformat ) do ; while ( 0 ) /* nothing */
|
||||
|
||||
|
||||
#else /* release mode */
|
||||
|
||||
|
||||
#define FT_Assert( condition ) do ; while ( 0 ) /* nothing */
|
||||
|
||||
#define FT_TRACE( level, varformat ) do ; while ( 0 ) /* nothing */
|
||||
#define FT_ERROR( varformat ) do ; while ( 0 ) /* nothing */
|
||||
|
||||
|
||||
#endif /* FT_DEBUG_LEVEL_TRACE, FT_DEBUG_LEVEL_ERROR */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define macros and functions that are common to the debug and trace */
|
||||
/* modes. */
|
||||
/* */
|
||||
/* You need vprintf() to be able to compile ftdebug.c. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
#if defined( FT_DEBUG_LEVEL_TRACE ) || defined( FT_DEBUG_LEVEL_ERROR )
|
||||
|
||||
|
||||
#include "stdio.h" /* for vprintf() */
|
||||
|
||||
|
||||
#define FT_Assert( condition ) \
|
||||
do \
|
||||
{ \
|
||||
if ( !( condition ) ) \
|
||||
FT_Panic( "assertion failed on line %d of file %s\n", \
|
||||
__LINE__, __FILE__ ); \
|
||||
} while ( 0 )
|
||||
|
||||
/* print a message */
|
||||
FT_EXPORT( void )
|
||||
FT_Message( const char* fmt, ... );
|
||||
|
||||
/* print a message and exit */
|
||||
FT_EXPORT( void )
|
||||
FT_Panic( const char* fmt, ... );
|
||||
|
||||
#define FT_ERROR( varformat ) FT_Message varformat
|
||||
|
||||
|
||||
#endif /* FT_DEBUG_LEVEL_TRACE || FT_DEBUG_LEVEL_ERROR */
|
||||
# define FT_TRACE( level, varformat ) do ; while ( 0 ) /* nothing */
|
||||
|
||||
#endif /* !FT_DEBUG_LEVEL_TRACE */
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
|
@ -230,6 +109,72 @@ FT_BEGIN_HEADER
|
|||
#define FT_TRACE7( varformat ) FT_TRACE( 7, varformat )
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define the FT_ERROR macro */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_ERROR
|
||||
|
||||
# define FT_ERROR( varformat ) FT_Message varformat
|
||||
|
||||
#else /* !FT_DEBUG_LEVEL_ERROR */
|
||||
|
||||
# define FT_ERROR( varformat ) do ; while ( 0 ) /* nothing */
|
||||
|
||||
#endif /* !FT_DEBUG_LEVEL_ERROR */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define the FT_ASSERT macro */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_ERROR
|
||||
|
||||
#define FT_ASSERT( condition ) \
|
||||
do \
|
||||
{ \
|
||||
if ( !( condition ) ) \
|
||||
FT_Panic( "assertion failed on line %d of file %s\n", \
|
||||
__LINE__, __FILE__ ); \
|
||||
} while ( 0 )
|
||||
|
||||
#else /* !FT_DEBUG_LEVEL_ERROR */
|
||||
|
||||
# define FT_ASSERT( condition ) do ; while ( 0 )
|
||||
|
||||
#endif /* !FT_DEBUG_LEVEL_ERROR */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define 'FT_Message' and 'FT_Panic' when needed */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_ERROR
|
||||
|
||||
#include "stdio.h" /* for vprintf() */
|
||||
|
||||
/* print a message */
|
||||
FT_EXPORT( void )
|
||||
FT_Message( const char* fmt, ... );
|
||||
|
||||
/* print a message and exit */
|
||||
FT_EXPORT( void )
|
||||
FT_Panic( const char* fmt, ... );
|
||||
|
||||
#endif /* FT_DEBUG_LEVEL_ERROR */
|
||||
|
||||
|
||||
|
||||
FT_BASE( void ) ft_debug_init( void );
|
||||
|
||||
|
||||
#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */
|
||||
|
||||
/* we disable the warning `conditional expression is constant' here */
|
||||
|
|
|
@ -1,211 +0,0 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftextend.h */
|
||||
/* */
|
||||
/* FreeType extensions implementation (specification). */
|
||||
/* */
|
||||
/* Copyright 1996-2001 by */
|
||||
/* 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 __FTEXTEND_H__
|
||||
#define __FTEXTEND_H__
|
||||
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* The extensions don't need to be integrated at compile time into the */
|
||||
/* engine, only at link time. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <FuncType> */
|
||||
/* FT_Extension_Initializer */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Each new face object can have several extensions associated with */
|
||||
/* it at creation time. This function is used to initialize given */
|
||||
/* extension data for a given face. */
|
||||
/* */
|
||||
/* <InOut> */
|
||||
/* ext :: A typeless pointer to the extension data. */
|
||||
/* */
|
||||
/* face :: A handle to the source face object the extension is */
|
||||
/* associated with. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* In case of error, the initializer should not destroy the extension */
|
||||
/* data, as the finalizer will get called later by the function's */
|
||||
/* caller. */
|
||||
/* */
|
||||
typedef FT_Error
|
||||
(*FT_Extension_Initializer)( void* ext,
|
||||
FT_Face face );
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <FuncType> */
|
||||
/* FT_Extension_Finalizer */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Each new face object can have several extensions associated with */
|
||||
/* it at creation time. This function is used to finalize given */
|
||||
/* extension data for a given face; it occurs before the face object */
|
||||
/* itself is finalized. */
|
||||
/* */
|
||||
/* <InOut> */
|
||||
/* ext :: A typeless pointer to the extension data. */
|
||||
/* */
|
||||
/* face :: A handle to the source face object the extension is */
|
||||
/* associated with. */
|
||||
/* */
|
||||
typedef void
|
||||
(*FT_Extension_Finalizer)( void* ext,
|
||||
FT_Face face );
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Struct> */
|
||||
/* FT_Extension_Class */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A simple structure used to describe a given extension to the */
|
||||
/* FreeType base layer. An FT_Extension_Class is used as a parameter */
|
||||
/* for FT_Register_Extension(). */
|
||||
/* */
|
||||
/* <Fields> */
|
||||
/* id :: The extension's ID. This is a normal C string that */
|
||||
/* is used to uniquely reference the extension's */
|
||||
/* interface. */
|
||||
/* */
|
||||
/* size :: The size in bytes of the extension data that must be */
|
||||
/* associated with each face object. */
|
||||
/* */
|
||||
/* init :: A pointer to the extension data's initializer. */
|
||||
/* */
|
||||
/* finalize :: A pointer to the extension data's finalizer. */
|
||||
/* */
|
||||
/* interface :: This pointer can be anything, but should usually */
|
||||
/* point to a table of function pointers which implement */
|
||||
/* the extension's interface. */
|
||||
/* */
|
||||
/* offset :: This field is set and used within the base layer and */
|
||||
/* should be set to 0 when registering an extension */
|
||||
/* through FT_Register_Extension(). It contains an */
|
||||
/* offset within the face's extension block for the */
|
||||
/* current extension's data. */
|
||||
/* */
|
||||
typedef struct FT_Extension_Class_
|
||||
{
|
||||
const char* id;
|
||||
FT_ULong size;
|
||||
FT_Extension_Initializer init;
|
||||
FT_Extension_Finalizer finalize;
|
||||
void* interface;
|
||||
|
||||
FT_ULong offset;
|
||||
|
||||
} FT_Extension_Class;
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* FT_Register_Extension */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Registers a new extension. */
|
||||
/* */
|
||||
/* <InOut> */
|
||||
/* driver :: A handle to the driver object. */
|
||||
/* */
|
||||
/* class :: A pointer to a class describing the extension. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
FT_EXPORT( FT_Error )
|
||||
FT_Register_Extension( FT_Driver driver,
|
||||
FT_Extension_Class* clazz );
|
||||
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_EXTEND_ENGINE
|
||||
|
||||
|
||||
/* Initialize the extension component */
|
||||
FT_LOCAL FT_Error
|
||||
FT_Init_Extensions( FT_Library library );
|
||||
|
||||
/* Finalize the extension component */
|
||||
FT_LOCAL FT_Error
|
||||
FT_Done_Extensions( FT_Library library );
|
||||
|
||||
/* Create an extension within a face object. Called by the */
|
||||
/* face object constructor. */
|
||||
FT_LOCAL FT_Error
|
||||
FT_Create_Extensions( FT_Face face );
|
||||
|
||||
/* Destroy all extensions within a face object. Called by the */
|
||||
/* face object destructor. */
|
||||
FT_LOCAL FT_Error
|
||||
FT_Destroy_Extensions( FT_Face face );
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* FT_Get_Extension */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Queries an extension block by an extension ID string. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* face :: A handle to the face object. */
|
||||
/* extension_id :: An ID string identifying the extension. */
|
||||
/* */
|
||||
/* <Output> */
|
||||
/* extension_interface :: A generic pointer, usually pointing to a */
|
||||
/* table of functions implementing the */
|
||||
/* extension interface. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* A generic pointer to the extension block. */
|
||||
/* */
|
||||
FT_EXPORT( void* )
|
||||
FT_Get_Extension( FT_Face face,
|
||||
const char* extension_id,
|
||||
void** extension_interface );
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* __FTEXTEND_H__ */
|
||||
|
||||
|
||||
/* END */
|
|
@ -26,7 +26,7 @@
|
|||
#ifndef __FTOBJS_H__
|
||||
#define __FTOBJS_H__
|
||||
|
||||
|
||||
#include <setjmp.h>
|
||||
#include <ft2build.h>
|
||||
#include FT_RENDER_H
|
||||
#include FT_SIZES_H
|
||||
|
@ -445,6 +445,171 @@ FT_BEGIN_HEADER
|
|||
FT_GlyphLoader* source );
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/**** ****/
|
||||
/**** ****/
|
||||
/**** V A L I D A T O R ****/
|
||||
/**** ****/
|
||||
/**** ****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
typedef struct FT_ValidatorRec_* FT_Validator;
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* there are three distinct validation levels here:
|
||||
*
|
||||
* DEFAULT ::
|
||||
* used to perform normal checks. A table validated with this setting
|
||||
* is sufficiently correct to be used reliably by FreeType
|
||||
*
|
||||
* TIGHT ::
|
||||
* this is more strict than default. A table validated with this setting
|
||||
* is sufficiently correct to be used reliablity by FreeType and to not
|
||||
* contain invalid data (that will not crash FreeType or produce bogus
|
||||
* warnings). This is used to spot font converter/generation tool
|
||||
* bugs..
|
||||
*
|
||||
* for example, a CharMap table could map a given character code to
|
||||
* a glyph index that is larger than the number of available glyphs
|
||||
* in the font. Such a table would not pass the "TIGHT" validation
|
||||
* even though it can be used safely with FreeType (which will later
|
||||
* report errors when trying to load the glyph, for example..)
|
||||
*
|
||||
*
|
||||
* PARANOID ::
|
||||
* in this mode, everything is checked to the maximum, and according
|
||||
* to the specification(s) defining the tables being checked. Really
|
||||
* useful for font fascists and to spot really weird font artefacts.
|
||||
*
|
||||
* Beware that most fonts will simply not pass this validation level
|
||||
* though !!
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
FT_VALIDATE_DEFAULT = 0,
|
||||
FT_VALIDATE_TIGHT,
|
||||
FT_VALIDATE_PARANOID
|
||||
|
||||
} FT_ValidationLevel;
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* to use it, you need something like:
|
||||
*
|
||||
* valid->error = 0;
|
||||
*
|
||||
* if ( setjmp( valid->jump_buffer ) == 0 )
|
||||
* validate_table( table_data, .... );
|
||||
*
|
||||
* return valid->error;
|
||||
*
|
||||
*/
|
||||
typedef struct FT_ValidatorRec_
|
||||
{
|
||||
FT_Byte* base; /* address of table in memory */
|
||||
FT_Byte* limit; /* base + size of table in bytes */
|
||||
|
||||
FT_Error error; /* error code. 0 in case of success */
|
||||
FT_ValidationLevel level; /* validation level.. */
|
||||
FT_UInt num_glyphs; /* if level >= FT_VALIDATE_TIGHT only */
|
||||
|
||||
jmp_buf jump_buffer;
|
||||
|
||||
} FT_ValidatorRec;
|
||||
|
||||
|
||||
/* call this function when an error is detected during validation. this */
|
||||
/* will set the error and call 'longjmp' to return to the top-level */
|
||||
/* caller of the validation routine.. */
|
||||
/* */
|
||||
FT_BASE( void )
|
||||
ft_validator_error( FT_Validator valid,
|
||||
FT_Error error );
|
||||
|
||||
/* this macro assumes that the local variable 'valid' points to the */
|
||||
/* current validator structure.. */
|
||||
#define FT_INVALID(e) ft_validator_error( valid, e )
|
||||
|
||||
/* a few "common" errors in font tables */
|
||||
#define FT_INVALID_TOO_SHORT FT_INVALID( FT_Err_Invalid_Table )
|
||||
#define FT_INVALID_OFFSET FT_INVALID( FT_Err_Invalid_Offset )
|
||||
#define FT_INVALID_GLYPH_ID FT_INVALID( FT_Err_Invalid_Table )
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/**** ****/
|
||||
/**** ****/
|
||||
/**** C H A R M A P S ****/
|
||||
/**** ****/
|
||||
/**** ****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
/* handle to internal charmap object */
|
||||
typedef struct FT_CMapRec_* FT_CMap;
|
||||
|
||||
/* handle to charmap class structure */
|
||||
typedef const struct FT_CMap_ClassRec_* FT_CMap_Class;
|
||||
|
||||
|
||||
/* internal charmap object structure, sub-class of 'FT_CharMapRec' */
|
||||
typedef struct FT_CMapRec_
|
||||
{
|
||||
FT_CharMapRec charmap;
|
||||
FT_CMap_Class clazz;
|
||||
FT_Pointer data; /* passed to validate/index/next methods */
|
||||
|
||||
} FT_CMapRec;
|
||||
|
||||
/* useful macros */
|
||||
#define FT_CMAP(x) ((FT_CMap)(x))
|
||||
#define FT_CMAP_FACE(x) (FT_CMAP(x)->charmap.face)
|
||||
#define FT_CMAP_PLATFORM_ID(x) (FT_CMAP(x)->charmap.platform_id)
|
||||
#define FT_CMAP_ENCODING_ID(x) (FT_CMAP(x)->charmap.encoding_id)
|
||||
#define FT_CMAP_ENCODING(x) (FT_CMAP(x)->charmap.encoding)
|
||||
|
||||
|
||||
/* charmap initializer */
|
||||
typedef FT_Error (*FT_CMap_InitFunc)( FT_CMap cmap );
|
||||
|
||||
/* charmap finalizer */
|
||||
typedef void (*FT_CMap_DoneFunc)( FT_CMap cmap );
|
||||
|
||||
/* charmap validation routine */
|
||||
typedef FT_Error (*FT_CMap_ValidateFunc)( FT_Pointer cmap_data,
|
||||
FT_Validator valid );
|
||||
|
||||
/* charmap charcode to glyph index mapping function */
|
||||
typedef FT_UInt (*FT_CMap_CharIndexFunc)( FT_Pointer cmap_data,
|
||||
FT_ULong char_code );
|
||||
|
||||
/* charmap charcode increment function */
|
||||
typedef FT_ULong (*FT_CMap_CharNextFunc)( FT_Pointer cmap_data,
|
||||
FT_ULong char_code,
|
||||
FT_UInt *agindex );
|
||||
|
||||
/* charmap class */
|
||||
typedef struct FT_CMap_ClassRec_
|
||||
{
|
||||
FT_ULong size; /* size in bytes */
|
||||
FT_CMap_InitFunc init;
|
||||
FT_CMap_DoneFunc done;
|
||||
FT_CMap_ValidateFunc validate;
|
||||
FT_CMap_CharIndexFunc char_index;
|
||||
FT_CMap_CharNextFunc char_next;
|
||||
|
||||
} FT_CMap_ClassRec;
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
/* definitions of trace levels for FreeType 2 */
|
||||
|
||||
/* the first level must always be `trace_any' */
|
||||
FT_TRACE_DEF( any )
|
||||
|
||||
/* base components */
|
||||
FT_TRACE_DEF( calc ) /* calculations (ftcalc.c) */
|
||||
FT_TRACE_DEF( memory ) /* memory manager (ftobjs.c) */
|
||||
FT_TRACE_DEF( stream ) /* stream manager (ftstream.c) */
|
||||
FT_TRACE_DEF( io ) /* i/o interface (ftsystem.c) */
|
||||
FT_TRACE_DEF( list ) /* list management (ftlist.c) */
|
||||
FT_TRACE_DEF( init ) /* initialization (ftinit.c) */
|
||||
FT_TRACE_DEF( objs ) /* base objects (ftobjs.c) */
|
||||
FT_TRACE_DEF( outline ) /* outline management (ftoutln.c) */
|
||||
FT_TRACE_DEF( glyph ) /* glyph management (ftglyph.c) */
|
||||
|
||||
FT_TRACE_DEF( raster ) /* monochrome rasterizer (ftraster.c) */
|
||||
FT_TRACE_DEF( smooth ) /* anti-aliasing raster (ftgrays.c) */
|
||||
FT_TRACE_DEF( mm ) /* MM interface (ftmm.c) */
|
||||
|
||||
/* Cache sub-system */
|
||||
FT_TRACE_DEF( cache ) /* cache sub-system (ftcache.c, etc..) */
|
||||
|
||||
/* SFNT driver components */
|
||||
FT_TRACE_DEF( sfobjs ) /* SFNT object handler (sfobjs.c) */
|
||||
FT_TRACE_DEF( ttcmap ) /* charmap handler (ttcmap.c) */
|
||||
FT_TRACE_DEF( ttload ) /* basic TrueType tables (ttload.c) */
|
||||
FT_TRACE_DEF( ttpost ) /* PS table processing (ttpost.c) */
|
||||
FT_TRACE_DEF( ttsbit ) /* TrueType sbit handling (ttsbit.c) */
|
||||
|
||||
/* TrueType driver components */
|
||||
FT_TRACE_DEF( ttdriver ) /* TT font driver (ttdriver.c) */
|
||||
FT_TRACE_DEF( ttgload ) /* TT glyph loader (ttgload.c) */
|
||||
FT_TRACE_DEF( ttinterp ) /* bytecode interpreter (ttinterp.c) */
|
||||
FT_TRACE_DEF( ttobjs ) /* TT objects manager (ttobjs.c) */
|
||||
FT_TRACE_DEF( ttpload ) /* TT data/program loader (ttpload.c) */
|
||||
|
||||
/* Type 1 driver components */
|
||||
FT_TRACE_DEF( t1driver )
|
||||
FT_TRACE_DEF( t1gload )
|
||||
FT_TRACE_DEF( t1hint )
|
||||
FT_TRACE_DEF( t1load )
|
||||
FT_TRACE_DEF( t1objs )
|
||||
FT_TRACE_DEF( t1parse )
|
||||
|
||||
/* PostScript helper module `psaux' */
|
||||
FT_TRACE_DEF( t1decode )
|
||||
FT_TRACE_DEF( psobjs )
|
||||
|
||||
/* PostScript hinting module `pshinter' */
|
||||
FT_TRACE_DEF( pshrec )
|
||||
FT_TRACE_DEF( pshalgo1 )
|
||||
FT_TRACE_DEF( pshalgo2 )
|
||||
|
||||
/* Type 2 driver components */
|
||||
FT_TRACE_DEF( cffdriver )
|
||||
FT_TRACE_DEF( cffgload )
|
||||
FT_TRACE_DEF( cffload )
|
||||
FT_TRACE_DEF( cffobjs )
|
||||
FT_TRACE_DEF( cffparse )
|
||||
|
||||
/* CID driver components */
|
||||
FT_TRACE_DEF( cidafm )
|
||||
FT_TRACE_DEF( ciddriver )
|
||||
FT_TRACE_DEF( cidgload )
|
||||
FT_TRACE_DEF( cidload )
|
||||
FT_TRACE_DEF( cidobjs )
|
||||
FT_TRACE_DEF( cidparse )
|
||||
|
||||
/* Windows fonts component */
|
||||
FT_TRACE_DEF( winfnt )
|
||||
|
||||
/* PCF fonts component */
|
||||
FT_TRACE_DEF( pcfdriver )
|
||||
FT_TRACE_DEF( pcfread )
|
|
@ -32,6 +32,7 @@
|
|||
#define FT_INTERNAL_CALC_H <freetype/internal/ftcalc.h>
|
||||
#define FT_INTERNAL_DRIVER_H <freetype/internal/ftdriver.h>
|
||||
#define FT_INTERNAL_EXTEND_H <freetype/internal/ftextend.h>
|
||||
#define FT_INTERNAL_TRACE_H <freetype/internal/fttrace.h>
|
||||
|
||||
#define FT_INTERNAL_SFNT_H <freetype/internal/sfnt.h>
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ SubDirHdrs [ FT2_SubDir src base ] ;
|
|||
|
||||
if $(FT2_MULTI)
|
||||
{
|
||||
_sources = ftcalc ftextend ftlist ftobjs ftstream ftoutln ftnames fttrigon
|
||||
_sources = ftcalc ftlist ftobjs ftstream ftoutln ftnames fttrigon
|
||||
ftdbgmem ;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -45,12 +45,7 @@
|
|||
#include FT_INTERNAL_DEBUG_H
|
||||
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
char ft_trace_levels[trace_max];
|
||||
#endif
|
||||
|
||||
|
||||
#if defined( FT_DEBUG_LEVEL_ERROR ) || defined( FT_DEBUG_LEVEL_TRACE )
|
||||
#if defined( FT_DEBUG_LEVEL_ERROR )
|
||||
|
||||
|
||||
#include <stdarg.h>
|
||||
|
@ -83,36 +78,123 @@
|
|||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
#endif /* FT_DEBUG_LEVEL_ERROR */
|
||||
|
||||
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
|
||||
FT_EXPORT_DEF( void )
|
||||
FT_SetTraceLevel( FT_Trace component,
|
||||
char level )
|
||||
/* array of trace levels, initialized to 0 */
|
||||
int ft_trace_levels[ trace_count ];
|
||||
|
||||
/* define array of trace toggle names */
|
||||
#define FT_TRACE_DEF(x) #x ,
|
||||
|
||||
static const char* ft_trace_toggles[ trace_count+1 ] =
|
||||
{
|
||||
#include FT_INTERNAL_TRACE_H
|
||||
NULL
|
||||
};
|
||||
|
||||
#undef FT_TRACE_DEF
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
* initialize the tracing sub-system, this is done by retrieving the
|
||||
* value of the "FT2_DEBUG" environment variable. It must be a list of
|
||||
* toggles, separated by spaces, ';' or ':' for example:
|
||||
*
|
||||
* "any=3 memory=6 stream=5"
|
||||
*
|
||||
* will request that all levels be set to 3, except the trace level for
|
||||
* the memory and stream components which are respectively set to 6 and 5
|
||||
*
|
||||
* see the file <freetype/internal/fttrace.h> for details of the available
|
||||
* toggle names.
|
||||
*
|
||||
* the level is between 0 and 6, where 0 is quiet (except in important
|
||||
* runtime errors), and 6 is _very_ verbose
|
||||
*/
|
||||
|
||||
FT_BASE_DEF( void )
|
||||
ft_debug_init( void )
|
||||
{
|
||||
if ( component >= trace_max )
|
||||
return;
|
||||
|
||||
/* if component is `trace_any', change _all_ levels at once */
|
||||
if ( component == trace_any )
|
||||
const char* ft2_debug = getenv( "FT2_DEBUG" );
|
||||
|
||||
if ( ft2_debug )
|
||||
{
|
||||
int n;
|
||||
|
||||
|
||||
for ( n = trace_any; n < trace_max; n++ )
|
||||
ft_trace_levels[n] = level;
|
||||
const char* p = ft2_debug;
|
||||
const char* q;
|
||||
|
||||
for ( ; *p; p++ )
|
||||
{
|
||||
/* skip leading whitespace and separators */
|
||||
if ( *p == ' ' || *p == '\t' || *p == ':' || *p == ';' || *p == '=' )
|
||||
continue;
|
||||
|
||||
/* read toggle name, followed by '=' */
|
||||
q = p;
|
||||
while ( *p && *p != '=' )
|
||||
p++;
|
||||
|
||||
if ( *p == '=' && p > q )
|
||||
{
|
||||
int n, i, len = p - q;
|
||||
int level = -1, found = -1;
|
||||
|
||||
for ( n = 0; n < trace_count; n++ )
|
||||
{
|
||||
const char* toggle = ft_trace_toggles[n];
|
||||
|
||||
for ( i = 0; i < len; i++ )
|
||||
{
|
||||
if ( toggle[i] != q[i] )
|
||||
break;
|
||||
}
|
||||
|
||||
if ( i == len && toggle[i] == 0 )
|
||||
{
|
||||
found = n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* read level */
|
||||
p++;
|
||||
if ( *p )
|
||||
{
|
||||
level = *p++ - '0';
|
||||
if ( level < 0 || level > 6 )
|
||||
level = -1;
|
||||
}
|
||||
|
||||
if ( found >= 0 && level >= 0 )
|
||||
{
|
||||
if ( found == trace_any )
|
||||
{
|
||||
/* special case for "any" */
|
||||
for ( n = 0; n < trace_count; n++ )
|
||||
ft_trace_levels[n] = level;
|
||||
}
|
||||
else
|
||||
ft_trace_levels[ found ] = level;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else /* otherwise, only change individual component */
|
||||
ft_trace_levels[component] = level;
|
||||
}
|
||||
|
||||
#endif /* FT_DEBUG_LEVEL_TRACE */
|
||||
#else /* !FT_DEBUG_LEVEL_TRACE */
|
||||
|
||||
#endif /* FT_DEBUG_LEVEL_TRACE || FT_DEBUG_LEVEL_ERROR */
|
||||
FT_BASE_DEF( void )
|
||||
ft_debut_init( void )
|
||||
{
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
|
||||
/* ANSI C doesn't allow empty files, so we insert a dummy symbol */
|
||||
extern const int ft_debug_dummy;
|
||||
#endif /* !FT_DEBUG_LEVEL_TRACE */
|
||||
|
||||
|
||||
/* END */
|
||||
|
|
|
@ -1,302 +0,0 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftextend.c */
|
||||
/* */
|
||||
/* FreeType extensions implementation (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2001 by */
|
||||
/* 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* This is an updated version of the extension component, now located */
|
||||
/* in the main library's source directory. It allows the dynamic */
|
||||
/* registration/use of various face object extensions through a simple */
|
||||
/* API. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_INTERNAL_EXTEND_H
|
||||
#include FT_INTERNAL_DEBUG_H
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
|
||||
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
|
||||
/* messages during execution. */
|
||||
/* */
|
||||
#undef FT_COMPONENT
|
||||
#define FT_COMPONENT trace_extend
|
||||
|
||||
|
||||
typedef struct FT_Extension_Registry_
|
||||
{
|
||||
FT_Int num_extensions;
|
||||
FT_Long cur_offset;
|
||||
FT_Extension_Class classes[FT_MAX_EXTENSIONS];
|
||||
|
||||
} FT_Extension_Registry;
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* FT_Init_Extensions */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Initializes the extension component. */
|
||||
/* */
|
||||
/* <InOut> */
|
||||
/* driver :: A handle to the driver object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
FT_LOCAL_DEF FT_Error
|
||||
FT_Init_Extensions( FT_Driver driver )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Memory memory;
|
||||
FT_Extension_Registry* registry;
|
||||
|
||||
|
||||
memory = driver->root.library->memory;
|
||||
if ( ALLOC( registry, sizeof ( *registry ) ) )
|
||||
return error;
|
||||
|
||||
registry->num_extensions = 0;
|
||||
registry->cur_offset = 0;
|
||||
driver->extensions = registry;
|
||||
|
||||
FT_TRACE2(( "FT_Init_Extensions: success\n" ));
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* FT_Done_Extensions */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Finalizes the extension component. */
|
||||
/* */
|
||||
/* <InOut> */
|
||||
/* driver :: A handle to the driver object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
FT_LOCAL_DEF FT_Error
|
||||
FT_Done_Extensions( FT_Driver driver )
|
||||
{
|
||||
FT_Memory memory = driver->root.memory;
|
||||
|
||||
|
||||
FREE( driver->extensions );
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftextend.h */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Register_Extension( FT_Driver driver,
|
||||
FT_Extension_Class* clazz )
|
||||
{
|
||||
FT_Extension_Registry* registry;
|
||||
|
||||
|
||||
if ( !driver )
|
||||
return FT_Err_Invalid_Driver_Handle;
|
||||
|
||||
if ( !clazz )
|
||||
return FT_Err_Invalid_Argument;
|
||||
|
||||
registry = (FT_Extension_Registry*)driver->extensions;
|
||||
if ( registry )
|
||||
{
|
||||
FT_Int n = registry->num_extensions;
|
||||
FT_Extension_Class* cur = registry->classes + n;
|
||||
|
||||
|
||||
if ( n >= FT_MAX_EXTENSIONS )
|
||||
return FT_Err_Too_Many_Extensions;
|
||||
|
||||
*cur = *clazz;
|
||||
|
||||
cur->offset = registry->cur_offset;
|
||||
|
||||
registry->num_extensions++;
|
||||
registry->cur_offset +=
|
||||
( cur->size + FT_ALIGNMENT - 1 ) & -FT_ALIGNMENT;
|
||||
|
||||
FT_TRACE1(( "FT_Register_Extension: `%s' successfully registered\n",
|
||||
cur->id ));
|
||||
}
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
/* documentation is in ftextend.h */
|
||||
|
||||
FT_EXPORT_DEF( void* )
|
||||
FT_Get_Extension( FT_Face face,
|
||||
const char* extension_id,
|
||||
void** extension_interface )
|
||||
{
|
||||
FT_Extension_Registry* registry;
|
||||
|
||||
|
||||
if ( !face || !extension_id || !extension_interface )
|
||||
return 0;
|
||||
|
||||
registry = (FT_Extension_Registry*)face->driver->extensions;
|
||||
if ( registry && face->extensions )
|
||||
{
|
||||
FT_Extension_Class* cur = registry->classes;
|
||||
FT_Extension_Class* limit = cur + registry->num_extensions;
|
||||
|
||||
|
||||
for ( ; cur < limit; cur++ )
|
||||
if ( strcmp( cur->id, extension_id ) == 0 )
|
||||
{
|
||||
*extension_interface = cur->interface;
|
||||
|
||||
FT_TRACE1(( "FT_Get_Extension: got `%s'\n", extension_id ));
|
||||
|
||||
return (void*)((char*)face->extensions + cur->offset);
|
||||
}
|
||||
}
|
||||
|
||||
/* could not find the extension id */
|
||||
|
||||
FT_ERROR(( "FT_Get_Extension: couldn't find `%s'\n", extension_id ));
|
||||
|
||||
*extension_interface = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* FT_Destroy_Extensions */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Destroys all extensions within a face object. */
|
||||
/* */
|
||||
/* <InOut> */
|
||||
/* face :: A handle to the face object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* Called by the face object destructor. */
|
||||
/* */
|
||||
FT_LOCAL_DEF FT_Error
|
||||
FT_Destroy_Extensions( FT_Face face )
|
||||
{
|
||||
FT_Extension_Registry* registry;
|
||||
FT_Memory memory;
|
||||
|
||||
|
||||
registry = (FT_Extension_Registry*)face->driver->extensions;
|
||||
if ( registry && face->extensions )
|
||||
{
|
||||
FT_Extension_Class* cur = registry->classes;
|
||||
FT_Extension_Class* limit = cur + registry->num_extensions;
|
||||
|
||||
|
||||
for ( ; cur < limit; cur++ )
|
||||
{
|
||||
char* ext = (char*)face->extensions + cur->offset;
|
||||
|
||||
if ( cur->finalize )
|
||||
cur->finalize( ext, face );
|
||||
}
|
||||
|
||||
memory = face->driver->root.memory;
|
||||
FREE( face->extensions );
|
||||
}
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* FT_Create_Extensions */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Creates an extension object within a face object for all */
|
||||
/* registered extensions. */
|
||||
/* */
|
||||
/* <InOut> */
|
||||
/* face :: A handle to the face object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* Called by the face object constructor. */
|
||||
/* */
|
||||
FT_LOCAL_DEF FT_Error
|
||||
FT_Create_Extensions( FT_Face face )
|
||||
{
|
||||
FT_Extension_Registry* registry;
|
||||
FT_Memory memory;
|
||||
FT_Error error;
|
||||
|
||||
|
||||
face->extensions = 0;
|
||||
|
||||
/* load extensions registry; exit successfully if none is there */
|
||||
|
||||
registry = (FT_Extension_Registry*)face->driver->extensions;
|
||||
if ( !registry )
|
||||
return FT_Err_Ok;
|
||||
|
||||
memory = face->driver->root.memory;
|
||||
if ( ALLOC( face->extensions, registry->cur_offset ) )
|
||||
return error;
|
||||
|
||||
{
|
||||
FT_Extension_Class* cur = registry->classes;
|
||||
FT_Extension_Class* limit = cur + registry->num_extensions;
|
||||
|
||||
|
||||
for ( ; cur < limit; cur++ )
|
||||
{
|
||||
char* ext = (char*)face->extensions + cur->offset;
|
||||
|
||||
if ( cur->init )
|
||||
{
|
||||
error = cur->init( ext, face );
|
||||
if ( error )
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
|
@ -57,7 +57,7 @@
|
|||
FT_Long size,
|
||||
void* *P )
|
||||
{
|
||||
FT_Assert( P != 0 );
|
||||
FT_ASSERT( P != 0 );
|
||||
|
||||
if ( size > 0 )
|
||||
{
|
||||
|
@ -94,7 +94,7 @@
|
|||
void* Q;
|
||||
|
||||
|
||||
FT_Assert( P != 0 );
|
||||
FT_ASSERT( P != 0 );
|
||||
|
||||
/* if the original pointer is NULL, call FT_Alloc() */
|
||||
if ( !*P )
|
||||
|
|
|
@ -201,7 +201,7 @@
|
|||
|
||||
|
||||
/* check for nested frame access */
|
||||
FT_Assert( stream && stream->cursor == 0 );
|
||||
FT_ASSERT( stream && stream->cursor == 0 );
|
||||
|
||||
if ( stream->read )
|
||||
{
|
||||
|
@ -265,7 +265,7 @@
|
|||
/* gracefully; however, stream.cursor is really set to 0 by the */
|
||||
/* FT_Access_Frame() call, and this is not an error. */
|
||||
/* */
|
||||
FT_Assert( stream );
|
||||
FT_ASSERT( stream );
|
||||
|
||||
if ( stream->read )
|
||||
{
|
||||
|
@ -285,7 +285,7 @@
|
|||
FT_Char result;
|
||||
|
||||
|
||||
FT_Assert( stream && stream->cursor );
|
||||
FT_ASSERT( stream && stream->cursor );
|
||||
|
||||
result = 0;
|
||||
if ( stream->cursor < stream->limit )
|
||||
|
@ -302,7 +302,7 @@
|
|||
FT_Short result;
|
||||
|
||||
|
||||
FT_Assert( stream && stream->cursor );
|
||||
FT_ASSERT( stream && stream->cursor );
|
||||
|
||||
result = 0;
|
||||
p = stream->cursor;
|
||||
|
@ -321,7 +321,7 @@
|
|||
FT_Short result;
|
||||
|
||||
|
||||
FT_Assert( stream && stream->cursor );
|
||||
FT_ASSERT( stream && stream->cursor );
|
||||
|
||||
result = 0;
|
||||
p = stream->cursor;
|
||||
|
@ -340,7 +340,7 @@
|
|||
FT_Long result;
|
||||
|
||||
|
||||
FT_Assert( stream && stream->cursor );
|
||||
FT_ASSERT( stream && stream->cursor );
|
||||
|
||||
result = 0;
|
||||
p = stream->cursor;
|
||||
|
@ -358,7 +358,7 @@
|
|||
FT_Long result;
|
||||
|
||||
|
||||
FT_Assert( stream && stream->cursor );
|
||||
FT_ASSERT( stream && stream->cursor );
|
||||
|
||||
result = 0;
|
||||
p = stream->cursor;
|
||||
|
@ -376,7 +376,7 @@
|
|||
FT_Long result;
|
||||
|
||||
|
||||
FT_Assert( stream && stream->cursor );
|
||||
FT_ASSERT( stream && stream->cursor );
|
||||
|
||||
result = 0;
|
||||
p = stream->cursor;
|
||||
|
@ -394,7 +394,7 @@
|
|||
FT_Byte result = 0;
|
||||
|
||||
|
||||
FT_Assert( stream );
|
||||
FT_ASSERT( stream );
|
||||
|
||||
*error = FT_Err_Ok;
|
||||
|
||||
|
@ -433,7 +433,7 @@
|
|||
FT_Short result = 0;
|
||||
|
||||
|
||||
FT_Assert( stream );
|
||||
FT_ASSERT( stream );
|
||||
|
||||
*error = FT_Err_Ok;
|
||||
|
||||
|
@ -480,7 +480,7 @@
|
|||
FT_Short result = 0;
|
||||
|
||||
|
||||
FT_Assert( stream );
|
||||
FT_ASSERT( stream );
|
||||
|
||||
*error = FT_Err_Ok;
|
||||
|
||||
|
@ -527,7 +527,7 @@
|
|||
FT_Long result = 0;
|
||||
|
||||
|
||||
FT_Assert( stream );
|
||||
FT_ASSERT( stream );
|
||||
|
||||
*error = FT_Err_Ok;
|
||||
|
||||
|
@ -574,7 +574,7 @@
|
|||
FT_Long result = 0;
|
||||
|
||||
|
||||
FT_Assert( stream );
|
||||
FT_ASSERT( stream );
|
||||
|
||||
*error = FT_Err_Ok;
|
||||
|
||||
|
@ -621,7 +621,7 @@
|
|||
FT_Long result = 0;
|
||||
|
||||
|
||||
FT_Assert( stream );
|
||||
FT_ASSERT( stream );
|
||||
|
||||
*error = FT_Err_Ok;
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ BASE_COMPILE := $(FT_COMPILE) $I$(SRC_)base
|
|||
#
|
||||
BASE_SRC := $(BASE_)ftcalc.c \
|
||||
$(BASE_)fttrigon.c \
|
||||
$(BASE_)ftextend.c \
|
||||
$(BASE_)ftlist.c \
|
||||
$(BASE_)ftobjs.c \
|
||||
$(BASE_)ftstream.c \
|
||||
|
|
|
@ -523,7 +523,7 @@
|
|||
#include <stdio.h>
|
||||
|
||||
static void
|
||||
print_zone( PSH2_Zone zone )
|
||||
psh2_print_zone( PSH2_Zone zone )
|
||||
{
|
||||
printf( "zone [scale,delta,min,max] = [%.3f,%.3f,%d,%d]\n",
|
||||
zone->scale/65536.0,
|
||||
|
@ -534,7 +534,7 @@
|
|||
|
||||
#else
|
||||
|
||||
#define print_zone( x ) do { } while ( 0 )
|
||||
#define psh2_print_zone( x ) do { } while ( 0 )
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -576,7 +576,7 @@
|
|||
zone->min = PSH2_ZONE_MIN;
|
||||
zone->max = hint->org_pos;
|
||||
|
||||
print_zone( zone );
|
||||
psh2_print_zone( zone );
|
||||
|
||||
zone++;
|
||||
|
||||
|
@ -597,7 +597,7 @@
|
|||
zone->max = hint->org_pos + hint->org_len;
|
||||
zone->delta = hint->cur_pos - FT_MulFix( zone->min, scale2 );
|
||||
|
||||
print_zone( zone );
|
||||
psh2_print_zone( zone );
|
||||
|
||||
zone++;
|
||||
}
|
||||
|
@ -620,7 +620,7 @@
|
|||
zone->delta = hint->cur_pos + hint->cur_len -
|
||||
FT_MulFix( zone->min, scale2 );
|
||||
|
||||
print_zone( zone );
|
||||
psh2_print_zone( zone );
|
||||
|
||||
zone++;
|
||||
|
||||
|
@ -634,7 +634,7 @@
|
|||
zone->delta = hint->cur_pos + hint->cur_len -
|
||||
FT_MulFix( zone->min, scale );
|
||||
|
||||
print_zone( zone );
|
||||
psh2_print_zone( zone );
|
||||
|
||||
zone++;
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
/* messages during execution. */
|
||||
/* */
|
||||
#undef FT_COMPONENT
|
||||
#define FT_COMPONENT trace_aaraster
|
||||
#define FT_COMPONENT trace_smooth
|
||||
|
||||
|
||||
#define ErrRaster_MemoryOverflow -4
|
||||
|
|
Loading…
Reference in New Issue