formatting

This commit is contained in:
Werner Lemberg 2002-03-29 23:23:28 +00:00
parent b1e6e59782
commit 78e004e843
13 changed files with 567 additions and 522 deletions

View File

@ -142,6 +142,10 @@
FT_AutoHinter_Interface* => FT_AutoHinter_Service FT_AutoHinter_Interface* => FT_AutoHinter_Service
etc. etc.
FT_AutoHinter_Get_Global_Func => FT_AutoHinter_GlobalGetFunc
FT_AutoHinter_Done_Global_Func => FT_AutoHinter_GlobalDoneFunc
etc.
* include/freetype/internal/cfftypes.h, src/cff/*.c: Updating the * include/freetype/internal/cfftypes.h, src/cff/*.c: Updating the
type definitions of the CFF font driver. type definitions of the CFF font driver.
@ -161,6 +165,10 @@
src/winfonts/winfnt.c, src/winfonts/winfnt.h: Updating type src/winfonts/winfnt.c, src/winfonts/winfnt.h: Updating type
definitions for font drivers. definitions for font drivers.
FTDriver_initFace => FT_Face_InitFunc
FTDriver_initGlyphSlot => FT_Slot_InitFunc
etc.
* include/freetype/internal/ftobjs.h, src/base/ftapi.c, * include/freetype/internal/ftobjs.h, src/base/ftapi.c,
src/base/ftobjs.c: Updated a few face method definitions: src/base/ftobjs.c: Updated a few face method definitions:
@ -400,12 +408,16 @@
* Moving all memory and list management code to "src/base/ftutil.c" * Moving all memory and list management code to "src/base/ftutil.c"
(previously in "ftobjs.c" and "ftlist.c" respectively). (previously in "ftobjs.c" and "ftlist.c" respectively).
* Moving all code related to glyph loaders to "internal/ftgloadr.h" * include/freetype/internal/ftobjs.h: Moving all code related to
and "src/base/ftgloadr.c". glyph loaders to ...
* include/freetype/"internal/ftgloadr.h: This new file.
"FT_GlyphLoader" is now a pointer to the structure "FT_GlyphLoader" is now a pointer to the structure
"FT_GlyphLoaderRec". "FT_GlyphLoaderRec".
(ft_glyph_own_bitmap): Renamed to ...
* Renaming "ft_glyph_own_bitmap" into "FT_GLYPH_OWN_BITMAP". (FT_GLYPH_OWN_BITMAP): This.
* src/base/ftobjs.c: Moving all code related to glyph loaders
to ...
* src/base/ftgloadr.c: This new file.
2002-02-22 Werner Lemberg <wl@gnu.org> 2002-02-22 Werner Lemberg <wl@gnu.org>
@ -429,9 +441,9 @@
(FT_ASSERT): This. (FT_ASSERT): This.
Some stuff from ftdebug.h has been moved to ... Some stuff from ftdebug.h has been moved to ...
* include/freetype/internal/fttrace.h: This new file to define the * include/freetype/internal/fttrace.h: New file, to define the trace
trace levels used for debugging. It is used both to define enums levels used for debugging. It is used both to define enums and
and toggle names for FT2_DEBUG. toggle names for FT2_DEBUG.
* include/freetype/internal/internal.h: Updated. * include/freetype/internal/internal.h: Updated.
* src/base/ftobjs.c, src/base/ftstream.c: Updated. * src/base/ftobjs.c, src/base/ftstream.c: Updated.

View File

@ -4,7 +4,7 @@
/* */ /* */
/* High-level `autohint' module-specific interface (specification). */ /* High-level `autohint' module-specific interface (specification). */
/* */ /* */
/* Copyright 1996-2001 by */ /* Copyright 1996-2001, 2002 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -88,8 +88,8 @@ FT_BEGIN_HEADER
/* <Description> */ /* <Description> */
/* Retrieves the global hints computed for a given face object the */ /* Retrieves the global hints computed for a given face object the */
/* resulting data is dissociated from the face and will survive a */ /* resulting data is dissociated from the face and will survive a */
/* call to FT_Done_Face(). It must be discarded through the API */ /* call to FT_Done_Face(). It must be discarded through the API */
/* FT_AutoHinter_GlobalDoneFunc (). */ /* FT_AutoHinter_GlobalDoneFunc(). */
/* */ /* */
/* <Input> */ /* <Input> */
/* hinter :: A handle to the source auto-hinter. */ /* hinter :: A handle to the source auto-hinter. */
@ -102,10 +102,10 @@ FT_BEGIN_HEADER
/* global_len :: The size in bytes of the global hints. */ /* global_len :: The size in bytes of the global hints. */
/* */ /* */
typedef void typedef void
(*FT_AutoHinter_GlobalGetFunc )( FT_AutoHinter hinter, (*FT_AutoHinter_GlobalGetFunc)( FT_AutoHinter hinter,
FT_Face face, FT_Face face,
void** global_hints, void** global_hints,
long* global_len ); long* global_len );
/*************************************************************************/ /*************************************************************************/
@ -115,7 +115,7 @@ FT_BEGIN_HEADER
/* */ /* */
/* <Description> */ /* <Description> */
/* Discards the global hints retrieved through */ /* Discards the global hints retrieved through */
/* FT_AutoHinter_GlobalGetFunc (). This is the only way these hints */ /* FT_AutoHinter_GlobalGetFunc(). This is the only way these hints */
/* are freed from memory. */ /* are freed from memory. */
/* */ /* */
/* <Input> */ /* <Input> */
@ -124,8 +124,8 @@ FT_BEGIN_HEADER
/* global :: A pointer to retrieved global hints to discard. */ /* global :: A pointer to retrieved global hints to discard. */
/* */ /* */
typedef void typedef void
(*FT_AutoHinter_GlobalDoneFunc )( FT_AutoHinter hinter, (*FT_AutoHinter_GlobalDoneFunc)( FT_AutoHinter hinter,
void* global ); void* global );
/*************************************************************************/ /*************************************************************************/
@ -144,8 +144,8 @@ FT_BEGIN_HEADER
/* face :: A handle to the face. */ /* face :: A handle to the face. */
/* */ /* */
typedef void typedef void
(*FT_AutoHinter_GlobalResetFunc )( FT_AutoHinter hinter, (*FT_AutoHinter_GlobalResetFunc)( FT_AutoHinter hinter,
FT_Face face ); FT_Face face );
/*************************************************************************/ /*************************************************************************/
@ -159,7 +159,9 @@ FT_BEGIN_HEADER
/* */ /* */
/* <Input> */ /* <Input> */
/* face :: A handle to the face. */ /* face :: A handle to the face. */
/* */
/* glyph_index :: The glyph index. */ /* glyph_index :: The glyph index. */
/* */
/* load_flags :: The load flags. */ /* load_flags :: The load flags. */
/* */ /* */
/* <Note> */ /* <Note> */
@ -187,13 +189,14 @@ FT_BEGIN_HEADER
/* */ /* */
typedef struct FT_AutoHinter_ServiceRec_ typedef struct FT_AutoHinter_ServiceRec_
{ {
FT_AutoHinter_GlobalResetFunc reset_face; FT_AutoHinter_GlobalResetFunc reset_face;
FT_AutoHinter_GlobalGetFunc get_global_hints; FT_AutoHinter_GlobalGetFunc get_global_hints;
FT_AutoHinter_GlobalDoneFunc done_global_hints; FT_AutoHinter_GlobalDoneFunc done_global_hints;
FT_AutoHinter_GlyphLoadFunc load_glyph; FT_AutoHinter_GlyphLoadFunc load_glyph;
} FT_AutoHinter_ServiceRec, *FT_AutoHinter_Service; } FT_AutoHinter_ServiceRec, *FT_AutoHinter_Service;
FT_END_HEADER FT_END_HEADER
#endif /* __AUTOHINT_H__ */ #endif /* __AUTOHINT_H__ */

View File

@ -5,7 +5,7 @@
/* Basic OpenType/CFF type definitions and interface (specification */ /* Basic OpenType/CFF type definitions and interface (specification */
/* only). */ /* only). */
/* */ /* */
/* Copyright 1996-2001 by */ /* Copyright 1996-2001, 2002 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -31,7 +31,7 @@ FT_BEGIN_HEADER
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Struct> */ /* <Struct> */
/* CFF_IndexRec */ /* CFF_IndexRec */
/* */ /* */
/* <Description> */ /* <Description> */
/* A structure used to model a CFF Index table. */ /* A structure used to model a CFF Index table. */
@ -184,16 +184,16 @@ FT_BEGIN_HEADER
} CFF_FDSelectRec, *CFF_FDSelect; } CFF_FDSelectRec, *CFF_FDSelect;
/* A SubFont packs a font dict and a private dict together. They are */ /* A SubFont packs a font dict and a private dict together. They are */
/* needed to support CID-keyed CFF fonts. */ /* needed to support CID-keyed CFF fonts. */
typedef struct CFF_SubFontRec_ typedef struct CFF_SubFontRec_
{ {
CFF_FontRecDictRec font_dict; CFF_FontRecDictRec font_dict;
CFF_PrivateRec private_dict; CFF_PrivateRec private_dict;
CFF_IndexRec local_subrs_index; CFF_IndexRec local_subrs_index;
FT_UInt num_local_subrs; FT_UInt num_local_subrs;
FT_Byte** local_subrs; FT_Byte** local_subrs;
} CFF_SubFontRec, *CFF_SubFont; } CFF_SubFontRec, *CFF_SubFont;

View File

