diff --git a/ChangeLog b/ChangeLog index e3d3ea7a4..de7b8f69d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,39 @@ +2004-03-04 Werner Lemberg + + * Jamfile, vms_make.com, builds/win32/visualc/freetype.dsp, + builds/win32/visualc/freetype/vcproj, include/freetype/ftmoderr.h: + Add LZW module. + + * Jamfile.in: Removed. + + * docs/CHANGES: Updated. + + * include/freetype/internal/ftobjs.h: s/MIN/FT_MIN/, s/MAX/FT_MAX/, + s/ABS/FT_ABS/. Updated all callers. + + * src/type1/t1load.c (parse_dict), src/pcf/pcfdrivr.c + (PCF_Face_Init): Use FT_ERROR_BASE. + +2004-03-04 Albert Chin + + Add support for PCF fonts compressed with LZW (extension .pcf.Z, + created with `compress'). + + * include/freetype/config/ftoption.h, devel/ftoption.h + (FT_CONFIG_OPTION_USE_LZW): New macro. + + * include/freetype/ftlzw.h: New file. + * include/freetype/config/ftheader.h (FT_LZW_H): New macro for + ftlzw.h. + + * src/lzw/*: New files. + + * src/pcf/pcfdrivr.c: Include FT_LZW_H. + (PCF_Face_Init): Try LZW also. + + * src/gzip/ftgzip.c: s/0/Gzip_Err_Ok/ where appropriate. + Beautify. + 2004-03-03 Werner Lemberg * src/pshinter/pshalgo.c (psh_hint_table_init): Simplify code. diff --git a/Jamfile b/Jamfile index 61583c729..c4e98a909 100644 --- a/Jamfile +++ b/Jamfile @@ -62,13 +62,14 @@ FT2_BUILD_INCLUDE ?= ; # if you modify this list or provide your own. # FT2_COMPONENTS ?= autofit # auto-fitter - gzip # support for gzip-compressed files autohint # auto-hinter base # base component (public APIs) bdf # BDF font driver cache # cache sub-system cff # CFF/CEF font driver cid # PostScript CID-keyed font driver + gzip # support for gzip-compressed files + lzw # support for LZW-compressed files pcf # PCF font driver pfr # PFR/TrueDoc font driver psaux # common PostScript routines module diff --git a/builds/win32/visualc/freetype.dsp b/builds/win32/visualc/freetype.dsp index b467c0a49..bb353dec0 100644 --- a/builds/win32/visualc/freetype.dsp +++ b/builds/win32/visualc/freetype.dsp @@ -235,6 +235,10 @@ SOURCE=..\..\..\src\gzip\ftgzip.c # End Source File # Begin Source File +SOURCE=..\..\..\src\lzw\ftlzw.c +# End Source File +# Begin Source File + SOURCE=..\..\..\src\base\ftinit.c # SUBTRACT CPP /Fr # End Source File diff --git a/builds/win32/visualc/freetype.vcproj b/builds/win32/visualc/freetype.vcproj index 2b15dcb6d..fefe7c7d0 100644 --- a/builds/win32/visualc/freetype.vcproj +++ b/builds/win32/visualc/freetype.vcproj @@ -770,6 +770,60 @@ BasicRuntimeChecks="3"/> + + + + + + + + + + + + + + + + + + + + style_name; example: `Bold SemiCondensed'. + - The PCF driver now handles bitmap fonts compressed with the LZW + algorithm (extension .pcf.Z, compressed with `compress'). + - A new API function `FT_Get_CMap_Language_ID' (declared in `tttables.h') is available to get the language ID of a TrueType/SFNT cmap. @@ -61,6 +62,8 @@ LATEST CHANGES BETWEEN 2.1.8 and 2.1.7 in file-based fonts, it can happen in document-embedded resources of PostScript documents. + - Embedded bitmaps in SFNT-based CFF fonts are now supported. + - A simple API is now available to control FreeType's tracing mechanism if compiled with FT_DEBUG_LEVEL_TRACE. See the file `ftdebug.h' for more details. diff --git a/include/freetype/config/ftheader.h b/include/freetype/config/ftheader.h index 52d18195c..b996a7a6f 100644 --- a/include/freetype/config/ftheader.h +++ b/include/freetype/config/ftheader.h @@ -4,7 +4,7 @@ /* */ /* Build macros of the FreeType 2 library. */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -150,6 +150,7 @@ #define FT_CONFIG_MODULES_H #endif + /* public headers */ /*************************************************************************/ @@ -373,6 +374,18 @@ #define FT_GZIP_H + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_LZW_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the definitions of an API to support for LZW-compressed files. */ + /* */ +#define FT_LZW_H + + /*************************************************************************/ /* */ /* @macro: */ @@ -384,6 +397,7 @@ /* */ #define FT_WINFONTS_H + /*************************************************************************/ /* */ /* @macro: */ diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index 58125c159..a527ec12d 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -95,6 +95,21 @@ FT_BEGIN_HEADER #undef FT_CONFIG_OPTION_FORCE_INT64 + /*************************************************************************/ + /* */ + /* LZW-compressed file support. */ + /* */ + /* FreeType now handles font files that have been compressed with the */ + /* 'compress' program. This is mostly used to parse many of the PCF */ + /* files that come with various X11 distributions. The implementation */ + /* uses NetBSD's `zopen' to partially uncompress the file on the fly */ + /* (see src/lzw/ftgzip.c). */ + /* */ + /* Define this macro if you want to enable this `feature'. */ + /* */ +#define FT_CONFIG_OPTION_USE_LZW + + /*************************************************************************/ /* */ /* Gzip-compressed file support. */ @@ -102,11 +117,10 @@ FT_BEGIN_HEADER /* FreeType now handles font files that have been compressed with the */ /* 'gzip' program. This is mostly used to parse many of the PCF files */ /* that come with XFree86. The implementation uses `zlib' to */ - /* partially uncompress the file on the fly (see src/base/ftgzip.c). */ + /* partially uncompress the file on the fly (see src/gzip/ftgzip.c). */ /* */ - /* Define this macro if you want to enable this "feature". Note that */ - /* this will however force you to link the zlib to any program that */ - /* also uses FreeType. */ + /* Define this macro if you want to enable this `feature'. See also */ + /* the macro FT_CONFIG_OPTION_SYSTEM_ZLIB below. */ /* */ #define FT_CONFIG_OPTION_USE_ZLIB @@ -116,7 +130,7 @@ FT_BEGIN_HEADER /* ZLib library selection */ /* */ /* This macro is only used when FT_CONFIG_OPTION_USE_ZLIB is defined. */ - /* It allows FreeType's "ftgzip" component to link to the system's */ + /* It allows FreeType's `ftgzip' component to link to the system's */ /* installation of the ZLib library. This is useful on systems like */ /* Unix or VMS where it generally is already available. */ /* */ diff --git a/include/freetype/ftmoderr.h b/include/freetype/ftmoderr.h index c9b812179..d190167fa 100644 --- a/include/freetype/ftmoderr.h +++ b/include/freetype/ftmoderr.h @@ -4,7 +4,7 @@ /* */ /* FreeType module error offsets (specification). */ /* */ -/* Copyright 2001, 2002, 2003 by */ +/* Copyright 2001, 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -23,8 +23,8 @@ /* The lower byte gives the error code, the higher byte gives the */ /* module. The base module has error offset 0. For example, the error */ /* `FT_Err_Invalid_File_Format' has value 0x003, the error */ - /* `TT_Err_Invalid_File_Format' has value 0xF03, the error */ - /* `T1_Err_Invalid_File_Format' has value 0x1003, etc. */ + /* `TT_Err_Invalid_File_Format' has value 0x1003, the error */ + /* `T1_Err_Invalid_File_Format' has value 0x1103, etc. */ /* */ /* Undefine the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in ftoption.h */ /* to make the higher byte always zero (disabling the module error */ @@ -109,18 +109,19 @@ FT_MODERRDEF( CFF, 0x400, "CFF module" ) FT_MODERRDEF( CID, 0x500, "CID module" ) FT_MODERRDEF( Gzip, 0x600, "Gzip module" ) - FT_MODERRDEF( PCF, 0x700, "PCF module" ) - FT_MODERRDEF( PFR, 0x800, "PFR module" ) - FT_MODERRDEF( PSaux, 0x900, "PS auxiliary module" ) - FT_MODERRDEF( PShinter, 0xA00, "PS hinter module" ) - FT_MODERRDEF( PSnames, 0xB00, "PS names module" ) - FT_MODERRDEF( Raster, 0xC00, "raster module" ) - FT_MODERRDEF( SFNT, 0xD00, "SFNT module" ) - FT_MODERRDEF( Smooth, 0xE00, "smooth raster module" ) - FT_MODERRDEF( TrueType, 0xF00, "TrueType module" ) - FT_MODERRDEF( Type1, 0x1000, "Type 1 module" ) - FT_MODERRDEF( Type42, 0x1100, "Type 42 module" ) - FT_MODERRDEF( Winfonts, 0x1200, "Windows FON/FNT module" ) + FT_MODERRDEF( LZW, 0x700, "LZW module" ) + FT_MODERRDEF( PCF, 0x800, "PCF module" ) + FT_MODERRDEF( PFR, 0x900, "PFR module" ) + FT_MODERRDEF( PSaux, 0xA00, "PS auxiliary module" ) + FT_MODERRDEF( PShinter, 0xB00, "PS hinter module" ) + FT_MODERRDEF( PSnames, 0xC00, "PS names module" ) + FT_MODERRDEF( Raster, 0xD00, "raster module" ) + FT_MODERRDEF( SFNT, 0xE00, "SFNT module" ) + FT_MODERRDEF( Smooth, 0xF00, "smooth raster module" ) + FT_MODERRDEF( TrueType, 0x1000, "TrueType module" ) + FT_MODERRDEF( Type1, 0x1100, "Type 1 module" ) + FT_MODERRDEF( Type42, 0x1200, "Type 42 module" ) + FT_MODERRDEF( Winfonts, 0x1300, "Windows FON/FNT module" ) #ifdef FT_MODERR_END_LIST diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index 75569b7f8..3a28119af 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -4,7 +4,7 @@ /* */ /* The FreeType private base classes (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -64,19 +64,12 @@ FT_BEGIN_HEADER /*************************************************************************/ /* */ /* The min and max functions missing in C. As usual, be careful not to */ - /* write things like MIN( a++, b++ ) to avoid side effects. */ + /* write things like FT_MIN( a++, b++ ) to avoid side effects. */ /* */ -#ifndef MIN -#define MIN( a, b ) ( (a) < (b) ? (a) : (b) ) -#endif +#define FT_MIN( a, b ) ( (a) < (b) ? (a) : (b) ) +#define FT_MAX( a, b ) ( (a) > (b) ? (a) : (b) ) -#ifndef MAX -#define MAX( a, b ) ( (a) > (b) ? (a) : (b) ) -#endif - -#ifndef ABS -#define ABS( a ) ( (a) < 0 ? -(a) : (a) ) -#endif +#define FT_ABS( a ) ( (a) < 0 ? -(a) : (a) ) #define FT_PAD_FLOOR( x, n ) ( (x) & ~((n)-1) ) diff --git a/src/autofit/afhints.c b/src/autofit/afhints.c index a415fdf60..0a2c96a39 100644 --- a/src/autofit/afhints.c +++ b/src/autofit/afhints.c @@ -137,8 +137,8 @@ FT_Pos dy ) { AF_Direction dir; - FT_Pos ax = ABS( dx ); - FT_Pos ay = ABS( dy ); + FT_Pos ax = FT_ABS( dx ); + FT_Pos ay = FT_ABS( dy ); dir = AF_DIR_NONE; diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c index 00fb7b6d0..385f55986 100644 --- a/src/autofit/aflatin.c +++ b/src/autofit/aflatin.c @@ -469,7 +469,7 @@ FT_Pos max_coord = -32000; #endif - major_dir = ABS( axis->major_dir ); + major_dir = FT_ABS( axis->major_dir ); segment_dir = major_dir; /* set up (u,v) in each point */ @@ -524,8 +524,8 @@ if ( point == last ) /* skip singletons -- just in case */ continue; - if ( ABS( last->out_dir ) == major_dir && - ABS( point->out_dir ) == major_dir ) + if ( FT_ABS( last->out_dir ) == major_dir && + FT_ABS( point->out_dir ) == major_dir ) { /* we are already on an edge, try to locate its start */ last = point; @@ -533,7 +533,7 @@ for (;;) { point = point->prev; - if ( ABS( point->out_dir ) != major_dir ) + if ( FT_ABS( point->out_dir ) != major_dir ) { point = point->next; break; @@ -598,7 +598,7 @@ passed = 1; } - if ( !on_edge && ABS( point->out_dir ) == major_dir ) + if ( !on_edge && FT_ABS( point->out_dir ) == major_dir ) { /* this is the start of a new segment! */ segment_dir = point->out_dir; diff --git a/src/autohint/ahglyph.c b/src/autohint/ahglyph.c index ad2f46efe..d0c2c6618 100644 --- a/src/autohint/ahglyph.c +++ b/src/autohint/ahglyph.c @@ -5,7 +5,7 @@ /* Routines used to load and analyze a given glyph before hinting */ /* (body). */ /* */ -/* Copyright 2000-2001, 2002, 2003 Catharon Productions Inc. */ +/* Copyright 2000-2001, 2002, 2003, 2004 Catharon Productions Inc. */ /* Author: David Turner */ /* */ /* This file is part of the Catharon Typography Project and shall only */ @@ -141,8 +141,8 @@ FT_Pos dy ) { AH_Direction dir; - FT_Pos ax = ABS( dx ); - FT_Pos ay = ABS( dy ); + FT_Pos ax = FT_ABS( dx ); + FT_Pos ay = FT_ABS( dy ); dir = AH_DIR_NONE; @@ -884,8 +884,8 @@ if ( point == last ) /* skip singletons -- just in case */ continue; - if ( ABS( last->out_dir ) == major_dir && - ABS( point->out_dir ) == major_dir ) + if ( FT_ABS( last->out_dir ) == major_dir && + FT_ABS( point->out_dir ) == major_dir ) { /* we are already on an edge, try to locate its start */ last = point; @@ -893,7 +893,7 @@ for (;;) { point = point->prev; - if ( ABS( point->out_dir ) != major_dir ) + if ( FT_ABS( point->out_dir ) != major_dir ) { point = point->next; break; @@ -958,7 +958,7 @@ passed = 1; } - if ( !on_edge && ABS( point->out_dir ) == major_dir ) + if ( !on_edge && FT_ABS( point->out_dir ) == major_dir ) { /* this is the start of a new segment! */ segment_dir = point->out_dir; diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c index 4fb236627..f169642e0 100644 --- a/src/base/ftcalc.c +++ b/src/base/ftcalc.c @@ -4,7 +4,7 @@ /* */ /* Arithmetic computations (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -325,9 +325,9 @@ if ( a == 0 || b == c ) return a; - s = a; a = ABS( a ); - s ^= b; b = ABS( b ); - s ^= c; c = ABS( c ); + s = a; a = FT_ABS( a ); + s ^= b; b = FT_ABS( b ); + s ^= c; c = FT_ABS( c ); if ( a <= 46340L && b <= 46340L && c <= 176095L && c > 0 ) a = ( a * b + ( c >> 1 ) ) / c; @@ -364,9 +364,9 @@ if ( a == 0 || b == c ) return a; - s = a; a = ABS( a ); - s ^= b; b = ABS( b ); - s ^= c; c = ABS( c ); + s = a; a = FT_ABS( a ); + s ^= b; b = FT_ABS( b ); + s ^= c; c = FT_ABS( c ); if ( a <= 46340L && b <= 46340L && c > 0 ) a = a * b / c; @@ -401,8 +401,8 @@ if ( a == 0 || b == 0x10000L ) return a; - s = a; a = ABS(a); - s ^= b; b = ABS(b); + s = a; a = FT_ABS(a); + s ^= b; b = FT_ABS(b); ua = (FT_ULong)a; ub = (FT_ULong)b; @@ -434,8 +434,8 @@ FT_UInt32 q; - s = a; a = ABS(a); - s ^= b; b = ABS(b); + s = a; a = FT_ABS(a); + s ^= b; b = FT_ABS(b); if ( b == 0 ) { @@ -474,8 +474,8 @@ FT_Int32 s; - s = x; x = ABS( x ); - s ^= y; y = ABS( y ); + s = x; x = FT_ABS( x ); + s ^= y; y = FT_ABS( y ); ft_multo64( x, y, z ); @@ -508,7 +508,7 @@ x->lo = (FT_UInt32)-(FT_Int32)x->lo; x->hi = ~x->hi + !x->lo; } - s ^= y; y = ABS( y ); + s ^= y; y = FT_ABS( y ); /* Shortcut */ if ( x->hi == 0 ) @@ -562,7 +562,7 @@ x->lo = (FT_UInt32)-(FT_Int32)x->lo; x->hi = ~x->hi + !x->lo; } - s ^= y; y = ABS( y ); + s ^= y; y = FT_ABS( y ); /* Shortcut */ if ( x->hi == 0 ) diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c index b4066db46..be0e3987e 100644 --- a/src/bdf/bdflib.c +++ b/src/bdf/bdflib.c @@ -1,6 +1,6 @@ /* * Copyright 2000 Computing Research Labs, New Mexico State University - * Copyright 2001, 2002, 2003 Francesco Zappa Nardelli + * Copyright 2001, 2002, 2003, 2004 Francesco Zappa Nardelli * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -1770,14 +1770,14 @@ /* Determine the overall font bounding box as the characters are */ /* loaded so corrections can be done later if indicated. */ - p->maxas = (short)MAX( glyph->bbx.ascent, p->maxas ); - p->maxds = (short)MAX( glyph->bbx.descent, p->maxds ); + p->maxas = (short)FT_MAX( glyph->bbx.ascent, p->maxas ); + p->maxds = (short)FT_MAX( glyph->bbx.descent, p->maxds ); p->rbearing = (short)( glyph->bbx.width + glyph->bbx.x_offset ); - p->maxrb = (short)MAX( p->rbearing, p->maxrb ); - p->minlb = (short)MIN( glyph->bbx.x_offset, p->minlb ); - p->maxlb = (short)MAX( glyph->bbx.x_offset, p->maxlb ); + p->maxrb = (short)FT_MAX( p->rbearing, p->maxrb ); + p->minlb = (short)FT_MIN( glyph->bbx.x_offset, p->minlb ); + p->maxlb = (short)FT_MAX( glyph->bbx.x_offset, p->maxlb ); if ( !( p->flags & _BDF_DWIDTH ) ) { diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c index c9043fd2f..006dd5c13 100644 --- a/src/cache/ftcsbits.c +++ b/src/cache/ftcsbits.c @@ -163,7 +163,7 @@ /* now, compute size */ if ( asize ) - *asize = ABS( sbit->pitch ) * sbit->height; + *asize = FT_ABS( sbit->pitch ) * sbit->height; } /* glyph loading successful */ diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index a44e43e20..c4e5a6c59 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -4,7 +4,7 @@ /* */ /* CFF token stream parser (body) */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -334,7 +334,7 @@ offset->x = cff_parse_fixed_thousand( data++ ); offset->y = cff_parse_fixed_thousand( data ); - temp = ABS( matrix->yy ); + temp = FT_ABS( matrix->yy ); *upm = (FT_UShort)FT_DivFix( 0x10000L, FT_DivFix( temp, 1000 ) ); diff --git a/src/cid/cidload.c b/src/cid/cidload.c index 3a418e282..ad29dd52d 100644 --- a/src/cid/cidload.c +++ b/src/cid/cidload.c @@ -162,7 +162,7 @@ (void)cid_parser_to_fixed_array( parser, 6, temp, 3 ); - temp_scale = ABS( temp[3] ); + temp_scale = FT_ABS( temp[3] ); /* Set units per EM based on FontMatrix values. We set the value to */ /* `1000/temp_scale', because temp_scale was already multiplied by */ diff --git a/src/gzip/ftgzip.c b/src/gzip/ftgzip.c index 0787d8095..e35c07385 100644 --- a/src/gzip/ftgzip.c +++ b/src/gzip/ftgzip.c @@ -4,11 +4,11 @@ /* */ /* FreeType support for .gz compressed files. */ /* */ -/* this optional component relies on zlib. It should mainly be used to */ +/* This optional component relies on zlib. It should mainly be used to */ /* parse compressed PCF fonts, as found with many X11 server */ /* distributions. */ /* */ -/* Copyright 2002, 2003 by */ +/* Copyright 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -144,7 +144,7 @@ /***************************************************************************/ /***************************************************************************/ -#define FT_GZIP_BUFFER_SIZE 4096 +#define FT_GZIP_BUFFER_SIZE 4096 typedef struct FT_GZipFileRec_ { @@ -154,7 +154,7 @@ z_stream zstream; /* zlib input stream */ FT_ULong start; /* starting position, after .gz header */ - FT_Byte input[FT_GZIP_BUFFER_SIZE]; /* input read buffer */ + FT_Byte input[FT_GZIP_BUFFER_SIZE]; /* input read buffer */ FT_Byte buffer[FT_GZIP_BUFFER_SIZE]; /* output buffer */ FT_ULong pos; /* position in output */ @@ -173,7 +173,7 @@ #define FT_GZIP_RESERVED 0xE0 /* bits 5..7: reserved */ - /* check and skip .gz header - we don't support "transparent" compression */ + /* check and skip .gz header - we don't support `transparent' compression */ static FT_Error ft_gzip_check_header( FT_Stream stream ) { @@ -254,7 +254,7 @@ FT_Stream source ) { z_stream* zstream = &zip->zstream; - FT_Error error = 0; + FT_Error error = Gzip_Err_Ok; zip->stream = stream; @@ -276,9 +276,9 @@ zip->start = FT_STREAM_POS(); } - /* initialize zlib - there is no zlib header in the compressed stream */ - zstream->zalloc = (alloc_func) ft_gzip_alloc; - zstream->zfree = (free_func) ft_gzip_free; + /* initialize zlib -- there is no zlib header in the compressed stream */ + zstream->zalloc = (alloc_func)ft_gzip_alloc; + zstream->zfree = (free_func) ft_gzip_free; zstream->opaque = stream->memory; zstream->avail_in = 0; @@ -286,10 +286,7 @@ if ( inflateInit2( zstream, -MAX_WBITS ) != Z_OK || zstream->next_in == NULL ) - { error = Gzip_Err_Invalid_File_Format; - goto Exit; - } Exit: return error; @@ -301,6 +298,7 @@ { z_stream* zstream = &zip->zstream; + inflateEnd( zstream ); /* clear the rest */ @@ -341,7 +339,8 @@ zip->cursor = zip->limit; zip->pos = 0; } - return error; + + return error; } @@ -376,7 +375,7 @@ zstream->next_in = zip->input; zstream->avail_in = size; - return 0; + return Gzip_Err_Ok; } @@ -418,6 +417,7 @@ break; } } + return error; } @@ -427,8 +427,8 @@ ft_gzip_file_skip_output( FT_GZipFile zip, FT_ULong count ) { - FT_Error error = 0; - FT_ULong delta; + FT_Error error = Gzip_Err_Ok; + FT_ULong delta; for (;;) diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c index dc25b5d87..503daae21 100644 --- a/src/pcf/pcfdrivr.c +++ b/src/pcf/pcfdrivr.c @@ -31,6 +31,7 @@ THE SOFTWARE. #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_OBJECTS_H #include FT_GZIP_H +#include FT_LZW_H #include FT_ERRORS_H #include FT_BDF_H @@ -214,7 +215,7 @@ THE SOFTWARE. FT_TRACE4(( "PCF_Face_Done: done face\n" )); - /* close gzip stream if any */ + /* close gzip/LZW stream if any */ if ( face->root.stream == &face->gzip_stream ) { FT_Stream_Close( &face->gzip_stream ); @@ -247,21 +248,44 @@ THE SOFTWARE. /* this didn't work, try gzip support! */ error2 = FT_Stream_OpenGzip( &face->gzip_stream, stream ); - if ( error2 == PCF_Err_Unimplemented_Feature ) + if ( FT_ERROR_BASE( error2 ) == FT_Err_Unimplemented_Feature ) goto Fail; error = error2; if ( error ) - goto Fail; + { + FT_Error error3; - face->gzip_source = stream; - face->root.stream = &face->gzip_stream; - stream = face->root.stream; + /* this didn't work, try LZW support! */ + error3 = FT_Stream_OpenLZW( &face->gzip_stream, stream ); + if ( FT_ERROR_BASE( error3 ) == FT_Err_Unimplemented_Feature ) + goto Fail; - error = pcf_load_font( stream, face ); - if ( error ) - goto Fail; + error = error3; + if ( error ) + goto Fail; + + face->gzip_source = stream; + face->root.stream = &face->gzip_stream; + + stream = face->root.stream; + + error = pcf_load_font( stream, face ); + if ( error ) + goto Fail; + } + else + { + face->gzip_source = stream; + face->root.stream = &face->gzip_stream; + + stream = face->root.stream; + + error = pcf_load_font( stream, face ); + if ( error ) + goto Fail; + } } /* set-up charmap */ diff --git a/src/pshinter/pshalgo.c b/src/pshinter/pshalgo.c index 3acd62ec3..5f077d54d 100644 --- a/src/pshinter/pshalgo.c +++ b/src/pshinter/pshalgo.c @@ -427,7 +427,7 @@ FT_Fixed delta2 = FT_PIX_ROUND( pos + len ) - pos - len; - if ( ABS( delta1 ) <= ABS( delta2 ) ) + if ( FT_ABS( delta1 ) <= FT_ABS( delta2 ) ) return delta1; else return delta2; @@ -771,7 +771,7 @@ FT_Fixed side_delta = psh_hint_snap_stem_side_delta ( pos, len ); - if ( ABS( side_delta ) < ABS( delta_b ) ) + if ( FT_ABS( side_delta ) < FT_ABS( delta_b ) ) pos += side_delta; else pos += delta_b; @@ -1414,7 +1414,7 @@ flag = PSH_POINT_EDGE_MIN; d = point->org_u - hint->org_pos; - if ( ABS( d ) < threshold ) + if ( FT_ABS( d ) < threshold ) { Is_Strong: psh_point_set_strong( point ); @@ -1428,7 +1428,7 @@ flag = PSH_POINT_EDGE_MAX; d = point->org_u - hint->org_pos - hint->org_len; - if ( ABS( d ) < threshold ) + if ( FT_ABS( d ) < threshold ) goto Is_Strong; } } @@ -1464,7 +1464,7 @@ flag = PSH_POINT_EDGE_MIN; d = point->org_u - hint->org_pos; - if ( ABS( d ) < threshold ) + if ( FT_ABS( d ) < threshold ) { Is_Strong2: point->flags2 |= flag; @@ -1478,7 +1478,7 @@ flag = PSH_POINT_EDGE_MAX; d = point->org_u - hint->org_pos - hint->org_len; - if ( ABS( d ) < threshold ) + if ( FT_ABS( d ) < threshold ) goto Is_Strong2; } diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c index 27323f259..937cd0207 100644 --- a/src/sfnt/ttload.c +++ b/src/sfnt/ttload.c @@ -5,7 +5,7 @@ /* Load the basic TrueType tables, i.e., tables that can be either in */ /* TTF or OTF fonts (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -740,12 +740,12 @@ face->root.num_glyphs = maxProfile->numGlyphs; face->root.internal->max_points = - (FT_UShort)MAX( maxProfile->maxCompositePoints, - maxProfile->maxPoints ); + (FT_UShort)FT_MAX( maxProfile->maxCompositePoints, + maxProfile->maxPoints ); face->root.internal->max_contours = - (FT_Short)MAX( maxProfile->maxCompositeContours, - maxProfile->maxContours ); + (FT_Short)FT_MAX( maxProfile->maxCompositeContours, + maxProfile->maxContours ); face->max_components = (FT_ULong)maxProfile->maxComponentElements + maxProfile->maxComponentDepth; @@ -896,7 +896,8 @@ /* do we have an inconsistent number of metric values? */ { TT_ShortMetrics* cur = *shorts; - TT_ShortMetrics* limit = cur + MIN( num_shorts, num_shorts_checked ); + TT_ShortMetrics* limit = cur + + FT_MIN( num_shorts, num_shorts_checked ); for ( ; cur < limit; cur++ ) diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 018654129..889ebbf4f 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -2403,7 +2403,7 @@ /* at small sizes, F_dot_P can become too small, resulting */ /* in overflows and `spikes' in a number of glyphs like `w'. */ - if ( ABS( CUR.F_dot_P ) < 0x4000000L ) + if ( FT_ABS( CUR.F_dot_P ) < 0x4000000L ) CUR.F_dot_P = 0x40000000L; /* Disable cached aspect ratio */ @@ -2446,7 +2446,7 @@ FT_UNUSED_EXEC; - if ( ABS( Vx ) < 0x10000L && ABS( Vy ) < 0x10000L ) + if ( FT_ABS( Vx ) < 0x10000L && FT_ABS( Vy ) < 0x10000L ) { Vx *= 0x100; Vy *= 0x100; @@ -2985,8 +2985,8 @@ args[0] = TT_MULDIV( args[0], args[1], 64L ); -#define DO_ABS \ - args[0] = ABS( args[0] ); +#define DO_ABS \ + args[0] = FT_ABS( args[0] ); #define DO_NEG \ @@ -5708,7 +5708,7 @@ if ( ( CUR.opcode & 1 ) != 0 ) /* rounding and control cutin flag */ { - if ( ABS( distance - org_dist ) > CUR.GS.control_value_cutin ) + if ( FT_ABS( distance - org_dist ) > CUR.GS.control_value_cutin ) distance = org_dist; distance = CUR_Func_round( distance, CUR.tt_metrics.compensations[0] ); @@ -5752,7 +5752,7 @@ /* single width cutin test */ - if ( ABS( org_dist - CUR.GS.single_width_value ) < + if ( FT_ABS( org_dist - CUR.GS.single_width_value ) < CUR.GS.single_width_cutin ) { if ( org_dist >= 0 ) @@ -5842,7 +5842,7 @@ /* single width test */ - if ( ABS( cvt_dist - CUR.GS.single_width_value ) < + if ( FT_ABS( cvt_dist - CUR.GS.single_width_value ) < CUR.GS.single_width_cutin ) { if ( cvt_dist >= 0 ) @@ -5886,7 +5886,7 @@ /* refer to the same zone. */ if ( CUR.GS.gep0 == CUR.GS.gep1 ) - if ( ABS( cvt_dist - org_dist ) >= CUR.GS.control_value_cutin ) + if ( FT_ABS( cvt_dist - org_dist ) >= CUR.GS.control_value_cutin ) cvt_dist = org_dist; distance = CUR_Func_round( @@ -6036,7 +6036,7 @@ discriminant = TT_MULDIV( dax, -dby, 0x40 ) + TT_MULDIV( day, dbx, 0x40 ); - if ( ABS( discriminant ) >= 0x40 ) + if ( FT_ABS( discriminant ) >= 0x40 ) { val = TT_MULDIV( dx, -dby, 0x40 ) + TT_MULDIV( dy, dbx, 0x40 ); diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 6b33b68fe..16a034155 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -854,7 +854,7 @@ (void)T1_ToFixedArray( parser, 6, temp, 3 ); - temp_scale = ABS( temp[3] ); + temp_scale = FT_ABS( temp[3] ); /* Set Units per EM based on FontMatrix values. We set the value to */ /* 1000 / temp_scale, because temp_scale was already multiplied by */ @@ -1660,7 +1660,7 @@ keyword_flag[0] = 1; else { - if ( parser->root.error == T1_Err_Ignore ) + if ( FT_ERROR_BASE( parser->root.error ) == FT_Err_Ignore ) parser->root.error = T1_Err_Ok; else return parser->root.error; diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c index bf9794790..ff53a3eb4 100644 --- a/src/type42/t42parse.c +++ b/src/type42/t42parse.c @@ -4,7 +4,7 @@ /* */ /* Type 42 font parser (body). */ /* */ -/* Copyright 2002, 2003 by Roberto Alameda. */ +/* Copyright 2002, 2003, 2004 by Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ @@ -245,7 +245,7 @@ (void)T1_ToFixedArray( parser, 6, temp, 3 ); - temp_scale = ABS( temp[3] ); + temp_scale = FT_ABS( temp[3] ); /* Set Units per EM based on FontMatrix values. We set the value to */ /* 1000 / temp_scale, because temp_scale was already multiplied by */ diff --git a/tests/gview.c b/tests/gview.c index 77f15bcdf..f68598512 100644 --- a/tests/gview.c +++ b/tests/gview.c @@ -745,7 +745,7 @@ ah_draw_edges( void ) x = (NV_Pos)( v1.x + 0.5 ); nv_pixmap_fill_rect( target, x - 1, y2, 3, - ABS( y1 - y2 ) + 1, SEGMENT_COLOR ); + FT_ABS( y1 - y2 ) + 1, SEGMENT_COLOR ); } } @@ -787,7 +787,7 @@ ah_draw_edges( void ) x = (NV_Pos)( v1.y + 0.5 ); nv_pixmap_fill_rect( target, y1, x - 1, - ABS( y1 - y2 ) + 1, 3, SEGMENT_COLOR ); + FT_ABS( y1 - y2 ) + 1, 3, SEGMENT_COLOR ); } } diff --git a/vms_make.com b/vms_make.com index 184a09350..12152ad04 100644 --- a/vms_make.com +++ b/vms_make.com @@ -151,6 +151,8 @@ all : $(MMS)$(MMSQUALIFIERS) set default [-.gzip] $(MMS)$(MMSQUALIFIERS) + set default [-.lzw] + $(MMS)$(MMSQUALIFIERS) set default [-.pcf] $(MMS)$(MMSQUALIFIERS) set default [-.pfr] @@ -271,6 +273,39 @@ CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=($(LIBINCS)[--.include],[--.src.gzip]) OBJS=ftgzip.obj +all : $(OBJS) + library [--.lib]freetype.olb $(OBJS) + +# EOF +$ eod +$ close out +$ write sys$output "... [.src.lzw] directory" +$ create [.src.lzw]descrip.mms +$ open/append out [.src.lzw]descrip.mms +$ copy sys$input: out +$ deck +# +# FreeType 2 LZW support compilation rules for VMS +# + + +# Copyright 2004 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. +$EOD +$ if libincs .nes. "" then write out "LIBINCS = ", libincs, "," +$ copy sys$input: out +$ deck + +CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=($(LIBINCS)[--.include],[--.src.lzw]) + +OBJS=ftlzw.obj + all : $(OBJS) library [--.lib]freetype.olb $(OBJS)