From cda2d957dc66673ac7d573e72e6aa4c02d407eb2 Mon Sep 17 00:00:00 2001 From: David Turner Date: Thu, 16 Feb 2006 22:45:31 +0000 Subject: [PATCH] * builds/amiga/src/base/ftsystem.c, devel/ftoption.h include/freetype/ftcache.h, include/freetype/ftoutln.h, include/freetype/cache/ftccache.h, include/freetype/cache/ftccmap.h, include/freetype/config/ftoption.h, include/freetype/internal/ftcalc.h, include/freetype/internal/ftdriver.h, include/freetype/internal/ftmemory.h, include/freetype/internal/ftobjs.h, include/freetype/internal/ftrfork.h, include/freetype/internal/psaux.h, include/freetype/internal/sfnt.h, include/freetype/internal/t1types.h, include/freetype/internal/tttypes.h, src/base/ftcalc.c, src/base/ftdbgmem.c, src/base/ftobjs.c, src/base/ftsystem.c, src/base/ftutil.c, src/bdf/bdfdrivr.c, src/cache/ftccache.c, src/cache/ftccback.h, src/cache/ftccmap.c, src/cache/ftcmanag.c, src/cff/cffdrivr.c, src/cid/cidriver.c, src/pcf/pcfdrivr.c, src/pfr/pfrdrivr.c, src/psaux/psauxmod.c, src/sfnt/sfdriver.c, src/truetype/ttdriver.c, src/type1/t1driver.c, src/type1/t1objs.c, src/type42/t42drivr.c, src/winfonts/winfnt.c: massive changes to the internals to respect the internal object layouts and exported functions of FreeType 2.1.7. Note that the cache sub-system cannot be fully retrofitted, unfortunately. --- ChangeLog | 29 ++- builds/amiga/src/base/ftsystem.c | 2 +- devel/ftoption.h | 2 +- include/freetype/cache/ftccache.h | 10 + include/freetype/cache/ftccmap.h | 166 ++--------------- include/freetype/config/ftoption.h | 7 +- include/freetype/ftcache.h | 17 ++ include/freetype/ftoutln.h | 2 +- include/freetype/internal/ftcalc.h | 4 +- include/freetype/internal/ftdriver.h | 61 ++++-- include/freetype/internal/ftmemory.h | 266 +++++++++++++++------------ include/freetype/internal/ftobjs.h | 4 + include/freetype/internal/ftrfork.h | 2 +- include/freetype/internal/psaux.h | 4 +- include/freetype/internal/sfnt.h | 215 ++++++++++++++++++++-- include/freetype/internal/t1types.h | 10 +- include/freetype/internal/tttypes.h | 109 ++++++----- src/base/ftcalc.c | 4 +- src/base/ftdbgmem.c | 40 ++-- src/base/ftobjs.c | 58 +++++- src/base/ftsystem.c | 2 +- src/base/ftutil.c | 137 ++++++++++---- src/bdf/bdfdrivr.c | 17 +- src/cache/ftccache.c | 2 +- src/cache/ftccback.h | 4 +- src/cache/ftccmap.c | 1 + src/cache/ftcmanag.c | 43 +++++ src/cff/cffdrivr.c | 27 +-- src/cid/cidriver.c | 11 +- src/pcf/pcfdrivr.c | 12 +- src/pfr/pfrdrivr.c | 10 +- src/psaux/psauxmod.c | 8 +- src/sfnt/sfdriver.c | 205 +++++++++++++++++---- src/truetype/ttdriver.c | 22 ++- src/type1/t1driver.c | 10 +- src/type1/t1objs.c | 11 +- src/type42/t42drivr.c | 10 +- src/winfonts/winfnt.c | 13 +- 38 files changed, 1035 insertions(+), 522 deletions(-) diff --git a/ChangeLog b/ChangeLog index abd3fe3b9..5fb84f10b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,31 @@ +2006-02-16 David Turner + + * builds/amiga/src/base/ftsystem.c, devel/ftoption.h + include/freetype/ftcache.h, include/freetype/ftoutln.h, + include/freetype/cache/ftccache.h, include/freetype/cache/ftccmap.h, + include/freetype/config/ftoption.h, include/freetype/internal/ftcalc.h, + include/freetype/internal/ftdriver.h, + include/freetype/internal/ftmemory.h, + include/freetype/internal/ftobjs.h, include/freetype/internal/ftrfork.h, + include/freetype/internal/psaux.h, include/freetype/internal/sfnt.h, + include/freetype/internal/t1types.h, include/freetype/internal/tttypes.h, + src/base/ftcalc.c, src/base/ftdbgmem.c, src/base/ftobjs.c, + src/base/ftsystem.c, src/base/ftutil.c, src/bdf/bdfdrivr.c, + src/cache/ftccache.c, src/cache/ftccback.h, src/cache/ftccmap.c, + src/cache/ftcmanag.c, src/cff/cffdrivr.c, src/cid/cidriver.c, + src/pcf/pcfdrivr.c, src/pfr/pfrdrivr.c, src/psaux/psauxmod.c, + src/sfnt/sfdriver.c, src/truetype/ttdriver.c, src/type1/t1driver.c, + src/type1/t1objs.c, src/type42/t42drivr.c, src/winfonts/winfnt.c: + + massive changes to the internals to respect the internal object layouts + and exported functions of FreeType 2.1.7. Note that the cache sub-system + cannot be fully retrofitted, unfortunately. + 2006-02-15 Chia-I Wu * include/freetype/internal/ftobjs.h (FT_Face_InternalRec): Remove unused `max_points' and `max_contours'. - + * src/cid/cidobjs.c (cid_face_init), src/type1/t1objs.c (T1_Face_Init), src/type42/t42objs.c (T42_Face_Init): Update. @@ -127,7 +150,7 @@ src/sfnt/sfdriver.c, src/sfnt/sfnt.c, src/sfnt/sfobjs.c, src/sfnt/ttload.c, src/sfnt/ttload.h, src/sfnt/ttsbit.c, src/sfnt/ttsbit.h, src/sfnt/ttsbit0.c: Clean up the SFNT_Interface. - + * src/sfnt/ttmtx.c, src/sfnt/ttmtx.h: New files. Metrics-related tables' loading and parsing code is moved to here. Move `tt_face_get_metrics' here from the truetype module. The @@ -377,7 +400,7 @@ 2006-01-27 David Turner * builds/unix/configure.ac: Fix build problem on Cygwin. - + * builds/unix/install.mk (install): Don't install the internal headers, and remove existing ones if found in the target install directory. diff --git a/builds/amiga/src/base/ftsystem.c b/builds/amiga/src/base/ftsystem.c index ffedfa026..1eb63df10 100644 --- a/builds/amiga/src/base/ftsystem.c +++ b/builds/amiga/src/base/ftsystem.c @@ -116,7 +116,7 @@ Free_VecPooled( APTR poolHeader, /* */ /* It is not necessary to do any error checking for the */ /* allocation-related functions. This will be done by the higher level */ - /* routines like FT_Alloc() or FT_Realloc(). */ + /* routines like ft_mem_alloc() or ft_mem_realloc(). */ /* */ /*************************************************************************/ diff --git a/devel/ftoption.h b/devel/ftoption.h index 1900d744e..742edb2ad 100644 --- a/devel/ftoption.h +++ b/devel/ftoption.h @@ -567,7 +567,7 @@ FT_BEGIN_HEADER /* * This temporary macro is used to control whether we are going to - * compile certain functions like FT_Alloc in a way that prevents recent + * compile certain functions like ft_mem_alloc in a way that prevents recent * GCC releases from emitting zillions of `strict aliasing' warning * messages each time a memory-management function is called. */ diff --git a/include/freetype/cache/ftccache.h b/include/freetype/cache/ftccache.h index da2e9922f..3bd247683 100644 --- a/include/freetype/cache/ftccache.h +++ b/include/freetype/cache/ftccache.h @@ -82,6 +82,16 @@ FT_BEGIN_HEADER FTC_Node_Destroy( FTC_Node node, FTC_Manager manager ); +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + FT_BASE( void ) + ftc_node_destroy( FTC_Node node, + FTC_Manager manager ); + + FT_BASE( void ) + ftc_node_done( FTC_Node node, + FTC_Manager manager ); + +#endif /*************************************************************************/ /*************************************************************************/ diff --git a/include/freetype/cache/ftccmap.h b/include/freetype/cache/ftccmap.h index 7dbbc5074..0b97704fa 100644 --- a/include/freetype/cache/ftccmap.h +++ b/include/freetype/cache/ftccmap.h @@ -25,64 +25,15 @@ FT_BEGIN_HEADER +/* the FT 2.1.7 Charmap cache interface + * + * unfortunately, it is not possible to implement it in later + * versions, since some function signature changed too significantly + * to do that. + */ - /*************************************************************************/ - /* */ - /*
*/ - /* cache_subsystem */ - /* */ - /*************************************************************************/ +#if 0 - /************************************************************************* - * - * @type: - * FTC_CMapCache - * - * @description: - * An opaque handle used to manager a charmap cache. This cache is to - * hold character codes -> glyph indices mappings. - * - */ - typedef struct FTC_CMapCacheRec_* FTC_CMapCache; - - - /************************************************************************* - * - * @type: - * FTC_CMapDesc - * - * @description: - * A handle to an @FTC_CMapDescRec structure used to describe a given - * charmap in a charmap cache. - * - * Each @FTC_CMapDesc describes which charmap (of which @FTC_FaceID) we - * want to use in @FTC_CMapCache_Lookup. - * - */ - typedef struct FTC_CMapDescRec_* FTC_CMapDesc; - - - /************************************************************************* - * - * @enum: - * FTC_CMapType - * - * @description: - * The list of valid @FTC_CMapDesc types. They indicate how we want to - * address a charmap within an @FTC_FaceID. - * - * @values: - * FTC_CMAP_BY_INDEX :: - * Address a charmap by its index in the corresponding @FT_Face. - * - * FTC_CMAP_BY_ENCODING :: - * Use a @FT_Face charmap that corresponds to a given encoding. - * - * FTC_CMAP_BY_ID :: - * Use an @FT_Face charmap that corresponds to a given - * (platform,encoding) ID. See @FTC_CMapIdRec. - * - */ typedef enum FTC_CMapType_ { FTC_CMAP_BY_INDEX = 0, @@ -92,23 +43,6 @@ FT_BEGIN_HEADER } FTC_CMapType; - /************************************************************************* - * - * @struct: - * FTC_CMapIdRec - * - * @description: - * A short structure to identify a charmap by a (platform,encoding) pair - * of values. - * - * @fields: - * platform :: - * The platform ID. - * - * encoding :: - * The encoding ID. - * - */ typedef struct FTC_CMapIdRec_ { FT_UInt platform; @@ -117,34 +51,6 @@ FT_BEGIN_HEADER } FTC_CMapIdRec; - /************************************************************************* - * - * @struct: - * FTC_CMapDescRec - * - * @description: - * A structure to describe a given charmap to @FTC_CMapCache. - * - * @fields: - * face_id :: - * @FTC_FaceID of the face this charmap belongs to. - * - * type :: - * The type of charmap, see @FTC_CMapType. - * - * u.index :: - * For @FTC_CMAP_BY_INDEX types, this is the charmap index (within a - * @FT_Face) we want to use. - * - * u.encoding :: - * For @FTC_CMAP_BY_ENCODING types, this is the charmap encoding we - * want to use. see @FT_Encoding. - * - * u.id :: - * For @FTC_CMAP_BY_ID types, this is the (platform,encoding) pair we - * want to use. see @FTC_CMapIdRec and @FT_CharMapRec. - * - */ typedef struct FTC_CMapDescRec_ { FTC_FaceID face_id; @@ -158,73 +64,25 @@ FT_BEGIN_HEADER } u; - } FTC_CMapDescRec; + } FTC_CMapDescRec, *FTC_CMapDesc; - /************************************************************************* - * - * @function: - * FTC_CMapCache_New - * - * @description: - * Creates a new charmap cache. - * - * @input: - * manager :: - * A handle to the cache manager. - * - * @output: - * acache :: - * A new cache handle. NULL in case of error. - * - * @return: - * FreeType error code. 0 means success. - * - * @note: - * Like all other caches, this one will be destroyed with the cache - * manager. - * - */ +#if 0 FT_EXPORT( FT_Error ) FTC_CMapCache_New( FTC_Manager manager, FTC_CMapCache *acache ); - /************************************************************************* - * - * @function: - * FTC_CMapCache_Lookup - * - * @description: - * Translates a character code into a glyph index, using the charmap - * cache. - * - * @input: - * cache :: - * A charmap cache handle. - * - * cmap_desc :: - * A charmap descriptor handle. - * - * char_code :: - * The character code (in the corresponding charmap). - * - * @return: - * Glyph index. 0 means `no glyph'. - * - * @note: - * This function doesn't return @FTC_Node handles, since there is no - * real use for them with typical uses of charmaps. - * - */ FT_EXPORT( FT_UInt ) FTC_CMapCache_Lookup( FTC_CMapCache cache, FTC_CMapDesc cmap_desc, FT_UInt32 char_code ); +#endif + +#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ /* */ - FT_END_HEADER diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index dae8feacf..33704092b 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -583,12 +583,17 @@ FT_BEGIN_HEADER /* * This temporary macro is used to control whether we are going to - * compile certain functions like FT_Alloc in a way that prevents recent + * compile certain functions like ft_mem_alloc in a way that prevents recent * GCC releases from emitting zillions of `strict aliasing' warning * messages each time a memory-management function is called. */ #define FT_STRICT_ALIASING +/* define this variable if you want to keep the layout of internal structures + * that was used prior to FreeType 2.2. This also compiles in a few obsolete + * functions to avoid linking problems on typical Unix distributions + */ +#define FT_CONFIG_OPTION_OLD_INTERNALS FT_END_HEADER diff --git a/include/freetype/ftcache.h b/include/freetype/ftcache.h index ca8982b97..fdc6b945c 100644 --- a/include/freetype/ftcache.h +++ b/include/freetype/ftcache.h @@ -829,6 +829,23 @@ FT_BEGIN_HEADER /* */ +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + + FT_EXPORT( FT_Error ) + FTC_Manager_Lookup_Face( FTC_Manager manager, + FTC_FaceID face_id, + FT_Face *aface ); + + FT_EXPORT( FT_Error ) + FTC_Manager_Lookup_Size( FTC_Manager manager, + FTC_Font font, + FT_Face *aface, + FT_Size *asize ); + +#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ + + /* */ + FT_END_HEADER #endif /* __FTCACHE_H__ */ diff --git a/include/freetype/ftoutln.h b/include/freetype/ftoutln.h index dbe8edc8a..96412d3e9 100644 --- a/include/freetype/ftoutln.h +++ b/include/freetype/ftoutln.h @@ -176,7 +176,7 @@ FT_BEGIN_HEADER /* descriptor will be released. */ /* */ /* The reason why this function takes an `library' parameter is */ - /* simply to use FT_Free(). */ + /* simply to use ft_mem_free(). */ /* */ FT_EXPORT( FT_Error ) FT_Outline_Done( FT_Library library, diff --git a/include/freetype/internal/ftcalc.h b/include/freetype/internal/ftcalc.h index 7cfd9a333..1fe2f7b9b 100644 --- a/include/freetype/internal/ftcalc.h +++ b/include/freetype/internal/ftcalc.h @@ -48,7 +48,7 @@ FT_BEGIN_HEADER FT_SqrtFixed( FT_Int32 x ); -#if 0 +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS /*************************************************************************/ /* */ @@ -68,7 +68,7 @@ FT_BEGIN_HEADER FT_EXPORT( FT_Int32 ) FT_Sqrt32( FT_Int32 x ); -#endif /* 0 */ +#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ /*************************************************************************/ diff --git a/include/freetype/internal/ftdriver.h b/include/freetype/internal/ftdriver.h index 89a92ab7e..dd86db9ca 100644 --- a/include/freetype/internal/ftdriver.h +++ b/include/freetype/internal/ftdriver.h @@ -59,6 +59,19 @@ FT_BEGIN_HEADER typedef FT_Error (*FT_Size_SelectFunc)( FT_Size size, FT_ULong size_index ); +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + typedef FT_Error + (*FT_Size_ResetPointsFunc)( FT_Size size, + FT_F26Dot6 char_width, + FT_F26Dot6 char_height, + FT_UInt horz_resolution, + FT_UInt vert_resolution ); + + typedef FT_Error + (*FT_Size_ResetPixelsFunc)( FT_Size size, + FT_UInt pixel_width, + FT_UInt pixel_height ); +#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ typedef FT_Error (*FT_Slot_LoadFunc)( FT_GlyphSlot slot, @@ -125,15 +138,6 @@ FT_BEGIN_HEADER /* */ /* done_slot :: The format-specific slot destructor. */ /* */ - /* request_size :: A handle to a function used to request the new */ - /* character size. Can be set to 0 if the */ - /* scaling done in the base layer suffices. */ - /* */ - /* select_size :: A handle to a function used to select a new */ - /* fixed size. It is used only if */ - /* @FT_FACE_FLAG_FIXED_SIZES is set. Can be set */ - /* to 0 if the scaling done in the base layer */ - /* suffices. */ /* */ /* load_glyph :: A function handle to load a glyph to a slot. */ /* This field is mandatory! */ @@ -163,6 +167,15 @@ FT_BEGIN_HEADER /* device-independent text layout without loading */ /* a single glyph image. */ /* */ + /* request_size :: A handle to a function used to request the new */ + /* character size. Can be set to 0 if the */ + /* scaling done in the base layer suffices. */ + /* */ + /* select_size :: A handle to a function used to select a new */ + /* fixed size. It is used only if */ + /* @FT_FACE_FLAG_FIXED_SIZES is set. Can be set */ + /* to 0 if the scaling done in the base layer */ + /* suffices. */ /* */ /* Most function pointers, with the exception of `load_glyph' and */ /* `get_char_index' can be set to 0 to indicate a default behaviour. */ @@ -184,8 +197,10 @@ FT_BEGIN_HEADER FT_Slot_InitFunc init_slot; FT_Slot_DoneFunc done_slot; - FT_Size_RequestFunc request_size; - FT_Size_SelectFunc select_size; +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + FT_Size_ResetPointsFunc set_char_sizes; + FT_Size_ResetPixelsFunc set_pixel_sizes; +#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ FT_Slot_LoadFunc load_glyph; @@ -193,9 +208,33 @@ FT_BEGIN_HEADER FT_Face_AttachFunc attach_file; FT_Face_GetAdvancesFunc get_advances; + /* since FT 2.2. */ + FT_Size_RequestFunc request_size; + FT_Size_SelectFunc select_size; + } FT_Driver_ClassRec, *FT_Driver_Class; +/* the following are used as stubs for 'set_char_sizes' + * and 'set_pixel_sizes'. their implementation uses + * 'request_size' and 'select_size' functions instead + * + * implementation is in src/base/ftobjs.c + */ +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + FT_BASE( FT_Error ) + ft_stub_set_char_sizes( FT_Size size, + FT_F26Dot6 width, + FT_F26Dot6 height, + FT_UInt horz_res, + FT_UInt vert_res ); + + FT_BASE( FT_Error ) + ft_stub_set_pixel_sizes( FT_Size size, + FT_UInt width, + FT_UInt height ); +#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ + FT_END_HEADER #endif /* __FTDRIVER_H__ */ diff --git a/include/freetype/internal/ftmemory.h b/include/freetype/internal/ftmemory.h index 40703d5d3..0114ffa80 100644 --- a/include/freetype/internal/ftmemory.h +++ b/include/freetype/internal/ftmemory.h @@ -67,90 +67,90 @@ FT_BEGIN_HEADER */ FT_BASE( FT_Pointer ) - FT_Alloc( FT_Memory memory, - FT_Long size, - FT_Error *p_error ); + ft_mem_alloc( FT_Memory memory, + FT_Long size, + FT_Error *p_error ); FT_BASE( FT_Pointer ) - FT_QAlloc( FT_Memory memory, - FT_Long size, - FT_Error *p_error ); + ft_mem_qalloc( FT_Memory memory, + FT_Long size, + FT_Error *p_error ); FT_BASE( FT_Pointer ) - FT_Realloc( FT_Memory memory, - FT_Long current, - FT_Long size, - void* block, - FT_Error *p_error ); + ft_mem_realloc( FT_Memory memory, + FT_Long current, + FT_Long size, + void* block, + FT_Error *p_error ); FT_BASE( FT_Pointer ) - FT_QRealloc( FT_Memory memory, - FT_Long current, - FT_Long size, - void* block, - FT_Error *p_error ); + ft_mem_qrealloc( FT_Memory memory, + FT_Long current, + FT_Long size, + void* block, + FT_Error *p_error ); FT_BASE( void ) - FT_Free( FT_Memory memory, - const void* P ); + ft_mem_free( FT_Memory memory, + const void* P ); #ifdef FT_DEBUG_MEMORY FT_BASE( FT_Pointer ) - FT_Alloc_Debug( FT_Memory memory, - FT_Long size, - FT_Error *p_error, - const char* file_name, - FT_Long line_no ); + ft_mem_alloc_debug( FT_Memory memory, + FT_Long size, + FT_Error *p_error, + const char* file_name, + FT_Long line_no ); FT_BASE( FT_Pointer ) - FT_QAlloc_Debug( FT_Memory memory, - FT_Long size, - FT_Error *p_error, - const char* file_name, - FT_Long line_no ); + ft_mem_qalloc_debug( FT_Memory memory, + FT_Long size, + FT_Error *p_error, + const char* file_name, + FT_Long line_no ); FT_BASE( FT_Pointer ) - FT_Realloc_Debug( FT_Memory memory, - FT_Long current, - FT_Long size, - void* P, - FT_Error *p_error, - const char* file_name, - FT_Long line_no ); + ft_mem_realloc_debug( FT_Memory memory, + FT_Long current, + FT_Long size, + void* P, + FT_Error *p_error, + const char* file_name, + FT_Long line_no ); FT_BASE( FT_Pointer ) - FT_QRealloc_Debug( FT_Memory memory, - FT_Long current, - FT_Long size, - void* P, - FT_Error *p_error, + ft_mem_qrealloc_debug( FT_Memory memory, + FT_Long current, + FT_Long size, + void* P, + FT_Error *p_error, + const char* file_name, + FT_Long line_no ); + + FT_BASE( void ) + ft_mem_free_debug( FT_Memory memory, + const void *P, const char* file_name, FT_Long line_no ); - FT_BASE( void ) - FT_Free_Debug( FT_Memory memory, - const void *P, - const char* file_name, - FT_Long line_no ); - #define FT_MEM_ALLOC( _pointer_, _size_ ) \ - (_pointer_) = FT_Alloc_Debug( memory, _size_, &error, \ + (_pointer_) = ft_mem_alloc_debug( memory, _size_, &error, \ __FILE__, __LINE__ ) #define FT_MEM_REALLOC( _pointer_, _current_, _size_ ) \ - (_pointer_) = FT_Realloc_Debug( memory, _current_, _size_, \ + (_pointer_) = ft_mem_realloc_debug( memory, _current_, _size_, \ (_pointer_), &error, \ __FILE__, __LINE__ ) #define FT_MEM_QALLOC( _pointer_, _size_ ) \ - (_pointer_) = FT_QAlloc_Debug( memory, _size_, &error, \ + (_pointer_) = ft_mem_qalloc_debug( memory, _size_, &error, \ __FILE__, __LINE__ ) #define FT_MEM_QREALLOC( _pointer_, _current_, _size_ ) \ - (_pointer_) = FT_QRealloc_Debug( memory, _current_, _size_, \ + (_pointer_) = ft_mem_qrealloc_debug( memory, _current_, _size_, \ (_pointer_), &error, \ __FILE__, __LINE__ ) @@ -158,7 +158,7 @@ FT_BEGIN_HEADER FT_BEGIN_STMNT \ if ( _pointer_ ) \ { \ - FT_Free_Debug( memory, (_pointer_), __FILE__, __LINE__ ); \ + ft_mem_free_debug( memory, (_pointer_), __FILE__, __LINE__ ); \ (_pointer_) = NULL; \ } \ FT_END_STMNT @@ -168,26 +168,26 @@ FT_BEGIN_HEADER #define FT_MEM_ALLOC( _pointer_, _size_ ) \ - (_pointer_) = FT_Alloc( memory, _size_, &error ) + (_pointer_) = ft_mem_alloc( memory, _size_, &error ) #define FT_MEM_FREE( _pointer_ ) \ FT_BEGIN_STMNT \ if ( (_pointer_) ) \ { \ - FT_Free( memory, (_pointer_) ); \ + ft_mem_free( memory, (_pointer_) ); \ (_pointer_) = NULL; \ } \ FT_END_STMNT #define FT_MEM_REALLOC( _pointer_, _current_, _size_ ) \ - (_pointer_) = FT_Realloc( memory, _current_, _size_, \ + (_pointer_) = ft_mem_realloc( memory, _current_, _size_, \ (_pointer_), &error ) #define FT_MEM_QALLOC( _pointer_, _size_ ) \ - (_pointer_) = FT_QAlloc( memory, _size_, &error ) + (_pointer_) = ft_mem_qalloc( memory, _size_, &error ) #define FT_MEM_QREALLOC( _pointer_, _current_, _size_ ) \ - (_pointer_) = FT_QRealloc( memory, _current_, _size_, \ + (_pointer_) = ft_mem_qrealloc( memory, _current_, _size_, \ (_pointer_), &error ) #endif /* !FT_DEBUG_MEMORY */ @@ -203,40 +203,40 @@ FT_BEGIN_HEADER FT_BASE( FT_Error ) - FT_Alloc_Debug( FT_Memory memory, - FT_Long size, - void* *P, - const char* file_name, - FT_Long line_no ); + ft_mem_alloc_debug( FT_Memory memory, + FT_Long size, + void* *P, + const char* file_name, + FT_Long line_no ); FT_BASE( FT_Error ) - FT_QAlloc_Debug( FT_Memory memory, - FT_Long size, - void* *P, - const char* file_name, - FT_Long line_no ); + ft_mem_qalloc_debug( FT_Memory memory, + FT_Long size, + void* *P, + const char* file_name, + FT_Long line_no ); FT_BASE( FT_Error ) - FT_Realloc_Debug( FT_Memory memory, - FT_Long current, - FT_Long size, - void* *P, - const char* file_name, - FT_Long line_no ); + ft_mem_realloc_debug( FT_Memory memory, + FT_Long current, + FT_Long size, + void* *P, + const char* file_name, + FT_Long line_no ); FT_BASE( FT_Error ) - FT_QRealloc_Debug( FT_Memory memory, - FT_Long current, - FT_Long size, - void* *P, - const char* file_name, - FT_Long line_no ); + ft_mem_qrealloc_debug( FT_Memory memory, + FT_Long current, + FT_Long size, + void* *P, + const char* file_name, + FT_Long line_no ); FT_BASE( void ) - FT_Free_Debug( FT_Memory memory, - FT_Pointer block, - const char* file_name, - FT_Long line_no ); + ft_mem_free_debug( FT_Memory memory, + FT_Pointer block, + const char* file_name, + FT_Long line_no ); #endif /* FT_DEBUG_MEMORY */ @@ -245,7 +245,7 @@ FT_BEGIN_HEADER /*************************************************************************/ /* */ /* */ - /* FT_Alloc */ + /* ft_mem_alloc */ /* */ /* */ /* Allocates a new block of memory. The returned area is always */ @@ -265,15 +265,15 @@ FT_BEGIN_HEADER /* FreeType error code. 0 means success. */ /* */ FT_BASE( FT_Error ) - FT_Alloc( FT_Memory memory, - FT_Long size, - void* *P ); + ft_mem_alloc( FT_Memory memory, + FT_Long size, + void* *P ); /*************************************************************************/ /* */ /* */ - /* FT_QAlloc */ + /* ft_mem_qalloc */ /* */ /* */ /* Allocates a new block of memory. The returned area is *not* */ @@ -293,15 +293,15 @@ FT_BEGIN_HEADER /* FreeType error code. 0 means success. */ /* */ FT_BASE( FT_Error ) - FT_QAlloc( FT_Memory memory, - FT_Long size, - void* *p ); + ft_mem_qalloc( FT_Memory memory, + FT_Long size, + void* *p ); /*************************************************************************/ /* */ /* */ - /* FT_Realloc */ + /* ft_mem_realloc */ /* */ /* */ /* Reallocates a block of memory pointed to by `*P' to `Size' bytes */ @@ -324,20 +324,20 @@ FT_BEGIN_HEADER /* FreeType error code. 0 means success. */ /* */ /* */ - /* All callers of FT_Realloc() _must_ provide the current block size */ - /* as well as the new one. */ + /* All callers of ft_mem_realloc() _must_ provide the current block */ + /* size as well as the new one. */ /* */ FT_BASE( FT_Error ) - FT_Realloc( FT_Memory memory, - FT_Long current, - FT_Long size, - void* *P ); + ft_mem_realloc( FT_Memory memory, + FT_Long current, + FT_Long size, + void* *P ); /*************************************************************************/ /* */ /* */ - /* FT_QRealloc */ + /* ft_mem_qrealloc */ /* */ /* */ /* Reallocates a block of memory pointed to by `*P' to `Size' bytes */ @@ -360,23 +360,23 @@ FT_BEGIN_HEADER /* FreeType error code. 0 means success. */ /* */ /* */ - /* All callers of FT_Realloc() _must_ provide the current block size */ - /* as well as the new one. */ + /* All callers of ft_mem_realloc() _must_ provide the current block */ + /* size as well as the new one. */ /* */ FT_BASE( FT_Error ) - FT_QRealloc( FT_Memory memory, - FT_Long current, - FT_Long size, - void* *p ); + ft_mem_qrealloc( FT_Memory memory, + FT_Long current, + FT_Long size, + void* *p ); /*************************************************************************/ /* */ /* */ - /* FT_Free */ + /* ft_mem_free */ /* */ /* */ - /* Releases a given block of memory allocated through FT_Alloc(). */ + /* Releases a given block of memory allocated through ft_mem_alloc(). */ /* */ /* */ /* memory :: A handle to a given `memory object' which handles */ @@ -391,35 +391,35 @@ FT_BEGIN_HEADER /* drivers. */ /* */ FT_BASE( void ) - FT_Free( FT_Memory memory, - void* *P ); + ft_mem_free( FT_Memory memory, + void* *P ); #ifdef FT_DEBUG_MEMORY #define FT_MEM_ALLOC( _pointer_, _size_ ) \ - FT_Alloc_Debug( memory, _size_, \ + ft_mem_alloc_debug( memory, _size_, \ (void**)(void*)&(_pointer_), \ __FILE__, __LINE__ ) #define FT_MEM_REALLOC( _pointer_, _current_, _size_ ) \ - FT_Realloc_Debug( memory, _current_, _size_, \ + ft_mem_realloc_debug( memory, _current_, _size_, \ (void**)(void*)&(_pointer_), \ __FILE__, __LINE__ ) #define FT_MEM_QALLOC( _pointer_, _size_ ) \ - FT_QAlloc_Debug( memory, _size_, \ + ft_mem_qalloc_debug( memory, _size_, \ (void**)(void*)&(_pointer_), \ __FILE__, __LINE__ ) #define FT_MEM_QREALLOC( _pointer_, _current_, _size_ ) \ - FT_QRealloc_Debug( memory, _current_, _size_, \ + ft_mem_qrealloc_debug( memory, _current_, _size_, \ (void**)(void*)&(_pointer_), \ __FILE__, __LINE__ ) #define FT_MEM_FREE( _pointer_ ) \ - FT_Free_Debug( memory, (void**)(void*)&(_pointer_), \ + ft_mem_free_debug( memory, (void**)(void*)&(_pointer_), \ __FILE__, __LINE__ ) @@ -427,23 +427,23 @@ FT_BEGIN_HEADER #define FT_MEM_ALLOC( _pointer_, _size_ ) \ - FT_Alloc( memory, _size_, \ + ft_mem_alloc( memory, _size_, \ (void**)(void*)&(_pointer_) ) #define FT_MEM_FREE( _pointer_ ) \ - FT_Free( memory, \ + ft_mem_free( memory, \ (void**)(void*)&(_pointer_) ) #define FT_MEM_REALLOC( _pointer_, _current_, _size_ ) \ - FT_Realloc( memory, _current_, _size_, \ + ft_mem_realloc( memory, _current_, _size_, \ (void**)(void*)&(_pointer_) ) #define FT_MEM_QALLOC( _pointer_, _size_ ) \ - FT_QAlloc( memory, _size_, \ + ft_mem_qalloc( memory, _size_, \ (void**)(void*)&(_pointer_) ) #define FT_MEM_QREALLOC( _pointer_, _current_, _size_ ) \ - FT_QRealloc( memory, _current_, _size_, \ + ft_mem_qrealloc( memory, _current_, _size_, \ (void**)(void*)&(_pointer_) ) @@ -580,6 +580,36 @@ FT_BEGIN_HEADER (_new_) * sizeof ( _type_ ) ) +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + + FT_BASE( FT_Error ) + FT_Alloc( FT_Memory memory, + FT_Long size, + void* *P ); + + FT_BASE( FT_Error ) + FT_QAlloc( FT_Memory memory, + FT_Long size, + void* *p ); + + FT_BASE( FT_Error ) + FT_Realloc( FT_Memory memory, + FT_Long current, + FT_Long size, + void* *P ); + + FT_BASE( FT_Error ) + FT_QRealloc( FT_Memory memory, + FT_Long current, + FT_Long size, + void* *p ); + FT_BASE( void ) + FT_Free( FT_Memory memory, + void* *P ); + +#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ + + /* */ diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index 4da978931..133f36007 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -213,6 +213,10 @@ FT_BEGIN_HEADER /* */ typedef struct FT_Face_InternalRec_ { +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + FT_UShort reserved1; + FT_Short reserved2; +#endif FT_Matrix transform_matrix; FT_Vector transform_delta; FT_Int transform_flags; diff --git a/include/freetype/internal/ftrfork.h b/include/freetype/internal/ftrfork.h index e7b10024a..490949111 100644 --- a/include/freetype/internal/ftrfork.h +++ b/include/freetype/internal/ftrfork.h @@ -154,7 +154,7 @@ FT_BEGIN_HEADER /* offsets :: */ /* The stream offsets for the resource data specified by `tag'. */ /* This array is allocated by the function, so you have to call */ - /* @FT_Free after use. */ + /* @ft_mem_free after use. */ /* */ /* count :: */ /* The length of offsets array. */ diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index 7ca47d8c9..43017dd07 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -784,7 +784,6 @@ FT_BEGIN_HEADER const PS_Parser_FuncsRec* ps_parser_funcs; const T1_Builder_FuncsRec* t1_builder_funcs; const T1_Decoder_FuncsRec* t1_decoder_funcs; - const AFM_Parser_FuncsRec* afm_parser_funcs; void (*t1_decrypt)( FT_Byte* buffer, @@ -793,6 +792,9 @@ FT_BEGIN_HEADER T1_CMap_Classes t1_cmap_classes; + /* fields from here were added after 2.1.10 */ + const AFM_Parser_FuncsRec* afm_parser_funcs; + } PSAux_ServiceRec, *PSAux_Service; /* backwards-compatible type definition */ diff --git a/include/freetype/internal/sfnt.h b/include/freetype/internal/sfnt.h index 1da799fc2..27d76c046 100644 --- a/include/freetype/internal/sfnt.h +++ b/include/freetype/internal/sfnt.h @@ -125,6 +125,75 @@ FT_BEGIN_HEADER (*TT_Done_Face_Func)( TT_Face face ); +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + /*************************************************************************/ + /* */ + /* */ + /* TT_Load_SFNT_HeaderRec_Func */ + /* */ + /* */ + /* Loads the header of a SFNT font file. Supports collections. */ + /* */ + /* */ + /* face :: A handle to the target face object. */ + /* */ + /* stream :: The input stream. */ + /* */ + /* face_index :: The index of the TrueType font, if we are opening a */ + /* collection. */ + /* */ + /* */ + /* sfnt :: The SFNT header. */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ + /* */ + /* The stream cursor must be at the font file's origin. */ + /* */ + /* This function recognizes fonts embedded in a `TrueType */ + /* collection'. */ + /* */ + /* This function checks that the header is valid by looking at the */ + /* values of `search_range', `entry_selector', and `range_shift'. */ + /* */ + typedef FT_Error + (*TT_Load_SFNT_HeaderRec_Func)( TT_Face face, + FT_Stream stream, + FT_Long face_index, + SFNT_Header sfnt ); + + + + /*************************************************************************/ + /* */ + /* */ + /* TT_Load_Directory_Func */ + /* */ + /* */ + /* Loads the table directory into a face object. */ + /* */ + /* */ + /* face :: A handle to the target face object. */ + /* */ + /* stream :: The input stream. */ + /* */ + /* sfnt :: The SFNT header. */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ + /* */ + /* The stream cursor must be on the first byte after the 4-byte font */ + /* format tag. This is the case just after a call to */ + /* TT_Load_Format_Tag(). */ + /* */ + typedef FT_Error + (*TT_Load_Directory_Func)( TT_Face face, + FT_Stream stream, + SFNT_Header sfnt ); +#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ + /*************************************************************************/ /* */ /* */ @@ -292,6 +361,85 @@ FT_BEGIN_HEADER TT_SBit_MetricsRec *ametrics ); +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + /*************************************************************************/ + /* */ + /* */ + /* TT_Set_SBit_Strike_OldFunc */ + /* */ + /* */ + /* Select an sbit strike for a given size request. */ + /* */ + /* */ + /* face :: The target face object. */ + /* */ + /* req :: The size request. */ + /* */ + /* */ + /* astrike_index :: The index of the sbit strike. */ + /* */ + /* */ + /* FreeType error code. 0 means success. Returns an error if no */ + /* sbit strike exists for the selected ppem values. */ + /* */ + typedef FT_Error + (*TT_Set_SBit_Strike_OldFunc)( TT_Face face, + FT_UInt x_ppem, + FT_UInt y_ppem, + FT_ULong* astrike_index ); + + /*************************************************************************/ + /* */ + /* */ + /* TT_CharMap_Load_Func */ + /* */ + /* */ + /* Loads a given TrueType character map into memory. */ + /* */ + /* */ + /* face :: A handle to the parent face object. */ + /* */ + /* stream :: A handle to the current stream object. */ + /* */ + /* */ + /* cmap :: A pointer to a cmap object. */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ + /* */ + /* The function assumes that the stream is already in use (i.e., */ + /* opened). In case of error, all partially allocated tables are */ + /* released. */ + /* */ + typedef FT_Error + (*TT_CharMap_Load_Func)( TT_Face face, + void* cmap, + FT_Stream input ); + + + /*************************************************************************/ + /* */ + /* */ + /* TT_CharMap_Free_Func */ + /* */ + /* */ + /* Destroys a character mapping table. */ + /* */ + /* */ + /* face :: A handle to the parent face object. */ + /* */ + /* cmap :: A handle to a cmap object. */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ + typedef FT_Error + (*TT_CharMap_Free_Func)( TT_Face face, + void* cmap ); + +#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ + /*************************************************************************/ /* */ /* */ @@ -503,50 +651,81 @@ FT_BEGIN_HEADER FT_Module_Requester get_interface; TT_Load_Any_Func load_any; - - /* load the font directory, i.e., the offset table and */ - /* the table directory */ - TT_Load_Table_Func load_font_dir; +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + TT_Load_SFNT_HeaderRec_Func load_sfnt_header; + TT_Load_Directory_Func load_directory; +#endif /* these functions are called by `load_face' but they can also */ /* be called from external modules, if there is a need to do so */ TT_Load_Table_Func load_head; TT_Load_Metrics_Func load_hhea; - TT_Load_Metrics_Func load_hmtx; TT_Load_Table_Func load_cmap; TT_Load_Table_Func load_maxp; TT_Load_Table_Func load_os2; TT_Load_Table_Func load_post; + TT_Load_Table_Func load_name; TT_Free_Table_Func free_name; /* optional tables */ - TT_Load_Table_Func load_kern; +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + TT_Load_Table_Func load_hdmx_stub; + TT_Free_Table_Func free_hdmx_stub; +#endif + TT_Load_Table_Func load_kern; /* a.k.a load_kerning <= 2.1.10 */ + TT_Load_Table_Func load_gasp; TT_Load_Table_Func load_pclt; /* see `ttload.h' */ - TT_Load_Table_Func load_bhed; + TT_Load_Table_Func load_bhed; /* a.k.a load_bitmap_header <= 2.1.10 */ /* see `ttsbit.h' */ - TT_Load_Table_Func load_eblc; - TT_Free_Table_Func free_eblc; +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + TT_Set_SBit_Strike_OldFunc set_sbit_strike_stub; + TT_Load_Table_Func load_sbits_stub; +#endif - TT_Set_SBit_Strike_Func set_sbit_strike; - TT_Load_Strike_Metrics_Func load_strike_metrics; - TT_Find_SBit_Image_Func find_sbit_image; - TT_Load_SBit_Metrics_Func load_sbit_metrics; TT_Load_SBit_Image_Func load_sbit_image; - - /* see `ttkern.h' */ - TT_Face_GetKerningFunc get_kerning; - - TT_Get_Metrics_Func get_metrics; +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + TT_Free_Table_Func free_sbits_stub; +#endif /* see `ttpost.h' */ TT_Get_PS_Name_Func get_psname; TT_Free_Table_Func free_psnames; +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS /* the following disappeared in 2.1.8, but were there before */ + TT_CharMap_Load_Func load_charmap_stub; + TT_CharMap_Free_Func free_charmap_stub; +#endif + + /* from here, the structure differs from 2.1.7 */ + + /* since FT 2.1.8, but appeared before 'get_psname' */ + TT_Face_GetKerningFunc get_kerning; + + /* the following appeared in 2.1.8, but were placed + * between 'load_sbits' and 'load_sbit_image'. BOOOOH + */ + TT_Find_SBit_Image_Func find_sbit_image; /* NULL if FT_OPTIMIZE_MEMORY */ + TT_Load_SBit_Metrics_Func load_sbit_metrics; /* NULL if FT_OPTIMIZE_MEMORY */ + + /* since FreeType 2.2 */ + /* load the font directory, i.e., the offset table and */ + /* the table directory */ + TT_Load_Table_Func load_font_dir; + TT_Load_Metrics_Func load_hmtx; + + TT_Load_Table_Func load_eblc; + TT_Free_Table_Func free_eblc; + + TT_Set_SBit_Strike_Func set_sbit_strike; + TT_Load_Strike_Metrics_Func load_strike_metrics; + + TT_Get_Metrics_Func get_metrics; + } SFNT_Interface; diff --git a/include/freetype/internal/t1types.h b/include/freetype/internal/t1types.h index 66bf0d999..d66d10974 100644 --- a/include/freetype/internal/t1types.h +++ b/include/freetype/internal/t1types.h @@ -200,7 +200,9 @@ FT_BEGIN_HEADER const void* afm_data; FT_CharMapRec charmaprecs[2]; FT_CharMap charmaps[2]; - PS_UnicodesRec unicode_map; +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + PS_Unicodes unicode_map; /* apparently unused, keep for old internals */ +#endif /* support for Multiple Masters fonts */ PS_Blend blend; @@ -218,13 +220,15 @@ FT_BEGIN_HEADER void* psaux; CID_FaceInfoRec cid; void* afm_data; - FT_Byte* binary_data; /* used if hex data has been converted */ - FT_Stream cid_stream; CID_Subrs subrs; /* since FT 2.1 - interface to PostScript hinter */ void* pshinter; + /* since FT 2.1.8, but was originally after 'afm_data' */ + FT_Byte* binary_data; /* used if hex data has been converted */ + FT_Stream cid_stream; + } CID_FaceRec; diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h index 4b6b88dd1..3e71b308a 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -311,7 +311,7 @@ FT_BEGIN_HEADER } TT_GaspRec; -#ifndef FT_OPTIMIZE_MEMORY +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS /*************************************************************************/ /* */ @@ -389,7 +389,7 @@ FT_BEGIN_HEADER } TT_Kern0_PairRec, *TT_Kern0_Pair; -#endif /* !OPTIMIZE_MEMORY */ +#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ /*************************************************************************/ @@ -1267,19 +1267,14 @@ FT_BEGIN_HEADER TT_Header header; /* TrueType header table */ TT_HoriHeader horizontal; /* TrueType horizontal header */ -#ifdef FT_OPTIMIZE_MEMORY - FT_Byte* horz_metrics; - FT_ULong horz_metrics_size; -#endif TT_MaxProfile max_profile; +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + FT_ULong max_components; /* stubbed to 0 */ +#endif FT_Bool vertical_info; TT_VertHeader vertical; /* TT Vertical header, if present */ -#ifdef FT_OPTIMIZE_MEMORY - FT_Byte* vert_metrics; - FT_ULong vert_metrics_size; -#endif FT_UShort num_names; /* number of name records */ TT_NameTableRec name_table; /* name table */ @@ -1314,13 +1309,7 @@ FT_BEGIN_HEADER /***********************************************************************/ /* horizontal device metrics */ -#ifdef FT_OPTIMIZE_MEMORY - FT_Byte* hdmx_table; - FT_ULong hdmx_table_size; - FT_UInt hdmx_record_count; - FT_ULong hdmx_record_size; - FT_Byte* hdmx_record_sizes; -#else +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS TT_HdmxRec hdmx; #endif @@ -1331,11 +1320,7 @@ FT_BEGIN_HEADER TT_PCLT pclt; /* embedded bitmaps support */ -#ifdef FT_OPTIMIZE_MEMORY - FT_Byte* sbit_table; - FT_ULong sbit_table_size; - FT_UInt sbit_num_strikes; -#else +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS FT_ULong num_sbit_strikes; TT_SBit_Strike sbit_strikes; #endif @@ -1354,16 +1339,11 @@ FT_BEGIN_HEADER /***********************************************************************/ /* the glyph locations */ -#ifdef FT_OPTIMIZE_MEMORY - FT_UInt num_locations; - FT_Byte* glyph_locations; -#else - FT_UShort num_locations; - FT_Long* glyph_locations; +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + FT_UShort num_locations_stub; + FT_Long* glyph_locations_stub; #endif - FT_ULong glyf_len; - /* the font program, if any */ FT_ULong font_program_size; FT_Byte* font_program; @@ -1376,13 +1356,7 @@ FT_BEGIN_HEADER FT_ULong cvt_size; FT_Short* cvt; -#ifdef FT_OPTIMIZE_MEMORY - FT_Byte* kern_table; - FT_ULong kern_table_size; - FT_UInt num_kern_tables; - FT_UInt32 kern_avail_bits; - FT_UInt32 kern_order_bits; -#else +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS /* the format 0 kerning table, if any */ FT_Int num_kern_pairs; FT_Int kern_table_index; @@ -1398,15 +1372,6 @@ FT_BEGIN_HEADER FT_Bool unpatented_hinting; #endif -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - FT_Bool doblend; - GX_Blend blend; -#endif - -#ifdef TT_CONFIG_OPTION_BDF - TT_BDFRec bdf; -#endif /* TT_CONFIG_OPTION_BDF */ - /***********************************************************************/ /* */ /* Other tables or fields. This is used by derivative formats like */ @@ -1418,6 +1383,48 @@ FT_BEGIN_HEADER const char* postscript_name; + /* since FreeType 2.1.8, but was originally placed after 'glyph_locations_stub' */ + FT_ULong glyf_len; + + /* since FreeType 2.1.8, but was originally placed before 'extra' */ +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + FT_Bool doblend; + GX_Blend blend; +#endif + + /* since FreeType 2.2 */ + +#ifdef FT_OPTIMIZE_MEMORY + FT_Byte* horz_metrics; + FT_ULong horz_metrics_size; + + FT_Byte* vert_metrics; + FT_ULong vert_metrics_size; + + FT_UInt num_locations; + FT_Byte* glyph_locations; + + FT_Byte* hdmx_table; + FT_ULong hdmx_table_size; + FT_UInt hdmx_record_count; + FT_ULong hdmx_record_size; + FT_Byte* hdmx_record_sizes; + + FT_Byte* sbit_table; + FT_ULong sbit_table_size; + FT_UInt sbit_num_strikes; + + FT_Byte* kern_table; + FT_ULong kern_table_size; + FT_UInt num_kern_tables; + FT_UInt32 kern_avail_bits; + FT_UInt32 kern_order_bits; +#endif + +#ifdef TT_CONFIG_OPTION_BDF + TT_BDFRec bdf; +#endif /* TT_CONFIG_OPTION_BDF */ + } TT_FaceRec; @@ -1488,15 +1495,11 @@ FT_BEGIN_HEADER FT_BBox bbox; FT_Int left_bearing; FT_Int advance; - FT_Int top_bearing; - FT_Int vadvance; FT_Int linear; FT_Bool linear_def; FT_Bool preserve_pps; FT_Vector pp1; FT_Vector pp2; - FT_Vector pp3; - FT_Vector pp4; FT_ULong glyf_offset; @@ -1511,6 +1514,12 @@ FT_BEGIN_HEADER /* for possible extensibility in other formats */ void* other; + /* since FT 2.1.8 */ + FT_Int top_bearing; + FT_Int vadvance; + FT_Vector pp3; + FT_Vector pp4; + } TT_LoaderRec; diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c index 36064cd2c..4af18498a 100644 --- a/src/base/ftcalc.c +++ b/src/base/ftcalc.c @@ -99,7 +99,7 @@ } -#if 0 +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS /* documentation is in ftcalc.h */ @@ -130,7 +130,7 @@ return root; } -#endif /* 0 */ +#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ #ifdef FT_LONG64 diff --git a/src/base/ftdbgmem.c b/src/base/ftdbgmem.c index 557a05c2f..77d50f707 100644 --- a/src/base/ftdbgmem.c +++ b/src/base/ftdbgmem.c @@ -891,7 +891,7 @@ FT_BASE_DEF( FT_Pointer ) - FT_Alloc_Debug( FT_Memory memory, + ft_mem_alloc_debug( FT_Memory memory, FT_Long size, FT_Error *p_error, const char* file_name, @@ -906,12 +906,12 @@ table->line_no = line_no; } - return FT_Alloc( memory, size, p_error ); + return ft_mem_alloc( memory, size, p_error ); } FT_BASE_DEF( FT_Pointer ) - FT_Realloc_Debug( FT_Memory memory, + ft_mem_realloc_debug( FT_Memory memory, FT_Long current, FT_Long size, void* block, @@ -928,12 +928,12 @@ table->line_no = line_no; } - return FT_Realloc( memory, current, size, block, p_error ); + return ft_mem_realloc( memory, current, size, block, p_error ); } FT_BASE_DEF( FT_Pointer ) - FT_QAlloc_Debug( FT_Memory memory, + ft_mem_qalloc_debug( FT_Memory memory, FT_Long size, FT_Error *p_error, const char* file_name, @@ -948,12 +948,12 @@ table->line_no = line_no; } - return FT_QAlloc( memory, size, p_error ); + return ft_mem_qalloc( memory, size, p_error ); } FT_BASE_DEF( FT_Pointer ) - FT_QRealloc_Debug( FT_Memory memory, + ft_mem_qrealloc_debug( FT_Memory memory, FT_Long current, FT_Long size, void* block, @@ -970,12 +970,12 @@ table->line_no = line_no; } - return FT_QRealloc( memory, current, size, block, p_error ); + return ft_mem_qrealloc( memory, current, size, block, p_error ); } FT_BASE_DEF( void ) - FT_Free_Debug( FT_Memory memory, + ft_mem_free_debug( FT_Memory memory, const void *P, const char* file_name, FT_Long line_no ) @@ -989,7 +989,7 @@ table->line_no = line_no; } - FT_Free( memory, (void *)P ); + ft_mem_free( memory, (void *)P ); } @@ -997,7 +997,7 @@ FT_BASE_DEF( FT_Error ) - FT_Alloc_Debug( FT_Memory memory, + ft_mem_alloc_debug( FT_Memory memory, FT_Long size, void* *P, const char* file_name, @@ -1012,12 +1012,12 @@ table->line_no = line_no; } - return FT_Alloc( memory, size, P ); + return ft_mem_alloc( memory, size, P ); } FT_BASE_DEF( FT_Error ) - FT_Realloc_Debug( FT_Memory memory, + ft_mem_realloc_debug( FT_Memory memory, FT_Long current, FT_Long size, void* *P, @@ -1033,12 +1033,12 @@ table->line_no = line_no; } - return FT_Realloc( memory, current, size, P ); + return ft_mem_realloc( memory, current, size, P ); } FT_BASE_DEF( FT_Error ) - FT_QAlloc_Debug( FT_Memory memory, + ft_mem_qalloc_debug( FT_Memory memory, FT_Long size, void* *P, const char* file_name, @@ -1053,12 +1053,12 @@ table->line_no = line_no; } - return FT_QAlloc( memory, size, P ); + return ft_mem_qalloc( memory, size, P ); } FT_BASE_DEF( FT_Error ) - FT_QRealloc_Debug( FT_Memory memory, + ft_mem_qrealloc_debug( FT_Memory memory, FT_Long current, FT_Long size, void* *P, @@ -1074,12 +1074,12 @@ table->line_no = line_no; } - return FT_QRealloc( memory, current, size, P ); + return ft_mem_qrealloc( memory, current, size, P ); } FT_BASE_DEF( void ) - FT_Free_Debug( FT_Memory memory, + ft_mem_free_debug( FT_Memory memory, FT_Pointer block, const char* file_name, FT_Long line_no ) @@ -1093,7 +1093,7 @@ table->line_no = line_no; } - FT_Free( memory, (void **)block ); + ft_mem_free( memory, (void **)block ); } diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 7afd63013..a6a62d6e9 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -1734,7 +1734,7 @@ { FT_Int i; - + for ( i = 0; i < face->num_fixed_sizes; i++ ) { FT_Bitmap_Size* bsize = face->available_sizes + i; @@ -3674,5 +3674,61 @@ library->debug_hooks[hook_index] = debug_hook; } +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + FT_BASE_DEF( FT_Error ) + ft_stub_set_char_sizes( FT_Size size, + FT_F26Dot6 width, + FT_F26Dot6 height, + FT_UInt horz_res, + FT_UInt vert_res ) + { + FT_Size_RequestRec req; + FT_Driver driver = size->face->driver; + + if ( driver->clazz->request_size ) + { + req.type = FT_SIZE_REQUEST_TYPE_NOMINAL; + req.width = width; + req.height = height; + + if ( horz_res == 0 ) + horz_res = vert_res; + + if ( vert_res == 0 ) + vert_res = horz_res; + + if ( horz_res == 0 ) + horz_res = vert_res = 72; + + req.horiResolution = horz_res; + req.vertResolution = vert_res; + + return driver->clazz->request_size( size, &req ); + } + return 0; + } + + + FT_BASE_DEF( FT_Error ) + ft_stub_set_pixel_sizes( FT_Size size, + FT_UInt width, + FT_UInt height ) + { + FT_Size_RequestRec req; + FT_Driver driver = size->face->driver; + + if ( driver->clazz->request_size ) + { + req.type = FT_SIZE_REQUEST_TYPE_NOMINAL; + req.width = width << 6; + req.height = height << 6; + req.horiResolution = 0; + req.vertResolution = 0; + + return driver->clazz->request_size( size, &req ); + } + return 0; + } +#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ /* END */ diff --git a/src/base/ftsystem.c b/src/base/ftsystem.c index b7033237d..86b5df6a4 100644 --- a/src/base/ftsystem.c +++ b/src/base/ftsystem.c @@ -46,7 +46,7 @@ /* */ /* It is not necessary to do any error checking for the */ /* allocation-related functions. This will be done by the higher level */ - /* routines like FT_Alloc() or FT_Realloc(). */ + /* routines like ft_mem_alloc() or ft_mem_realloc(). */ /* */ /*************************************************************************/ diff --git a/src/base/ftutil.c b/src/base/ftutil.c index cb99f88e7..ef5935301 100644 --- a/src/base/ftutil.c +++ b/src/base/ftutil.c @@ -50,13 +50,13 @@ FT_BASE_DEF( FT_Pointer ) - FT_Alloc( FT_Memory memory, + ft_mem_alloc( FT_Memory memory, FT_Long size, FT_Error *p_error ) { FT_Error error = FT_Err_Ok; FT_Pointer block = NULL; - + if ( size > 0 ) { @@ -70,16 +70,16 @@ *p_error = error; return block; } - + FT_BASE_DEF( FT_Pointer ) - FT_QAlloc( FT_Memory memory, + ft_mem_qalloc( FT_Memory memory, FT_Long size, FT_Error *p_error ) { FT_Error error = FT_Err_Ok; FT_Pointer block = NULL; - + if ( size > 0 ) { @@ -91,28 +91,28 @@ *p_error = error; return block; } - + FT_BASE_DEF( FT_Pointer ) - FT_Realloc( FT_Memory memory, + ft_mem_realloc( FT_Memory memory, FT_Long current, FT_Long size, void* block, FT_Error *p_error ) { FT_Error error = FT_Err_Ok; - + if ( size <= 0 ) { - FT_Free( memory, block ); + ft_mem_free( memory, block ); block = NULL; } else if ( current <= 0 ) { FT_ASSERT( block == NULL ); - - block = FT_Alloc( memory, size, &error ); + + block = ft_mem_alloc( memory, size, &error ); } else { @@ -133,28 +133,28 @@ *p_error = error; return block; } - + FT_BASE_DEF( FT_Pointer ) - FT_QRealloc( FT_Memory memory, + ft_mem_qrealloc( FT_Memory memory, FT_Long current, FT_Long size, void* block, FT_Error *p_error ) { FT_Error error = FT_Err_Ok; - + if ( size <= 0 ) { - FT_Free( memory, block ); + ft_mem_free( memory, block ); block = NULL; } else if ( current <= 0 ) { FT_ASSERT( block == NULL ); - - block = FT_QAlloc( memory, size, &error ); + + block = ft_mem_qalloc( memory, size, &error ); } else { @@ -170,15 +170,15 @@ *p_error = error; return block; - } + } FT_BASE_DEF( void ) - FT_Free( FT_Memory memory, + ft_mem_free( FT_Memory memory, const void *P ) { if ( P ) memory->free( memory, (void*)P ); - } + } #else /* !FT_STRICT_ALIASING */ @@ -187,7 +187,7 @@ /* documentation is in ftmemory.h */ FT_BASE_DEF( FT_Error ) - FT_Alloc( FT_Memory memory, + ft_mem_alloc( FT_Memory memory, FT_Long size, void* *P ) { @@ -198,7 +198,7 @@ *P = memory->alloc( memory, size ); if ( !*P ) { - FT_ERROR(( "FT_Alloc:" )); + FT_ERROR(( "ft_mem_alloc:" )); FT_ERROR(( " Out of memory? (%ld requested)\n", size )); @@ -209,7 +209,7 @@ else *P = NULL; - FT_TRACE7(( "FT_Alloc:" )); + FT_TRACE7(( "ft_mem_alloc:" )); FT_TRACE7(( " size = %ld, block = 0x%08p, ref = 0x%08p\n", size, *P, P )); @@ -220,7 +220,7 @@ /* documentation is in ftmemory.h */ FT_BASE_DEF( FT_Error ) - FT_QAlloc( FT_Memory memory, + ft_mem_qalloc( FT_Memory memory, FT_Long size, void* *P ) { @@ -231,7 +231,7 @@ *P = memory->alloc( memory, size ); if ( !*P ) { - FT_ERROR(( "FT_QAlloc:" )); + FT_ERROR(( "ft_mem_qalloc:" )); FT_ERROR(( " Out of memory? (%ld requested)\n", size )); @@ -241,7 +241,7 @@ else *P = NULL; - FT_TRACE7(( "FT_QAlloc:" )); + FT_TRACE7(( "ft_mem_qalloc:" )); FT_TRACE7(( " size = %ld, block = 0x%08p, ref = 0x%08p\n", size, *P, P )); @@ -252,7 +252,7 @@ /* documentation is in ftmemory.h */ FT_BASE_DEF( FT_Error ) - FT_Realloc( FT_Memory memory, + ft_mem_realloc( FT_Memory memory, FT_Long current, FT_Long size, void** P ) @@ -262,14 +262,14 @@ FT_ASSERT( P != 0 ); - /* if the original pointer is NULL, call FT_Alloc() */ + /* if the original pointer is NULL, call ft_mem_alloc() */ if ( !*P ) - return FT_Alloc( memory, size, P ); + return ft_mem_alloc( memory, size, P ); /* if the new block if zero-sized, clear the current one */ if ( size <= 0 ) { - FT_Free( memory, P ); + ft_mem_free( memory, P ); return FT_Err_Ok; } @@ -284,7 +284,7 @@ return FT_Err_Ok; Fail: - FT_ERROR(( "FT_Realloc:" )); + FT_ERROR(( "ft_mem_realloc:" )); FT_ERROR(( " Failed (current %ld, requested %ld)\n", current, size )); return FT_Err_Out_Of_Memory; @@ -294,7 +294,7 @@ /* documentation is in ftmemory.h */ FT_BASE_DEF( FT_Error ) - FT_QRealloc( FT_Memory memory, + ft_mem_qrealloc( FT_Memory memory, FT_Long current, FT_Long size, void** P ) @@ -304,14 +304,14 @@ FT_ASSERT( P != 0 ); - /* if the original pointer is NULL, call FT_QAlloc() */ + /* if the original pointer is NULL, call ft_mem_qalloc() */ if ( !*P ) - return FT_QAlloc( memory, size, P ); + return ft_mem_qalloc( memory, size, P ); /* if the new block if zero-sized, clear the current one */ if ( size <= 0 ) { - FT_Free( memory, P ); + ft_mem_free( memory, P ); return FT_Err_Ok; } @@ -323,7 +323,7 @@ return FT_Err_Ok; Fail: - FT_ERROR(( "FT_QRealloc:" )); + FT_ERROR(( "ft_mem_qrealloc:" )); FT_ERROR(( " Failed (current %ld, requested %ld)\n", current, size )); return FT_Err_Out_Of_Memory; @@ -333,10 +333,10 @@ /* documentation is in ftmemory.h */ FT_BASE_DEF( void ) - FT_Free( FT_Memory memory, + ft_mem_free( FT_Memory memory, void** P ) { - FT_TRACE7(( "FT_Free:" )); + FT_TRACE7(( "ft_mem_free:" )); FT_TRACE7(( " Freeing block 0x%08p, ref 0x%08p\n", P, P ? *P : (void*)0 )); @@ -561,5 +561,66 @@ return value; } +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + + FT_BASE_DEF( FT_Error ) + FT_Alloc( FT_Memory memory, + FT_Long size, + void* *P ) + { + FT_Error error; + + (void)FT_ALLOC( *P, size ); + return error; + } + + FT_BASE_DEF( FT_Error ) + FT_QAlloc( FT_Memory memory, + FT_Long size, + void* *p ) + { + FT_Error error; + + (void)FT_QALLOC( *p, size ); + return error; + } + + FT_BASE_DEF( FT_Error ) + FT_Realloc( FT_Memory memory, + FT_Long current, + FT_Long size, + void* *P ) + { + FT_Error error; + + (void)FT_REALLOC( *P, current, size ); + return error; + } + + + FT_BASE_DEF( FT_Error ) + FT_QRealloc( FT_Memory memory, + FT_Long current, + FT_Long size, + void* *p ) + { + FT_Error error; + + (void)FT_QREALLOC( *p, current, size ); + return error; + } + + FT_BASE_DEF( void ) + FT_Free( FT_Memory memory, + void* *P ) + { + if ( *P ) + { + ft_mem_free( memory, *P ); + *P = NULL; + } + } + +#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ /* END */ diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c index 93592f517..39198eb9b 100644 --- a/src/bdf/bdfdrivr.c +++ b/src/bdf/bdfdrivr.c @@ -251,7 +251,7 @@ THE SOFTWARE. { if ( FT_ALLOC( face->style_name, ft_strlen( "Regular" ) + 1 ) ) return error; - + ft_strcpy( face->style_name, "Regular" ); } else @@ -475,7 +475,7 @@ THE SOFTWARE. (face->en_table[n]).enc = cur[n].encoding; FT_TRACE4(( "idx %d, val 0x%lX\n", n, cur[n].encoding )); (face->en_table[n]).glyph = (FT_Short)n; - + if ( cur[n].encoding == font->default_char ) face->default_glyph = n; } @@ -639,6 +639,7 @@ THE SOFTWARE. } + FT_CALLBACK_DEF( FT_Error ) BDF_Glyph_Load( FT_GlyphSlot slot, FT_Size size, @@ -704,7 +705,7 @@ THE SOFTWARE. slot->metrics.width = bitmap->width << 6; slot->metrics.height = bitmap->rows << 6; - /* + /* * XXX DWIDTH1 and VVECTOR should be parsed and * used here, provided such fonts do exist. */ @@ -837,14 +838,18 @@ THE SOFTWARE. 0, /* FT_Slot_InitFunc */ 0, /* FT_Slot_DoneFunc */ - BDF_Size_Request, - BDF_Size_Select, - +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + ft_stub_set_char_sizes, + ft_stub_set_pixel_sizes, +#endif BDF_Glyph_Load, 0, /* FT_Face_GetKerningFunc */ 0, /* FT_Face_AttachFunc */ 0, /* FT_Face_GetAdvancesFunc */ + + BDF_Size_Request, + BDF_Size_Select }; diff --git a/src/cache/ftccache.c b/src/cache/ftccache.c index 22ec06cb8..89d51c791 100644 --- a/src/cache/ftccache.c +++ b/src/cache/ftccache.c @@ -256,7 +256,7 @@ /* remove a node from the cache manager */ - FT_LOCAL_DEF( void ) + FT_BASE_DEF( void ) ftc_node_destroy( FTC_Node node, FTC_Manager manager ) { diff --git a/src/cache/ftccback.h b/src/cache/ftccback.h index 5c4741fe3..b0aa3e93c 100644 --- a/src/cache/ftccback.h +++ b/src/cache/ftccback.h @@ -79,11 +79,11 @@ FT_LOCAL( void ) ftc_cache_done( FTC_Cache cache ); - +#ifndef FT_CONFIG_OPTION_OLD_INTERNALS FT_LOCAL( void ) ftc_node_destroy( FTC_Node node, FTC_Manager manager ); - +#endif #endif /* __FTCCBACK_H__ */ diff --git a/src/cache/ftccmap.c b/src/cache/ftccmap.c index 02b814818..c14378db9 100644 --- a/src/cache/ftccmap.c +++ b/src/cache/ftccmap.c @@ -300,4 +300,5 @@ } + /* END */ diff --git a/src/cache/ftcmanag.c b/src/cache/ftcmanag.c index ccb9eda41..16b4158aa 100644 --- a/src/cache/ftcmanag.c +++ b/src/cache/ftcmanag.c @@ -677,5 +677,48 @@ node->ref_count--; } +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + + FT_EXPORT_DEF( FT_Error ) + FTC_Manager_Lookup_Face( FTC_Manager manager, + FTC_FaceID face_id, + FT_Face *aface ) + { + return FTC_Manager_LookupFace( manager, face_id, aface ); + } + + + FT_EXPORT( FT_Error ) + FTC_Manager_Lookup_Size( FTC_Manager manager, + FTC_Font font, + FT_Face *aface, + FT_Size *asize ) + { + FTC_ScalerRec scaler; + FT_Error error; + FT_Size size; + + scaler.face_id = font->face_id; + scaler.width = font->pix_width; + scaler.height = font->pix_height; + scaler.pixel = TRUE; + scaler.x_res = 0; + scaler.y_res = 0; + + error = FTC_Manager_LookupSize( manager, &scaler, &size ); + if ( error ) + { + *aface = NULL; + *asize = NULL; + } + else + { + *aface = size->face; + *asize = size; + } + return error; + } + +#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ /* END */ diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 3b09499e3..e90e2b04e 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -313,8 +313,8 @@ /* * TT CMAP INFO * - * If the charmap is a synthetic Unicode encoding cmap or - * a Type 1 standard (or expert) encoding cmap, hide TT CMAP INFO + * If the charmap is a synthetic Unicode encoding cmap or + * a Type 1 standard (or expert) encoding cmap, hide TT CMAP INFO * service defined in SFNT module. * * Otherwise call the service function in the sfnt module. @@ -330,7 +330,7 @@ cmap_info->language = 0; - if ( cmap->clazz != &cff_cmap_encoding_class_rec && + if ( cmap->clazz != &cff_cmap_encoding_class_rec && cmap->clazz != &cff_cmap_unicode_class_rec ) { FT_Face face = FT_CMAP_FACE( cmap ); @@ -433,19 +433,24 @@ cff_slot_init, cff_slot_done, - cff_size_request, - -#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS - cff_size_select, -#else - 0, /* FT_Size_SelectFunc */ -#endif +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + ft_stub_set_char_sizes, + ft_stub_set_pixel_sizes, +#endif Load_Glyph, cff_get_kerning, 0, /* FT_Face_AttachFunc */ - 0 /* FT_Face_GetAdvancesFunc */ + 0, /* FT_Face_GetAdvancesFunc */ + + cff_size_request, + +#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS + cff_size_select +#else + 0 /* FT_Size_SelectFunc */ +#endif }; diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c index 01378d549..5c5a72957 100644 --- a/src/cid/cidriver.c +++ b/src/cid/cidriver.c @@ -143,15 +143,20 @@ cid_slot_init, cid_slot_done, - cid_size_request, - 0, /* FT_Size_SelectFunc */ +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + ft_stub_set_char_sizes, + ft_stub_set_pixel_sizes, +#endif cid_slot_load_glyph, 0, /* FT_Face_GetKerningFunc */ 0, /* FT_Face_AttachFunc */ - 0 /* FT_Face_GetAdvancesFunc */ + 0, /* FT_Face_GetAdvancesFunc */ + + cid_size_request, + 0 /* FT_Size_SelectFunc */ }; diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c index 719e58f95..91de2b229 100644 --- a/src/pcf/pcfdrivr.c +++ b/src/pcf/pcfdrivr.c @@ -643,14 +643,18 @@ THE SOFTWARE. 0, /* FT_Slot_InitFunc */ 0, /* FT_Slot_DoneFunc */ - PCF_Size_Request, - PCF_Size_Select, - +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + ft_stub_set_char_sizes, + ft_stub_set_pixel_sizes, +#endif PCF_Glyph_Load, 0, /* FT_Face_GetKerningFunc */ 0, /* FT_Face_AttachFunc */ - 0 /* FT_Face_GetAdvancesFunc */ + 0, /* FT_Face_GetAdvancesFunc */ + + PCF_Size_Request, + PCF_Size_Select }; diff --git a/src/pfr/pfrdrivr.c b/src/pfr/pfrdrivr.c index 2183a69f6..40206720e 100644 --- a/src/pfr/pfrdrivr.c +++ b/src/pfr/pfrdrivr.c @@ -190,13 +190,17 @@ pfr_slot_init, pfr_slot_done, - 0, /* FT_Size_RequestFunc */ - 0, /* FT_Size_SelectFunc */ +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + ft_stub_set_char_sizes, + ft_stub_set_pixel_sizes, +#endif pfr_slot_load, pfr_get_kerning, 0, /* FT_Face_AttachFunc */ - 0 /* FT_Face_GetAdvancesFunc */ + 0, /* FT_Face_GetAdvancesFunc */ + 0, /* FT_Size_RequestFunc */ + 0, /* FT_Size_SelectFunc */ }; diff --git a/src/psaux/psauxmod.c b/src/psaux/psauxmod.c index bbb6c01ed..4c3579f7b 100644 --- a/src/psaux/psauxmod.c +++ b/src/psaux/psauxmod.c @@ -107,15 +107,15 @@ &ps_parser_funcs, &t1_builder_funcs, &t1_decoder_funcs, + t1_decrypt, + + (const T1_CMap_ClassesRec*) &t1_cmap_classes, + #ifndef T1_CONFIG_OPTION_NO_AFM &afm_parser_funcs, #else 0, #endif - - t1_decrypt, - - (const T1_CMap_ClassesRec*) &t1_cmap_classes, }; diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index 829a57ed4..88958532e 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -312,7 +312,7 @@ /* XXX: I don't know whether this is correct, since * tt_face_find_bdf_prop only returns something correct if we have - * previously selected a size that is listed in the BDF table. + * previously selected a size that is listed in the BDF table. * Should we change the BDF table format to include single offsets * for `CHARSET_REGISTRY' and `CHARSET_ENCODING'? */ @@ -376,6 +376,112 @@ } +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + + FT_CALLBACK_DEF( FT_Error ) + tt_face_load_sfnt_header_stub( TT_Face face, + FT_Stream stream, + FT_Long face_index, + SFNT_Header header ) + { + FT_UNUSED( face ); + FT_UNUSED( stream ); + FT_UNUSED( face_index ); + FT_UNUSED( header ); + + return FT_Err_Unimplemented_Feature; + } + + + FT_CALLBACK_DEF( FT_Error ) + tt_face_load_directory_stub( TT_Face face, + FT_Stream stream, + SFNT_Header header ) + { + FT_UNUSED( face ); + FT_UNUSED( stream ); + FT_UNUSED( header ); + + return FT_Err_Unimplemented_Feature; + } + + + FT_CALLBACK_DEF( FT_Error ) + tt_face_load_hdmx_stub( TT_Face face, + FT_Stream stream ) + { + FT_UNUSED( face ); + FT_UNUSED( stream ); + + return FT_Err_Unimplemented_Feature; + } + + + FT_CALLBACK_DEF( void ) + tt_face_free_hdmx_stub( TT_Face face ) + { + FT_UNUSED( face ); + } + + + FT_CALLBACK_DEF( FT_Error ) + tt_face_set_sbit_strike_stub( TT_Face face, + FT_UInt x_ppem, + FT_UInt y_ppem, + FT_ULong* astrike_index ) + { + FT_UNUSED( face ); + FT_UNUSED( x_ppem ); + FT_UNUSED( y_ppem ); + + *astrike_index = 0x7FFFFFFFUL; + return FT_Err_Unimplemented_Feature; + } + + + FT_CALLBACK_DEF( FT_Error ) + tt_face_load_sbit_stub( TT_Face face, + FT_Stream stream ) + { + FT_UNUSED( face ); + FT_UNUSED( stream ); + + return FT_Err_Unimplemented_Feature; + } + + + FT_CALLBACK_DEF( void ) + tt_face_free_sbit_stub( TT_Face face ) + { + FT_UNUSED( face ); + } + + + FT_CALLBACK_DEF( FT_Error ) + tt_face_load_charmap_stub( TT_Face face, + void* cmap, + FT_Stream input ) + { + FT_UNUSED( face ); + FT_UNUSED( cmap ); + FT_UNUSED( input ); + + return FT_Err_Unimplemented_Feature; + } + + + FT_CALLBACK_DEF( FT_Error ) + tt_face_free_charmap_stub( TT_Face face, + void* cmap ) + { + FT_UNUSED( face ); + FT_UNUSED( cmap ); + + return 0; + } + +#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ + static const SFNT_Interface sfnt_interface = { @@ -387,11 +493,14 @@ sfnt_get_interface, tt_face_load_any, - tt_face_load_font_dir, + +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + tt_face_load_sfnt_header_stub, + tt_face_load_directory_stub, +#endif tt_face_load_head, tt_face_load_hhea, - tt_face_load_hmtx, tt_face_load_cmap, tt_face_load_maxp, tt_face_load_os2, @@ -400,62 +509,82 @@ tt_face_load_name, tt_face_free_name, +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + tt_face_load_hdmx_stub, + tt_face_free_hdmx_stub, +#endif + tt_face_load_kern, tt_face_load_gasp, tt_face_load_pclt, #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS - /* see `ttload.h' */ tt_face_load_bhed, +#else + 0, +#endif +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + tt_face_set_sbit_strike_stub, + tt_face_load_sbit_stub, +#endif +#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS + tt_face_load_sbit_image, +#else /* !TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ + 0, +#endif /* !TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ + +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + tt_face_free_sbit_stub, +#endif + +#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES + /* see `ttpost.h' */ + tt_face_get_ps_name, + tt_face_free_ps_names, +#else /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */ + 0, + 0, +#endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */ + +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + tt_face_load_charmap_stub, + tt_face_free_charmap_stub, +#endif + + /* since FT 2.1.8 */ + + tt_face_get_kerning, + +# ifndef FT_OPTIMIZE_MEMORY + tt_find_sbit_image, + tt_load_sbit_metrics, +# else + 0, + 0, +# endif + + /* since FT 2.2 */ + tt_face_load_font_dir, + tt_face_load_hmtx, + +#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS /* see `ttsbit.h' and `sfnt.h' */ tt_face_load_eblc, tt_face_free_eblc, tt_face_set_sbit_strike, tt_face_load_strike_metrics, -#ifdef FT_OPTIMIZE_MEMORY - 0, - 0, #else - tt_find_sbit_image, - tt_load_sbit_metrics, -#endif - tt_face_load_sbit_image, - -#else /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ - - 0, - 0, - 0, - 0, 0, 0, 0, 0, +#endif -#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ - - /* see `ttkern.h' */ - tt_face_get_kerning, - - tt_face_get_metrics, - -#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES - - /* see `ttpost.h' */ - tt_face_get_ps_name, - tt_face_free_ps_names, - -#else /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */ - - 0, - 0, - -#endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */ - + tt_face_get_metrics }; diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index 037480b41..4a7e66b61 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -113,7 +113,7 @@ if ( sfnt ) kerning->x = sfnt->get_kerning( face, left_glyph, right_glyph ); - + return 0; } @@ -365,18 +365,22 @@ tt_slot_init, 0, /* FT_Slot_DoneFunc */ - tt_size_request, -#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS - tt_size_select, -#else - 0, /* FT_Size_SelectFunc */ -#endif - +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + ft_stub_set_char_sizes, + ft_stub_set_pixel_sizes, +#endif Load_Glyph, tt_get_kerning, 0, /* FT_Face_AttachFunc */ - 0 /* FT_Face_GetAdvancesFunc */ + 0, /* FT_Face_GetAdvancesFunc */ + + tt_size_request, +#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS + tt_size_select +#else + 0 /* FT_Size_SelectFunc */ +#endif }; diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c index 09be57db3..806d35d01 100644 --- a/src/type1/t1driver.c +++ b/src/type1/t1driver.c @@ -306,8 +306,10 @@ (FT_Slot_InitFunc) T1_GlyphSlot_Init, (FT_Slot_DoneFunc) T1_GlyphSlot_Done, - (FT_Size_RequestFunc) T1_Size_Request, - (FT_Size_SelectFunc) 0, +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + ft_stub_set_char_sizes, + ft_stub_set_pixel_sizes, +#endif (FT_Slot_LoadFunc) T1_Load_Glyph, #ifdef T1_CONFIG_OPTION_NO_AFM @@ -317,7 +319,9 @@ (FT_Face_GetKerningFunc) Get_Kerning, (FT_Face_AttachFunc) T1_Read_Metrics, #endif - (FT_Face_GetAdvancesFunc) 0 + (FT_Face_GetAdvancesFunc) 0, + (FT_Size_RequestFunc) T1_Size_Request, + (FT_Size_SelectFunc) 0 }; diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index 74b925a2c..fae69c127 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -115,8 +115,8 @@ FT_Size_Request req ) { PSH_Globals_Funcs funcs = T1_Size_Get_Globals_Funcs( size ); - - + + FT_Request_Metrics( size->root.face, req ); if ( funcs ) @@ -240,8 +240,11 @@ #endif /* release unicode map, if any */ - FT_FREE( face->unicode_map.maps ); - face->unicode_map.num_maps = 0; +#if 0 + FT_FREE( face->unicode_map_rec.maps ); + face->unicode_map_rec.num_maps = 0; + face->unicode_map = NULL; +#endif face->root.family_name = 0; face->root.style_name = 0; diff --git a/src/type42/t42drivr.c b/src/type42/t42drivr.c index b293e1823..e3c469742 100644 --- a/src/type42/t42drivr.c +++ b/src/type42/t42drivr.c @@ -229,14 +229,18 @@ (FT_Slot_InitFunc) T42_GlyphSlot_Init, (FT_Slot_DoneFunc) T42_GlyphSlot_Done, - (FT_Size_RequestFunc) T42_Size_Request, - (FT_Size_SelectFunc) T42_Size_Select, +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + ft_stub_set_char_sizes, + ft_stub_set_pixel_sizes, +#endif (FT_Slot_LoadFunc) T42_GlyphSlot_Load, (FT_Face_GetKerningFunc) 0, (FT_Face_AttachFunc) 0, - (FT_Face_GetAdvancesFunc) 0 + (FT_Face_GetAdvancesFunc) 0, + (FT_Size_RequestFunc) T42_Size_Request, + (FT_Size_SelectFunc) T42_Size_Select }; diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c index 8f74300da..553cddbc0 100644 --- a/src/winfonts/winfnt.c +++ b/src/winfonts/winfnt.c @@ -479,7 +479,7 @@ bsize->y_ppem = FT_MulDiv( bsize->size, y_res, 72 ); bsize->y_ppem = FT_PIX_ROUND( bsize->y_ppem ); - /* + /* * this reads: * * the nominal height is larger than the bbox's height @@ -801,13 +801,18 @@ (FT_Slot_InitFunc) 0, (FT_Slot_DoneFunc) 0, - (FT_Size_RequestFunc) FNT_Size_Request, - (FT_Size_SelectFunc) FNT_Size_Select, +#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + ft_stub_set_char_sizes, + ft_stub_set_pixel_sizes, +#endif (FT_Slot_LoadFunc) FNT_Load_Glyph, (FT_Face_GetKerningFunc) 0, (FT_Face_AttachFunc) 0, - (FT_Face_GetAdvancesFunc) 0 + (FT_Face_GetAdvancesFunc) 0, + + (FT_Size_RequestFunc) FNT_Size_Request, + (FT_Size_SelectFunc) FNT_Size_Select };