@ -5,7 +5,7 @@
/* Basic Windows FNT/FON type definitions and interface (specification */ /* Basic Windows FNT/FON type definitions and interface (specification */
/* only). */ /* only). */
/* */ /* */
/* Copyright 1996-2001 by */ /* Copyright 1996-2001, 2002 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -115,13 +115,13 @@ FT_BEGIN_HEADER
typedef struct FNT_FontRec_ typedef struct FNT_FontRec_
{ {
FT_ULong offset; FT_ULong offset;
FT_Int size_shift; FT_Int size_shift;
WinFNT_HeaderRec header; WinFNT_HeaderRec header;
FT_Byte* fnt_frame; FT_Byte* fnt_frame;
FT_ULong fnt_size; FT_ULong fnt_size;
} FNT_FontRec, *FNT_Font; } FNT_FontRec, *FNT_Font;
@ -129,7 +129,7 @@ FT_BEGIN_HEADER
typedef struct FNT_SizeRec_ typedef struct FNT_SizeRec_
{ {
FT_SizeRec root; FT_SizeRec root;
FNT_Font font; FNT_Font font;
} FNT_SizeRec, *FNT_Size; } FNT_SizeRec, *FNT_Size;

View File

@ -4,7 +4,7 @@
/* */ /* */
/* Debugging and logging component (specification). */ /* Debugging and logging component (specification). */
/* */ /* */
/* Copyright 1996-2001 by */ /* Copyright 1996-2001, 2002 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -27,9 +27,9 @@
FT_BEGIN_HEADER FT_BEGIN_HEADER
/* force the definition of FT_DEBUG_LEVEL_ERROR if FT_DEBUG_LEVEL_TRACE */ /* force the definition of FT_DEBUG_LEVEL_ERROR if FT_DEBUG_LEVEL_TRACE */
/* is already defined; this simplifies the following #ifdefs */ /* is already defined; this simplifies the following #ifdefs */
/* */ /* */
#ifdef FT_DEBUG_LEVEL_TRACE #ifdef FT_DEBUG_LEVEL_TRACE
#undef FT_DEBUG_LEVEL_ERROR #undef FT_DEBUG_LEVEL_ERROR
#define FT_DEBUG_LEVEL_ERROR #define FT_DEBUG_LEVEL_ERROR
@ -38,8 +38,8 @@ FT_BEGIN_HEADER
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* Define the trace enums as well as the trace levels array when */ /* Define the trace enums as well as the trace levels array when they */
/* they're needed */ /* are needed. */
/* */ /* */
/*************************************************************************/ /*************************************************************************/
@ -47,7 +47,7 @@ FT_BEGIN_HEADER
#define FT_TRACE_DEF( x ) trace_ ## x , #define FT_TRACE_DEF( x ) trace_ ## x ,
/* defining the enums */ /* defining the enumeration */
typedef enum typedef enum
{ {
#include FT_INTERNAL_TRACE_H #include FT_INTERNAL_TRACE_H
@ -57,7 +57,7 @@ FT_BEGIN_HEADER
/* defining the array of trace levels, provided by `src/base/ftdebug.c' */ /* defining the array of trace levels, provided by `src/base/ftdebug.c' */
extern int ft_trace_levels[trace_count]; extern int ft_trace_levels[trace_count];
#undef FT_TRACE_DEF #undef FT_TRACE_DEF
@ -66,7 +66,7 @@ FT_BEGIN_HEADER
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* Define the FT_TRACE macro */ /* Define the FT_TRACE macro */
/* */ /* */
/* IMPORTANT! */ /* IMPORTANT! */
/* */ /* */
@ -128,7 +128,7 @@ FT_BEGIN_HEADER
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* Define the FT_ASSERT macro */ /* Define the FT_ASSERT macro */
/* */ /* */
/*************************************************************************/ /*************************************************************************/
@ -170,7 +170,8 @@ FT_BEGIN_HEADER
#endif /* FT_DEBUG_LEVEL_ERROR */ #endif /* FT_DEBUG_LEVEL_ERROR */
FT_BASE( void ) ft_debug_init( void ); FT_BASE( void )
ft_debug_init( void );
#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ #if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */

View File

@ -4,7 +4,7 @@
/* */ /* */
/* FreeType font driver interface (specification). */ /* FreeType font driver interface (specification). */
/* */ /* */
/* Copyright 1996-2001 by */ /* Copyright 1996-2001, 2002 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -76,14 +76,14 @@ FT_BEGIN_HEADER
FT_Long charcode ); FT_Long charcode );
typedef FT_Long typedef FT_Long
(*FT_CharMap_CharNextFunc)( FT_CharMap charmap, (*FT_CharMap_CharNextFunc)( FT_CharMap charmap,
FT_Long charcode ); FT_Long charcode );
typedef FT_Error typedef FT_Error
(*FT_Face_GetKerningFunc)( FT_Face face, (*FT_Face_GetKerningFunc)( FT_Face face,
FT_UInt left_glyph, FT_UInt left_glyph,
FT_UInt right_glyph, FT_UInt right_glyph,
FT_Vector* kerning ); FT_Vector* kerning );
typedef FT_Error typedef FT_Error
@ -167,31 +167,31 @@ FT_BEGIN_HEADER
/* */ /* */
typedef struct FT_Driver_ClassRec_ typedef struct FT_Driver_ClassRec_
{ {
FT_Module_Class root; FT_Module_Class root;
FT_Int face_object_size; FT_Int face_object_size;
FT_Int size_object_size; FT_Int size_object_size;
FT_Int slot_object_size; FT_Int slot_object_size;
FT_Face_InitFunc init_face; FT_Face_InitFunc init_face;
FT_Face_DoneFunc done_face; FT_Face_DoneFunc done_face;
FT_Size_InitFunc init_size; FT_Size_InitFunc init_size;
FT_Size_DoneFunc done_size; FT_Size_DoneFunc done_size;
FT_Slot_InitFunc init_slot; FT_Slot_InitFunc init_slot;
FT_Slot_DoneFunc done_slot; FT_Slot_DoneFunc done_slot;
FT_Size_ResetPointsFunc set_char_sizes; FT_Size_ResetPointsFunc set_char_sizes;
FT_Size_ResetPixelsFunc set_pixel_sizes; FT_Size_ResetPixelsFunc set_pixel_sizes;
FT_Slot_LoadFunc load_glyph; FT_Slot_LoadFunc load_glyph;
FT_CharMap_CharIndexFunc get_char_index; FT_CharMap_CharIndexFunc get_char_index;
FT_Face_GetKerningFunc get_kerning; FT_Face_GetKerningFunc get_kerning;
FT_Face_AttachFunc attach_file; FT_Face_AttachFunc attach_file;
FT_Face_GetAdvancesFunc get_advances; FT_Face_GetAdvancesFunc get_advances;
FT_CharMap_CharNextFunc get_next_char; FT_CharMap_CharNextFunc get_next_char;
} FT_Driver_ClassRec, *FT_Driver_Class; } FT_Driver_ClassRec, *FT_Driver_Class;

View File

@ -1,22 +1,30 @@
#ifndef __FT_INTERNAL_GLYPH_LOADER_H__ /***************************************************************************/
#define __FT_INTERNAL_GLYPH_LOADER_H__ /* */
/* ftgloadr.h */
/* */
/* The FreeType glyph loader (specification). */
/* */
/* Copyright 2002 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. */
/* */
/***************************************************************************/
#ifndef __FTGLOADR_H__
#define __FTGLOADR_H__
#include <ft2build.h> #include <ft2build.h>
#include FT_FREETYPE_H #include FT_FREETYPE_H
FT_BEGIN_HEADER
/*************************************************************************/ FT_BEGIN_HEADER
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** ****/
/**** G L Y P H L O A D E R ****/
/**** ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/ /*************************************************************************/
@ -63,9 +71,9 @@ FT_BEGIN_HEADER
typedef struct FT_GlyphLoadRec_ typedef struct FT_GlyphLoadRec_
{ {
FT_Outline outline; /* outline */ FT_Outline outline; /* outline */
FT_Vector* extra_points; /* extra points table */ FT_Vector* extra_points; /* extra points table */
FT_UInt num_subglyphs; /* number of subglyphs */ FT_UInt num_subglyphs; /* number of subglyphs */
FT_SubGlyph subglyphs; /* subglyphs */ FT_SubGlyph subglyphs; /* subglyphs */
} FT_GlyphLoadRec, *FT_GlyphLoad; } FT_GlyphLoadRec, *FT_GlyphLoad;
@ -87,55 +95,59 @@ FT_BEGIN_HEADER
} FT_GlyphLoaderRec; } FT_GlyphLoaderRec;
/* create new empty glyph loader */ /* create new empty glyph loader */
FT_BASE( FT_Error ) FT_BASE( FT_Error )
FT_GlyphLoader_New( FT_Memory memory, FT_GlyphLoader_New( FT_Memory memory,
FT_GlyphLoader *aloader ); FT_GlyphLoader *aloader );
/* add an extra points table to a glyph loader */ /* add an extra points table to a glyph loader */
FT_BASE( FT_Error ) FT_BASE( FT_Error )
FT_GlyphLoader_CreateExtra( FT_GlyphLoader loader ); FT_GlyphLoader_CreateExtra( FT_GlyphLoader loader );
/* destroy a glyph loader */ /* destroy a glyph loader */
FT_BASE( void ) FT_BASE( void )
FT_GlyphLoader_Done( FT_GlyphLoader loader ); FT_GlyphLoader_Done( FT_GlyphLoader loader );
/* reset a glyph loader (frees everything int it) */ /* reset a glyph loader (frees everything int it) */
FT_BASE( void ) FT_BASE( void )
FT_GlyphLoader_Reset( FT_GlyphLoader loader ); FT_GlyphLoader_Reset( FT_GlyphLoader loader );
/* rewind a glyph loader */ /* rewind a glyph loader */
FT_BASE( void ) FT_BASE( void )
FT_GlyphLoader_Rewind( FT_GlyphLoader loader ); FT_GlyphLoader_Rewind( FT_GlyphLoader loader );
/* check that there is enough room to add 'n_points' and 'n_contours' */ /* check that there is enough room to add 'n_points' and 'n_contours' */
/* to the glyph loader.. */ /* to the glyph loader */
FT_BASE( FT_Error ) FT_BASE( FT_Error )
FT_GlyphLoader_CheckPoints( FT_GlyphLoader loader, FT_GlyphLoader_CheckPoints( FT_GlyphLoader loader,
FT_UInt n_points, FT_UInt n_points,
FT_UInt n_contours ); FT_UInt n_contours );
/* check that there is enough room to add 'n_subs' sub-glyphs to */ /* check that there is enough room to add 'n_subs' sub-glyphs to */
/* a glyph loader */ /* a glyph loader */
FT_BASE( FT_Error ) FT_BASE( FT_Error )
FT_GlyphLoader_CheckSubGlyphs( FT_GlyphLoader loader, FT_GlyphLoader_CheckSubGlyphs( FT_GlyphLoader loader,
FT_UInt n_subs ); FT_UInt n_subs );
/* prepare a glyph loader, i.e. empty the current glyph */ /* prepare a glyph loader, i.e. empty the current glyph */
FT_BASE( void ) FT_BASE( void )
FT_GlyphLoader_Prepare( FT_GlyphLoader loader ); FT_GlyphLoader_Prepare( FT_GlyphLoader loader );
/* add the current glyph to the base glyph */ /* add the current glyph to the base glyph */
FT_BASE( void ) FT_BASE( void )
FT_GlyphLoader_Add( FT_GlyphLoader loader ); FT_GlyphLoader_Add( FT_GlyphLoader loader );
/* copy points from one glyph loader to another */ /* copy points from one glyph loader to another */
FT_BASE( FT_Error ) FT_BASE( FT_Error )
FT_GlyphLoader_CopyPoints( FT_GlyphLoader target, FT_GlyphLoader_CopyPoints( FT_GlyphLoader target,
FT_GlyphLoader source ); FT_GlyphLoader source );
/* */ /* */
FT_END_HEADER FT_END_HEADER
#endif /* __FT_INTERNAL_GLYPH_LOADER_H__ */ #endif /* __FTGLOADR_H__ */
/* END */

View File

