From 0959a8777a2b7fedcb95221338eb1dc408e64c40 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 18 Jul 2000 06:50:03 +0000 Subject: [PATCH] Formatting. --- include/freetype/internal/ftcalc.h | 31 +-- include/freetype/internal/ftdebug.h | 9 +- include/freetype/internal/ftdriver.h | 181 ++++++++-------- include/freetype/internal/ftextend.h | 35 +++- include/freetype/internal/ftlist.h | 42 ++-- include/freetype/internal/ftmemory.h | 67 +++--- include/freetype/internal/ftobjs.h | 300 ++++++++++++++------------- src/winfonts/winfnt.c | 8 +- 8 files changed, 360 insertions(+), 313 deletions(-) diff --git a/include/freetype/internal/ftcalc.h b/include/freetype/internal/ftcalc.h index f9547e4cd..99b6cfaf6 100644 --- a/include/freetype/internal/ftcalc.h +++ b/include/freetype/internal/ftcalc.h @@ -7,8 +7,8 @@ /* Copyright 1996-2000 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 */ +/* 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. */ @@ -37,6 +37,7 @@ #define DIV_64( x, y ) ( (x) / (y) ) + #ifdef FT_CONFIG_OPTION_OLD_CALCS #define SQRT_64( z ) FT_Sqrt64( z ) @@ -45,6 +46,7 @@ #endif /* FT_CONFIG_OPTION_OLD_CALCS */ + #else /* LONG64 */ @@ -55,28 +57,32 @@ } FT_Int64; + #define ADD_64( x, y, z ) FT_Add64( &x, &y, &z ) #define MUL_64( x, y, z ) FT_MulTo64( x, y, &z ) #define DIV_64( x, y ) FT_Div64by32( &x, y ) - FT_EXPORT_DEF( void ) FT_Add64 ( FT_Int64* x, - FT_Int64* y, - FT_Int64* z ); - FT_EXPORT_DEF( void ) FT_MulTo64 ( FT_Int32 x, - FT_Int32 y, - FT_Int64* z ); + FT_EXPORT_DEF( void ) FT_Add64( FT_Int64* x, + FT_Int64* y, + FT_Int64* z ); + + FT_EXPORT_DEF( void ) FT_MulTo64( FT_Int32 x, + FT_Int32 y, + FT_Int64* z ); FT_EXPORT_DEF( FT_Int32 ) FT_Div64by32( FT_Int64* x, FT_Int32 y ); + #ifdef FT_CONFIG_OPTION_OLD_CALCS #define SQRT_64( z ) FT_Sqrt64( &z ) FT_EXPORT_DEF( FT_Int32 ) FT_Sqrt64( FT_Int64* x ); -#endif /* OLD_CALC */ +#endif /* FT_CONFIG_OPTION_OLD_CALCS */ + #endif /* LONG64 */ @@ -85,9 +91,9 @@ #define SQRT_32( x ) FT_Sqrt32( x ) - BASE_DEF(FT_Int32) FT_Sqrt32( FT_Int32 x ); + BASE_DEF( FT_Int32 ) FT_Sqrt32( FT_Int32 x ); -#endif /* FT_CONFIG_OPTION_OLD_CALCS */ +#endif /* !FT_CONFIG_OPTION_OLD_CALCS */ /*************************************************************************/ @@ -101,11 +107,12 @@ #define INT_TO_F2DOT14( x ) ( (FT_Long)(x) << 14 ) #define INT_TO_FIXED( x ) ( (FT_Long)(x) << 16 ) #define F2DOT14_TO_FIXED( x ) ( (FT_Long)(x) << 2 ) -#define FLOAT_TO_FIXED( x ) ( (FT_Long)(x * 65536.0) ) +#define FLOAT_TO_FIXED( x ) ( (FT_Long)( x * 65536.0 ) ) #define ROUND_F26DOT6( x ) ( x >= 0 ? ( ( (x) + 32 ) & -64 ) \ : ( -( ( 32 - (x) ) & -64 ) ) ) + #ifdef __cplusplus } #endif diff --git a/include/freetype/internal/ftdebug.h b/include/freetype/internal/ftdebug.h index 3240f3fef..8b1e4dd5a 100644 --- a/include/freetype/internal/ftdebug.h +++ b/include/freetype/internal/ftdebug.h @@ -7,8 +7,8 @@ /* Copyright 1996-2000 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 */ +/* 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. */ @@ -110,13 +110,12 @@ /* Windows fonts component */ trace_winfnt, - /* other trace levels */ - /* the last level must always be `trace_max' */ trace_max } FT_Trace; + /* declared in ftdebug.c */ extern char ft_trace_levels[trace_max]; @@ -189,7 +188,7 @@ 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 ) FT_XCAT( FT_Message, varformat ) diff --git a/include/freetype/internal/ftdriver.h b/include/freetype/internal/ftdriver.h index f2d435e99..592de498c 100644 --- a/include/freetype/internal/ftdriver.h +++ b/include/freetype/internal/ftdriver.h @@ -2,44 +2,44 @@ /* */ /* ftdriver.h */ /* */ -/* FreeType font driver interface (specification). */ +/* FreeType font driver interface (specification). */ /* */ /* Copyright 1996-2000 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 */ +/* 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. */ /* */ /***************************************************************************/ + #ifndef FTDRIVER_H #define FTDRIVER_H + #include #include + typedef FT_Error (*FTDriver_initFace)( FT_Stream stream, FT_Face face, FT_Int typeface_index, FT_Int num_params, FT_Parameter* parameters ); - typedef void (*FTDriver_doneFace)( FT_Face face ); typedef FT_Error (*FTDriver_initSize)( FT_Size size ); - typedef void (*FTDriver_doneSize)( FT_Size size ); typedef FT_Error (*FTDriver_initGlyphSlot)( FT_GlyphSlot slot ); - typedef void (*FTDriver_doneGlyphSlot)( FT_GlyphSlot slot ); @@ -68,7 +68,8 @@ FT_Vector* kerning ); - typedef FT_Error (*FTDriver_attachFile)( FT_Face face, FT_Stream stream ); + typedef FT_Error (*FTDriver_attachFile)( FT_Face face, + FT_Stream stream ); typedef FT_Error (*FTDriver_getAdvances)( FT_Face face, @@ -78,95 +79,99 @@ FT_UShort* advances ); - /************************************************************************* - * - * - * FT_Driver_Class - * - * - * The font driver class. This structure mostly contains pointers to - * driver methods. - * - * - * face_object_size :: size of a face object in bytes - * size_object_size :: size of a size object in bytes - * slot_object_size :: size of a glyph object in bytes - * - * init_face :: format-specific face constructor - * done_face :: format-specific face destructor - * - * init_size :: format-specific size constructor - * done_size :: format-specific size destructor - * - * init_slot :: format-specific slot constructor - * done_slot :: format-specific slot destructor - * - * set_char_sizes :: handle to a function used to set the new character - * size in points + resolution. can be set to 0 to - * indicate default behaviour - * - * set_pixel_sizes :: handme to function used to set the new character - * size in pixels. can be set to 0 to indicate - * default behaviour - * - * load_glyph :: load a given glyph image in a slot. This field - * is mandatory ! - * - * get_char_index :: return the glyph index of a given character - * for a given charmap. This field is mandatory ! - * - * get_kerning :: return the unscaled kerning for a given pair - * of glyphs. can be set to 0 if the format doesn't - * support kerning. - * - * attach_file :: reads additional data for a face from another - * file/stream. For example, this can be used - * to add data from AFM or PFM files on a Type 1 - * face, or a CIDMap on a CID-keyed face.. - * - * get_advances :: a function used to return the advances of 'count' - * glyphs, starting at 'index'. the "vertical" flags - * must be set when vertical advances are queried. - * the advances buffer is caller-allocated - * - * get_bboxes :: a function used to return the bounding box of - * 'count' glyphs, starting at 'index'. the bbox - * buffer is caller-allocated - * - * - * Most function pointers, with the exception of "load_glyph" and - * "get_char_index" can be set to 0 to indicate a the default behaviour - * - * - *************************************************************************/ - + /*************************************************************************/ + /* */ + /* */ + /* FT_Driver_Class */ + /* */ + /* */ + /* The font driver class. This structure mostly contains pointers to */ + /* driver methods. */ + /* */ + /* */ + /* root :: The parent module. */ + /* */ + /* face_object_size :: The size of a face object in bytes. */ + /* */ + /* size_object_size :: The size of a size object in bytes. */ + /* */ + /* slot_object_size :: The size of a glyph object in bytes. */ + /* */ + /* init_face :: The format-specific face constructor. */ + /* */ + /* done_face :: The format-specific face destructor. */ + /* */ + /* init_size :: The format-specific size constructor. */ + /* */ + /* done_size :: The format-specific size destructor. */ + /* */ + /* init_slot :: The format-specific slot constructor. */ + /* */ + /* done_slot :: The format-specific slot destructor. */ + /* */ + /* set_char_sizes :: A handle to a function used to set the new */ + /* character size in points + resolution. Can be */ + /* set to 0 to indicate default behaviour. */ + /* */ + /* set_pixel_sizes :: A handle to a function used to set the new */ + /* character size in pixels. Can be set to 0 to */ + /* indicate default behaviour. */ + /* */ + /* load_glyph :: A function handle to load a given glyph image */ + /* in a slot. This field is mandatory! */ + /* */ + /* get_char_index :: A function handle to return the glyph index of */ + /* a given character for a given charmap. This */ + /* field is mandatory! */ + /* */ + /* get_kerning :: A function handle to return the unscaled */ + /* kerning for a given pair of glyphs. Can be */ + /* set to 0 if the format doesn't support */ + /* kerning. */ + /* */ + /* attach_file :: This function handle is used to read */ + /* additional data for a face from another */ + /* file/stream. For example, this can be used to */ + /* add data from AFM or PFM files on a Type 1 */ + /* face, or a CIDMap on a CID-keyed face. */ + /* */ + /* get_advances :: A function handle used to return the advances */ + /* of 'count' glyphs, starting at `index'. the */ + /* `vertical' flags must be set when vertical */ + /* advances are queried. The advances buffer is */ + /* caller-allocated. */ + /* */ + /* */ + /* Most function pointers, with the exception of `load_glyph' and */ + /* `get_char_index' can be set to 0 to indicate a default behaviour. */ + /* */ typedef struct FT_Driver_Class_ { - FT_Module_Class root; - - FT_Int face_object_size; - FT_Int size_object_size; - FT_Int slot_object_size; + FT_Module_Class root; - FTDriver_initFace init_face; - FTDriver_doneFace done_face; - - FTDriver_initSize init_size; - FTDriver_doneSize done_size; + FT_Int face_object_size; + FT_Int size_object_size; + FT_Int slot_object_size; - FTDriver_initGlyphSlot init_slot; - FTDriver_doneGlyphSlot done_slot; + FTDriver_initFace init_face; + FTDriver_doneFace done_face; - FTDriver_setCharSizes set_char_sizes; - FTDriver_setPixelSizes set_pixel_sizes; + FTDriver_initSize init_size; + FTDriver_doneSize done_size; - FTDriver_loadGlyph load_glyph; - FTDriver_getCharIndex get_char_index; + FTDriver_initGlyphSlot init_slot; + FTDriver_doneGlyphSlot done_slot; - FTDriver_getKerning get_kerning; - FTDriver_attachFile attach_file; + FTDriver_setCharSizes set_char_sizes; + FTDriver_setPixelSizes set_pixel_sizes; - FTDriver_getAdvances get_advances; + FTDriver_loadGlyph load_glyph; + FTDriver_getCharIndex get_char_index; + + FTDriver_getKerning get_kerning; + FTDriver_attachFile attach_file; + + FTDriver_getAdvances get_advances; } FT_Driver_Class; diff --git a/include/freetype/internal/ftextend.h b/include/freetype/internal/ftextend.h index dff9f51f8..fdd2c6ef2 100644 --- a/include/freetype/internal/ftextend.h +++ b/include/freetype/internal/ftextend.h @@ -2,22 +2,24 @@ /* */ /* ftextend.h */ /* */ -/* FreeType extensions implementation (specification). */ +/* FreeType extensions implementation (specification). */ /* */ /* Copyright 1996-2000 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 */ +/* 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. */ /* */ /***************************************************************************/ + #ifndef FTEXTEND_H #define FTEXTEND_H + #include @@ -25,6 +27,7 @@ extern "C" { #endif + /*************************************************************************/ /* */ /* The extensions don't need to be integrated at compile time into the */ @@ -32,6 +35,7 @@ /* */ /*************************************************************************/ + /*************************************************************************/ /* */ /* */ @@ -44,6 +48,7 @@ /* */ /* */ /* ext :: A typeless pointer to the extension data. */ + /* */ /* face :: A handle to the source face object the extension is */ /* associated with. */ /* */ @@ -55,8 +60,8 @@ /* data, as the finalizer will get called later by the function's */ /* caller. */ /* */ - typedef FT_Error (*FT_Extension_Initializer)( void* ext, - FT_Face face ); + typedef FT_Error (*FT_Extension_Initializer)( void* ext, + FT_Face face ); /*************************************************************************/ @@ -72,6 +77,7 @@ /* */ /* */ /* ext :: A typeless pointer to the extension data. */ + /* */ /* face :: A handle to the source face object the extension is */ /* associated with. */ /* */ @@ -93,10 +99,14 @@ /* id :: The extension's ID. This is a normal C string that */ /* is used to uniquely reference the extension's */ /* interface. */ + /* */ /* size :: The size in bytes of the extension data that must be */ /* associated with each face object. */ + /* */ /* init :: A pointer to the extension data's initializer. */ + /* */ /* finalize :: A pointer to the extension data's finalizer. */ + /* */ /* interface :: This pointer can be anything, but should usually */ /* point to a table of function pointers which implement */ /* the extension's interface. */ @@ -120,8 +130,9 @@ } FT_Extension_Class; - FT_EXPORT_DEF(FT_Error) FT_Register_Extension( FT_Driver driver, - FT_Extension_Class* clazz ); + FT_EXPORT_DEF( FT_Error ) FT_Register_Extension( + FT_Driver driver, + FT_Extension_Class* clazz ); #ifdef FT_CONFIG_OPTION_EXTEND_ENGINE @@ -149,10 +160,12 @@ #endif - /* Returns an extension's data & interface according to its ID */ - FT_EXPORT_DEF(void*) FT_Get_Extension( FT_Face face, - const char* extension_id, - void* *extension_interface ); + /* return an extension's data & interface according to its ID */ + FT_EXPORT_DEF( void* ) FT_Get_Extension( + FT_Face face, + const char* extension_id, + void** extension_interface ); + #ifdef __cplusplus } diff --git a/include/freetype/internal/ftlist.h b/include/freetype/internal/ftlist.h index db2e30bd2..7c6d8ed3b 100644 --- a/include/freetype/internal/ftlist.h +++ b/include/freetype/internal/ftlist.h @@ -7,14 +7,15 @@ /* Copyright 1996-2000 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 */ +/* 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. */ /* */ /***************************************************************************/ + /*************************************************************************/ /* */ /* This file implements functions relative to list processing. Its */ @@ -33,20 +34,20 @@ #endif - FT_EXPORT_DEF(FT_ListNode) FT_List_Find( FT_List list, - void* data ); + FT_EXPORT_DEF( FT_ListNode ) FT_List_Find( FT_List list, + void* data ); - FT_EXPORT_DEF(void) FT_List_Add( FT_List list, - FT_ListNode node ); + FT_EXPORT_DEF( void ) FT_List_Add( FT_List list, + FT_ListNode node ); - FT_EXPORT_DEF(void) FT_List_Insert( FT_List list, - FT_ListNode node ); + FT_EXPORT_DEF( void ) FT_List_Insert( FT_List list, + FT_ListNode node ); - FT_EXPORT_DEF(void) FT_List_Remove( FT_List list, - FT_ListNode node ); + FT_EXPORT_DEF( void ) FT_List_Remove( FT_List list, + FT_ListNode node ); - FT_EXPORT_DEF(void) FT_List_Up( FT_List list, - FT_ListNode node ); + FT_EXPORT_DEF( void ) FT_List_Up( FT_List list, + FT_ListNode node ); /*************************************************************************/ @@ -60,6 +61,7 @@ /* */ /* */ /* node :: The current iteration list node. */ + /* */ /* user :: A typeless pointer passed to FT_List_Iterate(). */ /* Can be used to point to the iteration's state. */ /* */ @@ -67,9 +69,9 @@ void* user ); - FT_EXPORT_DEF(FT_Error) FT_List_Iterate( FT_List list, - FT_List_Iterator iterator, - void* user ); + FT_EXPORT_DEF( FT_Error ) FT_List_Iterate( FT_List list, + FT_List_Iterator iterator, + void* user ); /*************************************************************************/ @@ -84,7 +86,9 @@ /* */ /* */ /* system :: The current system object. */ + /* */ /* data :: The current object to destroy. */ + /* */ /* user :: A typeless pointer passed to FT_List_Iterate(). It can */ /* be used to point to the iteration's state. */ /* */ @@ -93,10 +97,10 @@ void* user ); - FT_EXPORT_DEF(void) FT_List_Finalize( FT_List list, - FT_List_Destructor destroy, - FT_Memory memory, - void* user ); + FT_EXPORT_DEF( void ) FT_List_Finalize( FT_List list, + FT_List_Destructor destroy, + FT_Memory memory, + void* user ); #ifdef __cplusplus diff --git a/include/freetype/internal/ftmemory.h b/include/freetype/internal/ftmemory.h index db10cb4c4..da8d3a412 100644 --- a/include/freetype/internal/ftmemory.h +++ b/include/freetype/internal/ftmemory.h @@ -2,25 +2,28 @@ /* */ /* ftmemory.h */ /* */ -/* The FreeType memory management macros */ +/* The FreeType memory management macros (specification). */ /* */ /* Copyright 1996-2000 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 */ +/* 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. */ /* */ /***************************************************************************/ + #ifndef FTMEMORY_H #define FTMEMORY_H + #include #include + /*************************************************************************/ /* */ /* */ @@ -33,7 +36,7 @@ /* */ #undef FT_SET_ERROR #define FT_SET_ERROR( expression ) \ - ( (error = (expression)) != 0 ) + ( ( error = (expression) ) != 0 ) /*************************************************************************/ @@ -48,22 +51,22 @@ /*************************************************************************/ /*************************************************************************/ - BASE_DEF(FT_Error) FT_Alloc( FT_Memory memory, - FT_Long size, - void** P ); - - BASE_DEF(FT_Error) FT_Realloc( FT_Memory memory, - FT_Long current, + BASE_DEF( FT_Error ) FT_Alloc( FT_Memory memory, FT_Long size, void** P ); - BASE_DEF(void) FT_Free( FT_Memory memory, - void** P ); + BASE_DEF( FT_Error ) FT_Realloc( FT_Memory memory, + FT_Long current, + FT_Long size, + void** P ); + + BASE_DEF( void ) FT_Free( FT_Memory memory, + void** P ); - /* This include is needed by the MEM_xxx() macros, it should be */ - /* available on every platform we know !! */ + /* This `#include' is needed by the MEM_xxx() macros; it should be */ + /* available on all platforms we know of. */ #include #define MEM_Set( dest, byte, count ) memset( dest, byte, count ) @@ -86,39 +89,39 @@ /* ALLOC_ARRAY() now use an implicit variable, `memory'. It must be */ /* defined at all locations where a memory operation is queried. */ /* */ - - /* */ - /* Note that ALL memory allocation functions need an IMPLICIT argument */ - /* called `memory' to point to the current memory object. */ - /* */ -#define MEM_Alloc( _pointer_, _size_ ) \ +#define MEM_Alloc( _pointer_, _size_ ) \ FT_Alloc( memory, _size_, (void**)&(_pointer_) ) -#define MEM_Alloc_Array( _pointer_, _count_, _type_ ) \ - FT_Alloc( memory, (_count_)*sizeof(_type_), (void**)&(_pointer_) ) +#define MEM_Alloc_Array( _pointer_, _count_, _type_ ) \ + FT_Alloc( memory, (_count_)*sizeof ( _type_ ), \ + (void**)&(_pointer_) ) -#define MEM_Realloc( _pointer_, _current_, _size_ ) \ +#define MEM_Realloc( _pointer_, _current_, _size_ ) \ FT_Realloc( memory, _current_, _size_, (void**)&(_pointer_) ) -#define MEM_Realloc_Array( _pointer_, _current_, _new_, _type_ ) \ - FT_Realloc( memory, (_current_)*sizeof(_type_), \ - (_new_)*sizeof(_type_), (void**)&(_pointer_) ) +#define MEM_Realloc_Array( _pointer_, _current_, _new_, _type_ ) \ + FT_Realloc( memory, (_current_)*sizeof ( _type_ ), \ + (_new_)*sizeof ( _type_ ), (void**)&(_pointer_) ) -#define ALLOC( _pointer_, _size_ ) \ +#define ALLOC( _pointer_, _size_ ) \ FT_SET_ERROR( MEM_Alloc( _pointer_, _size_ ) ) -#define REALLOC( _pointer_, _current_, _size_ ) \ +#define REALLOC( _pointer_, _current_, _size_ ) \ FT_SET_ERROR( MEM_Realloc( _pointer_, _current_, _size_ ) ) -#define ALLOC_ARRAY( _pointer_, _count_, _type_ ) \ - FT_SET_ERROR( MEM_Alloc( _pointer_, (_count_)*sizeof (_type_) ) ) +#define ALLOC_ARRAY( _pointer_, _count_, _type_ ) \ + FT_SET_ERROR( MEM_Alloc( _pointer_, \ + (_count_)*sizeof ( _type_ ) ) ) #define REALLOC_ARRAY( _pointer_, _current_, _count_, _type_ ) \ - FT_SET_ERROR( MEM_Realloc( _pointer_, (_current_)*sizeof(_type_), \ - (_count_)*sizeof(_type_) ) ) + FT_SET_ERROR( MEM_Realloc( _pointer_, \ + (_current_)*sizeof ( _type_ ), \ + (_count_)*sizeof ( _type_ ) ) ) #define FREE( _pointer_ ) FT_Free( memory, (void**)&(_pointer_) ) + #endif /* FTMEMORY_H */ + /* END */ diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index 74f08102b..e08ea6e84 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -2,7 +2,7 @@ /* */ /* ftobjs.h */ /* */ -/* The FreeType private base classes (specification). */ +/* The FreeType private base classes (specification). */ /* */ /* Copyright 1996-2000 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ @@ -22,6 +22,7 @@ /* */ /*************************************************************************/ + #ifndef FTOBJS_H #define FTOBJS_H @@ -87,23 +88,25 @@ /*************************************************************************/ /*************************************************************************/ - /************************************************************************ - * - * - * FT_ModuleRec - * - * - * A module object instance. - * - * - * clazz :: pointer to module's class - * library :: handle to parent library object - * memory :: handle to memory manager - * generic :: generic structure for user-level extensibility (?) - * - ************************************************************************/ - - typedef struct FT_ModuleRec_ + + /*************************************************************************/ + /* */ + /* */ + /* FT_ModuleRec */ + /* */ + /* */ + /* A module object instance. */ + /* */ + /* */ + /* clazz :: A pointer to the module's class. */ + /* */ + /* library :: A handle to the parent library object. */ + /* */ + /* memory :: A handle to the memory manager. */ + /* */ + /* generic :: A generic structure for user-level extensibility (?). */ + /* */ + typedef struct FT_ModuleRec_ { FT_Module_Class* clazz; FT_Library library; @@ -112,35 +115,36 @@ } FT_ModuleRec; + /* typecast an object to a FT_Module */ -#define FT_MODULE(x) ((FT_Module)(x)) -#define FT_MODULE_CLASS(x) FT_MODULE(x)->clazz -#define FT_MODULE_LIBRARY(x) FT_MODULE(x)->library -#define FT_MODULE_MEMORY(x) FT_MODULE(x)->memory +#define FT_MODULE( x ) ((FT_Module)(x)) +#define FT_MODULE_CLASS( x ) FT_MODULE(x)->clazz +#define FT_MODULE_LIBRARY( x ) FT_MODULE(x)->library +#define FT_MODULE_MEMORY( x ) FT_MODULE(x)->memory -#define FT_MODULE_IS_DRIVER(x) (FT_MODULE_CLASS(x)->module_flags & \ - ft_module_font_driver ) +#define FT_MODULE_IS_DRIVER( x ) ( FT_MODULE_CLASS( x )->module_flags & \ + ft_module_font_driver ) -#define FT_MODULE_IS_DRIVER(x) (FT_MODULE_CLASS(x)->module_flags & \ - ft_module_font_driver ) +#define FT_MODULE_IS_DRIVER( x ) ( FT_MODULE_CLASS( x )->module_flags & \ + ft_module_font_driver ) -#define FT_MODULE_IS_RENDERER(x) (FT_MODULE_CLASS(x)->module_flags & \ - ft_module_renderer ) +#define FT_MODULE_IS_RENDERER( x ) ( FT_MODULE_CLASS( x )->module_flags & \ + ft_module_renderer ) -#define FT_MODULE_IS_HINTER(x) (FT_MODULE_CLASS(x)->module_flags & \ - ft_module_hinter ) +#define FT_MODULE_IS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \ + ft_module_hinter ) -#define FT_MODULE_IS_STYLER(x) (FT_MODULE_CLASS(x)->module_flags & \ - ft_module_styler ) +#define FT_MODULE_IS_STYLER( x ) ( FT_MODULE_CLASS( x )->module_flags & \ + ft_module_styler ) -#define FT_DRIVER_IS_SCALABLE(x) (FT_MODULE_CLASS(x)->module_flags & \ - ft_module_driver_scalable ) +#define FT_DRIVER_IS_SCALABLE( x ) ( FT_MODULE_CLASS(x)->module_flags & \ + ft_module_driver_scalable ) -#define FT_DRIVER_USES_OUTLINES(x) !(FT_MODULE_CLASS(x)->module_flags & \ - ft_module_driver_no_outlines ) +#define FT_DRIVER_USES_OUTLINES( x ) !( FT_MODULE_CLASS(x)->module_flags & \ + ft_module_driver_no_outlines ) -#define FT_DRIVER_HAS_HINTER(x) (FT_MODULE_CLASS(x)->module_flags & \ - ft_module_driver_has_hinter ) +#define FT_DRIVER_HAS_HINTER( x ) ( FT_MODULE_CLASS(x)->module_flags & \ + ft_module_driver_has_hinter ) /*************************************************************************/ @@ -182,35 +186,34 @@ /* a few macros used to perform easy typecasts with minimal brain damage */ -#define FT_FACE(x) ((FT_Face)x) -#define FT_SIZE(x) ((FT_Size)x) -#define FT_SLOT(x) ((FT_GlyphSlot)x) +#define FT_FACE( x ) ((FT_Face)(x)) +#define FT_SIZE( x ) ((FT_Size)(x)) +#define FT_SLOT( x ) ((FT_GlyphSlot)(x)) -#define FT_FACE_DRIVER(x) FT_FACE(x)->driver -#define FT_FACE_LIBRARY(x) FT_FACE_DRIVER(x)->root.library -#define FT_FACE_MEMORY(x) FT_FACE(x)->memory +#define FT_FACE_DRIVER( x ) FT_FACE( x )->driver +#define FT_FACE_LIBRARY( x ) FT_FACE_DRIVER( x )->root.library +#define FT_FACE_MEMORY( x ) FT_FACE( x )->memory -#define FT_SIZE_FACE(x) FT_SIZE(x)->face -#define FT_SLOT_FACE(x) FT_SLOT(x)->face +#define FT_SIZE_FACE( x ) FT_SIZE( x )->face +#define FT_SLOT_FACE( x ) FT_SLOT( x )->face -#define FT_FACE_SLOT(x) FT_FACE(x)->glyph -#define FT_FACE_SIZE(x) FT_FACE(x)->size +#define FT_FACE_SLOT( x ) FT_FACE( x )->glyph +#define FT_FACE_SIZE( x ) FT_FACE( x )->size - /* this must be kept exported - this will be used later in our own */ - /* high-level caching font manager called SemTex (way after the */ - /* 2.0 release though.. */ - FT_EXPORT_DEF(FT_Error) FT_New_Size( FT_Face face, - FT_Size* size ); + /* this must be kept exported -- tt will be used later in our own */ + /* high-level caching font manager called SemTex (way after the */ + /* 2.0 release though */ + FT_EXPORT_DEF( FT_Error ) FT_New_Size( FT_Face face, + FT_Size* size ); - FT_EXPORT_DEF(FT_Error) FT_Done_Size( FT_Size size ); + FT_EXPORT_DEF( FT_Error ) FT_Done_Size( FT_Size size ); - FT_EXPORT_DEF(FT_Error) FT_New_GlyphSlot( FT_Face face, - FT_GlyphSlot* aslot ); - - FT_EXPORT_DEF(void) FT_Done_GlyphSlot( FT_GlyphSlot slot ); + FT_EXPORT_DEF( FT_Error ) FT_New_GlyphSlot( FT_Face face, + FT_GlyphSlot* aslot ); + FT_EXPORT_DEF( void ) FT_Done_GlyphSlot( FT_GlyphSlot slot ); /*************************************************************************/ @@ -251,12 +254,12 @@ }; - typedef struct FT_GlyphLoad_ + typedef struct FT_GlyphLoad_ { - FT_Outline outline; /* outline */ - FT_UInt num_subglyphs; /* number of subglyphs */ - FT_SubGlyph* subglyphs; /* subglyphs */ - FT_Vector* extra_points; /* extra points table.. */ + FT_Outline outline; /* outline */ + FT_UInt num_subglyphs; /* number of subglyphs */ + FT_SubGlyph* subglyphs; /* subglyphs */ + FT_Vector* extra_points; /* extra points table */ } FT_GlyphLoad; @@ -272,36 +275,39 @@ FT_GlyphLoad base; FT_GlyphLoad current; - void* other; /* for possible future extension ? */ + void* other; /* for possible future extension? */ }; - BASE_DEF(FT_Error) FT_GlyphLoader_New( FT_Memory memory, - FT_GlyphLoader* *aloader ); + BASE_DEF( FT_Error ) FT_GlyphLoader_New( FT_Memory memory, + FT_GlyphLoader** aloader ); - BASE_DEF(FT_Error) FT_GlyphLoader_Create_Extra( FT_GlyphLoader* loader ); + BASE_DEF( FT_Error ) FT_GlyphLoader_Create_Extra( + FT_GlyphLoader* loader ); - BASE_DEF(void) FT_GlyphLoader_Done( FT_GlyphLoader* loader ); + BASE_DEF( void ) FT_GlyphLoader_Done( FT_GlyphLoader* loader ); - BASE_DEF(void) FT_GlyphLoader_Reset( FT_GlyphLoader* loader ); + BASE_DEF( void ) FT_GlyphLoader_Reset( FT_GlyphLoader* loader ); - BASE_DEF(void) FT_GlyphLoader_Rewind( FT_GlyphLoader* loader ); + BASE_DEF( void ) FT_GlyphLoader_Rewind( FT_GlyphLoader* loader ); - BASE_DEF(FT_Error) FT_GlyphLoader_Check_Points( FT_GlyphLoader* loader, - FT_UInt n_points, - FT_UInt n_contours ); + BASE_DEF( FT_Error ) FT_GlyphLoader_Check_Points( + FT_GlyphLoader* loader, + FT_UInt n_points, + FT_UInt n_contours ); - BASE_DEF(FT_Error) FT_GlyphLoader_Check_Subglyphs( FT_GlyphLoader* loader, - FT_UInt n_subs ); + BASE_DEF( FT_Error ) FT_GlyphLoader_Check_Subglyphs( + FT_GlyphLoader* loader, + FT_UInt n_subs ); - BASE_DEF(void) FT_GlyphLoader_Prepare( FT_GlyphLoader* loader ); + BASE_DEF( void ) FT_GlyphLoader_Prepare( FT_GlyphLoader* loader ); - - BASE_DEF(void) FT_GlyphLoader_Add( FT_GlyphLoader* loader ); + BASE_DEF( void ) FT_GlyphLoader_Add( FT_GlyphLoader* loader ); + + BASE_DEF( FT_Error ) FT_GlyphLoader_Copy_Points( FT_GlyphLoader* target, + FT_GlyphLoader* source ); - BASE_DEF(FT_Error) FT_GlyphLoader_Copy_Points( FT_GlyphLoader* target, - FT_GlyphLoader* source ); /*************************************************************************/ /*************************************************************************/ @@ -315,12 +321,14 @@ /*************************************************************************/ /*************************************************************************/ -#define FT_RENDERER(x) ((FT_Renderer)(x)) -#define FT_GLYPH(x) ((FT_Glyph)(x)) -#define FT_BITMAP_GLYPH(x) ((FT_BitmapGlyph)(x)) -#define FT_OUTLINE_GLYPH(x) ((FT_OutlineGlyph)(x)) - typedef struct FT_RendererRec_ +#define FT_RENDERER( x ) ((FT_Renderer)( x )) +#define FT_GLYPH( x ) ((FT_Glyph)( x )) +#define FT_BITMAP_GLYPH( x ) ((FT_BitmapGlyph)( x )) +#define FT_OUTLINE_GLYPH( x ) ((FT_OutlineGlyph)( x )) + + + typedef struct FT_RendererRec_ { FT_ModuleRec root; FT_Renderer_Class* clazz; @@ -333,6 +341,7 @@ } FT_RendererRec; + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -345,11 +354,13 @@ /*************************************************************************/ /*************************************************************************/ + /* typecast a module into a driver easily */ -#define FT_DRIVER(x) ((FT_Driver)(x)) +#define FT_DRIVER( x ) ((FT_Driver)(x)) /* typecast a module as a driver, and get its driver class */ -#define FT_DRIVER_CLASS(x) FT_DRIVER(x)->clazz +#define FT_DRIVER_CLASS( x ) FT_DRIVER( x )->clazz + /*************************************************************************/ /* */ @@ -361,20 +372,22 @@ /* managing and loading font files of a given format. */ /* */ /* */ - /* root :: contains the fields of the root module class */ + /* root :: Contains the fields of the root module class. */ /* */ - /* clazz :: a pointer to the font driver's class. Note that */ - /* this is NOT root.clazz. 'class' wasn't used */ - /* as it's a reserved word in C++ */ + /* clazz :: A pointer to the font driver's class. Note that */ + /* this is NOT root.clazz. `class' wasn't used */ + /* as it is a reserved word in C++. */ /* */ - /* faces_list :: The list of faces currently opened by this driver. */ + /* faces_list :: The list of faces currently opened by this */ + /* driver. */ /* */ - /* extensions :: a typeless pointer to the driver's extensions */ - /* registry, when they are supported through the */ - /* config macro FT_CONFIG_OPTION_EXTENSIONS */ + /* extensions :: A typeless pointer to the driver's extensions */ + /* registry, if they are supported through the */ + /* configuration macro FT_CONFIG_OPTION_EXTENSIONS. */ /* */ - /* glyph_loader :: glyph loader for all faces managed by this driver */ - /* this object isn't defined for unscalable formats */ + /* glyph_loader :: The glyph loader for all faces managed by this */ + /* driver. This object isn't defined for unscalable */ + /* formats. */ /* */ typedef struct FT_DriverRec_ { @@ -401,9 +414,11 @@ /*************************************************************************/ /*************************************************************************/ + #define FT_DEBUG_HOOK_TRUETYPE 0 #define FT_DEBUG_HOOK_TYPE1 1 + /*************************************************************************/ /* */ /* */ @@ -415,87 +430,88 @@ /* FT_Done_Library() to discard it and all child objects. */ /* */ /* */ - /* memory :: The library's memory object. Manages memory */ - /* allocation */ + /* memory :: The library's memory object. Manages memory */ + /* allocation. */ /* */ - /* generic :: Client data variable. Used to extend the */ - /* Library class by higher levels and clients. */ + /* generic :: Client data variable. Used to extend the */ + /* Library class by higher levels and clients. */ /* */ - /* num_modules :: The number of modules currently registered */ - /* within this library. This is set to 0 for new */ - /* libraries. New modules are added through the */ - /* FT_Add_Module() API function. */ + /* num_modules :: The number of modules currently registered */ + /* within this library. This is set to 0 for new */ + /* libraries. New modules are added through the */ + /* FT_Add_Module() API function. */ /* */ - /* modules :: A table used to store handles to the currently */ - /* registered modules. Note that each font driver */ - /* contains a list of its opened faces. */ + /* modules :: A table used to store handles to the currently */ + /* registered modules. Note that each font driver */ + /* contains a list of its opened faces. */ /* */ - /* renderers :: the list of renderers currently registered */ - /* within the library. */ + /* renderers :: The list of renderers currently registered */ + /* within the library. */ /* */ - /* cur_renderer :: current outline renderer. This is a short cut */ - /* used to avoid parsing the list on each call to */ - /* FT_Outline_Render. It is a handle to the current */ - /* renderer for the ft_glyph_format_outline format. */ + /* cur_renderer :: The current outline renderer. This is a */ + /* shortcut used to avoid parsing the list on */ + /* each call to FT_Outline_Render(). It is a */ + /* handle to the current renderer for the */ + /* ft_glyph_format_outline format. */ /* */ - /* raster_pool :: The raster object's render pool. This can */ - /* ideally be changed dynamically at run-time. */ + /* raster_pool :: The raster object's render pool. This can */ + /* ideally be changed dynamically at run-time. */ /* */ - /* raster_pool_size :: size of the render pool in bytes */ + /* raster_pool_size :: The size of the render pool in bytes. */ /* */ - /* */ - /* */ - /* */ - - typedef struct FT_LibraryRec_ { - FT_Memory memory; /* library's memory manager */ + FT_Memory memory; /* library's memory manager */ FT_Generic generic; FT_UInt num_modules; - FT_Module modules[ FT_MAX_MODULES ]; /* module objects */ + FT_Module modules[FT_MAX_MODULES]; /* module objects */ - FT_ListRec renderers; /* list of renderers */ - FT_Renderer cur_renderer; /* current outline renderer */ + FT_ListRec renderers; /* list of renderers */ + FT_Renderer cur_renderer; /* current outline renderer */ FT_Module auto_hinter; - FT_Byte* raster_pool; /* scan-line conversion render pool */ - FT_ULong raster_pool_size; /* size of render pool in bytes */ + FT_Byte* raster_pool; /* scan-line conversion */ + /* render pool */ + FT_ULong raster_pool_size; /* size of render pool in bytes */ FT_DebugHook_Func debug_hooks[4]; } FT_LibraryRec; - BASE_DEF(FT_Renderer) FT_Lookup_Renderer( FT_Library library, - FT_Glyph_Format format, - FT_ListNode *node ); + BASE_DEF( FT_Renderer ) FT_Lookup_Renderer( FT_Library library, + FT_Glyph_Format format, + FT_ListNode* node ); - BASE_DEF(FT_Error) FT_Render_Glyph_Internal( FT_Library library, + BASE_DEF( FT_Error ) FT_Render_Glyph_Internal( FT_Library library, FT_GlyphSlot slot, FT_UInt render_mode ); #ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM - FT_EXPORT_DEF(FT_Error) FT_New_Stream( const char* filepathname, - FT_Stream astream ); - FT_EXPORT_DEF(void) FT_Done_Stream( FT_Stream stream ); + FT_EXPORT_DEF( FT_Error ) FT_New_Stream( const char* filepathname, + FT_Stream astream ); - FT_EXPORT_DEF(FT_Memory) FT_New_Memory( void ); + FT_EXPORT_DEF( void ) FT_Done_Stream( FT_Stream stream ); -#endif + FT_EXPORT_DEF( FT_Memory ) FT_New_Memory( void ); -/* Define default raster's interface. The default raster is located in `src/base/ftraster.c' */ -/* */ -/* Client applications can register new rasters through the FT_Set_Raster API.. */ -/* */ +#endif /* !FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */ + + + /* Define default raster's interface. The default raster is located in */ + /* `src/base/ftraster.c' */ + /* */ + /* Client applications can register new rasters through the */ + /* FT_Set_Raster() API. */ + #ifndef FT_NO_DEFAULT_RASTER - FT_EXPORT_VAR(FT_Raster_Funcs) ft_default_raster; + FT_EXPORT_VAR( FT_Raster_Funcs ) ft_default_raster; #endif diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c index 567334ae9..9f31ce5f4 100644 --- a/src/winfonts/winfnt.c +++ b/src/winfonts/winfnt.c @@ -454,10 +454,10 @@ { size->font = cur; - size->root.metrics.ascender = cur->header.ascent*64; - size->root.metrics.descender =(cur->header.pixel_height - - cur->header.ascent)*64; - size->root.metrics.height = cur->header.pixel_height*64; + size->root.metrics.ascender = cur->header.ascent * 64; + size->root.metrics.descender = ( cur->header.pixel_height - + cur->header.ascent ) * 64; + size->root.metrics.height = cur->header.pixel_height * 64; break; } }