More preparation for tracing. Formatting.

This commit is contained in:
Werner Lemberg 2000-06-03 06:03:11 +00:00
parent 9a754ce32b
commit eb81e37825
10 changed files with 194 additions and 55 deletions

View File

@ -41,19 +41,27 @@
#ifdef FT_DEBUG_LEVEL_TRACE
/* note that not all levels are used currently */
typedef enum FT_Trace_
{
/* the first level must always be `trace_any' */
trace_any = 0,
/* we start with an enum for each common component */
trace_io, /* i/o monitoring -- see ftsystem.c */
trace_memory, /* memory manager -- see ftobjs.c */
trace_stream, /* stream manager -- see ftstream.c */
trace_calc, /* computations -- see ftcalc.c */
trace_raster, /* raster -- see ftraster.c */
trace_list, /* list manager -- see ftlist.c */
trace_objs, /* base objects -- see ftobjs.c */
/* we start with an enum for each base component */
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, /* raster (ftraster.c) */
trace_stream, /* stream manager (ftstream.c) */
/* then define an enum for each TrueType driver component */
trace_ttobjs,
@ -64,7 +72,7 @@
trace_ttextend,
trace_ttdriver,
/* define an enum for each Type1 driver component */
/* define an enum for each Type 1 driver component */
trace_t1objs,
trace_t1load,
trace_t1gload,
@ -72,8 +80,6 @@
trace_t1driver,
/* other trace levels */
trace_init,
trace_extend,
/* the last level must always be `trace_max' */
trace_max
@ -88,37 +94,37 @@
/* */
/* IMPORTANT! */
/* */
/* Each component must define the macro FT_COMPONENT to a valid */
/* Trace_Component value before using any TRACE macro. */
/* Each component must define the macro FT_COMPONENT to a valid FT_Trace */
/* value before using any TRACE macro. */
/* */
/*************************************************************************/
#define FT_TRACE( level, varformat ) \
do \
{ \
if ( ft_trace_levels[FT_COMPONENT] >= level ) \
FT_XCAT( FT_Message, varformat ); \
#define FT_TRACE( level, varformat ) \
do \
{ \
if ( ft_trace_levels[FT_COMPONENT] >= level ) \
FT_XCAT( FT_Message, varformat ); \
} while ( 0 )
FT_EXPORT_DEF(void) FT_SetTraceLevel( FT_Trace component,
char level );
FT_EXPORT_DEF( void ) FT_SetTraceLevel( FT_Trace component,
char level );
#elif defined( FT_DEBUG_LEVEL_ERROR )
#define FT_TRACE( level, varformat ) while ( 0 ) { } /* nothing */
#define FT_TRACE( level, varformat ) do ; while ( 0 ) /* nothing */
#else /* release mode */
#define FT_Assert( condition ) while ( 0 ) { } /* nothing */
#define FT_Assert( condition ) do ; while ( 0 ) /* nothing */
#define FT_TRACE( level, varformat ) while ( 0 ) { } /* nothing */
#define FT_ERROR( varformat ) 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 */
@ -133,11 +139,13 @@
/* */
/*************************************************************************/
#if defined( FT_DEBUG_LEVEL_TRACE ) || defined( FT_DEBUG_LEVEL_ERROR )
#include "stdio.h" /* for vprintf() */
#define FT_Assert( condition ) \
do \
{ \
@ -147,19 +155,24 @@
} while ( 0 )
/* print a message */
FT_EXPORT_DEF(void) FT_Message( const char* fmt, ... );
FT_EXPORT_DEF( void ) FT_Message( const char* fmt, ... );
/* print a message and exit */
FT_EXPORT_DEF(void) FT_Panic ( const char* fmt, ... );
FT_EXPORT_DEF( void ) FT_Panic ( const char* fmt, ... );
#define FT_ERROR(varformat) do { FT_XCAT( FT_Message, varformat ); } while(0)
#define FT_ERROR( varformat ) FT_XCAT( FT_Message, varformat )
#endif /* FT_DEBUG_LEVEL_TRACE || FT_DEBUG_LEVEL_ERROR */
/* you need two opening resp. closing parentheses!
Example: FT_TRACE0(( "Value is %i", foo )) */
/*************************************************************************/
/* */
/* 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 )

View File

@ -36,6 +36,16 @@
#include <freetype/internal/ftobjs.h> /* for ABS() */
/*************************************************************************/
/* */
/* 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_calc
#ifdef FT_CONFIG_OPTION_OLD_CALCS
static const FT_Long ft_square_roots[63] =

View File

@ -32,6 +32,16 @@
#include <freetype/internal/ftobjs.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_glyph
static
void ft_prepare_glyph( FT_Glyph glyph,
FT_Face face,
@ -522,8 +532,8 @@
case ft_glyph_type_bitmap:
{
FT_BitmapGlyph bit = (FT_BitmapGlyph)glyph;
box->xMin = bit->left;
box->xMax = box->xMin + bit->bitmap.width;
box->yMax = bit->top;

View File

@ -31,7 +31,7 @@
/* */
/* cc -c -D_STANDALONE_ ftgrays.c */
/* */
/* The renderer can be initialised with a call to */
/* The renderer can be initialized with a call to */
/* `ft_grays_raster.grays_raster_new'; an anti-aliased bitmap can be */
/* generated with a call to `ft_grays_raster.grays_raster_render'. */
/* */
@ -83,10 +83,23 @@
#include <string.h> /* for memcpy() */
/*************************************************************************/
/* */
/* 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_aaraster
#define ErrRaster_Invalid_Outline -1
#ifdef _STANDALONE_
#include "ftimage.h"
#include "ftgrays.h"
@ -94,16 +107,31 @@
/* Its purpose is simply to reduce compiler warnings. Note also that */
/* simply defining it as `(void)x' doesn't avoid warnings with certain */
/* ANSI compilers (e.g. LCC). */
#define UNUSED( x ) (x) = (x)
#define UNUSED( x ) (x) = (x)
/* Disable the tracing mechanism for simplicity -- developers can */
/* activate it easily by redefining these two macros. */
#ifndef FT_ERROR
#define FT_ERROR( x ) do ; while ( 0 ) /* nothing */
#endif
#ifndef FT_TRACE
#define FT_TRACE( x ) do ; while ( 0 ) /* nothing */
#endif
#else /* _STANDALONE_ */
#include <freetype/ftgrays.h>
#include <freetype/internal/ftobjs.h> /* for UNUSED() */
#include <freetype/freetype.h> /* to link to FT_Outline_Decompose() */
#include <freetype/internal/ftobjs.h> /* for UNUSED() */
#include <freetype/internal/ftdebug.h> /* for FT_TRACE() and FT_ERROR() */
#include <freetype/freetype.h> /* for FT_Outline_Decompose() */
#endif /* _STANDALONE_ */
/* define this to dump debugging information */
#define xxxDEBUG_GRAYS
@ -111,6 +139,7 @@
#ifndef FT_STATIC_RASTER
#define RAS_ARG PRaster raster
#define RAS_ARG_ PRaster raster,
@ -119,8 +148,10 @@
#define ras (*raster)
#else /* FT_STATIC_RASTER */
#define RAS_ARG /* empty */
#define RAS_ARG_ /* empty */
#define RAS_VAR /* empty */
@ -128,8 +159,10 @@
static TRaster ras;
#endif /* FT_STATIC_RASTER */
/* must be at least 6 bits! */
#define PIXEL_BITS 8
@ -1841,7 +1874,7 @@
UNUSED( memory );
*araster = (FT_Raster)&the_raster;
memset( &the_raster, 0, sizeof ( the_raster ) );

View File

@ -28,6 +28,16 @@
#include <freetype/internal/ftobjs.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_list
/*************************************************************************/
/* */
/* <Function> */

View File

@ -19,6 +19,17 @@
#include <freetype/ftmm.h>
#include <freetype/internal/ftobjs.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_mm
FT_EXPORT_FUNC( FT_Error ) FT_Get_Multi_Master( FT_Face face,
FT_Multi_Master* master )
{
@ -27,7 +38,7 @@
if ( !face )
return FT_Err_Invalid_Face_Handle;
error = FT_Err_Invalid_Argument;
if ( FT_HAS_MULTIPLE_MASTERS( face ) )
@ -41,9 +52,9 @@
if ( func )
error = func( face, master );
}
return error;
}
}
FT_EXPORT_FUNC( FT_Error ) FT_Set_MM_Design_Coordinates(
@ -53,7 +64,7 @@
{
FT_Error error;
if ( !face )
return FT_Err_Invalid_Face_Handle;
@ -70,19 +81,19 @@
if ( func )
error = func( face, num_coords, coords );
}
return error;
}
}
FT_EXPORT_FUNC( FT_Error ) FT_Set_MM_Blend_Coordinates(
FT_Face face,
FT_UInt num_coords,
FT_Fixed* coords )
{
{
FT_Error error;
if ( !face )
return FT_Err_Invalid_Face_Handle;
@ -98,7 +109,7 @@
if ( func )
error = func( face, num_coords, coords );
}
return error;
}