@ -4,7 +4,7 @@
/* */ /* */
/* The FreeType memory management macros (specification). */ /* The FreeType memory management macros (specification). */
/* */ /* */
/* Copyright 1996-2001 by */ /* Copyright 1996-2001, 2002 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg */ /* David Turner, Robert Wilhelm, and Werner Lemberg */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -183,80 +183,79 @@ FT_BEGIN_HEADER
#define FT_MEM_MOVE( dest, source, count ) memmove( dest, source, count ) #define FT_MEM_MOVE( dest, source, count ) memmove( dest, source, count )
/************************************************************************** /*************************************************************************/
* /* */
* we first define FT_MEM_ALLOC, FT_MEM_REALLOC and FT_MEM_FREE /* We first define FT_MEM_ALLOC, FT_MEM_REALLOC, and FT_MEM_FREE. All */
* all macros use an _implicit_ 'memory' parameter to access the /* macros use an _implicit_ `memory' parameter to access the current */
* current memory allocator /* memory allocator. */
* /* */
*/
#ifdef FT_DEBUG_MEMORY #ifdef FT_DEBUG_MEMORY
# define FT_MEM_ALLOC( _pointer_, _size_ ) \ #define FT_MEM_ALLOC( _pointer_, _size_ ) \
FT_Alloc_Debug( memory, _size_, \ FT_Alloc_Debug( memory, _size_, \
(void**)&(_pointer_), __FILE__, __LINE__ ) (void**)&(_pointer_), __FILE__, __LINE__ )
# define FT_MEM_REALLOC( _pointer_, _current_, _size_ ) \ #define FT_MEM_REALLOC( _pointer_, _current_, _size_ ) \
FT_Realloc_Debug( memory, _current_, _size_, \ FT_Realloc_Debug( memory, _current_, _size_, \
(void**)&(_pointer_), __FILE__, __LINE__ ) (void**)&(_pointer_), __FILE__, __LINE__ )
# define FT_MEM_FREE( _pointer_ ) \ #define FT_MEM_FREE( _pointer_ ) \
FT_Free_Debug( memory, (void**)&(_pointer_), __FILE__, __LINE__ ) FT_Free_Debug( memory, (void**)&(_pointer_), __FILE__, __LINE__ )
#else /* !FT_DEBUG_MEMORY */ #else /* !FT_DEBUG_MEMORY */
# define FT_MEM_ALLOC( _pointer_, _size_ ) \
#define FT_MEM_ALLOC( _pointer_, _size_ ) \
FT_Alloc( memory, _size_, (void**)&(_pointer_) ) FT_Alloc( memory, _size_, (void**)&(_pointer_) )
# define FT_MEM_FREE( _pointer_ ) \ #define FT_MEM_FREE( _pointer_ ) \
FT_Free( memory, (void**)&(_pointer_) ) FT_Free( memory, (void**)&(_pointer_) )
# define FT_MEM_REALLOC( _pointer_, _current_, _size_ ) \ #define FT_MEM_REALLOC( _pointer_, _current_, _size_ ) \
FT_Realloc( memory, _current_, _size_, (void**)&(_pointer_) ) FT_Realloc( memory, _current_, _size_, (void**)&(_pointer_) )
#endif /* !FT_DEBUG_MEMORY */ #endif /* !FT_DEBUG_MEMORY */
/************************************************************************** /*************************************************************************/
* /* */
* the following functions macros that their pointer argument is _typed_ /* The following functions macros expect that their pointer argument is */
* in order to automatically compute array element sizes.. /* _typed_ in order to automatically compute array element sizes. */
*/ /* */
#define FT_MEM_NEW( _pointer_ ) \
FT_MEM_ALLOC( _pointer_, sizeof(*(_pointer_)) )
#define FT_MEM_NEW_ARRAY( _pointer_, _count_ ) \ #define FT_MEM_NEW( _pointer_ ) \
FT_MEM_ALLOC( _pointer_, (_count_)*sizeof(*(_pointer_)) ) FT_MEM_ALLOC( _pointer_, sizeof ( *(_pointer_) ) )
#define FT_MEM_RENEW_ARRAY( _pointer_, _old_, _new_ ) \ #define FT_MEM_NEW_ARRAY( _pointer_, _count_ ) \
FT_MEM_REALLOC( _pointer_, (_old_)*sizeof(*(_pointer_)), \ FT_MEM_ALLOC( _pointer_, (_count_) * sizeof ( *(_pointer_) ) )
(_new_)*sizeof(*(_pointer_)) )
#define FT_MEM_RENEW_ARRAY( _pointer_, _old_, _new_ ) \
FT_MEM_REALLOC( _pointer_, (_old_) * sizeof ( *(_pointer_) ), \
(_new_) * sizeof ( *(_pointer_) ) )
/************************************************************************** /*************************************************************************/
* /* */
* the following macros are obsolete but kept for compatibility reasons /* the following macros are obsolete but kept for compatibility reasons */
*/ /* */
#define FT_MEM_ALLOC_ARRAY( _pointer_, _count_, _type_ ) \ #define FT_MEM_ALLOC_ARRAY( _pointer_, _count_, _type_ ) \
FT_MEM_ALLOC( _pointer_, (_count_)*sizeof(_type_) ) FT_MEM_ALLOC( _pointer_, (_count_) * sizeof ( _type_ ) )
#define FT_MEM_REALLOC_ARRAY( _pointer_, _old_, _new_, _type_ ) \ #define FT_MEM_REALLOC_ARRAY( _pointer_, _old_, _new_, _type_ ) \
FT_MEM_REALLOC( _pointer_, (_old_)*sizeof(_type), \ FT_MEM_REALLOC( _pointer_, (_old_) * sizeof ( _type ), \
(_new_)*sizeof(_type_) ) (_new_) * sizeof ( _type_ ) )
/**************************************************************************
*
* the following macros are variants of their FT_MEM_XXXX equivalents
* they're used to set an _implicit_ 'error' variable and return TRUE
* if an error occured (i.e. if 'error != 0')
*/
/*************************************************************************/
/* */
/* The following macros are variants of their FT_MEM_XXXX equivalents; */
/* they are used to set an _implicit_ `error' variable and return TRUE */
/* if an error occured (i.e. if 'error != 0'). */
/* */
#define FT_ALLOC( _pointer_, _size_ ) \ #define FT_ALLOC( _pointer_, _size_ ) \
FT_SET_ERROR( FT_MEM_ALLOC( _pointer_, _size_ ) ) FT_SET_ERROR( FT_MEM_ALLOC( _pointer_, _size_ ) )
@ -276,17 +275,18 @@ FT_BEGIN_HEADER
#define FT_RENEW_ARRAY( _pointer_, _old_, _new_ ) \ #define FT_RENEW_ARRAY( _pointer_, _old_, _new_ ) \
FT_SET_ERROR( FT_MEM_RENEW_ARRAY( _pointer_, _old_, _new_ ) ) FT_SET_ERROR( FT_MEM_RENEW_ARRAY( _pointer_, _old_, _new_ ) )
#define FT_ALLOC_ARRAY( _pointer_, _count_, _type_ ) \
FT_SET_ERROR( FT_MEM_ALLOC( _pointer_, \
(_count_) * sizeof ( _type_ ) ) )
#define FT_ALLOC_ARRAY( _pointer_, _count_, _type_ ) \ #define FT_REALLOC_ARRAY( _pointer_, _old_, _new_, _type_ ) \
FT_SET_ERROR( FT_MEM_ALLOC( _pointer_, \
(_count_)*sizeof ( _type_ ) ) )
#define FT_REALLOC_ARRAY( _pointer_, _old_, _new_, _type_ ) \
FT_SET_ERROR( FT_MEM_REALLOC( _pointer_, \ FT_SET_ERROR( FT_MEM_REALLOC( _pointer_, \
(_old_)*sizeof ( _type_ ), \ (_old_) * sizeof ( _type_ ), \
(_new_)*sizeof ( _type_ ) ) ) (_new_) * sizeof ( _type_ ) ) )
/* */ /* */
FT_END_HEADER FT_END_HEADER
#endif /* __FTMEMORY_H__ */ #endif /* __FTMEMORY_H__ */

View File

