Commit 01f2de85 authored by David Turner's avatar David Turner
Browse files

* include/freetype/ftconfig.h: changed FT_LOCAL xxxx to FT_LOCAL( xxxx )

        everywhere in the source. Sames goes for FT_LOCAL_DEF xxxx translated
        into FT_LOCAL_DEF( xxxxx )
parent 31526ef8
2002-02-28 David Turner <david@freetype.org>
* include/freetype/ftconfig.h: changed FT_LOCAL xxxx to FT_LOCAL( xxxx )
everywhere in the source. Sames goes for FT_LOCAL_DEF xxxx translated
into FT_LOCAL_DEF( xxxxx )
* include/freetype/freetype.h: changing version to 2.1.0 to indicate
an unstable branch. Added the declarations of FT_Get_First_Char and
FT_Get_Next_Char
* src/base/ftobjs.c: implemented FT_Get_First_Char and FT_Get_Next_Char
* include/freetype/t1tables.h: re-naming structure types. This done
basically:
typedef T1_Struct_
{
} T1_Struct;
becomes:
typedef PS_StructRec_
{
} PS_StructRec, *PS_Struct;
typedef PS_StructRec T1_Struct; /* backwards-compatibility */
......
......@@ -205,17 +205,17 @@ FT_BEGIN_HEADER
#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
#define FT_LOCAL static
#define FT_LOCAL_DEF static
#define FT_LOCAL(x) static x
#define FT_LOCAL_DEF(x) static x
#else
#ifdef __cplusplus
#define FT_LOCAL extern "C"
#define FT_LOCAL_DEF extern "C"
#define FT_LOCAL(x) extern "C" x
#define FT_LOCAL_DEF(x) extern "C" x
#else
#define FT_LOCAL extern
#define FT_LOCAL_DEF extern
#define FT_LOCAL(x) extern x
#define FT_LOCAL_DEF(x) extern x
#endif
#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
......
......@@ -76,6 +76,15 @@ FT_BEGIN_HEADER
/*************************************************************************/
#undef FT_CONFIG_OPTION_USE_CMAPS
#define TT_CONFIG_CMAP_FORMAT_0
#define TT_CONFIG_CMAP_FORMAT_2
#define TT_CONFIG_CMAP_FORMAT_4
#define TT_CONFIG_CMAP_FORMAT_6
#define TT_CONFIG_CMAP_FORMAT_8
#define TT_CONFIG_CMAP_FORMAT_10
#define TT_CONFIG_CMAP_FORMAT_12
/*************************************************************************/
/* */
/* Convenience functions support */
......
......@@ -218,16 +218,22 @@ FT_BEGIN_HEADER
#define MEM_Free( _pointer_ ) \
FT_Free_Debug( memory, (void**)&(_pointer_), __FILE__, __LINE__ )
#else /* !FT_DEBUG_MEMORY */
#define MEM_Alloc( _pointer_, _size_ ) \
FT_Alloc( memory, _size_, (void**)&(_pointer_) )
#define MEM_New( _pointer_ ) MEM_Alloc( _pointer_, sizeof(*(_pointer_)) )
#define MEM_Alloc_Array( _pointer_, _count_, _type_ ) \
FT_Alloc( memory, (_count_)*sizeof ( _type_ ), \
(void**)&(_pointer_) )
#define MEM_New_Array( _pointer_, _count_ ) \
MEM_Alloc_Array( _pointer_, _count_, sizeof(*(_pointer_)) )
#define MEM_Realloc( _pointer_, _current_, _size_ ) \
FT_Realloc( memory, _current_, _size_, (void**)&(_pointer_) )
......@@ -235,6 +241,9 @@ FT_BEGIN_HEADER
FT_Realloc( memory, (_current_)*sizeof ( _type_ ), \
(_new_)*sizeof ( _type_ ), (void**)&(_pointer_) )
#define MEM_Renew_Array( _pointer_, _current_, _new_ ) \
MEM_Realloc_Array( _pointer_, _current_, _new_, *(_pointer_) )
#define MEM_Free( _pointer_ ) \
FT_Free( memory, (void**)&(_pointer_) )
......@@ -244,6 +253,9 @@ FT_BEGIN_HEADER
#define ALLOC( _pointer_, _size_ ) \
FT_SET_ERROR( MEM_Alloc( _pointer_, _size_ ) )
#define NEW( _pointer_ ) \
FT_SET_ERROR( MEM_New( _pointer_ ) )
#define REALLOC( _pointer_, _current_, _size_ ) \
FT_SET_ERROR( MEM_Realloc( _pointer_, _current_, _size_ ) )
......@@ -251,11 +263,17 @@ FT_BEGIN_HEADER
FT_SET_ERROR( MEM_Alloc( _pointer_, \
(_count_)*sizeof ( _type_ ) ) )
#define NEW_ARRAY( _pointer_, _count_ ) \
FT_SET_ERROR( MEM_New_Array( _pointer_, _count_ ) )
#define REALLOC_ARRAY( _pointer_, _current_, _count_, _type_ ) \
FT_SET_ERROR( MEM_Realloc( _pointer_, \
(_current_)*sizeof ( _type_ ), \
(_count_)*sizeof ( _type_ ) ) )
#define RENEW_ARRAY( _pointer_, _current_, _new_ ) \
FT_SET_ERROR( MEM_Renew_Array( _pointer_, _current_, _new_ ) )
#define FREE( _pointer_ ) \
MEM_Free( _pointer_ )
......
......@@ -102,7 +102,7 @@ FT_BEGIN_HEADER
* FT_VALIDATE_TIGHT ::
* a table that passes this validation level can be used reliably and
* 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
* return an error later when trying to load the glyph)
*
......@@ -120,7 +120,7 @@ FT_BEGIN_HEADER
FT_VALIDATE_DEFAULT = 0,
FT_VALIDATE_TIGHT,
FT_VALIDATE_PARANOID
} FT_ValidationLevel;
......@@ -131,9 +131,9 @@ FT_BEGIN_HEADER
FT_Byte* limit; /* 'base' + sizeof(table) in memory */
FT_ValidationLevel level; /* validation level */
FT_Error error; /* error returned. 0 means success */
jmp_buf jump_buffer; /* used for exception handling */
} FT_ValidatorRec;
......@@ -183,7 +183,7 @@ FT_BEGIN_HEADER
/* handle to internal charmap object */
typedef struct FT_CMapRec_* FT_CMap;
/* handle to charmap class structure */
typedef const struct FT_CMap_ClassRec_* FT_CMap_Class;
......@@ -192,8 +192,7 @@ FT_BEGIN_HEADER
{
FT_CharMapRec charmap;
FT_CMap_Class clazz;
FT_Pointer data;
} FT_CMapRec;
/* typecase any pointer to a charmap handle */
......@@ -208,15 +207,16 @@ FT_BEGIN_HEADER
/* class method definitions */
typedef FT_Error (*FT_CMap_InitFunc)( FT_CMap cmap,
FT_Pointer data );
FT_Pointer init_data );
typedef void (*FT_CMap_DoneFunc)( FT_CMap cmap );
typedef FT_UInt (*FT_CMap_CharIndexFunc)( FT_Pointer cmap_data,
FT_ULong char_code );
typedef FT_UInt (*FT_CMap_CharIndexFunc)( FT_CMap cmap,
FT_UInt32 char_code );
typedef FT_UInt (*FT_CMap_CharNextFunc)( FT_Pointer cmap_data,
FT_ULong *achar_code );
typedef FT_UInt32 (*FT_CMap_CharNextFunc)( FT_CMap cmap,
FT_UInt32 char_code,
FT_UInt *agindex );
typedef struct FT_CMap_ClassRec_
{
......@@ -225,14 +225,14 @@ FT_BEGIN_HEADER
FT_CMap_DoneFunc done;
FT_CMap_CharIndexFunc char_index;
FT_CMap_CharNextFunc char_next;
} FT_CMap_ClassRec;
/* create a new charmap and add it to charmap->face */
FT_BASE( FT_Error )
FT_CMap_New( FT_CMap_Class clazz,
FT_Pointer data,
FT_Pointer init_data,
FT_CharMap charmap,
FT_CMap *acmap );
......
......@@ -1101,18 +1101,6 @@ FT_BEGIN_HEADER
} TT_CharMapRec;
typedef const struct TT_CMap_ClassRec_* TT_CMap_Class;
typedef FT_Error (*TT_CMap_ValidateFunc)( FT_Byte* data,
FT_Validator valid );
typedef struct TT_CMap_ClassRec_
{
FT_CMap_ClassRec clazz;
TT_CMap_ValidateFunc validate;
} TT_CMap_ClassRec;
/*************************************************************************/
......@@ -1485,9 +1473,18 @@ FT_BEGIN_HEADER
TT_OS2 os2; /* TrueType OS/2 table */
TT_Postscript postscript; /* TrueType Postscript table */
#ifdef FT_CONFIG_OPTION_USE_CMAPS
FT_Byte* cmap_table; /* extracted 'cmap' table */
FT_ULong cmap_size;
#else /* !FT_CONFIG_OPTION_USE_CMAPS */
FT_Int num_charmaps;
TT_CharMap charmaps; /* array of TT_CharMapRec */
#endif /* !FT_CONFIG_OPTION_USE_CMAPS */
TT_Goto_Table_Func goto_table;
TT_Access_Glyph_Frame_Func access_glyph_frame;
......
......@@ -64,7 +64,7 @@
};
FT_LOCAL_DEF AH_Angle
FT_LOCAL_DEF( AH_Angle )
ah_angle( FT_Vector* v )
{
FT_Pos dx, dy;
......
......@@ -47,7 +47,7 @@ FT_BEGIN_HEADER
const AH_Angle ah_arctan[1L << AH_ATAN_BITS];
FT_LOCAL AH_Angle
FT_LOCAL( AH_Angle )
ah_angle( FT_Vector* v );
......
......@@ -384,7 +384,7 @@
}
FT_LOCAL_DEF FT_Error
FT_LOCAL_DEF( FT_Error )
ah_hinter_compute_globals( AH_Hinter* hinter )
{
return ah_hinter_compute_widths( hinter ) ||
......
......@@ -37,8 +37,7 @@ FT_BEGIN_HEADER
/* compute global metrics automatically */
FT_LOCAL
FT_Error ah_hinter_compute_globals( AH_Hinter* hinter );
FT_LOCAL( FT_Error ) ah_hinter_compute_globals( AH_Hinter* hinter );
FT_END_HEADER
......
......@@ -299,7 +299,7 @@
/* <Description> */
/* Creates a new and empty AH_Outline object. */
/* */
FT_LOCAL_DEF FT_Error
FT_LOCAL_DEF( FT_Error )
ah_outline_new( FT_Memory memory,
AH_Outline** aoutline )
{
......@@ -325,7 +325,7 @@
/* <Description> */
/* Destroys a given AH_Outline object. */
/* */
FT_LOCAL_DEF void
FT_LOCAL_DEF( void )
ah_outline_done( AH_Outline* outline )
{
FT_Memory memory = outline->memory;
......@@ -349,7 +349,7 @@
/* Saves the content of a given AH_Outline object into a face's glyph */
/* slot. */
/* */
FT_LOCAL_DEF void
FT_LOCAL_DEF( void )
ah_outline_save( AH_Outline* outline,
AH_Loader gloader )
{
......@@ -384,7 +384,7 @@
/* Loads an unscaled outline from a glyph slot into an AH_Outline */
/* object. */
/* */
FT_LOCAL_DEF FT_Error
FT_LOCAL_DEF( FT_Error )
ah_outline_load( AH_Outline* outline,
FT_Face face )
{
......@@ -622,7 +622,7 @@
}
FT_LOCAL_DEF void
FT_LOCAL_DEF( void )
ah_setup_uv( AH_Outline* outline,
AH_UV source )
{
......@@ -676,7 +676,7 @@
}
FT_LOCAL_DEF void
FT_LOCAL_DEF( void )
ah_outline_compute_segments( AH_Outline* outline )
{
int dimension;
......@@ -918,7 +918,7 @@
}
FT_LOCAL_DEF void
FT_LOCAL_DEF( void )
ah_outline_link_segments( AH_Outline* outline )
{
AH_Segment* segments;
......@@ -1286,7 +1286,7 @@
/* <Description> */
/* Performs feature detection on a given AH_Outline object. */
/* */
FT_LOCAL_DEF void
FT_LOCAL_DEF( void )
ah_outline_detect_features( AH_Outline* outline )
{
ah_outline_compute_segments( outline );
......@@ -1304,7 +1304,7 @@
/* Computes the `blue edges' in a given outline (i.e. those that must */
/* be snapped to a blue zone edge (top or bottom). */
/* */
FT_LOCAL_DEF void
FT_LOCAL_DEF( void )
ah_outline_compute_blue_edges( AH_Outline* outline,
AH_Face_Globals* face_globals )
{
......@@ -1438,7 +1438,7 @@
/* the contents of the detected edges (basically change the `blue */
/* edge' pointer from `design units' to `scaled ones'). */
/* */
FT_LOCAL_DEF void
FT_LOCAL_DEF( void )
ah_outline_scale_blue_edges( AH_Outline* outline,
AH_Face_Globals* globals )
{
......
......@@ -45,43 +45,43 @@ FT_BEGIN_HEADER
} AH_UV;
FT_LOCAL void
FT_LOCAL( void )
ah_setup_uv( AH_Outline* outline,
AH_UV source );
/* AH_Outline functions - they should be typically called in this order */
FT_LOCAL FT_Error
FT_LOCAL( FT_Error )
ah_outline_new( FT_Memory memory,
AH_Outline** aoutline );
FT_LOCAL FT_Error
FT_LOCAL( FT_Error )
ah_outline_load( AH_Outline* outline,
FT_Face face );
FT_LOCAL void
FT_LOCAL( void )
ah_outline_compute_segments( AH_Outline* outline );
FT_LOCAL void
FT_LOCAL( void )
ah_outline_link_segments( AH_Outline* outline );
FT_LOCAL void
FT_LOCAL( void )
ah_outline_detect_features( AH_Outline* outline );
FT_LOCAL void
FT_LOCAL( void )
ah_outline_compute_blue_edges( AH_Outline* outline,
AH_Face_Globals* globals );
FT_LOCAL void
FT_LOCAL( void )
ah_outline_scale_blue_edges( AH_Outline* outline,
AH_Face_Globals* globals );
FT_LOCAL void
FT_LOCAL( void )
ah_outline_save( AH_Outline* outline,
AH_Loader loader );
FT_LOCAL void
FT_LOCAL( void )
ah_outline_done( AH_Outline* outline );
......
......@@ -378,7 +378,7 @@
}
FT_LOCAL_DEF void
FT_LOCAL_DEF( void )
ah_hinter_hint_edges( AH_Hinter* hinter,
FT_Bool no_horz_edges,
FT_Bool no_vert_edges )
......@@ -807,7 +807,7 @@
#endif /* !AH_OPTION_NO_WEAK_INTERPOLATION */
FT_LOCAL_DEF void
FT_LOCAL_DEF( void )
ah_hinter_align_points( AH_Hinter* hinter )
{
ah_hinter_align_edge_points( hinter );
......@@ -896,7 +896,7 @@
/* finalize a hinter object */
FT_LOCAL_DEF void
FT_LOCAL_DEF( void )
ah_hinter_done( AH_Hinter* hinter )
{
if ( hinter )
......@@ -919,7 +919,7 @@
/* create a new empty hinter object */
FT_LOCAL_DEF FT_Error
FT_LOCAL_DEF( FT_Error )
ah_hinter_new( FT_Library library,
AH_Hinter** ahinter )
{
......@@ -955,7 +955,7 @@
/* create a face's autohint globals */
FT_LOCAL_DEF FT_Error
FT_LOCAL_DEF( FT_Error )
ah_hinter_new_face_globals( AH_Hinter* hinter,
FT_Face face,
AH_Globals* globals )
......@@ -987,7 +987,7 @@
/* discard a face's autohint globals */
FT_LOCAL_DEF void
FT_LOCAL_DEF( void )
ah_hinter_done_face_globals( AH_Face_Globals* globals )
{
FT_Face face = globals->face;
......@@ -1327,7 +1327,7 @@
/* load and hint a given glyph */
FT_LOCAL_DEF FT_Error
FT_LOCAL_DEF( FT_Error )
ah_hinter_load_glyph( AH_Hinter* hinter,
FT_GlyphSlot slot,
FT_Size size,
......@@ -1381,7 +1381,7 @@
/* retrieve a face's autohint globals for client applications */
FT_LOCAL_DEF void
FT_LOCAL_DEF( void )
ah_hinter_get_global_hints( AH_Hinter* hinter,
FT_Face face,
void** global_hints,
......@@ -1418,7 +1418,7 @@
}
FT_LOCAL_DEF void
FT_LOCAL_DEF( void )
ah_hinter_done_global_hints( AH_Hinter* hinter,
void* global_hints )
{
......
......@@ -37,12 +37,12 @@ FT_BEGIN_HEADER
/* create a new empty hinter object */
FT_LOCAL FT_Error
FT_LOCAL( FT_Error )
ah_hinter_new( FT_Library library,
AH_Hinter** ahinter );
/* Load a hinted glyph in the hinter */
FT_LOCAL FT_Error
FT_LOCAL( FT_Error )
ah_hinter_load_glyph( AH_Hinter* hinter,
FT_GlyphSlot slot,
FT_Size size,
......@@ -50,19 +50,19 @@ FT_BEGIN_HEADER
FT_Int load_flags );
/* finalize a hinter object */
FT_LOCAL void
FT_LOCAL( void )
ah_hinter_done( AH_Hinter* hinter );
FT_LOCAL void
FT_LOCAL( void )
ah_hinter_done_face_globals( AH_Face_Globals* globals );
FT_LOCAL void
FT_LOCAL( void )
ah_hinter_get_global_hints( AH_Hinter* hinter,
FT_Face face,
void** global_hints,
long* global_len );
FT_LOCAL void
FT_LOCAL( void )
ah_hinter_done_global_hints( AH_Hinter* hinter,
void* global_hints );
......
......@@ -1382,9 +1382,9 @@
FT_CMap_Class clazz = cmap->clazz;
FT_Face face = cmap->charmap.face;
FT_Memory memory = FT_FACE_MEMORY(face);
if ( clazz->done )
clazz->done( cmap->data );
clazz->done( cmap );
FREE( cmap );
}
......@@ -1393,15 +1393,15 @@
FT_BASE_DEF( FT_Error )
FT_CMap_New( FT_CMap_Class clazz,
FT_Pointer data,
FT_Pointer init_data,
FT_CharMap charmap,
FT_CMap *acmap )
{
{
FT_Error error = 0;
FT_Face face;
FT_Memory memory;
FT_CMap cmap;
if ( clazz == NULL || charmap == NULL || charmap->face == NULL )
return FT_Err_Invalid_Argument;
......@@ -1412,36 +1412,35 @@
{
cmap->charmap = *charmap;
cmap->clazz = clazz;
cmap->data = data;
if ( clazz->init )
{
error = clazz->init( cmap, data );
error = clazz->init( cmap, init_data );
if (error)
goto Fail;
}
/* add it to our list of charmaps */
if ( REALLOC_ARRAY( face->charmaps,
face->num_charmaps,
face->num_charmaps+1,
FT_CharMap* ) )
goto Fail;
face->charmaps[ face->num_charmaps++ ] = (FT_CharMap) cmap;
}
Exit:
if ( acmap )
*acmap = cmap;
return error;
Fail:
FT_CMap_Done( cmap );
cmap = NULL;
goto Exit;
}
}
/* documentation is in freetype.h */
......@@ -1457,8 +1456,14 @@
result = 0;
if ( face && face->charmap )
{
#ifdef FT_CONFIG_OPTION_USE_CMAPS
FT_CMap cmap = FT_CMAP( face->charmap );
result = cmap->clazz->char_index( cmap, charcode );
#else /* !FT_CONFIG_OPTION_USE_CMAPS */