From 6845a4fb0147117e8517d66f18792ca7acdbe06e Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Tue, 26 Mar 2013 08:57:05 +0200 Subject: Update bundled FreeType sources to 2.3.12 Most important changes: * SFNT cmap 13 table format support; * fixed glitches when rasterizing stretched TTF (xsize!=ysize); * various fixes in Type1, CFF, and PCF drivers Change-Id: Ib9e2210ffbd0daa2fdbf518ea87f4be502de6b48 Reviewed-by: Thiago Macieira Reviewed-by: Lars Knoll --- src/3rdparty/freetype/src/pcf/pcfdrivr.c | 82 +++++++++++++++++++------------- 1 file changed, 48 insertions(+), 34 deletions(-) (limited to 'src/3rdparty/freetype/src/pcf/pcfdrivr.c') diff --git a/src/3rdparty/freetype/src/pcf/pcfdrivr.c b/src/3rdparty/freetype/src/pcf/pcfdrivr.c index e2d4d3d874..b34e542aeb 100644 --- a/src/3rdparty/freetype/src/pcf/pcfdrivr.c +++ b/src/3rdparty/freetype/src/pcf/pcfdrivr.c @@ -111,7 +111,7 @@ THE SOFTWARE. while ( min < max ) { - FT_UInt32 code; + FT_ULong code; mid = ( min + max ) >> 1; @@ -140,7 +140,7 @@ THE SOFTWARE. PCF_CMap cmap = (PCF_CMap)pcfcmap; PCF_Encoding encodings = cmap->encodings; FT_UInt min, max, mid; - FT_UInt32 charcode = *acharcode + 1; + FT_ULong charcode = *acharcode + 1; FT_UInt result = 0; @@ -149,7 +149,7 @@ THE SOFTWARE. while ( min < max ) { - FT_UInt32 code; + FT_ULong code; mid = ( min + max ) >> 1; @@ -175,7 +175,14 @@ THE SOFTWARE. } Exit: - *acharcode = charcode; + if ( charcode > 0xFFFFFFFFUL ) + { + FT_TRACE1(( "pcf_cmap_char_next: charcode 0x%x > 32bit API" )); + *acharcode = 0; + /* XXX: result should be changed to indicate an overflow error */ + } + else + *acharcode = (FT_UInt32)charcode; return result; } @@ -266,19 +273,27 @@ THE SOFTWARE. error = pcf_load_font( stream, face ); if ( error ) { - FT_Error error2; + PCF_Face_Done( pcfface ); +#if defined( FT_CONFIG_OPTION_USE_ZLIB ) || \ + defined( FT_CONFIG_OPTION_USE_LZW ) - PCF_Face_Done( pcfface ); +#ifdef FT_CONFIG_OPTION_USE_ZLIB + { + FT_Error error2; - /* this didn't work, try gzip support! */ - error2 = FT_Stream_OpenGzip( &face->gzip_stream, stream ); - if ( FT_ERROR_BASE( error2 ) == FT_Err_Unimplemented_Feature ) - goto Fail; - error = error2; - if ( error ) + /* this didn't work, try gzip support! */ + error2 = FT_Stream_OpenGzip( &face->gzip_stream, stream ); + if ( FT_ERROR_BASE( error2 ) == FT_Err_Unimplemented_Feature ) + goto Fail; + + error = error2; + } +#endif /* FT_CONFIG_OPTION_USE_ZLIB */ + #ifdef FT_CONFIG_OPTION_USE_LZW + if ( error ) { FT_Error error3; @@ -289,32 +304,26 @@ THE SOFTWARE. goto Fail; error = error3; - if ( error ) - goto Fail; + } +#endif /* FT_CONFIG_OPTION_USE_LZW */ - face->gzip_source = stream; - pcfface->stream = &face->gzip_stream; + if ( error ) + goto Fail; - stream = pcfface->stream; + face->gzip_source = stream; + pcfface->stream = &face->gzip_stream; - error = pcf_load_font( stream, face ); - if ( error ) - goto Fail; - } -#else + stream = pcfface->stream; + + error = pcf_load_font( stream, face ); + if ( error ) goto Fail; -#endif - else - { - face->gzip_source = stream; - pcfface->stream = &face->gzip_stream; - stream = pcfface->stream; +#else /* !(FT_CONFIG_OPTION_USE_ZLIB || FT_CONFIG_OPTION_USE_LZW) */ - error = pcf_load_font( stream, face ); - if ( error ) - goto Fail; - } + goto Fail; + +#endif } /* set up charmap */ @@ -446,7 +455,7 @@ THE SOFTWARE. FT_Error error = PCF_Err_Ok; FT_Bitmap* bitmap = &slot->bitmap; PCF_Metric metric; - int bytes; + FT_Offset bytes; FT_UNUSED( load_flags ); @@ -576,12 +585,17 @@ THE SOFTWARE. } else { + if ( prop->value.l > 0x7FFFFFFFL || prop->value.l < ( -1 - 0x7FFFFFFFL ) ) + { + FT_TRACE1(( "pcf_get_bdf_property: " )); + FT_TRACE1(( "too large integer 0x%x is truncated\n" )); + } /* Apparently, the PCF driver loads all properties as signed integers! * This really doesn't seem to be a problem, because this is * sufficient for any meaningful values. */ aproperty->type = BDF_PROPERTY_TYPE_INTEGER; - aproperty->u.integer = prop->value.integer; + aproperty->u.integer = (FT_Int32)prop->value.l; } return 0; } -- cgit v1.2.3