@ -4,7 +4,7 @@
/* */ /* */
/* The FreeType private base classes (specification). */ /* The FreeType private base classes (specification). */
/* */ /* */
/* Copyright 1996-2001 by */ /* Copyright 1996-2001, 2002 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -86,36 +86,36 @@ FT_BEGIN_HEADER
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/* handle to a validation object */ /* handle to a validation object */
typedef struct FT_ValidatorRec_* FT_Validator; typedef struct FT_ValidatorRec_* FT_Validator;
/**************************************************************************
* /*************************************************************************/
* there are three distinct validation levels defined here: /* */
* /* There are three distinct validation levels defined here: */
* FT_VALIDATE_DEFAULT :: /* */
* a table that passes this validation level can be used reliably by /* FT_VALIDATE_DEFAULT :: */
* FreeType. It generally means that all offsets have been checked to /* A table that passes this validation level can be used reliably by */
* prevent out-of-bound reads, array counts are correct, etc.. /* FreeType. It generally means that all offsets have been checked to */
* /* prevent out-of-bound reads, array counts are correct, etc. */
* /* */
* FT_VALIDATE_TIGHT :: /* FT_VALIDATE_TIGHT :: */
* a table that passes this validation level can be used reliably and /* A table that passes this validation level can be used reliably and */
* doesn't contain invalid data. For example, a charmap table that /* doesn't contain invalid data. For example, a charmap table that */
* returns invalid glyph indices will not pass, even though it can /* returns invalid glyph indices will not pass, even though it can */
* be used with FreeType in default mode (the library will simply /* be used with FreeType in default mode (the library will simply */
* return an error later when trying to load the glyph) /* return an error later when trying to load the glyph). */
* /* */
* it also check that fields that must be a multiple of 2, 4 or 8 don't /* It also check that fields that must be a multiple of 2, 4, or 8 */
* have incorrect values, etc.. /* dont' have incorrect values, etc. */
* /* */
* /* FT_VALIDATE_PARANOID :: */
* FT_VALIDATE_PARANOID :: /* Only for font debugging. Checks that a table follows the */
* only for font facists. Checks that a table follows the specification /* specification by 100%. Very few fonts will be able to pass this */
* 100%. Very few fonts will be able to pass this level anyway but it /* level anyway but it can be useful for certain tools like font */
* can be useful for certain tools like font editors/converters.. /* editors/converters. */
*/ /* */
typedef enum FT_ValidationLevel_ typedef enum FT_ValidationLevel_
{ {
FT_VALIDATE_DEFAULT = 0, FT_VALIDATE_DEFAULT = 0,
FT_VALIDATE_TIGHT, FT_VALIDATE_TIGHT,
@ -124,19 +124,21 @@ FT_BEGIN_HEADER
} FT_ValidationLevel; } FT_ValidationLevel;
/* validator structure */ /* validator structure */
typedef struct FT_ValidatorRec_ typedef struct FT_ValidatorRec_
{ {
const FT_Byte* base; /* address of table in memory */ const FT_Byte* base; /* address of table in memory */
const FT_Byte* limit; /* 'base' + sizeof(table) in memory */ const FT_Byte* limit; /* `base' + sizeof(table) in memory */
FT_ValidationLevel level; /* validation level */ FT_ValidationLevel level; /* validation level */
FT_Error error; /* error returned. 0 means success */ FT_Error error; /* error returned. 0 means success */
jmp_buf jump_buffer; /* used for exception handling */ jmp_buf jump_buffer; /* used for exception handling */
} FT_ValidatorRec; } FT_ValidatorRec;
#define FT_VALIDATOR(x) ((FT_Validator)(x))
#define FT_VALIDATOR( x ) ((FT_Validator)( x ))
FT_BASE( void ) FT_BASE( void )
ft_validator_init( FT_Validator valid, ft_validator_init( FT_Validator valid,
@ -147,34 +149,34 @@ FT_BEGIN_HEADER
FT_BASE( FT_Int ) FT_BASE( FT_Int )
ft_validator_run( FT_Validator valid ); ft_validator_run( FT_Validator valid );
/* sets the error field in a validator, then calls 'longjmp' to return */ /* Sets the error field in a validator, then calls `longjmp' to return */
/* to high-level caller. Using 'setjmp/longjmp' avoids many stupid */ /* to high-level caller. Using `setjmp/longjmp' avoids many stupid */
/* error checks within the validation routines.. */ /* error checks within the validation routines. */
/* */ /* */
FT_BASE( void ) FT_BASE( void )
ft_validator_error( FT_Validator valid, ft_validator_error( FT_Validator valid,
FT_Error error ); FT_Error error );
/* calls ft_validate_error. Assumes that the 'valid' local variable holds */
/* a pointer to the current validator object.. */
/* */
#define FT_INVALID(_error) ft_validator_error( valid, _error )
/* called when a broken table is detected */ /* Calls ft_validate_error. Assumes that the `valid' local variable */
#define FT_INVALID_TOO_SHORT FT_INVALID( FT_Err_Invalid_Table ) /* holds a pointer to the current validator object. */
/* */
#define FT_INVALID( _error ) ft_validator_error( valid, _error )
/* called when an invalid offset is detected */ /* called when a broken table is detected */
#define FT_INVALID_OFFSET FT_INVALID( FT_Err_Invalid_Offset ) #define FT_INVALID_TOO_SHORT FT_INVALID( FT_Err_Invalid_Table )
/* called when an invalid format/value is detected */ /* called when an invalid offset is detected */
#define FT_INVALID_FORMAT FT_INVALID( FT_Err_Invalid_Table ) #define FT_INVALID_OFFSET FT_INVALID( FT_Err_Invalid_Offset )
/* called when an invalid glyph index is detected */ /* called when an invalid format/value is detected */
#define FT_INVALID_GLYPH_ID FT_INVALID( FT_Err_Invalid_Glyph_Index ) #define FT_INVALID_FORMAT FT_INVALID( FT_Err_Invalid_Table )
/* called when an invalid field value is detected */ /* called when an invalid glyph index is detected */
#define FT_INVALID_DATA FT_INVALID( FT_Err_Invalid_Table ) #define FT_INVALID_GLYPH_ID FT_INVALID( FT_Err_Invalid_Glyph_Index )
/* called when an invalid field value is detected */
#define FT_INVALID_DATA FT_INVALID( FT_Err_Invalid_Table )
/*************************************************************************/ /*************************************************************************/
@ -189,43 +191,48 @@ FT_BEGIN_HEADER
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/* handle to internal charmap object */ /* handle to internal charmap object */
typedef struct FT_CMapRec_* FT_CMap; typedef struct FT_CMapRec_* FT_CMap;
/* handle to charmap class structure */ /* handle to charmap class structure */
typedef const struct FT_CMap_ClassRec_* FT_CMap_Class; typedef const struct FT_CMap_ClassRec_* FT_CMap_Class;
/* internal charmap object structure */ /* internal charmap object structure */
typedef struct FT_CMapRec_ typedef struct FT_CMapRec_
{ {
FT_CharMapRec charmap; FT_CharMapRec charmap;
FT_CMap_Class clazz; FT_CMap_Class clazz;
} FT_CMapRec; } FT_CMapRec;
/* typecase any pointer to a charmap handle */ /* typecase any pointer to a charmap handle */
#define FT_CMAP(x) ((FT_CMap)(x)) #define FT_CMAP( x ) ((FT_CMap)( x ))
/* obvious macros */ /* obvious macros */
#define FT_CMAP_PLATFORM_ID(x) FT_CMAP(x)->charmap.platform_id #define FT_CMAP_PLATFORM_ID( x ) FT_CMAP( x )->charmap.platform_id
#define FT_CMAP_ENCODING_ID(x) FT_CMAP(x)->charmap.encoding_id #define FT_CMAP_ENCODING_ID( x ) FT_CMAP( x )->charmap.encoding_id
#define FT_CMAP_ENCODING(x) FT_CMAP(x)->charmap.encoding #define FT_CMAP_ENCODING( x ) FT_CMAP( x )->charmap.encoding
#define FT_CMAP_FACE(x) FT_CMAP(x)->charmap.face #define FT_CMAP_FACE( x ) FT_CMAP( x )->charmap.face
/* class method definitions */ /* class method definitions */
typedef FT_Error (*FT_CMap_InitFunc)( FT_CMap cmap, typedef FT_Error
FT_Pointer init_data ); (*FT_CMap_InitFunc)( FT_CMap cmap,
FT_Pointer init_data );
typedef void (*FT_CMap_DoneFunc)( FT_CMap cmap ); typedef void
(*FT_CMap_DoneFunc)( FT_CMap cmap );
typedef FT_UInt (*FT_CMap_CharIndexFunc)( FT_CMap cmap, typedef FT_UInt
FT_UInt32 char_code ); (*FT_CMap_CharIndexFunc)( FT_CMap cmap,
FT_UInt32 char_code );
typedef FT_UInt (*FT_CMap_CharNextFunc)( FT_CMap cmap, typedef FT_UInt
FT_UInt32 *achar_code ); (*FT_CMap_CharNextFunc)( FT_CMap cmap,
FT_UInt32 *achar_code );
typedef struct FT_CMap_ClassRec_
typedef struct FT_CMap_ClassRec_
{ {
FT_UInt size; FT_UInt size;
FT_CMap_InitFunc init; FT_CMap_InitFunc init;
@ -236,14 +243,14 @@ FT_BEGIN_HEADER
} FT_CMap_ClassRec; } FT_CMap_ClassRec;
/* create a new charmap and add it to charmap->face */ /* create a new charmap and add it to charmap->face */
FT_BASE( FT_Error ) FT_BASE( FT_Error )
FT_CMap_New( FT_CMap_Class clazz, FT_CMap_New( FT_CMap_Class clazz,
FT_Pointer init_data, FT_Pointer init_data,
FT_CharMap charmap, FT_CharMap charmap,
FT_CMap *acmap ); FT_CMap *acmap );
/* destroy a charmap (don't remove it from face's list though) */ /* destroy a charmap (don't remove it from face's list though) */
FT_BASE( void ) FT_BASE( void )
FT_CMap_Done( FT_CMap cmap ); FT_CMap_Done( FT_CMap cmap );
@ -330,11 +337,11 @@ FT_BEGIN_HEADER
/* */ /* */
typedef struct FT_Slot_InternalRec_ typedef struct FT_Slot_InternalRec_
{ {
FT_GlyphLoader loader; FT_GlyphLoader loader;
FT_Bool glyph_transformed; FT_Bool glyph_transformed;
FT_Matrix glyph_matrix; FT_Matrix glyph_matrix;
FT_Vector glyph_delta; FT_Vector glyph_delta;
void* glyph_hints; void* glyph_hints;
} FT_GlyphSlot_InternalRec; } FT_GlyphSlot_InternalRec;
@ -380,10 +387,11 @@ FT_BEGIN_HEADER
/* typecast an object to a FT_Module */ /* typecast an object to a FT_Module */
#define FT_MODULE( x ) ((FT_Module)(x)) #define FT_MODULE( x ) ((FT_Module)( x ))
#define FT_MODULE_CLASS( x ) FT_MODULE(x)->clazz #define FT_MODULE_CLASS( x ) FT_MODULE( x )->clazz
#define FT_MODULE_LIBRARY( x ) FT_MODULE(x)->library #define FT_MODULE_LIBRARY( x ) FT_MODULE( x )->library
#define FT_MODULE_MEMORY( x ) FT_MODULE(x)->memory #define FT_MODULE_MEMORY( x ) FT_MODULE( x )->memory
#define FT_MODULE_IS_DRIVER( x ) ( FT_MODULE_CLASS( x )->module_flags & \ #define FT_MODULE_IS_DRIVER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
ft_module_font_driver ) ft_module_font_driver )
@ -397,13 +405,13 @@ FT_BEGIN_HEADER
#define FT_MODULE_IS_STYLER( x ) ( FT_MODULE_CLASS( x )->module_flags & \ #define FT_MODULE_IS_STYLER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
ft_module_styler ) ft_module_styler )
#define FT_DRIVER_IS_SCALABLE( x ) ( FT_MODULE_CLASS(x)->module_flags & \ #define FT_DRIVER_IS_SCALABLE( x ) ( FT_MODULE_CLASS( x )->module_flags & \
ft_module_driver_scalable ) ft_module_driver_scalable )
#define FT_DRIVER_USES_OUTLINES( x ) !( FT_MODULE_CLASS(x)->module_flags & \ #define FT_DRIVER_USES_OUTLINES( x ) !( FT_MODULE_CLASS( x )->module_flags & \
ft_module_driver_no_outlines ) ft_module_driver_no_outlines )
#define FT_DRIVER_HAS_HINTER( x ) ( FT_MODULE_CLASS(x)->module_flags & \ #define FT_DRIVER_HAS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
ft_module_driver_has_hinter ) ft_module_driver_has_hinter )
@ -587,13 +595,13 @@ FT_BEGIN_HEADER
/* */ /* */
typedef struct FT_DriverRec_ typedef struct FT_DriverRec_
{ {
FT_ModuleRec root; FT_ModuleRec root;
FT_Driver_Class clazz; FT_Driver_Class clazz;
FT_ListRec faces_list; FT_ListRec faces_list;
void* extensions; void* extensions;
FT_GlyphLoader glyph_loader; FT_GlyphLoader glyph_loader;
} FT_DriverRec; } FT_DriverRec;
@ -611,8 +619,8 @@ FT_BEGIN_HEADER
/*************************************************************************/ /*************************************************************************/
#define FT_DEBUG_HOOK_TRUETYPE 0 #define FT_DEBUG_HOOK_TRUETYPE 0
#define FT_DEBUG_HOOK_TYPE1 1 #define FT_DEBUG_HOOK_TYPE1 1
/*************************************************************************/ /*************************************************************************/
@ -677,7 +685,7 @@ FT_BEGIN_HEADER
FT_Module auto_hinter; FT_Module auto_hinter;
FT_Byte* raster_pool; /* scan-line conversion */ FT_Byte* raster_pool; /* scan-line conversion */
/* render pool */ /* render pool */
FT_ULong raster_pool_size; /* size of render pool in bytes */ FT_ULong raster_pool_size; /* size of render pool in bytes */
FT_DebugHook_Func debug_hooks[4]; FT_DebugHook_Func debug_hooks[4];

View File

