From 41bd254198b8b879a562a85f7dc868c3c0f7fbc1 Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 12 Mar 2012 10:33:22 +0100 Subject: Updated to freetype-2.4.9 --- freetype/src/base/basepic.c | 44 +++++++++++------- freetype/src/base/basepic.h | 21 +++++++-- freetype/src/base/ftadvanc.c | 15 +++---- freetype/src/base/ftbase.c | 2 +- freetype/src/base/ftbase.h | 6 +-- freetype/src/base/ftcalc.c | 19 ++++---- freetype/src/base/ftglyph.c | 26 +++++------ freetype/src/base/ftinit.c | 103 +++++++++++++++++++++++++++---------------- freetype/src/base/ftmac.c | 6 ++- freetype/src/base/ftobjs.c | 27 +++++------- freetype/src/base/ftoutln.c | 4 +- freetype/src/base/ftrfork.c | 80 ++++++++++++--------------------- 12 files changed, 191 insertions(+), 162 deletions(-) (limited to 'freetype/src/base') diff --git a/freetype/src/base/basepic.c b/freetype/src/base/basepic.c index c0bccb695..d754eb1b0 100644 --- a/freetype/src/base/basepic.c +++ b/freetype/src/base/basepic.c @@ -24,18 +24,24 @@ #ifdef FT_CONFIG_OPTION_PIC /* forward declaration of PIC init functions from ftglyph.c */ - void FT_Init_Class_ft_outline_glyph_class(FT_Glyph_Class*); - void FT_Init_Class_ft_bitmap_glyph_class(FT_Glyph_Class*); + void FT_Init_Class_ft_outline_glyph_class( FT_Glyph_Class* clazz ); + void FT_Init_Class_ft_bitmap_glyph_class( FT_Glyph_Class* clazz ); + + /* forward declaration of PIC init function from ftrfork.c (not modularized) */ + void FT_Init_Table_raccess_guess_table( ft_raccess_guess_rec* record ); /* forward declaration of PIC init functions from ftinit.c */ - FT_Error ft_create_default_module_classes(FT_Library); - void ft_destroy_default_module_classes(FT_Library); + FT_Error + ft_create_default_module_classes( FT_Library library ); + + void + ft_destroy_default_module_classes( FT_Library library ); void - ft_base_pic_free( FT_Library library ) + ft_base_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Memory memory = library->memory; if ( pic_container->base ) { /* Destroy default module classes (in case FT_Add_Default_Modules was used) */ @@ -48,17 +54,17 @@ FT_Error - ft_base_pic_init( FT_Library library ) + ft_base_pic_init( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = FT_Err_Ok; - BasePIC* container; - FT_Memory memory = library->memory; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Error error = FT_Err_Ok; + BasePIC* container; + FT_Memory memory = library->memory; /* allocate pointer, clear and set global container pointer */ if ( FT_ALLOC ( container, sizeof ( *container ) ) ) return error; - FT_MEM_SET( container, 0, sizeof(*container) ); + FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->base = container; /* initialize default modules list and pointers */ @@ -67,12 +73,16 @@ goto Exit; /* initialize pointer table - this is how the module usually expects this data */ - FT_Init_Class_ft_outline_glyph_class(&container->ft_outline_glyph_class); - FT_Init_Class_ft_bitmap_glyph_class(&container->ft_bitmap_glyph_class); + FT_Init_Class_ft_outline_glyph_class( + &container->ft_outline_glyph_class ); + FT_Init_Class_ft_bitmap_glyph_class( + &container->ft_bitmap_glyph_class ); + FT_Init_Table_raccess_guess_table( + (ft_raccess_guess_rec*)&container->ft_raccess_guess_table); Exit: - if(error) - ft_base_pic_free(library); + if( error ) + ft_base_pic_free( library ); return error; } diff --git a/freetype/src/base/basepic.h b/freetype/src/base/basepic.h index bb1774576..bf90bef0b 100644 --- a/freetype/src/base/basepic.h +++ b/freetype/src/base/basepic.h @@ -19,7 +19,7 @@ #ifndef __BASEPIC_H__ #define __BASEPIC_H__ - + FT_BEGIN_HEADER #include FT_INTERNAL_PIC_H @@ -28,28 +28,43 @@ FT_BEGIN_HEADER #define FT_OUTLINE_GLYPH_CLASS_GET &ft_outline_glyph_class #define FT_BITMAP_GLYPH_CLASS_GET &ft_bitmap_glyph_class #define FT_DEFAULT_MODULES_GET ft_default_modules +#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK +#define FT_RACCESS_GUESS_TABLE_GET ft_raccess_guess_table +#endif #else /* FT_CONFIG_OPTION_PIC */ #include FT_GLYPH_H +#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK +#include FT_INTERNAL_RFORK_H +#endif + + typedef struct BasePIC_ { FT_Module_Class** default_module_classes; FT_Glyph_Class ft_outline_glyph_class; FT_Glyph_Class ft_bitmap_glyph_class; +#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK + ft_raccess_guess_rec ft_raccess_guess_table[FT_RACCESS_N_RULES]; +#endif } BasePIC; #define GET_PIC(lib) ((BasePIC*)((lib)->pic_container.base)) #define FT_OUTLINE_GLYPH_CLASS_GET (&GET_PIC(library)->ft_outline_glyph_class) #define FT_BITMAP_GLYPH_CLASS_GET (&GET_PIC(library)->ft_bitmap_glyph_class) #define FT_DEFAULT_MODULES_GET (GET_PIC(library)->default_module_classes) +#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK +#define FT_RACCESS_GUESS_TABLE_GET (GET_PIC(library)->ft_raccess_guess_table) +#endif + /* see basepic.c for the implementation. */ void - ft_base_pic_free( FT_Library library ); + ft_base_pic_free( FT_Library library ); FT_Error - ft_base_pic_init( FT_Library library ); + ft_base_pic_init( FT_Library library ); #endif /* FT_CONFIG_OPTION_PIC */ /* */ diff --git a/freetype/src/base/ftadvanc.c b/freetype/src/base/ftadvanc.c index 8ab7fcb92..a8bb43d3d 100644 --- a/freetype/src/base/ftadvanc.c +++ b/freetype/src/base/ftadvanc.c @@ -4,7 +4,7 @@ /* */ /* Quick computation of advance widths (body). */ /* */ -/* Copyright 2008, 2009 by */ +/* Copyright 2008, 2009, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -129,7 +129,7 @@ { error = func( face, start, count, flags, padvances ); if ( !error ) - goto Exit; + return _ft_face_scale_advances( face, padvances, count, flags ); if ( error != FT_ERROR_BASE( FT_Err_Unimplemented_Feature ) ) return error; @@ -147,16 +147,13 @@ if ( error ) break; + /* scale from 26.6 to 16.16 */ padvances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT ) - ? face->glyph->advance.y - : face->glyph->advance.x; + ? face->glyph->advance.y << 10 + : face->glyph->advance.x << 10; } - if ( error ) - return error; - - Exit: - return _ft_face_scale_advances( face, padvances, count, flags ); + return error; } diff --git a/freetype/src/base/ftbase.c b/freetype/src/base/ftbase.c index 6a27ea95a..5e5d70ec4 100644 --- a/freetype/src/base/ftbase.c +++ b/freetype/src/base/ftbase.c @@ -34,7 +34,7 @@ #include "fttrigon.c" #include "ftutil.c" -#if defined( FT_MACINTOSH ) && !defined ( DARWIN_NO_CARBON ) +#ifdef FT_MACINTOSH #include "ftmac.c" #endif diff --git a/freetype/src/base/ftbase.h b/freetype/src/base/ftbase.h index 516f4bb7f..51a1db18b 100644 --- a/freetype/src/base/ftbase.h +++ b/freetype/src/base/ftbase.h @@ -49,15 +49,15 @@ FT_BEGIN_HEADER FT_Face *aface ); -#if defined( FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK ) && \ - ( !defined( FT_MACINTOSH ) || defined( DARWIN_NO_CARBON ) ) +#if defined( FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK ) && \ + !defined( FT_MACINTOSH ) /* Mac OS X/Darwin kernel often changes recommended method to access */ /* the resource fork and older methods makes the kernel issue the */ /* warning of deprecated method. To calm it down, the methods based */ /* on Darwin VFS should be grouped and skip the rest methods after */ /* the case the resource is opened but found to lack a font in it. */ FT_LOCAL( FT_Bool ) - raccess_rule_by_darwin_vfs( FT_UInt rule_index ); + ft_raccess_rule_by_darwin_vfs( FT_Library library, FT_UInt rule_index ); #endif diff --git a/freetype/src/base/ftcalc.c b/freetype/src/base/ftcalc.c index 3892fabfe..2aeea0459 100644 --- a/freetype/src/base/ftcalc.c +++ b/freetype/src/base/ftcalc.c @@ -4,7 +4,7 @@ /* */ /* Arithmetic computations (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008 by */ +/* Copyright 1996-2006, 2008, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -307,7 +307,7 @@ q <<= 1; r |= lo >> 31; - if ( r >= (FT_UInt32)y ) + if ( r >= y ) { r -= y; q |= 1; @@ -373,7 +373,7 @@ if ( a <= 46340L && b <= 46340L && c <= 176095L && c > 0 ) a = ( a * b + ( c >> 1 ) ) / c; - else if ( c > 0 ) + else if ( (FT_Int32)c > 0 ) { FT_Int64 temp, temp2; @@ -412,7 +412,7 @@ if ( a <= 46340L && b <= 46340L && c > 0 ) a = a * b / c; - else if ( c > 0 ) + else if ( (FT_Int32)c > 0 ) { FT_Int64 temp; @@ -464,7 +464,7 @@ * Unfortunately, it doesn't work (at least not portably). * * It makes the assumption that right-shift on a negative signed value - * fills the leftmost bits by copying the sign bit. This is wrong. + * fills the leftmost bits by copying the sign bit. This is wrong. * According to K&R 2nd ed, section `A7.8 Shift Operators' on page 206, * the result of right-shift of a negative signed value is * implementation-defined. At least one implementation fills the @@ -544,7 +544,7 @@ s = (FT_Int32)a; a = FT_ABS( a ); s ^= (FT_Int32)b; b = FT_ABS( b ); - if ( b == 0 ) + if ( (FT_UInt32)b == 0 ) { /* check for division by 0 */ q = (FT_UInt32)0x7FFFFFFFL; @@ -552,15 +552,16 @@ else if ( ( a >> 16 ) == 0 ) { /* compute result directly */ - q = (FT_UInt32)( (a << 16) + (b >> 1) ) / (FT_UInt32)b; + q = (FT_UInt32)( ( a << 16 ) + ( b >> 1 ) ) / (FT_UInt32)b; } else { /* we need more bits; we have to do it by hand */ FT_Int64 temp, temp2; - temp.hi = (FT_Int32) (a >> 16); - temp.lo = (FT_UInt32)(a << 16); + + temp.hi = (FT_Int32) ( a >> 16 ); + temp.lo = (FT_UInt32)( a << 16 ); temp2.hi = 0; temp2.lo = (FT_UInt32)( b >> 1 ); FT_Add64( &temp, &temp2, &temp ); diff --git a/freetype/src/base/ftglyph.c b/freetype/src/base/ftglyph.c index b22050800..591b57a75 100644 --- a/freetype/src/base/ftglyph.c +++ b/freetype/src/base/ftglyph.c @@ -254,7 +254,7 @@ } - FT_DEFINE_GLYPH( ft_outline_glyph_class, + FT_DEFINE_GLYPH( ft_outline_glyph_class, sizeof ( FT_OutlineGlyphRec ), FT_GLYPH_FORMAT_OUTLINE, @@ -512,42 +512,42 @@ FT_Error error = FT_Err_Ok; FT_Glyph glyph; FT_BitmapGlyph bitmap = NULL; - const FT_Glyph_Class* clazz; -#ifdef FT_CONFIG_OPTION_PIC - FT_Library library = FT_GLYPH( glyph )->library; -#endif + /* FT_BITMAP_GLYPH_CLASS_GET derefers `library' in PIC mode */ + FT_Library library; /* check argument */ if ( !the_glyph ) goto Bad; - - /* we render the glyph into a glyph bitmap using a `dummy' glyph slot */ - /* then calling FT_Render_Glyph_Internal() */ - glyph = *the_glyph; if ( !glyph ) goto Bad; - clazz = glyph->clazz; + clazz = glyph->clazz; + library = glyph->library; + if ( !library || !clazz ) + goto Bad; /* when called with a bitmap glyph, do nothing and return successfully */ if ( clazz == FT_BITMAP_GLYPH_CLASS_GET ) goto Exit; - if ( !clazz || !clazz->glyph_prepare ) + if ( !clazz->glyph_prepare ) goto Bad; + /* we render the glyph into a glyph bitmap using a `dummy' glyph slot */ + /* then calling FT_Render_Glyph_Internal() */ + FT_MEM_ZERO( &dummy, sizeof ( dummy ) ); FT_MEM_ZERO( &dummy_internal, sizeof ( dummy_internal ) ); dummy.internal = &dummy_internal; - dummy.library = glyph->library; + dummy.library = library; dummy.format = clazz->glyph_format; /* create result bitmap glyph */ - error = ft_new_glyph( glyph->library, FT_BITMAP_GLYPH_CLASS_GET, + error = ft_new_glyph( library, FT_BITMAP_GLYPH_CLASS_GET, (FT_Glyph*)(void*)&bitmap ); if ( error ) goto Exit; diff --git a/freetype/src/base/ftinit.c b/freetype/src/base/ftinit.c index 305177a7e..91f8e2a18 100644 --- a/freetype/src/base/ftinit.c +++ b/freetype/src/base/ftinit.c @@ -4,7 +4,7 @@ /* */ /* FreeType initialization layer (body). */ /* */ -/* Copyright 1996-2001, 2002, 2005, 2007, 2009 by */ +/* Copyright 1996-2001, 2002, 2005, 2007, 2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -54,8 +54,10 @@ #undef FT_COMPONENT #define FT_COMPONENT trace_init + #ifndef FT_CONFIG_OPTION_PIC + #undef FT_USE_MODULE #ifdef __cplusplus #define FT_USE_MODULE( type, x ) extern "C" const type x; @@ -63,10 +65,8 @@ #define FT_USE_MODULE( type, x ) extern const type x; #endif - #include FT_CONFIG_MODULES_H - #undef FT_USE_MODULE #define FT_USE_MODULE( type, x ) (const FT_Module_Class*)&(x), @@ -77,8 +77,10 @@ 0 }; + #else /* FT_CONFIG_OPTION_PIC */ + #ifdef __cplusplus #define FT_EXTERNC extern "C" #else @@ -87,16 +89,19 @@ /* declare the module's class creation/destruction functions */ #undef FT_USE_MODULE -#define FT_USE_MODULE( type, x ) \ - FT_EXTERNC FT_Error FT_Create_Class_##x( FT_Library library, FT_Module_Class** output_class ); \ - FT_EXTERNC void FT_Destroy_Class_##x( FT_Library library, FT_Module_Class* clazz ); +#define FT_USE_MODULE( type, x ) \ + FT_EXTERNC FT_Error \ + FT_Create_Class_ ## x( FT_Library library, \ + FT_Module_Class* *output_class ); \ + FT_EXTERNC void \ + FT_Destroy_Class_ ## x( FT_Library library, \ + FT_Module_Class* clazz ); #include FT_CONFIG_MODULES_H - /* count all module classes */ #undef FT_USE_MODULE -#define FT_USE_MODULE( type, x ) MODULE_CLASS_##x, +#define FT_USE_MODULE( type, x ) MODULE_CLASS_ ## x, enum { @@ -104,26 +109,31 @@ FT_NUM_MODULE_CLASSES }; - /* destroy all module classes */ + /* destroy all module classes */ #undef FT_USE_MODULE -#define FT_USE_MODULE( type, x ) \ - if ( classes[i] ) { FT_Destroy_Class_##x(library, classes[i]); } \ - i++; \ +#define FT_USE_MODULE( type, x ) \ + if ( classes[i] ) \ + { \ + FT_Destroy_Class_ ## x( library, classes[i] ); \ + } \ + i++; + FT_BASE_DEF( void ) ft_destroy_default_module_classes( FT_Library library ) { - FT_Module_Class** classes; - FT_Memory memory; - FT_UInt i; - BasePIC* pic_container = (BasePIC*)library->pic_container.base; + FT_Module_Class* *classes; + FT_Memory memory; + FT_UInt i; + BasePIC* pic_container = (BasePIC*)library->pic_container.base; + if ( !pic_container->default_module_classes ) return; - memory = library->memory; + memory = library->memory; classes = pic_container->default_module_classes; - i = 0; + i = 0; #include FT_CONFIG_MODULES_H @@ -131,30 +141,37 @@ pic_container->default_module_classes = 0; } + /* initialize all module classes and the pointer table */ #undef FT_USE_MODULE -#define FT_USE_MODULE( type, x ) \ - error = FT_Create_Class_##x(library, &clazz); \ - if (error) goto Exit; \ +#define FT_USE_MODULE( type, x ) \ + error = FT_Create_Class_ ## x( library, &clazz ); \ + if ( error ) \ + goto Exit; \ classes[i++] = clazz; + FT_BASE_DEF( FT_Error ) ft_create_default_module_classes( FT_Library library ) { - FT_Error error; - FT_Memory memory; - FT_Module_Class** classes; - FT_Module_Class* clazz; - FT_UInt i; - BasePIC* pic_container = (BasePIC*)library->pic_container.base; - - memory = library->memory; + FT_Error error; + FT_Memory memory; + FT_Module_Class* *classes; + FT_Module_Class* clazz; + FT_UInt i; + BasePIC* pic_container = (BasePIC*)library->pic_container.base; + + + memory = library->memory; + pic_container->default_module_classes = 0; - if ( FT_ALLOC(classes, sizeof(FT_Module_Class*) * (FT_NUM_MODULE_CLASSES + 1) ) ) + if ( FT_ALLOC( classes, sizeof ( FT_Module_Class* ) * + ( FT_NUM_MODULE_CLASSES + 1 ) ) ) return error; + /* initialize all pointers to 0, especially the last one */ - for (i = 0; i < FT_NUM_MODULE_CLASSES; i++) + for ( i = 0; i < FT_NUM_MODULE_CLASSES; i++ ) classes[i] = 0; classes[FT_NUM_MODULE_CLASSES] = 0; @@ -162,16 +179,19 @@ #include FT_CONFIG_MODULES_H -Exit: - if (error) ft_destroy_default_module_classes( library ); - else pic_container->default_module_classes = classes; + Exit: + if ( error ) + ft_destroy_default_module_classes( library ); + else + pic_container->default_module_classes = classes; - return error; + return error; } #endif /* FT_CONFIG_OPTION_PIC */ + /* documentation is in ftmodapi.h */ FT_EXPORT_DEF( void ) @@ -181,9 +201,18 @@ Exit: const FT_Module_Class* const* cur; - /* test for valid `library' delayed to FT_Add_Module() */ + /* FT_DEFAULT_MODULES_GET dereferences `library' in PIC mode */ +#ifdef FT_CONFIG_OPTION_PIC + if ( !library ) + return; +#endif + + /* GCC 4.6 warns the type difference: + * FT_Module_Class** != const FT_Module_Class* const* + */ + cur = (const FT_Module_Class* const*)FT_DEFAULT_MODULES_GET; - cur = FT_DEFAULT_MODULES_GET; + /* test for valid `library' delayed to FT_Add_Module() */ while ( *cur ) { error = FT_Add_Module( library, *cur ); diff --git a/freetype/src/base/ftmac.c b/freetype/src/base/ftmac.c index 63f927d57..f2007485d 100644 --- a/freetype/src/base/ftmac.c +++ b/freetype/src/base/ftmac.c @@ -119,6 +119,8 @@ #endif +#ifdef FT_MACINTOSH + /* This function is deprecated because FSSpec is deprecated in Mac OS X */ FT_EXPORT_DEF( FT_Error ) FT_GetFile_From_Mac_Name( const char* fontName, @@ -144,7 +146,7 @@ { #if defined( MAC_OS_X_VERSION_10_5 ) && \ ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 ) - + OSStatus err; err = ATSFontGetFileReference( ats_font_id, ats_font_ref ); @@ -1053,5 +1055,7 @@ #endif } +#endif /* FT_MACINTOSH */ + /* END */ diff --git a/freetype/src/base/ftobjs.c b/freetype/src/base/ftobjs.c index 64575af59..36ee79749 100644 --- a/freetype/src/base/ftobjs.c +++ b/freetype/src/base/ftobjs.c @@ -4,7 +4,7 @@ /* */ /* The FreeType private base classes (body). */ /* */ -/* Copyright 1996-2011 by */ +/* Copyright 1996-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -445,6 +445,10 @@ else prev->next = cur->next; + /* finalize client-specific data */ + if ( slot->generic.finalizer ) + slot->generic.finalizer( slot ); + ft_glyphslot_done( slot ); FT_FREE( slot ); break; @@ -1187,7 +1191,7 @@ /* there's a Mac-specific extended implementation of FT_New_Face() */ /* in src/base/ftmac.c */ -#if !defined( FT_MACINTOSH ) || defined( DARWIN_NO_CARBON ) +#ifndef FT_MACINTOSH /* documentation is in freetype.h */ @@ -1211,7 +1215,7 @@ return FT_Open_Face( library, &args, face_index, aface ); } -#endif /* defined( FT_MACINTOSH ) && !defined( DARWIN_NO_CARBON ) */ +#endif /* documentation is in freetype.h */ @@ -1520,7 +1524,7 @@ } -#if !defined( FT_MACINTOSH ) || defined( DARWIN_NO_CARBON ) +#ifndef FT_MACINTOSH /* The resource header says we've got resource_cnt `POST' (type1) */ /* resources in this file. They all need to be coalesced into */ @@ -1875,7 +1879,7 @@ for ( i = 0; i < FT_RACCESS_N_RULES; i++ ) { - is_darwin_vfs = raccess_rule_by_darwin_vfs( i ); + is_darwin_vfs = ft_raccess_rule_by_darwin_vfs( library, i ); if ( is_darwin_vfs && vfs_rfork_has_no_font ) { FT_TRACE3(( "Skip rule %d: darwin vfs resource fork" @@ -4085,10 +4089,10 @@ /* all child faces. */ /* */ /* */ - /* module :: A handle to the target driver object. */ + /* module :: A handle to the target driver object. */ /* */ /* */ - /* The driver _must_ be LOCKED! */ + /* The driver _must_ be LOCKED! */ /* */ static void Destroy_Module( FT_Module module ) @@ -4098,10 +4102,6 @@ FT_Library library = module->library; - /* finalize client-data - before anything else */ - if ( module->generic.finalizer ) - module->generic.finalizer( module ); - if ( library && library->auto_hinter == module ) library->auto_hinter = 0; @@ -4318,6 +4318,7 @@ FT_Module* cur = library->modules; FT_Module* limit = cur + library->num_modules; + for ( ; cur < limit; cur++ ) { if ( cur[0] != module ) @@ -4511,10 +4512,6 @@ memory = library->memory; - /* Discard client-data */ - if ( library->generic.finalizer ) - library->generic.finalizer( library ); - /* * Close all faces in the library. If we don't do this, we can have * some subtle memory leaks. diff --git a/freetype/src/base/ftoutln.c b/freetype/src/base/ftoutln.c index 356b15611..9ae276d08 100644 --- a/freetype/src/base/ftoutln.c +++ b/freetype/src/base/ftoutln.c @@ -4,7 +4,7 @@ /* */ /* FreeType outline management (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 by */ +/* Copyright 1996-2008, 2010, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -771,7 +771,7 @@ return 1; } - return ( n % 2 ); + return n & 1; } diff --git a/freetype/src/base/ftrfork.c b/freetype/src/base/ftrfork.c index 33768b0e3..01d8625e6 100644 --- a/freetype/src/base/ftrfork.c +++ b/freetype/src/base/ftrfork.c @@ -28,7 +28,7 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_RFORK_H - +#include "basepic.h" #undef FT_COMPONENT #define FT_COMPONENT trace_raccess @@ -253,14 +253,6 @@ /*************************************************************************/ /*************************************************************************/ - typedef FT_Error - (*raccess_guess_func)( FT_Library library, - FT_Stream stream, - char *base_file_name, - char **result_file_name, - FT_Long *result_offset ); - - static FT_Error raccess_guess_apple_double( FT_Library library, FT_Stream stream, @@ -325,6 +317,20 @@ FT_Long *result_offset ); + CONST_FT_RFORK_RULE_ARRAY_BEGIN(ft_raccess_guess_table, + ft_raccess_guess_rec) + CONST_FT_RFORK_RULE_ARRAY_ENTRY(apple_double, apple_double) + CONST_FT_RFORK_RULE_ARRAY_ENTRY(apple_single, apple_single) + CONST_FT_RFORK_RULE_ARRAY_ENTRY(darwin_ufs_export, darwin_ufs_export) + CONST_FT_RFORK_RULE_ARRAY_ENTRY(darwin_newvfs, darwin_newvfs) + CONST_FT_RFORK_RULE_ARRAY_ENTRY(darwin_hfsplus, darwin_hfsplus) + CONST_FT_RFORK_RULE_ARRAY_ENTRY(vfat, vfat) + CONST_FT_RFORK_RULE_ARRAY_ENTRY(linux_cap, linux_cap) + CONST_FT_RFORK_RULE_ARRAY_ENTRY(linux_double, linux_double) + CONST_FT_RFORK_RULE_ARRAY_ENTRY(linux_netatalk, linux_netatalk) + CONST_FT_RFORK_RULE_ARRAY_END + + /*************************************************************************/ /**** ****/ /**** Helper functions ****/ @@ -348,43 +354,6 @@ const char *original_name, const char *insertion ); - - typedef enum FT_RFork_Rule_ { - FT_RFork_Rule_invalid = -2, - FT_RFork_Rule_uknown, /* -1 */ - FT_RFork_Rule_apple_double, - FT_RFork_Rule_apple_single, - FT_RFork_Rule_darwin_ufs_export, - FT_RFork_Rule_darwin_newvfs, - FT_RFork_Rule_darwin_hfsplus, - FT_RFork_Rule_vfat, - FT_RFork_Rule_linux_cap, - FT_RFork_Rule_linux_double, - FT_RFork_Rule_linux_netatalk - } FT_RFork_Rule; - - /* For fast translation between rule index and rule type, - * the macros FT_RFORK_xxx should be kept consistent with - * the raccess_guess_funcs table - */ - typedef struct raccess_guess_rec_ { - raccess_guess_func func; - FT_RFork_Rule type; - } raccess_guess_rec; - - static raccess_guess_rec raccess_guess_table[FT_RACCESS_N_RULES] = - { - { raccess_guess_apple_double, FT_RFork_Rule_apple_double, }, - { raccess_guess_apple_single, FT_RFork_Rule_apple_single, }, - { raccess_guess_darwin_ufs_export, FT_RFork_Rule_darwin_ufs_export, }, - { raccess_guess_darwin_newvfs, FT_RFork_Rule_darwin_newvfs, }, - { raccess_guess_darwin_hfsplus, FT_RFork_Rule_darwin_hfsplus, }, - { raccess_guess_vfat, FT_RFork_Rule_vfat, }, - { raccess_guess_linux_cap, FT_RFork_Rule_linux_cap, }, - { raccess_guess_linux_double, FT_RFork_Rule_linux_double, }, - { raccess_guess_linux_netatalk, FT_RFork_Rule_linux_netatalk, }, - }; - FT_BASE_DEF( void ) FT_Raccess_Guess( FT_Library library, FT_Stream stream, @@ -407,7 +376,7 @@ if ( errors[i] ) continue ; - errors[i] = (raccess_guess_table[i].func)( library, + errors[i] = (FT_RACCESS_GUESS_TABLE_GET[i].func)( library, stream, base_name, &(new_names[i]), &(offsets[i]) ); @@ -417,21 +386,28 @@ } -#if !defined( FT_MACINTOSH ) || defined( DARWIN_NO_CARBON ) +#ifndef FT_MACINTOSH static FT_RFork_Rule - raccess_get_rule_type_from_rule_index( FT_UInt rule_index ) + raccess_get_rule_type_from_rule_index( FT_Library library, + FT_UInt rule_index ) { + FT_UNUSED( library ); + if ( rule_index >= FT_RACCESS_N_RULES ) return FT_RFork_Rule_invalid; - return raccess_guess_table[rule_index].type; + return FT_RACCESS_GUESS_TABLE_GET[rule_index].type; } + /* + * For this function, refer ftbase.h. + */ FT_LOCAL_DEF( FT_Bool ) - raccess_rule_by_darwin_vfs( FT_UInt rule_index ) + ft_raccess_rule_by_darwin_vfs( FT_Library library, + FT_UInt rule_index ) { - switch( raccess_get_rule_type_from_rule_index( rule_index ) ) + switch( raccess_get_rule_type_from_rule_index( library, rule_index ) ) { case FT_RFork_Rule_darwin_newvfs: case FT_RFork_Rule_darwin_hfsplus: -- cgit v1.2.3