Commit 677dc0f7 authored by David Turner's avatar David Turner
Browse files

* 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..
parent af14179c
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
/* note that not all levels are used currently */
/*************************************************************************/
/* */
/* Define the trace enums as well as the trace levels array when */
/* they're needed */
/* */
/*************************************************************************/
typedef enum FT_Trace_
#ifdef FT_DEBUG_LEVEL_TRACE
# define FT_TRACE_DEF(x) trace_ ## x ,
/* 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,70 +76,66 @@ 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 */
# define FT_TRACE( level, varformat ) do ; while ( 0 ) /* nothing */
#endif /* !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. */
/* You need two opening resp. closing parentheses! */
/* */
/* level :: The tracing level. */
/* Example: FT_TRACE0(( "Value is %i", foo )) */
/* */
FT_EXPORT( void )
FT_SetTraceLevel( FT_Trace component,
char level );
#elif defined( FT_DEBUG_LEVEL_ERROR )
/*************************************************************************/
#define FT_TRACE0( varformat ) FT_TRACE( 0, varformat )
#define FT_TRACE1( varformat ) FT_TRACE( 1, varformat )
#define FT_TRACE2( varformat ) FT_TRACE( 2, varformat )
#define FT_TRACE3( varformat ) FT_TRACE( 3, varformat )
#define FT_TRACE4( varformat ) FT_TRACE( 4, varformat )
#define FT_TRACE5( varformat ) FT_TRACE( 5, varformat )
#define FT_TRACE6( varformat ) FT_TRACE( 6, varformat )
#define FT_TRACE7( varformat ) FT_TRACE( 7, varformat )
#define FT_TRACE( level, varformat ) do ; while ( 0 ) /* nothing */
#else /* release mode */
/*************************************************************************/
/* */
/* Define the FT_ERROR macro */
/* */
/*************************************************************************/
#ifdef FT_DEBUG_LEVEL_ERROR
#define FT_Assert( condition ) do ; while ( 0 ) /* nothing */
# define FT_ERROR( varformat ) FT_Message varformat
#define FT_TRACE( level, varformat ) do ; while ( 0 ) /* nothing */
#define FT_ERROR( varformat ) do ; while ( 0 ) /* nothing */
#else /* !FT_DEBUG_LEVEL_ERROR */
# define FT_ERROR( varformat ) do ; while ( 0 ) /* nothing */
#endif /* FT_DEBUG_LEVEL_TRACE, FT_DEBUG_LEVEL_ERROR */
#endif /* !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. */
/* Define the FT_ASSERT macro */
/* */
/*************************************************************************/
#ifdef FT_DEBUG_LEVEL_ERROR
#if defined( FT_DEBUG_LEVEL_TRACE ) || defined( FT_DEBUG_LEVEL_ERROR )
#include "stdio.h" /* for vprintf() */
#define FT_Assert( condition ) \
#define FT_ASSERT( condition ) \
do \
{ \
if ( !( condition ) ) \
......@@ -198,6 +143,23 @@ FT_BEGIN_HEADER
__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, ... );
......@@ -206,28 +168,11 @@ FT_BEGIN_HEADER
FT_EXPORT( void )
FT_Panic( const char* fmt, ... );
#define FT_ERROR( varformat ) FT_Message varformat
#endif /* FT_DEBUG_LEVEL_ERROR */
#endif /* FT_DEBUG_LEVEL_TRACE || FT_DEBUG_LEVEL_ERROR */
/*************************************************************************/
/* */
/* You need two opening resp. closing parentheses! */
/* */
/* Example: FT_TRACE0(( "Value is %i", foo )) */
/* */
/*************************************************************************/
#define FT_TRACE0( varformat ) FT_TRACE( 0, varformat )
#define FT_TRACE1( varformat ) FT_TRACE( 1, varformat )
#define FT_TRACE2( varformat ) FT_TRACE( 2, varformat )
#define FT_TRACE3( varformat ) FT_TRACE( 3, varformat )
#define FT_TRACE4( varformat ) FT_TRACE( 4, varformat )
#define FT_TRACE5( varformat ) FT_TRACE( 5, varformat )
#define FT_TRACE6( varformat ) FT_TRACE( 6, varformat )
#define FT_TRACE7( varformat ) FT_TRACE( 7, varformat )
FT_BASE( void ) ft_debug_init( void );
#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */
......
/***************************************************************************/
/* */
/* 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,