diff --git a/demos/config/x11/rules.mk b/demos/config/x11/rules.mk index 58feda15c..f14ab65db 100644 --- a/demos/config/x11/rules.mk +++ b/demos/config/x11/rules.mk @@ -41,13 +41,13 @@ endif # ifneq ($(X11_PATH),) -X11_INCLUDE := $(X11_PATH)$(SEP)include -X11_LIB := $(X11_PATH)$(SEP)lib +X11_INCLUDE := $(X11_PATH:%=%$(SEP)include) +X11_LIB := $(X11_PATH:%=%$(SEP)lib) # the GRAPH_LINK variable is expanded each time an executable is linked against # the graphics library.. # -GRAPH_LINK += -L$(X11_LIB) -lX11 +GRAPH_LINK += $(X11_LIB:%=-L%) -lX11 # Solaris needs a -lsocket in GRAPH_LINK .. # diff --git a/src/base/ftbbox.c b/src/base/ftbbox.c index 668741212..6cd35d882 100644 --- a/src/base/ftbbox.c +++ b/src/base/ftbbox.c @@ -47,11 +47,13 @@ /* */ /* This function is used as a `move_to' and `line_to' emitter during */ /* FT_Raster_Decompose(). It simply records the destination point in */ - /* user->last. */ + /* `user->last'. */ /* */ /* */ - /* to :: The destination vector. */ - /* user :: The current walk context. */ + /* to :: A pointer to the destination vector. */ + /* */ + /* */ + /* user :: A pointer to the current walk context. */ /* */ /* */ /* Error code. 0 means success. */ @@ -88,7 +90,7 @@ /* y2 :: The coordinate of the control point. */ /* y3 :: The end coordinate. */ /* */ - /* */ + /* */ /* min :: The address of the current minimum. */ /* max :: The address of the current maximum. */ /* */ @@ -143,11 +145,11 @@ /* update it. */ /* */ /* */ - /* control :: A control point. */ - /* to :: The destination vector. */ + /* control :: A pointer to a control point. */ + /* to :: A pointer to the destination vector. */ /* */ /* */ - /* user :: The current walk context. */ + /* user :: The address of the current walk context. */ /* */ /* */ /* Error code. 0 means success. */ @@ -288,12 +290,12 @@ /* update it. */ /* */ /* */ - /* control1 :: The first control point. */ - /* control2 :: The second control point. */ - /* to :: The destination vector. */ + /* control1 :: A pointer to the first control point. */ + /* control2 :: A pointer to the second control point. */ + /* to :: A pointer to the destination vector. */ /* */ /* */ - /* user :: The current walk context. */ + /* user :: The address of the current walk context. */ /* */ /* */ /* Error code. 0 means success. */ @@ -350,7 +352,7 @@ /* outline :: A pointer to the source outline. */ /* */ /* */ - /* bbox :: The outline's exact bounding box. */ + /* abbox :: A pointer to the outline's exact bounding box. */ /* */ /* */ /* Error code. 0 means success. */ @@ -376,8 +378,8 @@ return 0; } - /* We compute the control box, as well as the bounding box */ - /* of all `on' points in the outline. Then, if the two boxes */ + /* We compute the control box as well as the bounding box of */ + /* all `on' points in the outline. Then, if the two boxes */ /* coincide, we exit immediately. */ vec = outline->points; diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c index 3ec8ed5aa..008c281ba 100644 --- a/src/base/ftcalc.c +++ b/src/base/ftcalc.c @@ -422,15 +422,18 @@ /* FT_Add64 */ /* */ /* */ - /* Add two Int64 values. Will be wrapped by the ADD_64() macro. */ + /* Add two Int64 values. */ /* */ /* */ /* x :: A pointer to the first value to be added. */ /* y :: A pointer to the second value to be added. */ /* */ - /* */ + /* */ /* z :: A pointer to the result of `x + y'. */ /* */ + /* */ + /* Will be wrapped by the ADD_64() macro. */ + /* */ BASE_FUNC void FT_Add64( FT_Int64* x, FT_Int64* y, @@ -452,16 +455,18 @@ /* FT_MulTo64 */ /* */ /* */ - /* Multiplies two Int32 integers. Returns a Int64 integer. Will be */ - /* wrapped by the MUL_64() macro. */ + /* Multiplies two Int32 integers. Returns a Int64 integer. */ /* */ /* */ /* x :: The first multiplier. */ /* y :: The second multiplier. */ /* */ - /* */ + /* */ /* z :: A pointer to the result of `x * y'. */ /* */ + /* */ + /* Will be wrapped by the MUL_64() macro. */ + /* */ BASE_FUNC void FT_MulTo64( FT_Int32 x, FT_Int32 y, @@ -516,7 +521,7 @@ /* */ /* */ /* Divides an Int64 value by an Int32 value. Returns an Int32 */ - /* integer. Will be wrapped by the DIV_64() macro. */ + /* integer. */ /* */ /* */ /* x :: A pointer to the dividend. */ @@ -525,6 +530,9 @@ /* */ /* The result of `x / y'. */ /* */ + /* */ + /* Will be wrapped by the DIV_64() macro. */ + /* */ BASE_FUNC FT_Int32 FT_Div64by32( FT_Int64* x, FT_Int32 y ) diff --git a/src/base/ftcalc.h b/src/base/ftcalc.h index 949d88fa1..020b2189d 100644 --- a/src/base/ftcalc.h +++ b/src/base/ftcalc.h @@ -50,9 +50,12 @@ #define MUL_64( x, y, z ) FT_MulTo64( x, y, &z ) #define DIV_64( x, y ) FT_Div64by32( &x, y ) - BASE_DEF void FT_Add64 ( FT_Int64* x, FT_Int64* y, FT_Int64* z ); - BASE_DEF void FT_MulTo64 ( FT_Int32 x, FT_Int32 y, FT_Int64* z ); - BASE_DEF FT_Int32 FT_Div64by32( FT_Int64* x, FT_Int32 y ); + BASE_DEF + void FT_Add64 ( FT_Int64* x, FT_Int64* y, FT_Int64* z ); + BASE_DEF + void FT_MulTo64 ( FT_Int32 x, FT_Int32 y, FT_Int64* z ); + BASE_DEF + FT_Int32 FT_Div64by32( FT_Int64* x, FT_Int32 y ); #endif /* LONG64 */ @@ -60,7 +63,8 @@ #define SQRT_32( x ) FT_Sqrt32( x ) - BASE_DEF FT_Int32 FT_Sqrt32( FT_Int32 l ); + BASE_DEF + FT_Int32 FT_Sqrt32( FT_Int32 l ); /*************************************************************************/ /* */ diff --git a/src/base/ftdebug.c b/src/base/ftdebug.c index 168f9b767..06d232981 100644 --- a/src/base/ftdebug.c +++ b/src/base/ftdebug.c @@ -4,7 +4,7 @@ /* */ /* Debugging and logging component (body). */ /* */ -/* Copyright 1996-1999 by */ +/* Copyright 1996-2000 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ @@ -31,14 +31,6 @@ #include - /*************************************************************************/ - /* */ - /* The Print() function is defined in ftconfig.h. It defaults to */ - /* vprintf() on systems which have it. */ - /* */ - /*************************************************************************/ - - void FT_Message( const char* fmt, ... ) { va_list ap; @@ -65,6 +57,21 @@ #ifdef FT_DEBUG_LEVEL_TRACE + + /*************************************************************************/ + /* */ + /* */ + /* FT_SetTraceLevel */ + /* */ + /* */ + /* Sets the trace level for debugging. */ + /* */ + /* */ + /* component :: The component which should be traced. See ftdebug.h */ + /* for a complete list. If set to `trace_any', all */ + /* components will be traced. */ + /* level :: The tracing level. */ + /* */ EXPORT_FUNC void FT_SetTraceLevel( FT_Trace component, char level ) diff --git a/src/base/ftdebug.h b/src/base/ftdebug.h index c619f3529..b521e3f95 100644 --- a/src/base/ftdebug.h +++ b/src/base/ftdebug.h @@ -4,7 +4,7 @@ /* */ /* Debugging and logging component (specification). */ /* */ -/* Copyright 1996-1999 by */ +/* Copyright 1996-2000 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ @@ -35,7 +35,7 @@ /* */ /* - release mode: */ /* */ - /* No error message is sent nor generated. The code is free from any */ + /* No error message is sent or generated. The code is free from any */ /* debugging parts. */ /* */ /*************************************************************************/ @@ -57,6 +57,7 @@ typedef enum FT_Trace_ { + /* the first level must always be `trace_any' */ trace_any = 0, /* first, define an enum for each common component */ @@ -78,12 +79,14 @@ trace_ttextend, trace_ttdriver, +#if 0 /* define an enum for each TrueDoc driver component */ trace_tdobjs, trace_tdload, trace_tdgload, trace_tdhint, trace_tddriver, +#endif /* define an enum for each Type1 driver component */ trace_t1objs, @@ -93,13 +96,14 @@ trace_t1driver, /* other trace levels */ - trace_init, + trace_init, /* the last level must always be `trace_max' */ trace_max } FT_Trace; + /* declared in ftdebug.c */ extern char ft_trace_levels[trace_max]; @@ -113,9 +117,12 @@ /*************************************************************************/ -#define FT_TRACE( level, varformat ) \ - if ( ft_trace_levels[FT_COMPONENT] >= level ) \ - FT_Message##varformat +#define FT_TRACE( level, varformat ) \ + do \ + { \ + if ( ft_trace_levels[FT_COMPONENT] >= level ) \ + FT_Message##varformat; \ + } while ( 0 ) EXPORT_DEF @@ -126,16 +133,16 @@ #elif defined( FT_DEBUG_LEVEL_ERROR ) -#define FT_TRACE( level, varformat ) /* nothing */ +#define FT_TRACE( level, varformat ) while ( 0 ) { } /* nothing */ #else /* release mode */ -#define FT_Assert( condition ) /* nothing */ +#define FT_Assert( condition ) while ( 0 ) { } /* nothing */ -#define FT_TRACE( level, varformat ) /* nothing */ -#define FT_ERROR( varformat ) /* nothing */ +#define FT_TRACE( level, varformat ) while ( 0 ) { } /* nothing */ +#define FT_ERROR( varformat ) while ( 0 ) { } /* nothing */ #endif /* FT_DEBUG_LEVEL_TRACE, FT_DEBUG_LEVEL_ERROR */ @@ -146,7 +153,7 @@ /* Define macros and functions that are common to the debug and trace */ /* modes. */ /* */ - /* You need vprintf() to be able to compile ttdebug.c. */ + /* You need vprintf() to be able to compile ftdebug.c. */ /* */ /*************************************************************************/ @@ -155,10 +162,15 @@ #include "stdio.h" /* for vprintf() */ -#define FT_Assert( condition ) \ - if ( !(condition) ) \ - FT_Panic( "assertion failed on line %d of file %s\n", __LINE__, __FILE__ ); +#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 */ extern void FT_Message( const char* fmt, ... ); /* print a message and exit */ @@ -170,6 +182,9 @@ #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 ) diff --git a/src/base/ftdriver.h b/src/base/ftdriver.h index fe24f4641..7db8d49d8 100644 --- a/src/base/ftdriver.h +++ b/src/base/ftdriver.h @@ -4,7 +4,7 @@ /* */ /* FreeType driver interface (specification). */ /* */ -/* Copyright 1996-1999 by */ +/* Copyright 1996-2000 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ @@ -56,7 +56,7 @@ /*************************************************************************/ /* */ /* */ - /* FTDriver_doneEngine */ + /* FTDriver_doneDriver */ /* */ /* */ /* A driver method used to finalize a given driver object. Note that */ @@ -95,7 +95,7 @@ /* */ /* */ /* A typeless pointer to the extension's interface (normally a table */ - /* of function pointers). Returns NULL when the requested extension */ + /* of function pointers). Returns NULL if the requested extension */ /* isn't available (i.e., wasn't compiled in the driver at build */ /* time). */ /* */ @@ -106,17 +106,18 @@ /*************************************************************************/ /* */ /* */ - /* FTDriver_formatInterface */ + /* FT_FormatInterface */ /* */ /* */ /* A driver interface field whose value is a driver-specific */ - /* interface method tables. This table contains entry points to */ + /* interface method table. This table contains entry points to */ /* various functions that are strictly related to the driver's */ /* format. */ /* */ typedef void* FT_FormatInterface; + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -140,28 +141,27 @@ /* must be created by the caller. */ /* */ /* */ - /* driver :: A handle to the source driver object. */ - /* resource :: A handle to the source resource. */ - /* typeface_index :: The index of face in the font resource. Used to */ + /* stream :: The input stream. */ + /* typeface_index :: The face index in the font resource. Used to */ /* access individual faces in collections. */ - /* */ /* face :: A handle to the new target face. */ /* */ /* */ /* FreeType error code. 0 means success. */ /* */ /* */ - /* The `typeface_index' parameter field will be set to -1 when the */ + /* The `typeface_index' parameter field will be set to -1 if the */ /* engine only wants to test the format of the resource. This means */ /* that font drivers should simply check the font format, then return */ /* immediately with an error code of 0 (meaning success). The field */ /* `num_faces' should be set. */ /* */ - /* done_face() will be called subsequently, whatever the result was. */ + /* FTDriver_doneFace() will be called subsequently, whatever the */ + /* result was. */ /* */ - typedef FT_Error (*FTDriver_initFace)( FT_Stream stream, - FT_Long typeface_index, - FT_Face face ); + typedef FT_Error (*FTDriver_initFace)( FT_Stream stream, + FT_Long typeface_index, + FT_Face face ); /*************************************************************************/ @@ -194,15 +194,13 @@ /* */ /* */ /* face :: A handle to the source face object. */ - /* */ /* left_glyph :: The index of the left glyph in the kern pair. */ - /* */ /* right_glyph :: The index of the right glyph in the kern pair. */ /* */ /* */ - /* kerning :: The kerning vector. This is in font units for */ - /* scalable formats, and in pixels for fixed-sizes */ - /* formats. */ + /* kerning :: A pointer to the kerning vector. This is in font */ + /* units for scalable formats, and in pixels for */ + /* fixed-sizes formats. */ /* */ /* */ /* FreeType error code. 0 means success. */ @@ -213,7 +211,7 @@ /* kernings are out of the scope of this method (the basic driver */ /* interface is meant to be simple). */ /* */ - /* They can be implemented through format-specific interfaces. */ + /* They can be implemented by format-specific interfaces. */ /* */ typedef FT_Error (*FTDriver_getKerning)( FT_Face face, FT_UInt left_glyph, @@ -221,6 +219,7 @@ FT_Vector* kerning ); + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -244,7 +243,6 @@ /* must be created by the caller. */ /* */ /* */ - /* face :: A handle to the parent face object. */ /* size :: A handle to the new size object. */ /* */ /* */ @@ -267,11 +265,13 @@ /* and vertical) expressed in fractional points. */ /* */ /* */ - /* size :: A handle to the target size object. */ - /* char_width :: The character width expressed in 26.6 fractional */ - /* points. */ - /* char_height :: The character height expressed in 26.6 fractional */ - /* points. */ + /* size :: A handle to the target size object. */ + /* char_width :: The character width expressed in 26.6 */ + /* fractional points. */ + /* char_height :: The character height expressed in 26.6 */ + /* fractional points. */ + /* horz_resolution :: The horizontal resolution. */ + /* vert_resolution :: The vertical resolution. */ /* */ /* */ /* FreeType error code. 0 means success. */ @@ -298,26 +298,17 @@ /* */ /* */ /* size :: A handle to the target size object. */ - /* */ /* pixel_width :: The character width expressed in 26.6 fractional */ /* pixels. */ - /* */ /* pixel_height :: The character height expressed in 26.6 fractional */ /* pixels. */ /* */ - /* point_size :: The corresponding character size in points. This */ - /* value is only sent to the TrueType bytecode */ - /* interpreter, even though 99% of glyph programs */ - /* will simply ignore it. A safe value there is the */ - /* maximum of the pixel width and height (multiplied */ - /* by 64 to make it a 26.6 fixed float). */ /* */ /* FreeType error code. 0 means success. */ /* */ /* */ /* This function should work with all kinds of `Size' objects, either */ - /* fixed or scalable ones. The `point_size' parameter will simply be */ - /* ignored in case of fixed formats. */ + /* fixed or scalable ones. */ /* */ typedef FT_Error (*FTDriver_setPixelSizes)( FT_Size size, FT_UInt pixel_width, @@ -337,12 +328,10 @@ /* */ /* size :: A handle to the target size object. */ /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ typedef void (*FTDriver_doneSize)( FT_Size size ); + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -368,7 +357,6 @@ /* bitmap format. */ /* */ /* */ - /* face :: A handle to the parent face object. */ /* slot :: A handle to the new glyph slot object. */ /* */ /* */ @@ -387,12 +375,8 @@ /* is not destroyed by this function. */ /* */ /* */ - /* face :: A handle to the parent face object. */ /* slot :: A handle to the new glyph slot object. */ /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ typedef void (*FTDriver_doneGlyphSlot)( FT_GlyphSlot slot ); @@ -407,21 +391,14 @@ /* */ /* slot :: A handle to target slot object where the glyph will */ /* be loaded. */ - /* */ /* size :: A handle to the source face size at which the glyph */ /* must be scaled/loaded. */ - /* */ /* glyph_index :: The index of the glyph in the font file. */ - /* */ /* load_flags :: A flag indicating what to load for this glyph. The */ /* FTLOAD_??? constants can be used to control the */ /* glyph loading process (e.g., whether the outline */ /* should be scaled, whether to load bitmaps or not, */ /* whether to hint the outline, etc). */ - /* */ - /* result :: A set of bit flags indicating the type of data that */ - /* was loaded in the glyph slot (outline, bitmap, */ - /* pixmap, etc). */ /* */ /* */ /* FreeType error code. 0 means success. */ @@ -432,6 +409,7 @@ FT_Int load_flags ); + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -463,6 +441,19 @@ FT_Long charcode ); + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** ****/ + /**** I N T E R F A C E ****/ + /**** ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ /* */ /* */ @@ -482,63 +473,52 @@ /* */ /* driver_object_size :: The size in bytes of a single driver */ /* object. */ - /* */ /* face_object_size :: The size in bytes of a single face object. */ - /* */ /* size_object_size :: The size in bytes of a single size object. */ - /* */ /* slot_object_size :: The size in bytes of a single glyph slot */ /* object. */ /* */ - /* driver_name :: a string to describe the driver to the */ - /* system. It doesn't necessarily describe */ + /* driver_name :: A string to describe the driver to the */ + /* system. It doesn't necessarily describe */ /* in detail all the font formats the driver */ /* may support. */ - /* */ - /* driver_version :: driver version number. starts at 1 */ - /* */ - /* driver_requires :: the FreeType major version this driver is */ - /* written for. This number should be equal */ - /* to or greater than 2 ! */ + /* driver_version :: The driver version number. Starts at 1. */ + /* driver_requires :: The FreeType major version this driver is */ + /* written for. This number should be equal */ + /* to or greater than 2! */ /* */ /* format_interface :: A pointer to the driver's format-specific */ /* interface. */ /* */ /* init_driver :: Used to initialize a given driver object. */ - /* */ /* done_driver :: Used to finalize and destroy a given */ /* driver object. */ - /* */ - /* get_extension :: Returns an interface for a given driver */ + /* get_interface :: Returns an interface for a given driver */ /* extension. */ /* */ /* init_face :: Initializes a given face object. */ - /* */ /* done_face :: Discards a face object, as well as all */ /* child objects (sizes, charmaps, glyph */ /* slots). */ - /* */ /* get_kerning :: Returns the kerning vector corresponding */ /* to a pair of glyphs, expressed in unscaled */ /* font units. */ /* */ /* init_size :: Initializes a given size object. */ - /* */ /* done_size :: Finalizes a given size object. */ - /* */ /* set_size_char_sizes :: Resets a scalable size object's character */ /* size. */ - /* */ /* set_pixel_sizes :: Resets a face size object's pixel */ /* dimensions. Applies to both scalable and */ /* fixed faces. */ /* */ /* init_glyph_slot :: Initializes a given glyph slot object. */ - /* */ /* done_glyph_slot :: Finalizes a given glyph slot. */ - /* */ /* load_glyph :: Loads a given glyph into a given slot. */ /* */ + /* get_char_index :: Returns the glyph index for a given */ + /* charmap. */ + /* */ typedef struct FT_DriverInterface_ { FT_Int driver_object_size; @@ -573,6 +553,7 @@ } FT_DriverInterface; + #endif /* FTDRIVER_H */