@ -2,9 +2,9 @@
/* */ /* */
/* ftstream.h */ /* ftstream.h */
/* */ /* */
/* Stream handling(specification). */ /* Stream handling (specification). */
/* */ /* */
/* Copyright 1996-2001 by */ /* Copyright 1996-2001, 2002 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -27,19 +27,14 @@
FT_BEGIN_HEADER FT_BEGIN_HEADER
/* format of an 8-bit frame_op value: */
/* */
/* bit 76543210 */
/* xxxxxxes */
/* */
/* s is set to 1 if the value is signed. */
/* e is set to 1 if the value is little-endian. */
/* xxx is a command. */
/* format of an 8-bit frame_op value = [ xxxxx | e | s ] */
/* s is set to 1 if the value is signed, */
/* e is set to 1 if the value is little-endian */
/* xxxxx is a command */
#define FT_FRAME_OP_SHIFT 2 #define FT_FRAME_OP_SHIFT 2
#define FT_FRAME_OP_SIGNED 1 #define FT_FRAME_OP_SIGNED 1
@ -49,13 +44,13 @@ FT_BEGIN_HEADER
#define FT_MAKE_FRAME_OP( command, little, sign ) \ #define FT_MAKE_FRAME_OP( command, little, sign ) \
( ( command << FT_FRAME_OP_SHIFT ) | ( little << 1 ) | sign ) ( ( command << FT_FRAME_OP_SHIFT ) | ( little << 1 ) | sign )
#define FT_FRAME_OP_END 0 #define FT_FRAME_OP_END 0
#define FT_FRAME_OP_START 1 /* start a new frame */ #define FT_FRAME_OP_START 1 /* start a new frame */
#define FT_FRAME_OP_BYTE 2 /* read 1-byte value */ #define FT_FRAME_OP_BYTE 2 /* read 1-byte value */
#define FT_FRAME_OP_SHORT 3 /* read 2-byte value */ #define FT_FRAME_OP_SHORT 3 /* read 2-byte value */
#define FT_FRAME_OP_LONG 4 /* read 4-byte value */ #define FT_FRAME_OP_LONG 4 /* read 4-byte value */
#define FT_FRAME_OP_OFF3 5 /* read 3-byte value */ #define FT_FRAME_OP_OFF3 5 /* read 3-byte value */
#define FT_FRAME_OP_BYTES 6 /* read a bytes sequence */ #define FT_FRAME_OP_BYTES 6 /* read a bytes sequence */
typedef enum FT_Frame_Op_ typedef enum FT_Frame_Op_
@ -89,9 +84,9 @@ FT_BEGIN_HEADER
typedef struct FT_Frame_Field_ typedef struct FT_Frame_Field_
{ {
FT_Byte value; FT_Byte value;
FT_Byte size; FT_Byte size;
FT_UShort offset; FT_UShort offset;
} FT_Frame_Field; } FT_Frame_Field;
@ -99,6 +94,7 @@ FT_BEGIN_HEADER
/* Construct an FT_Frame_Field out of a structure type and a field name. */ /* Construct an FT_Frame_Field out of a structure type and a field name. */
/* The structure type must be set in the FT_STRUCTURE macro before */ /* The structure type must be set in the FT_STRUCTURE macro before */
/* calling the FT_FRAME_START() macro. */ /* calling the FT_FRAME_START() macro. */
/* */
#define FT_FIELD_SIZE( f ) \ #define FT_FIELD_SIZE( f ) \
(FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f ) (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f )
@ -146,120 +142,118 @@ FT_BEGIN_HEADER
#define FT_FRAME_SKIP_BYTES( count ) { ft_frame_skip, count, 0 } #define FT_FRAME_SKIP_BYTES( count ) { ft_frame_skip, count, 0 }
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* integer extraction macros -- the `buffer' parameter must ALWAYS be of */ /* Integer extraction macros -- the `buffer' parameter must ALWAYS be of */
/* type `char*' or equivalent (1-byte elements). */ /* type `char*' or equivalent (1-byte elements). */
/* */ /* */
#define FT_BYTE_(p,i) (((const FT_Byte*)(p))[(i)]) #define FT_BYTE_( p, i ) ( ((const FT_Byte*)(p))[(i)] )
#define FT_INT8_(p,i) (((const FT_Char*)(p))[(i)]) #define FT_INT8_( p, i ) ( ((const FT_Char*)(p))[(i)] )
#define FT_INT16(x) ((FT_Int16)(x)) #define FT_INT16( x ) ( (FT_Int16)(x) )
#define FT_UINT16(x) ((FT_UInt16)(x)) #define FT_UINT16( x ) ( (FT_UInt16)(x) )
#define FT_INT32(x) ((FT_Int32)(x)) #define FT_INT32( x ) ( (FT_Int32)(x) )
#define FT_UINT32(x) ((FT_UInt32)(x)) #define FT_UINT32( x ) ( (FT_UInt32)(x) )
#define FT_BYTE_I16(p,i,s) (FT_INT16( FT_BYTE_(p,i)) << (s)) #define FT_BYTE_I16( p, i, s ) ( FT_INT16( FT_BYTE_( p, i ) ) << (s) )
#define FT_BYTE_U16(p,i,s) (FT_UINT16(FT_BYTE_(p,i)) << (s)) #define FT_BYTE_U16( p, i, s ) ( FT_UINT16( FT_BYTE_( p, i ) ) << (s) )
#define FT_BYTE_I32(p,i,s) (FT_INT32( FT_BYTE_(p,i)) << (s)) #define FT_BYTE_I32( p, i, s ) ( FT_INT32( FT_BYTE_( p, i ) ) << (s) )
#define FT_BYTE_U32(p,i,s) (FT_UINT32(FT_BYTE_(p,i)) << (s)) #define FT_BYTE_U32( p, i, s ) ( FT_UINT32( FT_BYTE_( p, i ) ) << (s) )
#define FT_INT8_I16(p,i,s) (FT_INT16( FT_INT8_(p,i)) << (s)) #define FT_INT8_I16( p, i, s ) ( FT_INT16( FT_INT8_( p, i ) ) << (s) )
#define FT_INT8_U16(p,i,s) (FT_UINT16(FT_INT8_(p,i)) << (s)) #define FT_INT8_U16( p, i, s ) ( FT_UINT16( FT_INT8_( p, i ) ) << (s) )
#define FT_INT8_I32(p,i,s) (FT_INT32( FT_INT8_(p,i)) << (s)) #define FT_INT8_I32( p, i, s ) ( FT_INT32( FT_INT8_( p, i ) ) << (s) )
#define FT_INT8_U32(p,i,s) (FT_UINT32(FT_INT8_(p,i)) << (s)) #define FT_INT8_U32( p, i, s ) ( FT_UINT32( FT_INT8_( p, i ) ) << (s) )
#define FT_PEEK_SHORT( p ) FT_INT16( FT_INT8_I16(p,0,8) | \
FT_BYTE_I16(p,1,0) )
#define FT_PEEK_USHORT( p ) FT_UINT16( FT_BYTE_U16(p,0,8) | \
FT_BYTE_U16(p,1,0) )
#define FT_PEEK_LONG( p ) FT_INT32( FT_INT8_I32(p,0,24) | \
FT_BYTE_I32(p,1,16) | \
FT_BYTE_I32(p,2, 8) | \
FT_BYTE_I32(p,3, 0) )
#define FT_PEEK_ULONG( p ) FT_UINT32( FT_BYTE_U32(p,0,24) | \
FT_BYTE_U32(p,1,16) | \
FT_BYTE_U32(p,2, 8) | \
FT_BYTE_U32(p,3, 0) )
#define FT_PEEK_OFF3( p ) FT_INT32( FT_INT8_I32(p,0,16) | \
FT_BYTE_I32(p,1, 8) | \
FT_BYTE_I32(p,2, 0) )
#define FT_PEEK_UOFF3( p ) FT_UINT32( FT_BYTE_U32(p,0,16) | \
FT_BYTE_U32(p,1, 8) | \
FT_BYTE_U32(p,2, 0) )
#define FT_PEEK_SHORT_LE( p ) FT_INT16( FT_INT8_I16(p,1,8) | \ #define FT_PEEK_SHORT( p ) FT_INT16( FT_INT8_I16( p, 0, 8) | \
FT_BYTE_I16(p,0,0) ) FT_BYTE_I16( p, 1, 0) )
#define FT_PEEK_USHORT_LE( p ) FT_UINT16( FT_BYTE_U16(p,1,8) | \ #define FT_PEEK_USHORT( p ) FT_UINT16( FT_BYTE_U16( p, 0, 8 ) | \
FT_BYTE_U16(p,0,0) ) FT_BYTE_U16( p, 1, 0 ) )
#define FT_PEEK_LONG_LE( p ) FT_INT32( FT_INT8_I32(p,3,24) | \ #define FT_PEEK_LONG( p ) FT_INT32( FT_INT8_I32( p, 0, 24 ) | \
FT_BYTE_I32(p,2,16) | \ FT_BYTE_I32( p, 1, 16 ) | \
FT_BYTE_I32(p,1, 8) | \ FT_BYTE_I32( p, 2, 8 ) | \
FT_BYTE_I32(p,0, 0) ) FT_BYTE_I32( p, 3, 0 ) )
#define FT_PEEK_ULONG_LE( p ) FT_UINT32( FT_BYTE_U32(p,3,24) | \ #define FT_PEEK_ULONG( p ) FT_UINT32( FT_BYTE_U32( p, 0, 24 ) | \
FT_BYTE_U32(p,2,16) | \ FT_BYTE_U32( p, 1, 16 ) | \
FT_BYTE_U32(p,1, 8) | \ FT_BYTE_U32( p, 2, 8 ) | \
FT_BYTE_U32(p,0, 0) ) FT_BYTE_U32( p, 3, 0 ) )
#define FT_PEEK_OFF3_LE( p ) FT_INT32( FT_INT8_I32(p,2,16) | \ #define FT_PEEK_OFF3( p ) FT_INT32( FT_INT8_I32( p, 0, 16 ) | \
FT_BYTE_I32(p,1, 8) | \ FT_BYTE_I32( p, 1, 8 ) | \
FT_BYTE_I32(p,0, 0) ) FT_BYTE_I32( p, 2, 0 ) )
#define FT_PEEK_UOFF3_LE( p ) FT_UINT32( FT_BYTE_U32(p,2,16) | \ #define FT_PEEK_UOFF3( p ) FT_UINT32( FT_BYTE_U32( p, 0, 16 ) | \
FT_BYTE_U32(p,1, 8) | \ FT_BYTE_U32( p, 1, 8 ) | \
FT_BYTE_U32(p,0, 0) ) FT_BYTE_U32( p, 2, 0 ) )
#define FT_PEEK_SHORT_LE( p ) FT_INT16( FT_INT8_I16( p, 1, 8 ) | \
FT_BYTE_I16( p, 0, 0 ) )
#define FT_PEEK_USHORT_LE( p ) FT_UINT16( FT_BYTE_U16( p, 1, 8 ) | \
FT_BYTE_U16( p, 0, 0 ) )
#define FT_PEEK_LONG_LE( p ) FT_INT32( FT_INT8_I32( p, 3, 24 ) | \
FT_BYTE_I32( p, 2, 16 ) | \
FT_BYTE_I32( p, 1, 8 ) | \
FT_BYTE_I32( p, 0, 0 ) )
#define FT_PEEK_ULONG_LE( p ) FT_UINT32( FT_BYTE_U32( p, 3, 24 ) | \
FT_BYTE_U32( p, 2, 16 ) | \
FT_BYTE_U32( p, 1, 8 ) | \
FT_BYTE_U32( p, 0, 0 ) )
#define FT_PEEK_OFF3_LE( p ) FT_INT32( FT_INT8_I32( p, 2, 16 ) | \
FT_BYTE_I32( p, 1, 8 ) | \
FT_BYTE_I32( p, 0, 0 ) )
#define FT_PEEK_UOFF3_LE( p ) FT_UINT32( FT_BYTE_U32( p, 2, 16 ) | \
FT_BYTE_U32( p, 1, 8 ) | \
FT_BYTE_U32( p, 0, 0 ) )
#define FT_NEXT_CHAR( buffer ) \ #define FT_NEXT_CHAR( buffer ) \
( (signed char)*buffer++ ) ( (signed char)*buffer++ )
#define FT_NEXT_BYTE( buffer ) \ #define FT_NEXT_BYTE( buffer ) \
( (unsigned char)*buffer++ ) ( (unsigned char)*buffer++ )
#define FT_NEXT_SHORT( buffer ) \ #define FT_NEXT_SHORT( buffer ) \
( (short)( buffer += 2, FT_PEEK_SHORT( buffer - 2 ) ) ) ( (short)( buffer += 2, FT_PEEK_SHORT( buffer - 2 ) ) )
#define FT_NEXT_USHORT( buffer ) \ #define FT_NEXT_USHORT( buffer ) \
( (unsigned short)( buffer += 2, FT_PEEK_USHORT( buffer - 2 ) ) ) ( (unsigned short)( buffer += 2, FT_PEEK_USHORT( buffer - 2 ) ) )
#define FT_NEXT_OFF3( buffer ) \ #define FT_NEXT_OFF3( buffer ) \
( (long)( buffer += 3, FT_PEEK_OFF3( buffer - 3 ) ) ) ( (long)( buffer += 3, FT_PEEK_OFF3( buffer - 3 ) ) )
#define FT_NEXT_UOFF3( buffer ) \ #define FT_NEXT_UOFF3( buffer ) \
( (unsigned long)( buffer += 3, FT_PEEK_UOFF3( buffer - 3 ) ) ) ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3( buffer - 3 ) ) )
#define FT_NEXT_LONG( buffer ) \ #define FT_NEXT_LONG( buffer ) \
( (long)( buffer += 4, FT_PEEK_LONG( buffer - 4 ) ) ) ( (long)( buffer += 4, FT_PEEK_LONG( buffer - 4 ) ) )
#define FT_NEXT_ULONG( buffer ) \ #define FT_NEXT_ULONG( buffer ) \
( (unsigned long)( buffer += 4, FT_PEEK_ULONG( buffer - 4 ) ) ) ( (unsigned long)( buffer += 4, FT_PEEK_ULONG( buffer - 4 ) ) )
#define FT_NEXT_SHORT_LE( buffer ) \ #define FT_NEXT_SHORT_LE( buffer ) \
( (short)( buffer += 2, FT_PEEK_SHORT_LE( buffer - 2 ) ) ) ( (short)( buffer += 2, FT_PEEK_SHORT_LE( buffer - 2 ) ) )
#define FT_NEXT_USHORT_LE( buffer ) \ #define FT_NEXT_USHORT_LE( buffer ) \
( (unsigned short)( buffer += 2, FT_PEEK_USHORT_LE( buffer - 2 ) ) ) ( (unsigned short)( buffer += 2, FT_PEEK_USHORT_LE( buffer - 2 ) ) )
#define FT_NEXT_OFF3_LE( buffer ) \ #define FT_NEXT_OFF3_LE( buffer ) \
( (long)( buffer += 3, FT_PEEK_OFF3_LE( buffer - 3 ) ) ) ( (long)( buffer += 3, FT_PEEK_OFF3_LE( buffer - 3 ) ) )
#define FT_NEXT_UOFF3_LE( buffer ) \ #define FT_NEXT_UOFF3_LE( buffer ) \
( (unsigned long)( buffer += 3, FT_PEEK_UOFF3_LE( buffer - 3 ) ) ) ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3_LE( buffer - 3 ) ) )
#define FT_NEXT_LONG_LE( buffer ) \
#define FT_NEXT_LONG_LE( buffer ) \
( (long)( buffer += 4, FT_PEEK_LONG_LE( buffer - 4 ) ) ) ( (long)( buffer += 4, FT_PEEK_LONG_LE( buffer - 4 ) ) )
#define FT_NEXT_ULONG_LE( buffer ) \ #define FT_NEXT_ULONG_LE( buffer ) \
@ -272,15 +266,15 @@ FT_BEGIN_HEADER
/* */ /* */
#define FT_GET_MACRO( func, type ) ( (type)func( stream ) ) #define FT_GET_MACRO( func, type ) ( (type)func( stream ) )
#define FT_GET_CHAR() FT_GET_MACRO( FT_Stream_GetChar, FT_Char ) #define FT_GET_CHAR() FT_GET_MACRO( FT_Stream_GetChar, FT_Char )
#define FT_GET_BYTE() FT_GET_MACRO( FT_Stream_GetChar, FT_Byte ) #define FT_GET_BYTE() FT_GET_MACRO( FT_Stream_GetChar, FT_Byte )
#define FT_GET_SHORT() FT_GET_MACRO( FT_Stream_GetShort, FT_Short ) #define FT_GET_SHORT() FT_GET_MACRO( FT_Stream_GetShort, FT_Short )
#define FT_GET_USHORT() FT_GET_MACRO( FT_Stream_GetShort, FT_UShort ) #define FT_GET_USHORT() FT_GET_MACRO( FT_Stream_GetShort, FT_UShort )
#define FT_GET_OFF3() FT_GET_MACRO( FT_Stream_GetOffset, FT_Long ) #define FT_GET_OFF3() FT_GET_MACRO( FT_Stream_GetOffset, FT_Long )
#define FT_GET_UOFF3() FT_GET_MACRO( FT_Stream_GetOffset, FT_ULong ) #define FT_GET_UOFF3() FT_GET_MACRO( FT_Stream_GetOffset, FT_ULong )
#define FT_GET_LONG() FT_GET_MACRO( FT_Stream_GetLong, FT_Long ) #define FT_GET_LONG() FT_GET_MACRO( FT_Stream_GetLong, FT_Long )
#define FT_GET_ULONG() FT_GET_MACRO( FT_Stream_GetLong, FT_ULong ) #define FT_GET_ULONG() FT_GET_MACRO( FT_Stream_GetLong, FT_ULong )
#define FT_GET_TAG4() FT_GET_MACRO( FT_Stream_GetLong, FT_ULong ) #define FT_GET_TAG4() FT_GET_MACRO( FT_Stream_GetLong, FT_ULong )
#define FT_GET_SHORT_LE() FT_GET_MACRO( FT_Stream_GetShortLE, FT_Short ) #define FT_GET_SHORT_LE() FT_GET_MACRO( FT_Stream_GetShortLE, FT_Short )
#define FT_GET_USHORT_LE() FT_GET_MACRO( FT_Stream_GetShortLE, FT_UShort ) #define FT_GET_USHORT_LE() FT_GET_MACRO( FT_Stream_GetShortLE, FT_UShort )
@ -306,11 +300,9 @@ FT_BEGIN_HEADER
#define FT_READ_ULONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadLongLE, FT_ULong, var ) #define FT_READ_ULONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadLongLE, FT_ULong, var )
#ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM #ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
/* initialize a stream for reading a regular system stream */ /* initialize a stream for reading a regular system stream */
FT_EXPORT( FT_Error ) FT_EXPORT( FT_Error )
FT_Stream_Open( FT_Stream stream, FT_Stream_Open( FT_Stream stream,
const char* filepathname ); const char* filepathname );
@ -318,147 +310,144 @@ FT_BEGIN_HEADER
#endif /* FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */ #endif /* FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */
/* initialize a stream for reading in-memory data */ /* initialize a stream for reading in-memory data */
FT_BASE( void ) FT_BASE( void )
FT_Stream_OpenMemory( FT_Stream stream, FT_Stream_OpenMemory( FT_Stream stream,
const FT_Byte* base, const FT_Byte* base,
FT_ULong size ); FT_ULong size );
/* close a stream (does not destroy the stream structure) */ /* close a stream (does not destroy the stream structure) */
FT_BASE( void ) FT_BASE( void )
FT_Stream_Close( FT_Stream stream ); FT_Stream_Close( FT_Stream stream );
/* seek within a stream. position is relative to start of stream */ /* seek within a stream. position is relative to start of stream */
FT_BASE( FT_Error ) FT_BASE( FT_Error )
FT_Stream_Seek( FT_Stream stream, FT_Stream_Seek( FT_Stream stream,
FT_ULong pos ); FT_ULong pos );
/* skip bytes in a stream */ /* skip bytes in a stream */
FT_BASE( FT_Error ) FT_BASE( FT_Error )
FT_Stream_Skip( FT_Stream stream, FT_Stream_Skip( FT_Stream stream,
FT_Long distance ); FT_Long distance );
/* return current stream position */ /* return current stream position */
FT_BASE( FT_Long ) FT_BASE( FT_Long )
FT_Stream_Pos( FT_Stream stream ); FT_Stream_Pos( FT_Stream stream );
/* read bytes from a stream into a user-allocated buffer, returns an */
/* read bytes from a stream into a user-allocated buffer, returns an */ /* error if not all bytes could be read. */
/* error if all bytes could not be read.. */
FT_BASE( FT_Error ) FT_BASE( FT_Error )
FT_Stream_Read( FT_Stream stream, FT_Stream_Read( FT_Stream stream,
FT_Byte* buffer, FT_Byte* buffer,
FT_ULong count ); FT_ULong count );
/* read bytes from a stream at a given position */ /* read bytes from a stream at a given position */
FT_BASE( FT_Error ) FT_BASE( FT_Error )
FT_Stream_ReadAt( FT_Stream stream, FT_Stream_ReadAt( FT_Stream stream,
FT_ULong pos, FT_ULong pos,
FT_Byte* buffer, FT_Byte* buffer,
FT_ULong count ); FT_ULong count );
/* enter a frame of 'count' consecutive bytes in a stream. returns an */ /* Enter a frame of `count' consecutive bytes in a stream. Returns an */
/* error if the frame could not be read/accessed. The caller can use */ /* error if the frame could not be read/accessed. The caller can use */
/* the FT_Stream_Get_XXX function to retrieve frame data without */ /* the FT_Stream_Get_XXX functions to retrieve frame data without */
/* error checks.. */ /* error checks. */
/* */ /* */
/* you must _always_ call FT_Stream_ExitFrame once you've entered */ /* You must _always_ call FT_Stream_ExitFrame() once you have entered */
/* a stream frame !! */ /* a stream frame! */
/* */ /* */
FT_BASE( FT_Error ) FT_BASE( FT_Error )
FT_Stream_EnterFrame( FT_Stream stream, FT_Stream_EnterFrame( FT_Stream stream,
FT_ULong count ); FT_ULong count );
/* exit a stream frame.. */ /* exit a stream frame */
/* */
FT_BASE( void ) FT_BASE( void )
FT_Stream_ExitFrame( FT_Stream stream ); FT_Stream_ExitFrame( FT_Stream stream );
/* extract a stream frame. if the stream is disk-based, a heap block */ /* Extract a stream frame. If the stream is disk-based, a heap block */
/* is allocated and the frame bytes are read into it. if the stream */ /* is allocated and the frame bytes are read into it. If the stream */
/* is memory-based, this function simply set a pointer to the data */ /* is memory-based, this function simply set a pointer to the data. */
/* */ /* */
/* useful to optimize access to memory-based streams transparently. */ /* Useful to optimize access to memory-based streams transparently. */
/* */ /* */
/* all extracted frames must be "freed" with a call to the function */ /* All extracted frames must be `freed` with a call to the function */
/* FT_Stream_ReleaseFrame */ /* FT_Stream_ReleaseFrame(). */
/* */ /* */
FT_BASE( FT_Error ) FT_BASE( FT_Error )
FT_Stream_ExtractFrame( FT_Stream stream, FT_Stream_ExtractFrame( FT_Stream stream,
FT_ULong count, FT_ULong count,
FT_Byte** pbytes ); FT_Byte** pbytes );
/* release an extract frame (see FT_Stream_ExtractFrame) */ /* release an extract frame (see FT_Stream_ExtractFrame) */
/* */
FT_BASE( void ) FT_BASE( void )
FT_Stream_ReleaseFrame( FT_Stream stream, FT_Stream_ReleaseFrame( FT_Stream stream,
FT_Byte** pbytes ); FT_Byte** pbytes );
/* read a byte from an entered frame */ /* read a byte from an entered frame */
FT_BASE( FT_Char ) FT_BASE( FT_Char )
FT_Stream_GetChar( FT_Stream stream ); FT_Stream_GetChar( FT_Stream stream );
/* read a 16-bit big-endian integer from an entered frame */ /* read a 16-bit big-endian integer from an entered frame */
FT_BASE( FT_Short ) FT_BASE( FT_Short )
FT_Stream_GetShort( FT_Stream stream ); FT_Stream_GetShort( FT_Stream stream );
/* read a 24-bit big-endian integer from an entered frame */ /* read a 24-bit big-endian integer from an entered frame */
FT_BASE( FT_Long ) FT_BASE( FT_Long )
FT_Stream_GetOffset( FT_Stream stream ); FT_Stream_GetOffset( FT_Stream stream );
/* read a 32-bit big-endian integer from an entered frame */ /* read a 32-bit big-endian integer from an entered frame */
FT_BASE( FT_Long ) FT_BASE( FT_Long )
FT_Stream_GetLong( FT_Stream stream ); FT_Stream_GetLong( FT_Stream stream );
/* read a 16-bit little-endian integer from an entered frame */ /* read a 16-bit little-endian integer from an entered frame */
FT_BASE( FT_Short ) FT_BASE( FT_Short )
FT_Stream_GetShortLE( FT_Stream stream ); FT_Stream_GetShortLE( FT_Stream stream );
/* read a 32-bit little-endian integer from an entered frame */ /* read a 32-bit little-endian integer from an entered frame */
FT_BASE( FT_Long ) FT_BASE( FT_Long )
FT_Stream_GetLongLE( FT_Stream stream ); FT_Stream_GetLongLE( FT_Stream stream );
/* read a byte from a stream */ /* read a byte from a stream */
FT_BASE( FT_Char ) FT_BASE( FT_Char )
FT_Stream_ReadChar( FT_Stream stream, FT_Stream_ReadChar( FT_Stream stream,
FT_Error* error ); FT_Error* error );
/* read a 16-bit big-endian integer from a stream */ /* read a 16-bit big-endian integer from a stream */
FT_BASE( FT_Short ) FT_BASE( FT_Short )
FT_Stream_ReadShort( FT_Stream stream, FT_Stream_ReadShort( FT_Stream stream,
FT_Error* error ); FT_Error* error );
/* read a 24-bit big-endian integer from a stream */ /* read a 24-bit big-endian integer from a stream */
FT_BASE( FT_Long ) FT_BASE( FT_Long )
FT_Stream_ReadOffset( FT_Stream stream, FT_Stream_ReadOffset( FT_Stream stream,
FT_Error* error ); FT_Error* error );
/* read a 32-bit big-endian integer from a stream */ /* read a 32-bit big-endian integer from a stream */
FT_BASE( FT_Long ) FT_BASE( FT_Long )
FT_Stream_ReadLong( FT_Stream stream, FT_Stream_ReadLong( FT_Stream stream,
FT_Error* error ); FT_Error* error );
/* read a 16-bit little-endian integer from a stream */ /* read a 16-bit little-endian integer from a stream */
FT_BASE( FT_Short ) FT_BASE( FT_Short )
FT_Stream_ReadShortLE( FT_Stream stream, FT_Stream_ReadShortLE( FT_Stream stream,
FT_Error* error ); FT_Error* error );
/* read a 32-bit little-endian integer from a stream */ /* read a 32-bit little-endian integer from a stream */
FT_BASE( FT_Long ) FT_BASE( FT_Long )
FT_Stream_ReadLongLE( FT_Stream stream, FT_Stream_ReadLongLE( FT_Stream stream,
FT_Error* error ); FT_Error* error );
/* read a structure from a stream. The structure must be described */ /* Read a structure from a stream. The structure must be described */
/* by an array of FT_Frame_Field records.. */ /* by an array of FT_Frame_Field records. */
FT_BASE( FT_Error ) FT_BASE( FT_Error )
FT_Stream_ReadFields( FT_Stream stream, FT_Stream_ReadFields( FT_Stream stream,
const FT_Frame_Field* fields, const FT_Frame_Field* fields,
void* structure ); void* structure );
#define FT_STREAM_POS() \ #define FT_STREAM_POS() \
FT_Stream_Pos( stream ) FT_Stream_Pos( stream )
#define FT_STREAM_SEEK( position ) \ #define FT_STREAM_SEEK( position ) \
@ -467,9 +456,9 @@ FT_BEGIN_HEADER
#define FT_STREAM_SKIP( distance ) \ #define FT_STREAM_SKIP( distance ) \
FT_SET_ERROR( FT_Stream_Skip( stream, distance ) ) FT_SET_ERROR( FT_Stream_Skip( stream, distance ) )
#define FT_STREAM_READ( buffer, count ) \ #define FT_STREAM_READ( buffer, count ) \
FT_SET_ERROR( FT_Stream_Read( stream, \ FT_SET_ERROR( FT_Stream_Read( stream, \
(FT_Byte*)buffer, \ (FT_Byte*)buffer, \
count ) ) count ) )
#define FT_STREAM_READ_AT( position, buffer, count ) \ #define FT_STREAM_READ_AT( position, buffer, count ) \
@ -478,25 +467,24 @@ FT_BEGIN_HEADER
(FT_Byte*)buffer, \ (FT_Byte*)buffer, \
count ) ) count ) )
#define FT_STREAM_READ_FIELDS( fields, object ) \ #define FT_STREAM_READ_FIELDS( fields, object ) \
FT_SET_ERROR( FT_Stream_ReadFields( stream, fields, object ) ) FT_SET_ERROR( FT_Stream_ReadFields( stream, fields, object ) )
#define FT_FRAME_ENTER( size ) \ #define FT_FRAME_ENTER( size ) \
FT_SET_ERROR( FT_Stream_EnterFrame( stream, size ) ) FT_SET_ERROR( FT_Stream_EnterFrame( stream, size ) )
#define FT_FRAME_EXIT() \ #define FT_FRAME_EXIT() \
FT_Stream_ExitFrame( stream ) FT_Stream_ExitFrame( stream )
#define FT_FRAME_EXTRACT( size, bytes ) \ #define FT_FRAME_EXTRACT( size, bytes ) \
FT_SET_ERROR( FT_Stream_ExtractFrame( stream, size, \ FT_SET_ERROR( FT_Stream_ExtractFrame( stream, size, \
(FT_Byte**)&(bytes) ) ) (FT_Byte**)&(bytes) ) )
#define FT_FRAME_RELEASE( bytes ) \ #define FT_FRAME_RELEASE( bytes ) \
FT_Stream_ReleaseFrame( stream, (FT_Byte**)&(bytes) ) FT_Stream_ReleaseFrame( stream, (FT_Byte**)&(bytes) )
FT_END_HEADER FT_END_HEADER
#endif /* __FTSTREAM_H__ */ #endif /* __FTSTREAM_H__ */

