diff --git a/ChangeLog b/ChangeLog index e96f5acb8..718aecd05 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,39 +1,56 @@ +2002-02-22 Werner Lemberg + + * include/freetype/internal/ftdebug.h (FT_Trace): Remove comma in + enum to avoid compiler warnings. + 2002-02-21 David Turner - * 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 + 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/ftdebug.c: (FT_SetTraceLevel): Removed. + (ft_debug_init): New function. + (ft_debug_dummy): Removed. + Updated to changes in ftdebug.h + + * include/freetype/internal/ftdebug.h: Always define + FT_DEBUG_LEVEL_ERROR if FT_DEBUG_LEVEL_TRACE is defined. + (FT_Assert): Renamed to ... + (FT_ASSERT): This. + Some stuff from ftdebug.h has been moved to ... - * src/base/ftobjs.c, src/base/ftstream.c: FT_Assert renamed to - FT_ASSERT + * include/freetype/internal/fttrace.h: This new file to define the + trace levels used for debugging. It is used both to define enums + and toggle names for FT2_DEBUG. + * include/freetype/internal/internal.h: Updated. - * 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.. + * src/base/ftobjs.c, src/base/ftstream.c: Updated. - * include/freetype/fterrors.h: adding "#undef FT_ERR_CAT" to avoid - warnings with certain compilers (like LCC) + * include/freetype/internal/ftextend.h, src/base/ftextend.c: + Removed. Both files are now completely obsolete. + * src/base/Jamfile, src/base/rules.mk: Updated. - * src/pshinter/pshalgo2.c: renaming 'print_zone' to 'psh2_print_zone' - to avoid errors during compilation of debug library + * include/freetype/fterrors.h: Adding "#undef FT_ERR_CAT" and + `#undef FT_ERR_XCAT" to avoid warnings with certain compilers (like + LCC). + * src/pshinter/pshalgo2.c (print_zone): Renamed to ... + (psh2_print_zone): This to avoid errors during compilation of debug + library. + + * src/smooth/ftgrays.c (FT_COMPONENT): Change definition to as + `trace_smooth'. 2002-02-20 David Turner - * README: adding "devel@freetype.org" address for bug reports.. - + * README: Adding "devel@freetype.org" address for bug reports. 2002-02-20 Werner Lemberg * builds/unix/install.mk (check): New dummy target. (.PHONY): Add it. - 2002-02-19 Werner Lemberg * builds/freetype.mk (FT_CFLAGS): Use $(INCLUDE_FLAGS) first. @@ -154,7 +171,7 @@ 2002-02-06 Detlef Würkner * src/pcf/pcfdriver.c (FT_Done_Face): Fixed small memory leak. - + * src/pcf/pcfread.c (pcf_load_font): Now handles the "AVERAGE_WIDTH" property to return correct character pixel (width/height) pairs for embedded bitmaps. @@ -454,7 +471,7 @@ * src/cff/cffgload.c (CFF_Parse_CharStrings), src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings), src/pshinter/pshalgo2.c (*), Fixed a - bug where the X and Y axis where inversed in the postscript hinter. + bug where the X and Y axis where inversed in the postscript hinter. This caused problem when displaying on non-square surfaces. * src/pshinter/pshalgo2.c: s/vertical/dimension/. diff --git a/README b/README index 371afab50..dc7fb129e 100644 --- a/README +++ b/README @@ -24,14 +24,13 @@ ftp://ftp.freetype.org/pub/freetype2/ftdoc208.zip - Reports ======= - Please report bugs by e-mail to 'devel@freetype.org'. Don't forget - to join a detailed explanation of what's wrong, there is nothing - worse than receiving a terse message that says "it doesn't work" - for us :o) + Please report bugs by e-mail to `devel@freetype.org'. Don't + forget to send a detailed explanation of the problem -- there is + nothing worse than receiving a terse message that only says "it + doesn't work". diff --git a/include/freetype/fterrors.h b/include/freetype/fterrors.h index 85dd658ca..9c8ad41e0 100644 --- a/include/freetype/fterrors.h +++ b/include/freetype/fterrors.h @@ -196,11 +196,6 @@ "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 */ diff --git a/include/freetype/internal/ftdebug.h b/include/freetype/internal/ftdebug.h index b13aa78ce..3d1100abd 100644 --- a/include/freetype/internal/ftdebug.h +++ b/include/freetype/internal/ftdebug.h @@ -28,11 +28,11 @@ FT_BEGIN_HEADER /* force the definition of FT_DEBUG_LEVEL_ERROR if FT_DEBUG_LEVEL_TRACE */ -/* is already defined.. this simplifies the following #ifdefs.. */ +/* is already defined; this simplifies the following #ifdefs */ /* */ #ifdef FT_DEBUG_LEVEL_TRACE -# undef FT_DEBUG_LEVEL_ERROR -# define FT_DEBUG_LEVEL_ERROR +#undef FT_DEBUG_LEVEL_ERROR +#define FT_DEBUG_LEVEL_ERROR #endif @@ -45,26 +45,25 @@ FT_BEGIN_HEADER #ifdef FT_DEBUG_LEVEL_TRACE -# define FT_TRACE_DEF(x) trace_ ## x , +#define FT_TRACE_DEF( x ) trace_ ## x , - /* defining the enums */ + /* defining the enums */ typedef enum { -# include FT_INTERNAL_TRACE_H - trace_count, +#include FT_INTERNAL_TRACE_H + trace_count } FT_Trace; - /* defining the array of trace levels, provided by 'src/base/ftdebug.c' */ - extern int ft_trace_levels [ trace_count ]; + /* defining the array of trace levels, provided by `src/base/ftdebug.c' */ + extern int ft_trace_levels[trace_count]; -# undef FT_TRACE_DEF +#undef FT_TRACE_DEF #endif /* FT_DEBUG_LEVEL_TRACE */ - /*************************************************************************/ /* */ /* Define the FT_TRACE macro */ @@ -78,7 +77,7 @@ 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 ) \ @@ -87,10 +86,11 @@ FT_BEGIN_HEADER #else /* !FT_DEBUG_LEVEL_TRACE */ -# define FT_TRACE( level, varformat ) do ; while ( 0 ) /* nothing */ +#define FT_TRACE( level, varformat ) do ; while ( 0 ) /* nothing */ #endif /* !FT_DEBUG_LEVEL_TRACE */ + /*************************************************************************/ /* */ /* You need two opening resp. closing parentheses! */ @@ -109,7 +109,6 @@ FT_BEGIN_HEADER #define FT_TRACE7( varformat ) FT_TRACE( 7, varformat ) - /*************************************************************************/ /* */ /* Define the FT_ERROR macro */ @@ -118,11 +117,11 @@ FT_BEGIN_HEADER #ifdef FT_DEBUG_LEVEL_ERROR -# define FT_ERROR( varformat ) FT_Message varformat +#define FT_ERROR( varformat ) FT_Message varformat #else /* !FT_DEBUG_LEVEL_ERROR */ -# define FT_ERROR( varformat ) do ; while ( 0 ) /* nothing */ +#define FT_ERROR( varformat ) do ; while ( 0 ) /* nothing */ #endif /* !FT_DEBUG_LEVEL_ERROR */ @@ -145,7 +144,7 @@ FT_BEGIN_HEADER #else /* !FT_DEBUG_LEVEL_ERROR */ -# define FT_ASSERT( condition ) do ; while ( 0 ) +#define FT_ASSERT( condition ) do ; while ( 0 ) #endif /* !FT_DEBUG_LEVEL_ERROR */ @@ -171,7 +170,6 @@ FT_BEGIN_HEADER #endif /* FT_DEBUG_LEVEL_ERROR */ - FT_BASE( void ) ft_debug_init( void ); diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index 43a44d0c7..60eb598f9 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -445,171 +445,6 @@ 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; - - /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ diff --git a/src/base/ftdebug.c b/src/base/ftdebug.c index ea4033ab0..4263c6768 100644 --- a/src/base/ftdebug.c +++ b/src/base/ftdebug.c @@ -85,12 +85,12 @@ #ifdef FT_DEBUG_LEVEL_TRACE /* array of trace levels, initialized to 0 */ - int ft_trace_levels[ trace_count ]; + int ft_trace_levels[trace_count]; - /* define array of trace toggle names */ -#define FT_TRACE_DEF(x) #x , + /* define array of trace toggle names */ +#define FT_TRACE_DEF(x) #x , - static const char* ft_trace_toggles[ trace_count+1 ] = + static const char* ft_trace_toggles[trace_count + 1] = { #include FT_INTERNAL_TRACE_H NULL @@ -99,25 +99,24 @@ #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 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 - */ - + /*************************************************************************/ + /* */ + /* 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 `:'. Example: */ + /* */ + /* "any=3 memory=6 stream=5" */ + /* */ + /* This will request that all levels be set to 3, except the trace level */ + /* for the memory and stream components which are set to 6 and 5, */ + /* respectively. */ + /* */ + /* See the file for details of the */ + /* available toggle names. */ + /* */ + /* The level must be between 0 and 6; 0 means quiet (except for serious */ + /* runtime errors), and 6 means _very_ verbose. */ + /* */ FT_BASE_DEF( void ) ft_debug_init( void ) { @@ -128,6 +127,7 @@ const char* p = ft2_debug; const char* q; + for ( ; *p; p++ ) { /* skip leading whitespace and separators */ @@ -144,10 +144,12 @@ 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] ) @@ -179,7 +181,7 @@ ft_trace_levels[n] = level; } else - ft_trace_levels[ found ] = level; + ft_trace_levels[found] = level; } } }