From fa791414601df61d20d860299dba80fdb62565df Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 21 Jun 2013 10:45:51 +0200 Subject: Upgraded freetype to 2.5.0.1 --- freetype/builds/mac/ftmac.c | 79 +++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 39 deletions(-) (limited to 'freetype/builds/mac/ftmac.c') diff --git a/freetype/builds/mac/ftmac.c b/freetype/builds/mac/ftmac.c index 719dd0ce9..16d50e87f 100644 --- a/freetype/builds/mac/ftmac.c +++ b/freetype/builds/mac/ftmac.c @@ -5,7 +5,7 @@ /* Mac FOND support. Written by just@letterror.com. */ /* Heavily Fixed by mpsuzuki, George Williams and Sean McBride */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */ +/* Copyright 1996-2008, 2013 by */ /* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -184,7 +184,7 @@ typedef short ResourceIndex; FT_UNUSED( pathSpec ); FT_UNUSED( face_index ); - return FT_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); } #else @@ -270,7 +270,7 @@ typedef short ResourceIndex; return FT_Err_Ok; } else - return FT_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); } #endif /* HAVE_QUICKDRAW_CARBON */ @@ -323,10 +323,10 @@ typedef short ResourceIndex; CFRelease( cf_fontName ); if ( ats_font_id == 0 || ats_font_id == 0xFFFFFFFFUL ) - return FT_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); if ( noErr != FT_ATSFontGetFileReference( ats_font_id, ats_font_ref ) ) - return FT_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); /* face_index calculation by searching preceding fontIDs */ /* with same FSRef */ @@ -365,7 +365,7 @@ typedef short ResourceIndex; FT_UNUSED( maxPathSize ); FT_UNUSED( face_index ); - return FT_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); } #else @@ -385,7 +385,7 @@ typedef short ResourceIndex; return err; if ( noErr != FSRefMakePath( &ref, path, maxPathSize ) ) - return FT_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); return FT_Err_Ok; } @@ -404,7 +404,7 @@ typedef short ResourceIndex; FT_UNUSED( pathSpec ); FT_UNUSED( face_index ); - return FT_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); } #else @@ -425,7 +425,7 @@ typedef short ResourceIndex; if ( noErr != FSGetCatalogInfo( &ref, kFSCatInfoNone, NULL, NULL, pathSpec, NULL ) ) - return FT_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); return FT_Err_Ok; } @@ -580,7 +580,7 @@ typedef short ResourceIndex; if ( noErr != FSPathMakeRef( pathname, &ref, FALSE ) ) - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); /* at present, no support for dfont format */ err = FSOpenResourceFile( &ref, 0, NULL, fsRdPerm, res ); @@ -598,7 +598,7 @@ typedef short ResourceIndex; if ( noErr != FT_FSPathMakeSpec( pathname, &spec, FALSE ) ) - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); /* at present, no support for dfont format without FSRef */ /* (see above), try original resource-fork font */ @@ -696,11 +696,9 @@ typedef short ResourceIndex; count_faces_scalable( char* fond_data ) { AsscEntry* assoc; - FamRec* fond; short i, face, face_all; - fond = (FamRec*)fond_data; face_all = EndianS16_BtoN( *( (short *)( fond_data + sizeof ( FamRec ) ) ) ) + 1; assoc = (AsscEntry*)( fond_data + sizeof ( FamRec ) + 2 ); @@ -847,17 +845,17 @@ typedef short ResourceIndex; /* We should not extract parent directory by string manipulation. */ if ( noErr != FSPathMakeRef( path_fond, &ref, FALSE ) ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); if ( noErr != FSGetCatalogInfo( &ref, kFSCatInfoNone, NULL, NULL, NULL, &par_ref ) ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); if ( noErr != FSRefMakePath( &par_ref, path_lwfn, path_size ) ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); if ( ft_strlen( (char *)path_lwfn ) + 1 + base_lwfn[0] > path_size ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); /* now we have absolute dirname in path_lwfn */ if ( path_lwfn[0] == '/' ) @@ -870,11 +868,11 @@ typedef short ResourceIndex; path_lwfn[dirname_len + base_lwfn[0]] = '\0'; if ( noErr != FSPathMakeRef( path_lwfn, &ref, FALSE ) ) - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); if ( noErr != FSGetCatalogInfo( &ref, kFSCatInfoNone, NULL, NULL, NULL, NULL ) ) - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); return FT_Err_Ok; @@ -886,7 +884,7 @@ typedef short ResourceIndex; /* pathname for FSSpec is always HFS format */ if ( ft_strlen( (char *)path_fond ) > path_size ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); ft_strcpy( (char *)path_lwfn, (char *)path_fond ); @@ -895,7 +893,7 @@ typedef short ResourceIndex; i--; if ( i + 1 + base_lwfn[0] > path_size ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); if ( ':' == path_lwfn[i] ) { @@ -909,7 +907,7 @@ typedef short ResourceIndex; } if ( noErr != FT_FSPathMakeSpec( path_lwfn, &spec, FALSE ) ) - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); return FT_Err_Ok; @@ -1003,7 +1001,7 @@ typedef short ResourceIndex; /* detect integer overflows */ if ( total_size < old_total_size ) { - error = FT_Err_Array_Too_Large; + error = FT_ERR( Array_Too_Large ); goto Error; } @@ -1088,7 +1086,7 @@ typedef short ResourceIndex; if ( noErr != FT_FSPathMakeRes( pathname, &res ) ) - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); pfb_data = NULL; pfb_size = 0; @@ -1123,7 +1121,7 @@ typedef short ResourceIndex; sfnt = GetResource( TTAG_sfnt, sfnt_id ); if ( sfnt == NULL ) - return FT_Err_Invalid_Handle; + return FT_THROW( Invalid_Handle ); sfnt_size = (FT_ULong)GetHandleSize( sfnt ); if ( FT_ALLOC( sfnt_data, (FT_Long)sfnt_size ) ) @@ -1182,23 +1180,26 @@ typedef short ResourceIndex; FT_Long face_index, FT_Face* aface ) { - FT_Error error = FT_Err_Cannot_Open_Resource; + FT_Error error = FT_ERR( Cannot_Open_Resource ); ResFileRefNum res_ref; ResourceIndex res_index; Handle fond; - short num_faces_in_res, num_faces_in_fond; + short num_faces_in_res; if ( noErr != FT_FSPathMakeRes( pathname, &res_ref ) ) - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); UseResFile( res_ref ); if ( ResError() ) - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); num_faces_in_res = 0; for ( res_index = 1; ; ++res_index ) { + short num_faces_in_fond; + + fond = Get1IndResource( TTAG_FOND, res_index ); if ( ResError() ) break; @@ -1239,7 +1240,7 @@ typedef short ResourceIndex; GetResInfo( fond, &fond_id, &fond_type, fond_name ); if ( ResError() != noErr || fond_type != TTAG_FOND ) - return FT_Err_Invalid_File_Format; + return FT_THROW( Invalid_File_Format ); HLock( fond ); parse_fond( *fond, &have_sfnt, &sfnt_id, lwfn_file_name, face_index ); @@ -1322,7 +1323,7 @@ typedef short ResourceIndex; face_index, aface ); else - error = FT_Err_Unknown_File_Format; + error = FT_ERR( Unknown_File_Format ); found_no_lwfn_file: if ( have_sfnt && FT_Err_Ok != error ) @@ -1389,7 +1390,7 @@ typedef short ResourceIndex; /* test for valid `library' and `aface' delayed to FT_Open_Face() */ if ( !pathname ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); error = FT_Err_Ok; *aface = NULL; @@ -1432,7 +1433,7 @@ typedef short ResourceIndex; FT_UNUSED( face_index ); FT_UNUSED( aface ); - return FT_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); #else @@ -1443,11 +1444,11 @@ typedef short ResourceIndex; if ( !ref ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); err = FSRefMakePath( ref, pathname, sizeof ( pathname ) ); if ( err ) - error = FT_Err_Cannot_Open_Resource; + error = FT_ERR( Cannot_Open_Resource ); error = FT_New_Face_From_Resource( library, pathname, face_index, aface ); if ( error != 0 || *aface != NULL ) @@ -1487,7 +1488,7 @@ typedef short ResourceIndex; if ( !spec || FSpMakeFSRef( spec, &ref ) != noErr ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); else return FT_New_Face_From_FSRef( library, &ref, face_index, aface ); @@ -1500,11 +1501,11 @@ typedef short ResourceIndex; if ( !spec ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); err = FT_FSpMakePath( spec, pathname, sizeof ( pathname ) ); if ( err ) - error = FT_Err_Cannot_Open_Resource; + error = FT_ERR( Cannot_Open_Resource ); error = FT_New_Face_From_Resource( library, pathname, face_index, aface ); if ( error != 0 || *aface != NULL ) @@ -1522,7 +1523,7 @@ typedef short ResourceIndex; FT_UNUSED( face_index ); FT_UNUSED( aface ); - return FT_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); #endif /* HAVE_FSREF, HAVE_FSSPEC */ -- cgit v1.2.3