View File

@ -312,6 +312,11 @@
/*************************************************************************/
/*************************************************************************/
#undef FT_COMPONENT
#define FT_COMPONENT trace_objs
/* destructor for sizes list */
static
void destroy_size( FT_Memory memory,
@ -1798,7 +1803,7 @@
pixel_width = pixel_height;
else if ( pixel_height == 0 )
pixel_height = pixel_width;
if ( pixel_width < 1 ) pixel_width = 1;
if ( pixel_height < 1 ) pixel_height = 1;
@ -1978,7 +1983,7 @@
if ( glyph_index >= face->num_glyphs )
return FT_Err_Invalid_Argument;
driver = face->driver;
/* when the flag NO_RECURSE is set, we disable hinting and scaling */

View File

@ -27,6 +27,17 @@
#include <freetype/config/ftconfig.h>
#include <freetype/internal/ftobjs.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_outline
static
const FT_Outline null_outline = { 0, 0, 0, 0, 0, 0 };

View File

@ -128,11 +128,45 @@
/*************************************************************************/
/*************************************************************************/
/* required by the tracing mode */
/*************************************************************************/
/* */
/* 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_raster
#include <freetype/internal/ftdebug.h>
#ifdef _STANDALONE_
/* This macro is used to indicate that a function parameter is unused. */
/* Its purpose is simply to reduce compiler warnings. Note also that */
/* simply defining it as `(void)x' doesn't avoid warnings with certain */
/* ANSI compilers (e.g. LCC). */
#define UNUSED( x ) (x) = (x)
/* Disable the tracing mechanism for simplicity -- developers can */
/* activate it easily by redefining these two macros. */
#ifndef FT_ERROR
#define FT_ERROR( x ) do ; while ( 0 ) /* nothing */
#endif
#ifndef FT_TRACE
#define FT_TRACE( x ) do ; while ( 0 ) /* nothing */
#endif
#else /* _STANDALONE_ */
#include <freetype/internal/ftobjs.h>
#include <freetype/internal/ftdebug.h> /* for FT_TRACE() and FT_ERROR() */
#endif /* _STANDALONE_ */
#define Raster_Err_None 0
#define Raster_Err_Not_Ini -1
@ -583,7 +617,7 @@
if ( h > 0 )
{
FT_TRACE1(( "Ending profile %lx, start = %ld, height = %ld\n",
(long)ras.cProfile, ras.cProfile->start, h ));
(long)ras.cProfile, ras.cProfile->start, h ));
oldProfile = ras.cProfile;
ras.cProfile->height = h;
@ -1557,7 +1591,7 @@
v_last.x = SCALED( points[last].x );
v_last.y = SCALED( points[last].y );
if ( flipped )
if ( flipped )
{
SWAP_( v_start.x, v_start.y );
SWAP_( v_last.x, v_last.y );
@ -3087,6 +3121,7 @@
#ifdef _STANDALONE_
static
int ft_black_new( void* memory,
FT_Raster *araster )
@ -3109,9 +3144,9 @@
raster->init = 0;
}
#else /* _STANDALONE_ */
#include <freetype/internal/ftobjs.h>
static
int ft_black_new( FT_Memory memory,
@ -3141,6 +3176,7 @@
FREE( raster );
}
#endif /* _STANDALONE_ */

View File

@ -154,19 +154,19 @@
{
FT_Error error;
error = FT_Access_Frame( stream, count );
if ( !error )
{
*pbytes = (FT_Byte*)stream->cursor;
/* equivalent to FT_Forget_Frame(), with no memory block release */
stream->cursor = 0;
stream->limit = 0;
}
return error;
}
}
BASE_FUNC( void ) FT_Release_Frame( FT_Stream stream,