View File

@ -1,3 +1,21 @@
/***************************************************************************/
/* */
/* fttrace.h */
/* */
/* Tracing handling (specification only). */
/* */
/* Copyright 2002 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. */
/* */
/***************************************************************************/
/* definitions of trace levels for FreeType 2 */ /* definitions of trace levels for FreeType 2 */
/* the first level must always be `trace_any' */ /* the first level must always be `trace_any' */
@ -73,3 +91,6 @@ FT_TRACE_DEF( winfnt )
/* PCF fonts component */ /* PCF fonts component */
FT_TRACE_DEF( pcfdriver ) FT_TRACE_DEF( pcfdriver )
FT_TRACE_DEF( pcfread ) FT_TRACE_DEF( pcfread )
/* END */

View File

@ -4,7 +4,7 @@
/* */ /* */
/* Internal header files (specification only). */ /* Internal header files (specification only). */
/* */ /* */
/* Copyright 1996-2001 by */ /* Copyright 1996-2001, 2002 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */

View File

@ -5,7 +5,7 @@
/* Auxiliary functions and data structures related to PostScript fonts */ /* Auxiliary functions and data structures related to PostScript fonts */
/* (specification). */ /* (specification). */
/* */ /* */
/* Copyright 1996-2001 by */ /* Copyright 1996-2001, 2002 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -41,6 +41,7 @@ FT_BEGIN_HEADER
typedef struct PS_TableRec_* PS_Table; typedef struct PS_TableRec_* PS_Table;
typedef const struct PS_Table_FuncsRec_* PS_Table_Funcs; typedef const struct PS_Table_FuncsRec_* PS_Table_Funcs;
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Struct> */ /* <Struct> */
@ -162,8 +163,8 @@ FT_BEGIN_HEADER
/* a simple structure used to identify tokens */ /* a simple structure used to identify tokens */
typedef struct T1_TokenRec_ typedef struct T1_TokenRec_
{ {
FT_Byte* start; /* first character of token in input stream */ FT_Byte* start; /* first character of token in input stream */
FT_Byte* limit; /* first character after the token */ FT_Byte* limit; /* first character after the token */
T1_TokenType type; /* type of token */ T1_TokenType type; /* type of token */
} T1_TokenRec; } T1_TokenRec;
@ -186,6 +187,7 @@ FT_BEGIN_HEADER
} T1_FieldType; } T1_FieldType;
typedef enum T1_FieldLocation_ typedef enum T1_FieldLocation_
{ {
T1_FIELD_LOCATION_CID_INFO, T1_FIELD_LOCATION_CID_INFO,
@ -229,12 +231,12 @@ FT_BEGIN_HEADER
0, 0 \ 0, 0 \
}, },
#define T1_NEW_CALLBACK_FIELD( _ident, _reader ) \ #define T1_NEW_CALLBACK_FIELD( _ident, _reader ) \
{ \ { \
_ident, T1CODE, T1_FIELD_TYPE_CALLBACK, \ _ident, T1CODE, T1_FIELD_TYPE_CALLBACK, \
(T1_Field_ParseFunc)_reader, \ (T1_Field_ParseFunc)_reader, \
0, 0, \ 0, 0, \
0, 0 \ 0, 0 \
}, },
#define T1_NEW_TABLE_FIELD( _ident, _type, _fname, _max ) \ #define T1_NEW_TABLE_FIELD( _ident, _type, _fname, _max ) \
@ -257,40 +259,38 @@ FT_BEGIN_HEADER
}, },
#define T1_FIELD_TYPE_BOOL( _ident, _fname ) \ #define T1_FIELD_TYPE_BOOL( _ident, _fname ) \
T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BOOL, _fname ) T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BOOL, _fname )
#define T1_FIELD_NUM( _ident, _fname ) \ #define T1_FIELD_NUM( _ident, _fname ) \
T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER, _fname ) T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER, _fname )
#define T1_FIELD_FIXED( _ident, _fname ) \ #define T1_FIELD_FIXED( _ident, _fname ) \
T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED, _fname ) T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED, _fname )
#define T1_FIELD_STRING( _ident, _fname ) \ #define T1_FIELD_STRING( _ident, _fname ) \
T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_STRING, _fname ) T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_STRING, _fname )
#define T1_FIELD_NUM_TABLE( _ident, _fname, _fmax ) \ #define T1_FIELD_NUM_TABLE( _ident, _fname, _fmax ) \
T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \ T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \
_fname, _fmax ) _fname, _fmax )
#define T1_FIELD_FIXED_TABLE( _ident, _fname, _fmax ) \ #define T1_FIELD_FIXED_TABLE( _ident, _fname, _fmax ) \
T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \ T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \
_fname, _fmax ) _fname, _fmax )
#define T1_FIELD_NUM_TABLE2( _ident, _fname, _fmax ) \ #define T1_FIELD_NUM_TABLE2( _ident, _fname, _fmax ) \
T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \ T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \
_fname, _fmax ) _fname, _fmax )
#define T1_FIELD_FIXED_TABLE2( _ident, _fname, _fmax ) \ #define T1_FIELD_FIXED_TABLE2( _ident, _fname, _fmax ) \
T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \ T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \
_fname, _fmax ) _fname, _fmax )
#define T1_FIELD_CALLBACK( _ident, _name ) \ #define T1_FIELD_CALLBACK( _ident, _name ) \
T1_NEW_CALLBACK_FIELD( _ident, _name ) T1_NEW_CALLBACK_FIELD( _ident, _name )
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/***** *****/ /***** *****/
@ -305,9 +305,9 @@ FT_BEGIN_HEADER
{ {
void void
(*init)( PS_Parser parser, (*init)( PS_Parser parser,
FT_Byte* base, FT_Byte* base,
FT_Byte* limit, FT_Byte* limit,
FT_Memory memory ); FT_Memory memory );
void void
(*done)( PS_Parser parser ); (*done)( PS_Parser parser );
@ -321,16 +321,16 @@ FT_BEGIN_HEADER
(*to_int)( PS_Parser parser ); (*to_int)( PS_Parser parser );
FT_Fixed FT_Fixed
(*to_fixed)( PS_Parser parser, (*to_fixed)( PS_Parser parser,
FT_Int power_ten ); FT_Int power_ten );
FT_Int FT_Int
(*to_coord_array)( PS_Parser parser, (*to_coord_array)( PS_Parser parser,
FT_Int max_coords, FT_Int max_coords,
FT_Short* coords ); FT_Short* coords );
FT_Int FT_Int
(*to_fixed_array)( PS_Parser parser, (*to_fixed_array)( PS_Parser parser,
FT_Int max_values, FT_Int max_values,
FT_Fixed* values, FT_Fixed* values,
FT_Int power_ten ); FT_Int power_ten );
void void
(*to_token)( PS_Parser parser, (*to_token)( PS_Parser parser,
@ -338,22 +338,22 @@ FT_BEGIN_HEADER
void void
(*to_token_array)( PS_Parser parser, (*to_token_array)( PS_Parser parser,
T1_Token tokens, T1_Token tokens,
FT_UInt max_tokens, FT_UInt max_tokens,
FT_Int* pnum_tokens ); FT_Int* pnum_tokens );
FT_Error FT_Error
(*load_field)( PS_Parser parser, (*load_field)( PS_Parser parser,
const T1_Field field, const T1_Field field,
void** objects, void** objects,
FT_UInt max_objects, FT_UInt max_objects,
FT_ULong* pflags ); FT_ULong* pflags );
FT_Error FT_Error
(*load_field_table)( PS_Parser parser, (*load_field_table)( PS_Parser parser,
const T1_Field field, const T1_Field field,
void** objects, void** objects,
FT_UInt max_objects, FT_UInt max_objects,
FT_ULong* pflags ); FT_ULong* pflags );
} PS_Parser_FuncsRec; } PS_Parser_FuncsRec;
@ -379,20 +379,19 @@ FT_BEGIN_HEADER
/* */ /* */
/* funcs :: A table of functions for the parser. */ /* funcs :: A table of functions for the parser. */
/* */ /* */
typedef struct PS_ParserRec_ typedef struct PS_ParserRec_
{ {
FT_Byte* cursor; FT_Byte* cursor;
FT_Byte* base; FT_Byte* base;
FT_Byte* limit; FT_Byte* limit;
FT_Error error; FT_Error error;
FT_Memory memory; FT_Memory memory;
PS_Parser_FuncsRec funcs; PS_Parser_FuncsRec funcs;
} PS_ParserRec; } PS_ParserRec;
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/***** *****/ /***** *****/
@ -411,22 +410,22 @@ FT_BEGIN_HEADER
typedef void typedef void
(*T1_Builder_Add_Point_Func)( T1_Builder builder, (*T1_Builder_Add_Point_Func)( T1_Builder builder,
FT_Pos x, FT_Pos x,
FT_Pos y, FT_Pos y,
FT_Byte flag ); FT_Byte flag );
typedef FT_Error typedef FT_Error
(*T1_Builder_Add_Point1_Func)( T1_Builder builder, (*T1_Builder_Add_Point1_Func)( T1_Builder builder,
FT_Pos x, FT_Pos x,
FT_Pos y ); FT_Pos y );
typedef FT_Error typedef FT_Error
(*T1_Builder_Add_Contour_Func)( T1_Builder builder ); (*T1_Builder_Add_Contour_Func)( T1_Builder builder );
typedef FT_Error typedef FT_Error
(*T1_Builder_Start_Point_Func)( T1_Builder builder, (*T1_Builder_Start_Point_Func)( T1_Builder builder,
FT_Pos x, FT_Pos x,
FT_Pos y ); FT_Pos y );
typedef void typedef void
(*T1_Builder_Close_Contour_Func)( T1_Builder builder ); (*T1_Builder_Close_Contour_Func)( T1_Builder builder );
@ -514,35 +513,35 @@ FT_BEGIN_HEADER
/* */ /* */
typedef struct T1_BuilderRec_ typedef struct T1_BuilderRec_
{ {
FT_Memory memory; FT_Memory memory;
FT_Face face; FT_Face face;
FT_GlyphSlot glyph; FT_GlyphSlot glyph;
FT_GlyphLoader loader; FT_GlyphLoader loader;
FT_Outline* base; FT_Outline* base;
FT_Outline* current; FT_Outline* current;
FT_Vector last; FT_Vector last;
FT_Fixed scale_x; FT_Fixed scale_x;
FT_Fixed scale_y; FT_Fixed scale_y;
FT_Pos pos_x; FT_Pos pos_x;
FT_Pos pos_y; FT_Pos pos_y;
FT_Vector left_bearing; FT_Vector left_bearing;
FT_Vector advance; FT_Vector advance;
FT_BBox bbox; /* bounding box */ FT_BBox bbox; /* bounding box */
FT_Bool path_begun; FT_Bool path_begun;
FT_Bool load_points; FT_Bool load_points;
FT_Bool no_recurse; FT_Bool no_recurse;
FT_Bool shift; FT_Bool shift;
FT_Error error; /* only used for memory errors */ FT_Error error; /* only used for memory errors */
FT_Bool metrics_only; FT_Bool metrics_only;
void* hints_funcs; /* hinter-specific */ void* hints_funcs; /* hinter-specific */
void* hints_globals; /* hinter-specific */ void* hints_globals; /* hinter-specific */
T1_Builder_FuncsRec funcs; T1_Builder_FuncsRec funcs;
@ -598,22 +597,22 @@ FT_BEGIN_HEADER
typedef struct T1_Decoder_FuncsRec_ typedef struct T1_Decoder_FuncsRec_
{ {
FT_Error FT_Error
(*init) ( T1_Decoder decoder, (*init)( T1_Decoder decoder,
FT_Face face, FT_Face face,
FT_Size size, FT_Size size,
FT_GlyphSlot slot, FT_GlyphSlot slot,
FT_Byte** glyph_names, FT_Byte** glyph_names,
PS_Blend blend, PS_Blend blend,
FT_Bool hinting, FT_Bool hinting,
T1_Decoder_Callback callback ); T1_Decoder_Callback callback );
void void
(*done) ( T1_Decoder decoder ); (*done)( T1_Decoder decoder );
FT_Error FT_Error
(*parse_charstrings)( T1_Decoder decoder, (*parse_charstrings)( T1_Decoder decoder,
FT_Byte* base, FT_Byte* base,
FT_UInt len ); FT_UInt len );
} T1_Decoder_FuncsRec; } T1_Decoder_FuncsRec;
@ -651,6 +650,7 @@ FT_BEGIN_HEADER
} T1_DecoderRec; } T1_DecoderRec;
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/***** *****/ /***** *****/
@ -692,11 +692,11 @@ FT_BEGIN_HEADER
FT_Offset length, FT_Offset length,
FT_UShort seed ); FT_UShort seed );
T1_CMap_Classes t1_cmap_classes; T1_CMap_Classes t1_cmap_classes;
} PSAux_ServiceRec, *PSAux_Service; } PSAux_ServiceRec, *PSAux_Service;
/* backwards-compatible type definition */ /* backwards-compatible type definition */
typedef PSAux_ServiceRec PSAux_Interface; typedef PSAux_ServiceRec PSAux_Interface;
FT_END_HEADER FT_END_HEADER