diff -uNr freetype-2.2.1/include/freetype/freetype.h freetype-2.2.1-new/include/freetype/freetype.h --- freetype-2.2.1/include/freetype/freetype.h 2006-05-12 09:52:24.000000000 -0400 +++ freetype-2.2.1-new/include/freetype/freetype.h 2006-11-09 17:30:21.000000000 -0500 @@ -17,11 +17,7 @@ #ifndef FT_FREETYPE_H -#error "`ft2build.h' hasn't been included yet!" -#error "Please always use macros to include FreeType header files." -#error "Example:" -#error " #include " -#error " #include FT_FREETYPE_H" +#include #endif Index: src/base/ftmac.c =================================================================== RCS file: /sources/freetype/freetype2/src/base/ftmac.c,v retrieving revision 1.43 retrieving revision 1.48 diff -u -b -w -r1.43 -r1.48 --- freetype2/src/base/ftmac.c 2 May 2006 09:00:29 -0000 1.43 +++ freetype2/src/base/ftmac.c 15 Oct 2006 07:15:28 -0000 1.48 @@ -53,6 +53,12 @@ - If there is a TrueType font (an `sfnt' resource), read it into memory, wrap it into a memory stream, load the TrueType driver and delegate the rest of the work to it, by calling FT_Open_Face(). + + - Some suitcase fonts (notably Onyx) might point the `LWFN' file to + itself, even though it doesn't contains `POST' resources. To handle + this special case without opening the file an extra time, we just + ignore errors from the `LWFN' and fallback to the `sfnt' if both are + available. */ @@ -64,11 +70,13 @@ /* This is for Mac OS X. Without redefinition, OS_INLINE */ /* expands to `static inline' which doesn't survive the */ /* -ansi compilation flag of GCC. */ +#undef OS_INLINE #define OS_INLINE static __inline__ #include #else #include #include +#include #include #include #include @@ -536,7 +544,8 @@ /* The count is 1 greater than the value in the FOND. */ /* Isn't that cute? :-) */ - return 1 + *( (short*)( fond_data + sizeof ( FamRec ) ) ); + return EndianS16_BtoN( *( (short*)( fond_data + + sizeof ( FamRec ) ) ) ) + 1; } @@ -549,13 +558,14 @@ fond = (FamRec*)fond_data; - face_all = *( (short *)( fond_data + sizeof ( FamRec ) ) ) + 1; + face_all = EndianS16_BtoN( *( (short *)( fond_data + + sizeof ( FamRec ) ) ) ) + 1; assoc = (AsscEntry*)( fond_data + sizeof ( FamRec ) + 2 ); face = 0; for ( i = 0; i < face_all; i++ ) { - if ( 0 == assoc[i].fontSize ) + if ( 0 == EndianS16_BtoN( assoc[i].fontSize ) ) face++; } return face; @@ -597,19 +607,19 @@ /* if the face at this index is not scalable, fall back to the first one (old behavior) */ - if ( assoc->fontSize == 0 ) + if ( EndianS16_BtoN( assoc->fontSize ) == 0 ) { *have_sfnt = 1; - *sfnt_id = assoc->fontID; + *sfnt_id = EndianS16_BtoN( assoc->fontID ); } else if ( base_assoc->fontSize == 0 ) { *have_sfnt = 1; - *sfnt_id = base_assoc->fontID; + *sfnt_id = EndianS16_BtoN( base_assoc->fontID ); } } - if ( fond->ffStylOff ) + if ( EndianS32_BtoN( fond->ffStylOff ) ) { unsigned char* p = (unsigned char*)fond_data; StyleTable* style; @@ -619,10 +629,10 @@ int i; - p += fond->ffStylOff; + p += EndianS32_BtoN( fond->ffStylOff ); style = (StyleTable*)p; p += sizeof ( StyleTable ); - string_count = *(unsigned short*)(p); + string_count = EndianS16_BtoN( *(short*)(p) ); p += sizeof ( short ); for ( i = 0; i < string_count && i < 64; i++ ) @@ -770,13 +780,13 @@ Str255 lwfn_file_name; UInt8 buff[HFS_MAXPATHLEN]; FT_Error err; + short num_faces; have_sfnt = have_lwfn = 0; HLock( fond ); parse_fond( *fond, &have_sfnt, &sfnt_id, lwfn_file_name, 0 ); - HUnlock( fond ); if ( lwfn_file_name[0] ) { @@ -787,9 +797,12 @@ } if ( have_lwfn && ( !have_sfnt || PREFER_LWFN ) ) - return 1; + num_faces = 1; else - return count_faces_scalable( *fond ); + num_faces = count_faces_scalable( *fond ); + + HUnlock( fond ); + return num_faces; } @@ -1010,6 +1023,8 @@ error = FT_Open_Face( library, &args, face_index, aface ); if ( error == FT_Err_Ok ) (*aface)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM; + else + FT_Stream_Free( stream, 0 ); return error; } @@ -1150,7 +1165,7 @@ Str255 lwfn_file_name; UInt8 path_lwfn[HFS_MAXPATHLEN]; OSErr err; - FT_Error error; + FT_Error error = FT_Err_Ok; GetResInfo( fond, &fond_id, &fond_type, fond_name ); @@ -1233,19 +1248,21 @@ } if ( have_lwfn && ( !have_sfnt || PREFER_LWFN ) ) - return FT_New_Face_From_LWFN( library, + error = FT_New_Face_From_LWFN( library, path_lwfn, face_index, aface ); + else + error = FT_Err_Unknown_File_Format; found_no_lwfn_file: - if ( have_sfnt ) - return FT_New_Face_From_SFNT( library, + if ( have_sfnt && FT_Err_Ok != error ) + error = FT_New_Face_From_SFNT( library, sfnt_id, face_index, aface ); - return FT_Err_Unknown_File_Format; + return error; } diff -uNr freetype-2.2.1/modules.cfg freetype-2.2.1-new/modules.cfg --- freetype-2.2.1/modules.cfg 2006-03-01 02:01:21.000000000 +0900 +++ freetype-2.2.1-new/modules.cfg 2006-11-19 15:40:45.000000000 +0900 @@ -124,7 +124,7 @@ # OpenType table validation. Needs ftotval.c below. # -# AUX_MODULES += otvalid +AUX_MODULES += otvalid # Auxiliary PostScript driver component to share common code. #