ref: f993b6a0332e4783e110d97636fcd009add48287
parent: fc1f98944640c2069194a3daaba914dee6a4f613
author: Werner Lemberg <[email protected]>
date: Sat Jan 8 12:10:33 EST 2000
demos/config/x11/rules.mk: support for multiple X11R6 entries in $(PATH) added. ftxbbox.c, ftcalc.c, ftdebug.c, ftdriver.h: doc fixes. ftdebug.c: formatting. ftdebug.h: making makros `;'-safe (i.e., they can now be used within if-else clauses without side effects resp. don't produce a single `;').
--- a/demos/config/x11/rules.mk
+++ b/demos/config/x11/rules.mk
@@ -41,13 +41,13 @@
#
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 ..
#
--- a/src/base/ftbbox.c
+++ b/src/base/ftbbox.c
@@ -47,12 +47,14 @@
/* <Description> */
/* 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'. */
/* */
/* <Input> */
- /* to :: The destination vector. */
- /* user :: The current walk context. */
+ /* to :: A pointer to the destination vector. */
/* */
+ /* <InOut> */
+ /* user :: A pointer to the current walk context. */
+ /* */
/* <Return> */
/* Error code. 0 means success. */
/* */
@@ -88,7 +90,7 @@
/* y2 :: The coordinate of the control point. */
/* y3 :: The end coordinate. */
/* */
- /* <Output> */
+ /* <InOut> */
/* min :: The address of the current minimum. */
/* max :: The address of the current maximum. */
/* */
@@ -143,11 +145,11 @@
/* update it. */
/* */
/* <Input> */
- /* control :: A control point. */
- /* to :: The destination vector. */
+ /* control :: A pointer to a control point. */
+ /* to :: A pointer to the destination vector. */
/* */
/* <InOut> */
- /* user :: The current walk context. */
+ /* user :: The address of the current walk context. */
/* */
/* <Return> */
/* Error code. 0 means success. */
@@ -288,12 +290,12 @@
/* update it. */
/* */
/* <Input> */
- /* 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. */
/* */
/* <InOut> */
- /* user :: The current walk context. */
+ /* user :: The address of the current walk context. */
/* */
/* <Return> */
/* Error code. 0 means success. */
@@ -350,7 +352,7 @@
/* outline :: A pointer to the source outline. */
/* */
/* <Output> */
- /* bbox :: The outline's exact bounding box. */
+ /* abbox :: A pointer to the outline's exact bounding box. */
/* */
/* <Return> */
/* 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;
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -422,15 +422,18 @@
/* FT_Add64 */
/* */
/* <Description> */
- /* Add two Int64 values. Will be wrapped by the ADD_64() macro. */
+ /* Add two Int64 values. */
/* */
/* <Input> */
/* x :: A pointer to the first value to be added. */
/* y :: A pointer to the second value to be added. */
/* */
- /* <InOut> */
+ /* <Output> */
/* z :: A pointer to the result of `x + y'. */
/* */
+ /* <Note> */
+ /* 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 */
/* */
/* <Description> */
- /* Multiplies two Int32 integers. Returns a Int64 integer. Will be */
- /* wrapped by the MUL_64() macro. */
+ /* Multiplies two Int32 integers. Returns a Int64 integer. */
/* */
/* <Input> */
/* x :: The first multiplier. */
/* y :: The second multiplier. */
/* */
- /* <InOut> */
+ /* <Output> */
/* z :: A pointer to the result of `x * y'. */
/* */
+ /* <Note> */
+ /* Will be wrapped by the MUL_64() macro. */
+ /* */
BASE_FUNC
void FT_MulTo64( FT_Int32 x,
FT_Int32 y,
@@ -516,7 +521,7 @@
/* */
/* <Description> */
/* Divides an Int64 value by an Int32 value. Returns an Int32 */
- /* integer. Will be wrapped by the DIV_64() macro. */
+ /* integer. */
/* */
/* <Input> */
/* x :: A pointer to the dividend. */
@@ -524,6 +529,9 @@
/* */
/* <Return> */
/* The result of `x / y'. */
+ /* */
+ /* <Note> */
+ /* Will be wrapped by the DIV_64() macro. */
/* */
BASE_FUNC
FT_Int32 FT_Div64by32( FT_Int64* x,
--- 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 );
/*************************************************************************/
/* */
--- 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 <string.h>
- /*************************************************************************/
- /* */
- /* 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
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* FT_SetTraceLevel */
+ /* */
+ /* <Description> */
+ /* Sets the trace level for debugging. */
+ /* */
+ /* <Input> */
+ /* 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 )
--- 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,6 +79,7 @@
trace_ttextend,
trace_ttdriver,
+#if 0
/* define an enum for each TrueDoc driver component */
trace_tdobjs,
trace_tdload,
@@ -84,6 +86,7 @@
trace_tdgload,
trace_tdhint,
trace_tddriver,
+#endif
/* define an enum for each Type1 driver component */
trace_t1objs,
@@ -93,7 +96,7 @@
trace_t1driver,
/* other trace levels */
- trace_init,
+ trace_init,
/* the last level must always be `trace_max' */
trace_max
@@ -100,6 +103,7 @@
} 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 */
@@ -169,6 +181,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 )
--- 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 @@
/*************************************************************************/
/* */
/* <FuncType> */
- /* FTDriver_doneEngine */
+ /* FTDriver_doneDriver */
/* */
/* <Description> */
/* A driver method used to finalize a given driver object. Note that */
@@ -95,7 +95,7 @@
/* */
/* <Return> */
/* 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,11 +106,11 @@
/*************************************************************************/
/* */
/* <Type> */
- /* FTDriver_formatInterface */
+ /* FT_FormatInterface */
/* */
/* <Description> */
/* 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. */
/* */
@@ -117,6 +117,7 @@
typedef void* FT_FormatInterface;
+
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
@@ -140,11 +141,9 @@
/* must be created by the caller. */
/* */
/* <Input> */
- /* 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. */
/* */
/* <Return> */
@@ -151,17 +150,18 @@
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
- /* 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 @@
/* */
/* <Input> */
/* 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. */
/* */
/* <Output> */
- /* 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. */
/* */
/* <Return> */
/* 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. */
/* */
/* <Input> */
- /* face :: A handle to the parent face object. */
/* size :: A handle to the new size object. */
/* */
/* <Return> */
@@ -267,11 +265,13 @@
/* and vertical) expressed in fractional points. */
/* */
/* <Input> */
- /* 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. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
@@ -298,26 +298,17 @@
/* */
/* <Input> */
/* 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). */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* 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 @@
/* <Input> */
/* size :: A handle to the target size object. */
/* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
typedef void (*FTDriver_doneSize)( FT_Size size );
+
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
@@ -368,7 +357,6 @@
/* bitmap format. */
/* */
/* <Input> */
- /* face :: A handle to the parent face object. */
/* slot :: A handle to the new glyph slot object. */
/* */
/* <Return> */
@@ -387,12 +375,8 @@
/* is not destroyed by this function. */
/* */
/* <Input> */
- /* face :: A handle to the parent face object. */
/* slot :: A handle to the new glyph slot object. */
/* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
typedef void (*FTDriver_doneGlyphSlot)( FT_GlyphSlot slot );
@@ -407,21 +391,14 @@
/* <Input> */
/* 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). */
- /* <Output> */
- /* result :: A set of bit flags indicating the type of data that */
- /* was loaded in the glyph slot (outline, bitmap, */
- /* pixmap, etc). */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
@@ -432,6 +409,7 @@
FT_Int load_flags );
+
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
@@ -463,7 +441,20 @@
FT_Long charcode );
+
/*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /**** ****/
+ /**** ****/
+ /**** I N T E R F A C E ****/
+ /**** ****/
+ /**** ****/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+
+ /*************************************************************************/
/* */
/* <Struct> */
/* FT_DriverInterface */
@@ -482,63 +473,52 @@
/* <Fields> */
/* 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 :: 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! */
/* */
- /* 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 ! */
- /* */
/* 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;
@@ -572,6 +552,7 @@
FTDriver_getCharIndex get_char_index;
} FT_DriverInterface;
+
#endif /* FTDRIVER_H */