diff options
author | marha <marha@users.sourceforge.net> | 2011-01-16 17:43:39 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-01-16 17:43:39 +0000 |
commit | 2177eb8fad173f2b0fe04f188c4d6dadaa8f4441 (patch) | |
tree | 862ef4b348586f932593a7d2b599913230059cdd /freetype/src/base | |
parent | 367c91bebcdc1f5ba4278b68eb8715218d9640ad (diff) | |
download | vcxsrv-2177eb8fad173f2b0fe04f188c4d6dadaa8f4441.tar.gz vcxsrv-2177eb8fad173f2b0fe04f188c4d6dadaa8f4441.tar.bz2 vcxsrv-2177eb8fad173f2b0fe04f188c4d6dadaa8f4441.zip |
freetype 2.4.4
Diffstat (limited to 'freetype/src/base')
-rw-r--r-- | freetype/src/base/ftbase.h | 11 | ||||
-rw-r--r-- | freetype/src/base/ftdbgmem.c | 6 | ||||
-rw-r--r-- | freetype/src/base/ftobjs.c | 17 | ||||
-rw-r--r-- | freetype/src/base/ftrfork.c | 80 | ||||
-rw-r--r-- | freetype/src/base/ftsynth.c | 4 | ||||
-rw-r--r-- | freetype/src/base/ftsystem.c | 17 |
6 files changed, 112 insertions, 23 deletions
diff --git a/freetype/src/base/ftbase.h b/freetype/src/base/ftbase.h index 1dc49f3bd..6375613b2 100644 --- a/freetype/src/base/ftbase.h +++ b/freetype/src/base/ftbase.h @@ -49,6 +49,17 @@ FT_BEGIN_HEADER FT_Face *aface ); +#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK + /* 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 ); +#endif /* FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK */ + + FT_END_HEADER #endif /* __FTBASE_H__ */ diff --git a/freetype/src/base/ftdbgmem.c b/freetype/src/base/ftdbgmem.c index 160269d19..12fed04bb 100644 --- a/freetype/src/base/ftdbgmem.c +++ b/freetype/src/base/ftdbgmem.c @@ -47,7 +47,7 @@ typedef struct FT_MemTableRec_* FT_MemTable; -#define FT_MEM_VAL( addr ) ((FT_ULong)(FT_Pointer)( addr )) +#define FT_MEM_VAL( addr ) ((FT_PtrDist)(FT_Pointer)( addr )) /* * This structure holds statistics for a single allocation/release @@ -275,7 +275,7 @@ for ( i = 0; i < table->size; i++ ) { FT_MemNode node, next, *pnode; - FT_ULong hash; + FT_PtrDist hash; node = table->buckets[i]; @@ -430,7 +430,7 @@ ft_mem_table_get_nodep( FT_MemTable table, FT_Byte* address ) { - FT_ULong hash; + FT_PtrDist hash; FT_MemNode *pnode, node; diff --git a/freetype/src/base/ftobjs.c b/freetype/src/base/ftobjs.c index 7f38df0cb..cb44b8cca 100644 --- a/freetype/src/base/ftobjs.c +++ b/freetype/src/base/ftobjs.c @@ -1062,6 +1062,7 @@ if ( cur[0]->platform_id == TT_PLATFORM_APPLE_UNICODE && cur[0]->encoding_id == TT_APPLE_ID_VARIANT_SELECTOR && FT_Get_CMap_Format( cur[0] ) == 14 ) + { #ifdef FT_MAX_CHARMAP_CACHEABLE if ( cur - first > FT_MAX_CHARMAP_CACHEABLE ) { @@ -1071,6 +1072,7 @@ } #endif return cur[0]; + } } return NULL; @@ -1849,6 +1851,7 @@ char * file_names[FT_RACCESS_N_RULES]; FT_Long offsets[FT_RACCESS_N_RULES]; FT_Error errors[FT_RACCESS_N_RULES]; + FT_Bool is_darwin_vfs, vfs_rfork_has_no_font = FALSE; /* not tested */ FT_Open_Args args2; FT_Stream stream2 = 0; @@ -1859,6 +1862,15 @@ for ( i = 0; i < FT_RACCESS_N_RULES; i++ ) { + is_darwin_vfs = raccess_rule_by_darwin_vfs( i ); + if ( is_darwin_vfs && vfs_rfork_has_no_font ) + { + FT_TRACE3(( "Skip rule %d: darwin vfs resource fork" + " is already checked and" + " no font is found\n", i )); + continue; + } + if ( errors[i] ) { FT_TRACE3(( "Error[%d] has occurred in rule %d\n", errors[i], i )); @@ -1872,6 +1884,9 @@ i, args2.pathname, offsets[i] )); error = FT_Stream_New( library, &args2, &stream2 ); + if ( is_darwin_vfs && error == FT_Err_Cannot_Open_Stream ) + vfs_rfork_has_no_font = TRUE; + if ( error ) { FT_TRACE3(( "failed\n" )); @@ -1886,6 +1901,8 @@ if ( !error ) break; + else if ( is_darwin_vfs ) + vfs_rfork_has_no_font = TRUE; } for (i = 0; i < FT_RACCESS_N_RULES; i++) diff --git a/freetype/src/base/ftrfork.c b/freetype/src/base/ftrfork.c index f64d28b26..6df2def77 100644 --- a/freetype/src/base/ftrfork.c +++ b/freetype/src/base/ftrfork.c @@ -349,6 +349,42 @@ 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, @@ -360,19 +396,6 @@ FT_Long i; - raccess_guess_func funcs[FT_RACCESS_N_RULES] = - { - raccess_guess_apple_double, - raccess_guess_apple_single, - raccess_guess_darwin_ufs_export, - raccess_guess_darwin_newvfs, - raccess_guess_darwin_hfsplus, - raccess_guess_vfat, - raccess_guess_linux_cap, - raccess_guess_linux_double, - raccess_guess_linux_netatalk, - }; - for ( i = 0; i < FT_RACCESS_N_RULES; i++ ) { new_names[i] = NULL; @@ -384,14 +407,41 @@ if ( errors[i] ) continue ; - errors[i] = (funcs[i])( library, stream, base_name, - &(new_names[i]), &(offsets[i]) ); + errors[i] = (raccess_guess_table[i].func)( library, + stream, base_name, + &(new_names[i]), + &(offsets[i]) ); } return; } + static FT_RFork_Rule + raccess_get_rule_type_from_rule_index( FT_UInt rule_index ) + { + if ( rule_index >= FT_RACCESS_N_RULES ) + return FT_RFork_Rule_invalid; + + return raccess_guess_table[rule_index].type; + } + + + FT_LOCAL_DEF( FT_Bool ) + raccess_rule_by_darwin_vfs( FT_UInt rule_index ) + { + switch( raccess_get_rule_type_from_rule_index( rule_index ) ) + { + case FT_RFork_Rule_darwin_newvfs: + case FT_RFork_Rule_darwin_hfsplus: + return TRUE; + + default: + return FALSE; + } + } + + static FT_Error raccess_guess_apple_double( FT_Library library, FT_Stream stream, diff --git a/freetype/src/base/ftsynth.c b/freetype/src/base/ftsynth.c index ba3c633e2..d4ec0da57 100644 --- a/freetype/src/base/ftsynth.c +++ b/freetype/src/base/ftsynth.c @@ -90,7 +90,7 @@ if ( slot->format != FT_GLYPH_FORMAT_OUTLINE && - slot->format != FT_GLYPH_FORMAT_BITMAP ) + slot->format != FT_GLYPH_FORMAT_BITMAP ) return; /* some reasonable strength */ @@ -108,7 +108,7 @@ xstr = xstr * 2; ystr = xstr; } - else if ( slot->format == FT_GLYPH_FORMAT_BITMAP ) + else /* slot->format == FT_GLYPH_FORMAT_BITMAP */ { /* round to full pixels */ xstr &= ~63; diff --git a/freetype/src/base/ftsystem.c b/freetype/src/base/ftsystem.c index ba86005c5..66c5d76a9 100644 --- a/freetype/src/base/ftsystem.c +++ b/freetype/src/base/ftsystem.c @@ -229,6 +229,13 @@ if ( !stream ) return FT_Err_Invalid_Stream_Handle; + stream->descriptor.pointer = NULL; + stream->pathname.pointer = (char*)filepathname; + stream->base = 0; + stream->pos = 0; + stream->read = NULL; + stream->close = NULL; + file = ft_fopen( filepathname, "rb" ); if ( !file ) { @@ -240,12 +247,16 @@ ft_fseek( file, 0, SEEK_END ); stream->size = ft_ftell( file ); + if ( !stream->size ) + { + FT_ERROR(( "FT_Stream_Open:" )); + FT_ERROR(( " opened `%s' but zero-sized\n", filepathname )); + ft_fclose( file ); + return FT_Err_Cannot_Open_Stream; + } ft_fseek( file, 0, SEEK_SET ); stream->descriptor.pointer = file; - stream->pathname.pointer = (char*)filepathname; - stream->pos = 0; - stream->read = ft_ansi_stream_io; stream->close = ft_ansi_stream_close; |