From aaf21968deb85b635cb6aa6544df233ea5981346 Mon Sep 17 00:00:00 2001 From: marha Date: Wed, 13 Feb 2013 09:48:21 +0100 Subject: Update to following packages: openssl-1.0.1e freetype-2.4.11 --- freetype/src/base/basepic.c | 40 +++++++--- freetype/src/base/ftgloadr.c | 2 +- freetype/src/base/ftglyph.c | 8 +- freetype/src/base/ftinit.c | 4 +- freetype/src/base/ftobjs.c | 169 ++++++++++++++++++++++++++++++++++++------- freetype/src/base/ftoutln.c | 27 +++++-- freetype/src/base/ftrfork.c | 4 +- freetype/src/base/ftstroke.c | 11 ++- freetype/src/base/ftsynth.c | 2 +- freetype/src/base/fttrigon.c | 97 +++++++++---------------- 10 files changed, 239 insertions(+), 125 deletions(-) (limited to 'freetype/src/base') diff --git a/freetype/src/base/basepic.c b/freetype/src/base/basepic.c index d754eb1b0..5268e7c67 100644 --- a/freetype/src/base/basepic.c +++ b/freetype/src/base/basepic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for base. */ /* */ -/* Copyright 2009 by */ +/* Copyright 2009, 2012 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,14 +21,22 @@ #include FT_INTERNAL_OBJECTS_H #include "basepic.h" + #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* clazz ); - void FT_Init_Class_ft_bitmap_glyph_class( FT_Glyph_Class* clazz ); + void + FT_Init_Class_ft_outline_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 ); + void + FT_Init_Class_ft_bitmap_glyph_class( FT_Glyph_Class* clazz ); + +#ifdef FT_CONFIG_OPTION_MAC_FONTS + /* forward declaration of PIC init function from ftrfork.c */ + /* (not modularized) */ + void + FT_Init_Table_raccess_guess_table( ft_raccess_guess_rec* record ); +#endif /* forward declaration of PIC init functions from ftinit.c */ FT_Error @@ -37,14 +45,18 @@ void ft_destroy_default_module_classes( FT_Library library ); + void ft_base_pic_free( FT_Library library ) { FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_Memory memory = library->memory; + + if ( pic_container->base ) { - /* Destroy default module classes (in case FT_Add_Default_Modules was used) */ + /* destroy default module classes */ + /* (in case FT_Add_Default_Modules was used) */ ft_destroy_default_module_classes( library ); FT_FREE( pic_container->base ); @@ -57,9 +69,10 @@ 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_Error error = FT_Err_Ok; + BasePIC* container = NULL; + FT_Memory memory = library->memory; + /* allocate pointer, clear and set global container pointer */ if ( FT_ALLOC ( container, sizeof ( *container ) ) ) @@ -72,13 +85,16 @@ if ( error ) goto Exit; - /* initialize pointer table - this is how the module usually expects this data */ + /* 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 ); +#ifdef FT_CONFIG_OPTION_MAC_FONTS FT_Init_Table_raccess_guess_table( - (ft_raccess_guess_rec*)&container->ft_raccess_guess_table); + (ft_raccess_guess_rec*)&container->ft_raccess_guess_table ); +#endif Exit: if( error ) diff --git a/freetype/src/base/ftgloadr.c b/freetype/src/base/ftgloadr.c index 848345019..3a5615e5e 100644 --- a/freetype/src/base/ftgloadr.c +++ b/freetype/src/base/ftgloadr.c @@ -318,7 +318,7 @@ } - /* add current glyph to the base image - and prepare for another */ + /* add current glyph to the base image -- and prepare for another */ FT_BASE_DEF( void ) FT_GlyphLoader_Add( FT_GlyphLoader loader ) { diff --git a/freetype/src/base/ftglyph.c b/freetype/src/base/ftglyph.c index 591b57a75..7363c7dce 100644 --- a/freetype/src/base/ftglyph.c +++ b/freetype/src/base/ftglyph.c @@ -4,7 +4,7 @@ /* */ /* FreeType convenience functions to handle glyphs (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2007, 2008, 2010 by */ +/* Copyright 1996-2005, 2007, 2008, 2010, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -510,7 +510,7 @@ FT_GlyphSlotRec dummy; FT_GlyphSlot_InternalRec dummy_internal; FT_Error error = FT_Err_Ok; - FT_Glyph glyph; + FT_Glyph b, glyph; FT_BitmapGlyph bitmap = NULL; const FT_Glyph_Class* clazz; @@ -547,10 +547,10 @@ dummy.format = clazz->glyph_format; /* create result bitmap glyph */ - error = ft_new_glyph( library, FT_BITMAP_GLYPH_CLASS_GET, - (FT_Glyph*)(void*)&bitmap ); + error = ft_new_glyph( library, FT_BITMAP_GLYPH_CLASS_GET, &b ); if ( error ) goto Exit; + bitmap = (FT_BitmapGlyph)b; #if 1 /* if `origin' is set, translate the glyph image */ diff --git a/freetype/src/base/ftinit.c b/freetype/src/base/ftinit.c index 91f8e2a18..0d8b568be 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, 2012 by */ +/* Copyright 1996-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, */ @@ -156,7 +156,7 @@ { FT_Error error; FT_Memory memory; - FT_Module_Class* *classes; + FT_Module_Class* *classes = NULL; FT_Module_Class* clazz; FT_UInt i; BasePIC* pic_container = (BasePIC*)library->pic_container.base; diff --git a/freetype/src/base/ftobjs.c b/freetype/src/base/ftobjs.c index 36ee79749..76ccf0a44 100644 --- a/freetype/src/base/ftobjs.c +++ b/freetype/src/base/ftobjs.c @@ -29,6 +29,7 @@ #include FT_TRUETYPE_TAGS_H #include FT_TRUETYPE_IDS_H +#include FT_SERVICE_PROPERTIES_H #include FT_SERVICE_SFNT_H #include FT_SERVICE_POSTSCRIPT_NAME_H #include FT_SERVICE_GLYPH_DICT_H @@ -651,7 +652,7 @@ if ( autohint ) { - FT_AutoHinter_Service hinting; + FT_AutoHinter_Interface hinting; /* try to load embedded bitmaps first if available */ @@ -680,7 +681,7 @@ internal->transform_flags = 0; /* load auto-hinted outline */ - hinting = (FT_AutoHinter_Service)hinter->clazz->module_interface; + hinting = (FT_AutoHinter_Interface)hinter->clazz->module_interface; error = hinting->load_glyph( (FT_AutoHinter)hinter, slot, face->size, @@ -2055,11 +2056,12 @@ } else { + error = FT_Err_Missing_Module; + /* check each font driver for an appropriate format */ cur = library->modules; limit = cur + library->num_modules; - for ( ; cur < limit; cur++ ) { /* not all modules are font drivers, so check... */ @@ -2109,30 +2111,30 @@ } } - Fail3: - /* If we are on the mac, and we get an FT_Err_Invalid_Stream_Operation */ - /* it may be because we have an empty data fork, so we need to check */ - /* the resource fork. */ - if ( FT_ERROR_BASE( error ) != FT_Err_Cannot_Open_Stream && - FT_ERROR_BASE( error ) != FT_Err_Unknown_File_Format && - FT_ERROR_BASE( error ) != FT_Err_Invalid_Stream_Operation ) - goto Fail2; + Fail3: + /* If we are on the mac, and we get an */ + /* FT_Err_Invalid_Stream_Operation it may be because we have an */ + /* empty data fork, so we need to check the resource fork. */ + if ( FT_ERROR_BASE( error ) != FT_Err_Cannot_Open_Stream && + FT_ERROR_BASE( error ) != FT_Err_Unknown_File_Format && + FT_ERROR_BASE( error ) != FT_Err_Invalid_Stream_Operation ) + goto Fail2; #if !defined( FT_MACINTOSH ) && defined( FT_CONFIG_OPTION_MAC_FONTS ) - error = load_mac_face( library, stream, face_index, aface, args ); - if ( !error ) - { - /* We don't want to go to Success here. We've already done that. */ - /* On the other hand, if we succeeded we still need to close this */ - /* stream (we opened a different stream which extracted the */ - /* interesting information out of this stream here. That stream */ - /* will still be open and the face will point to it). */ - FT_Stream_Free( stream, external_stream ); - return error; - } + error = load_mac_face( library, stream, face_index, aface, args ); + if ( !error ) + { + /* We don't want to go to Success here. We've already done that. */ + /* On the other hand, if we succeeded we still need to close this */ + /* stream (we opened a different stream which extracted the */ + /* interesting information out of this stream here. That stream */ + /* will still be open and the face will point to it). */ + FT_Stream_Free( stream, external_stream ); + return error; + } - if ( FT_ERROR_BASE( error ) != FT_Err_Unknown_File_Format ) - goto Fail2; + if ( FT_ERROR_BASE( error ) != FT_Err_Unknown_File_Format ) + goto Fail2; #endif /* !FT_MACINTOSH && FT_CONFIG_OPTION_MAC_FONTS */ /* no driver is able to handle this format */ @@ -4301,19 +4303,18 @@ { FT_Pointer result = NULL; + if ( module ) { FT_ASSERT( module->clazz && module->clazz->get_interface ); - /* first, look for the service in the module - */ + /* first, look for the service in the module */ if ( module->clazz->get_interface ) result = module->clazz->get_interface( module, service_id ); if ( result == NULL ) { - /* we didn't find it, look in all other modules then - */ + /* we didn't find it, look in all other modules then */ FT_Library library = module->library; FT_Module* cur = library->modules; FT_Module* limit = cur + library->num_modules; @@ -4382,6 +4383,118 @@ } + FT_Error + ft_property_do( FT_Library library, + const FT_String* module_name, + const FT_String* property_name, + void* value, + FT_Bool set ) + { + FT_Module* cur; + FT_Module* limit; + FT_Module_Interface interface; + + FT_Service_Properties service; + +#ifdef FT_DEBUG_LEVEL_ERROR + const FT_String* set_name = "FT_Property_Set"; + const FT_String* get_name = "FT_Property_Get"; + const FT_String* func_name = set ? set_name : get_name; +#endif + + FT_Bool missing_func; + + + if ( !library ) + return FT_Err_Invalid_Library_Handle; + + if ( !module_name || !property_name || !value ) + return FT_Err_Invalid_Argument; + + cur = library->modules; + limit = cur + library->num_modules; + + /* search module */ + for ( ; cur < limit; cur++ ) + if ( !ft_strcmp( cur[0]->clazz->module_name, module_name ) ) + break; + + if ( cur == limit ) + { + FT_ERROR(( "%s: can't find module `%s'\n", + func_name, module_name )); + return FT_Err_Missing_Module; + } + + /* check whether we have a service interface */ + if ( !cur[0]->clazz->get_interface ) + { + FT_ERROR(( "%s: module `%s' doesn't support properties\n", + func_name, module_name )); + return FT_Err_Unimplemented_Feature; + } + + /* search property service */ + interface = cur[0]->clazz->get_interface( cur[0], + FT_SERVICE_ID_PROPERTIES ); + if ( !interface ) + { + FT_ERROR(( "%s: module `%s' doesn't support properties\n", + func_name, module_name )); + return FT_Err_Unimplemented_Feature; + } + + service = (FT_Service_Properties)interface; + + if ( set ) + missing_func = !service->set_property; + else + missing_func = !service->get_property; + + if ( missing_func ) + { + FT_ERROR(( "%s: property service of module `%s' is broken\n", + func_name, module_name )); + return FT_Err_Unimplemented_Feature; + } + + return set ? service->set_property( cur[0], property_name, value ) + : service->get_property( cur[0], property_name, value ); + } + + + /* documentation is in ftmodapi.h */ + + FT_Error + FT_Property_Set( FT_Library library, + const FT_String* module_name, + const FT_String* property_name, + const void* value ) + { + return ft_property_do( library, + module_name, + property_name, + (void*)value, + TRUE ); + } + + + /* documentation is in ftmodapi.h */ + + FT_Error + FT_Property_Get( FT_Library library, + const FT_String* module_name, + const FT_String* property_name, + void* value ) + { + return ft_property_do( library, + module_name, + property_name, + value, + FALSE ); + } + + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ diff --git a/freetype/src/base/ftoutln.c b/freetype/src/base/ftoutln.c index 76e2b04a1..c4fd2660a 100644 --- a/freetype/src/base/ftoutln.c +++ b/freetype/src/base/ftoutln.c @@ -922,7 +922,7 @@ for ( c = 0; c < outline->n_contours; c++ ) { FT_Vector in, out, shift; - FT_Fixed l_in, l_out, d; + FT_Fixed l_in, l_out, l, q, d; int last = outline->contours[c]; @@ -952,17 +952,32 @@ /* shift only if turn is less then ~160 degrees */ if ( 16 * d > l_in * l_out ) { - /* shift components are rotated */ - shift.x = FT_DivFix( l_out * in.y + l_in * out.y, d ); - shift.y = FT_DivFix( l_out * in.x + l_in * out.x, d ); + /* shift components are aligned along bisector */ + /* and directed according to the outline orientation. */ + shift.x = l_out * in.y + l_in * out.y; + shift.y = l_out * in.x + l_in * out.x; if ( orientation == FT_ORIENTATION_TRUETYPE ) shift.x = -shift.x; else shift.y = -shift.y; - shift.x = FT_MulFix( xstrength, shift.x ); - shift.y = FT_MulFix( ystrength, shift.y ); + /* threshold strength to better handle collapsing segments */ + l = FT_MIN( l_in, l_out ); + q = out.x * in.y - out.y * in.x; + if ( orientation == FT_ORIENTATION_TRUETYPE ) + q = -q; + + if ( FT_MulDiv( xstrength, q, l ) < d ) + shift.x = FT_MulDiv( shift.x, xstrength, d ); + else + shift.x = FT_MulDiv( shift.x, l, q ); + + + if ( FT_MulDiv( ystrength, q, l ) < d ) + shift.y = FT_MulDiv( shift.y, ystrength, d ); + else + shift.y = FT_MulDiv( shift.y, l, q ); } else shift.x = shift.y = 0; diff --git a/freetype/src/base/ftrfork.c b/freetype/src/base/ftrfork.c index 01d8625e6..dcefdd28d 100644 --- a/freetype/src/base/ftrfork.c +++ b/freetype/src/base/ftrfork.c @@ -362,7 +362,7 @@ FT_Long *offsets, FT_Error *errors ) { - FT_Long i; + FT_Int i; for ( i = 0; i < FT_RACCESS_N_RULES; i++ ) @@ -827,7 +827,7 @@ FT_Long *offsets, FT_Error *errors ) { - int i; + FT_Int i; FT_UNUSED( library ); FT_UNUSED( stream ); diff --git a/freetype/src/base/ftstroke.c b/freetype/src/base/ftstroke.c index 5399efe9d..fd6a0c10b 100644 --- a/freetype/src/base/ftstroke.c +++ b/freetype/src/base/ftstroke.c @@ -789,7 +789,7 @@ FT_Stroker_New( FT_Library library, FT_Stroker *astroker ) { - FT_Error error; + FT_Error error; /* assigned in FT_NEW */ FT_Memory memory; FT_Stroker stroker = NULL; @@ -1126,9 +1126,8 @@ middle.y += stroker->center.y; /* compute first angle point */ - length = FT_MulFix( radius, - FT_DivFix( 0x10000L - sigma, - ft_pos_abs( FT_Sin( theta ) ) ) ); + length = FT_MulDiv( radius, 0x10000L - sigma, + ft_pos_abs( FT_Sin( theta ) ) ); FT_Vector_From_Polar( &delta, length, phi + rotate ); delta.x += middle.x; @@ -1495,7 +1494,7 @@ sinA = ft_pos_abs( FT_Sin( alpha1 - gamma ) ); sinB = ft_pos_abs( FT_Sin( beta - gamma ) ); - alen = FT_DivFix( FT_MulFix( blen, sinA ), sinB ); + alen = FT_MulDiv( blen, sinA, sinB ); FT_Vector_From_Polar( &delta, alen, beta ); delta.x += start.x; @@ -1702,7 +1701,7 @@ sinA = ft_pos_abs( FT_Sin( alpha1 - gamma ) ); sinB = ft_pos_abs( FT_Sin( beta - gamma ) ); - alen = FT_DivFix( FT_MulFix( blen, sinA ), sinB ); + alen = FT_MulDiv( blen, sinA, sinB ); FT_Vector_From_Polar( &delta, alen, beta ); delta.x += start.x; diff --git a/freetype/src/base/ftsynth.c b/freetype/src/base/ftsynth.c index 81e2ed246..241d37f42 100644 --- a/freetype/src/base/ftsynth.c +++ b/freetype/src/base/ftsynth.c @@ -63,7 +63,7 @@ transform.xx = 0x10000L; transform.yx = 0x00000L; - transform.xy = 0x06000L; + transform.xy = 0x0366AL; transform.yy = 0x10000L; FT_Outline_Transform( outline, &transform ); diff --git a/freetype/src/base/fttrigon.c b/freetype/src/base/fttrigon.c index fdf433ab8..52395388b 100644 --- a/freetype/src/base/fttrigon.c +++ b/freetype/src/base/fttrigon.c @@ -4,7 +4,7 @@ /* */ /* FreeType trigonometric functions (body). */ /* */ -/* Copyright 2001, 2002, 2003, 2004, 2005 by */ +/* Copyright 2001-2005, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,25 +21,30 @@ #include FT_TRIGONOMETRY_H - /* the following is 0.2715717684432231 * 2^30 */ -#define FT_TRIG_COSCALE 0x11616E8EUL +#ifdef FT_LONG64 + typedef FT_INT64 FT_Int64; +#endif + + + /* the Cordic shrink factor 0.607252935008887 * 2^32 */ +#define FT_TRIG_SCALE 0x9B74EDA8UL + + /* the following is 0.607252935008887 * 2^30 */ +#define FT_TRIG_COSCALE 0x26DD3B6AUL /* this table was generated for FT_PI = 180L << 16, i.e. degrees */ #define FT_TRIG_MAX_ITERS 23 static const FT_Fixed - ft_trig_arctan_table[24] = + ft_trig_arctan_table[23] = { - 4157273L, 2949120L, 1740967L, 919879L, 466945L, 234379L, 117304L, - 58666L, 29335L, 14668L, 7334L, 3667L, 1833L, 917L, 458L, 229L, 115L, + 2949120L, 1740967L, 919879L, 466945L, 234379L, 117304L, 58666L, + 29335L, 14668L, 7334L, 3667L, 1833L, 917L, 458L, 229L, 115L, 57L, 29L, 14L, 7L, 4L, 2L, 1L }; - /* the Cordic shrink factor, multiplied by 2^32 */ -#define FT_TRIG_SCALE 1166391785UL /* 0x4585BA38UL */ - -#ifdef FT_CONFIG_HAS_INT64 +#ifdef FT_LONG64 /* multiply a given value by the CORDIC shrink factor */ static FT_Fixed @@ -58,7 +63,7 @@ return ( s >= 0 ) ? val : -val; } -#else /* !FT_CONFIG_HAS_INT64 */ +#else /* !FT_LONG64 */ /* multiply a given value by the CORDIC shrink factor */ static FT_Fixed @@ -72,10 +77,10 @@ val = ( val >= 0 ) ? val : -val; v1 = (FT_UInt32)val >> 16; - v2 = (FT_UInt32)(val & 0xFFFFL); + v2 = (FT_UInt32)( val & 0xFFFFL ); - k1 = (FT_UInt32)FT_TRIG_SCALE >> 16; /* constant */ - k2 = (FT_UInt32)(FT_TRIG_SCALE & 0xFFFFL); /* constant */ + k1 = (FT_UInt32)FT_TRIG_SCALE >> 16; /* constant */ + k2 = (FT_UInt32)( FT_TRIG_SCALE & 0xFFFFL ); /* constant */ hi = k1 * v1; lo1 = k1 * v2 + k2 * v1; /* can't overflow */ @@ -93,7 +98,7 @@ return ( s >= 0 ) ? val : -val; } -#endif /* !FT_CONFIG_HAS_INT64 */ +#endif /* !FT_LONG64 */ static FT_Int @@ -209,25 +214,9 @@ theta -= FT_ANGLE_PI; } - /* Initial pseudorotation, with left shift */ arctanptr = ft_trig_arctan_table; - if ( theta < 0 ) - { - xtemp = x + ( y << 1 ); - y = y - ( x << 1 ); - x = xtemp; - theta += *arctanptr++; - } - else - { - xtemp = x - ( y << 1 ); - y = y + ( x << 1 ); - x = xtemp; - theta -= *arctanptr++; - } - - /* Subsequent pseudorotations, with right shifts */ + /* Pseudorotations, with right shifts */ i = 0; do { @@ -255,9 +244,9 @@ static void ft_trig_pseudo_polarize( FT_Vector* vec ) { - FT_Fixed theta; - FT_Fixed yi, i; - FT_Fixed x, y; + FT_Angle theta; + FT_Int i; + FT_Fixed x, y, xtemp; const FT_Fixed *arctanptr; @@ -278,41 +267,23 @@ arctanptr = ft_trig_arctan_table; - if ( y < 0 ) - { - /* Rotate positive */ - yi = y + ( x << 1 ); - x = x - ( y << 1 ); - y = yi; - theta -= *arctanptr++; /* Subtract angle */ - } - else - { - /* Rotate negative */ - yi = y - ( x << 1 ); - x = x + ( y << 1 ); - y = yi; - theta += *arctanptr++; /* Add angle */ - } - + /* Pseudorotations, with right shifts */ i = 0; do { - if ( y < 0 ) + if ( y > 0 ) { - /* Rotate positive */ - yi = y + ( x >> i ); - x = x - ( y >> i ); - y = yi; - theta -= *arctanptr++; + xtemp = x + ( y >> i ); + y = y - ( x >> i ); + x = xtemp; + theta += *arctanptr++; } else { - /* Rotate negative */ - yi = y - ( x >> i ); - x = x + ( y >> i ); - y = yi; - theta += *arctanptr++; + xtemp = x - ( y >> i ); + y = y + ( x >> i ); + x = xtemp; + theta -= *arctanptr++; } } while ( ++i < FT_TRIG_MAX_ITERS ); -- cgit v1.2.3