From 4ee9d04bd5d518e5f1f86875f4f8184fc0552f44 Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Fri, 3 Dec 2021 04:03:12 +0000 Subject: freetype 2.11.1 git-svn-id: svn://tug.org/texlive/trunk@61211 c570f23f-e606-0410-a88d-b1316a301751 --- .../freetype2/freetype-src/src/base/ftbitmap.c | 4 +- .../libs/freetype2/freetype-src/src/base/ftcalc.c | 14 ++-- .../freetype2/freetype-src/src/base/ftdbgmem.c | 92 +++++++------------- .../libs/freetype2/freetype-src/src/base/ftdebug.c | 2 +- .../libs/freetype2/freetype-src/src/base/ftglyph.c | 18 ++-- .../libs/freetype2/freetype-src/src/base/ftmac.c | 2 +- .../libs/freetype2/freetype-src/src/base/ftobjs.c | 98 +++++++++++++++++----- .../freetype2/freetype-src/src/base/ftstream.c | 83 +++++++++--------- .../freetype2/freetype-src/src/base/fttrigon.c | 6 +- .../libs/freetype2/freetype-src/src/base/ftver.rc | 4 +- 10 files changed, 173 insertions(+), 150 deletions(-) (limited to 'Build/source/libs/freetype2/freetype-src/src/base') diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftbitmap.c b/Build/source/libs/freetype2/freetype-src/src/base/ftbitmap.c index e504db17210..2146d3e3649 100644 --- a/Build/source/libs/freetype2/freetype-src/src/base/ftbitmap.c +++ b/Build/source/libs/freetype2/freetype-src/src/base/ftbitmap.c @@ -112,10 +112,10 @@ target_size = (FT_ULong)target_pitch * target->rows; if ( target_size != size ) - (void)FT_QREALLOC( target->buffer, target_size, size ); + FT_MEM_QREALLOC( target->buffer, target_size, size ); } else - (void)FT_QALLOC( target->buffer, size ); + FT_MEM_QALLOC( target->buffer, size ); if ( !error ) { diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftcalc.c b/Build/source/libs/freetype2/freetype-src/src/base/ftcalc.c index e60303afc8d..9df8e4010d1 100644 --- a/Build/source/libs/freetype2/freetype-src/src/base/ftcalc.c +++ b/Build/source/libs/freetype2/freetype-src/src/base/ftcalc.c @@ -45,7 +45,7 @@ /* we need to emulate a 64-bit data type if a real one isn't available */ -#ifndef FT_LONG64 +#ifndef FT_INT64 typedef struct FT_Int64_ { @@ -54,7 +54,7 @@ } FT_Int64; -#endif /* !FT_LONG64 */ +#endif /* !FT_INT64 */ /************************************************************************** @@ -79,7 +79,7 @@ FT_END_STMNT /* The following three functions are available regardless of whether */ - /* FT_LONG64 is defined. */ + /* FT_INT64 is defined. */ /* documentation is in freetype.h */ @@ -164,7 +164,7 @@ } -#ifdef FT_LONG64 +#ifdef FT_INT64 /* documentation is in freetype.h */ @@ -272,7 +272,7 @@ } -#else /* !FT_LONG64 */ +#else /* !FT_INT64 */ static void @@ -651,7 +651,7 @@ } -#endif /* !FT_LONG64 */ +#endif /* !FT_INT64 */ /* documentation is in ftglyph.h */ @@ -985,7 +985,7 @@ /* we silently ignore overflow errors since such large values */ /* lead to even more (harmless) rendering errors later on */ -#ifdef FT_LONG64 +#ifdef FT_INT64 FT_Int64 delta = SUB_INT64( MUL_INT64( in_x, out_y ), MUL_INT64( in_y, out_x ) ); diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftdbgmem.c b/Build/source/libs/freetype2/freetype-src/src/base/ftdbgmem.c index 8425ca70280..4f5c1e76971 100644 --- a/Build/source/libs/freetype2/freetype-src/src/base/ftdbgmem.c +++ b/Build/source/libs/freetype2/freetype-src/src/base/ftdbgmem.c @@ -302,46 +302,6 @@ } - static FT_MemTable - ft_mem_table_new( FT_Memory memory ) - { - FT_MemTable table; - - - table = (FT_MemTable)memory->alloc( memory, sizeof ( *table ) ); - if ( !table ) - goto Exit; - - FT_ZERO( table ); - - table->size = FT_MEM_SIZE_MIN; - table->nodes = 0; - - table->memory = memory; - - table->memory_user = memory->user; - - table->alloc = memory->alloc; - table->realloc = memory->realloc; - table->free = memory->free; - - table->buckets = (FT_MemNode *) - memory->alloc( - memory, - table->size * (FT_Long)sizeof ( FT_MemNode ) ); - if ( table->buckets ) - FT_ARRAY_ZERO( table->buckets, table->size ); - else - { - memory->free( memory, table ); - table = NULL; - } - - Exit: - return table; - } - - static void ft_mem_table_destroy( FT_MemTable table ) { @@ -350,8 +310,6 @@ FT_Long leaks = 0; - FT_DumpMemory( table->memory ); - /* remove all blocks from the table, revealing leaked ones */ for ( i = 0; i < table->size; i++ ) { @@ -413,8 +371,6 @@ printf( "FreeType: maximum memory footprint = %ld\n", table->alloc_max ); - ft_mem_table_free( table, table ); - if ( leak_count > 0 ) ft_mem_debug_panic( "FreeType: %ld bytes of memory leaked in %ld blocks\n", @@ -821,17 +777,30 @@ } - extern FT_Int + extern void ft_mem_debug_init( FT_Memory memory ) { FT_MemTable table; - FT_Int result = 0; - if ( ft_getenv( "FT2_DEBUG_MEMORY" ) ) + if ( !ft_getenv( "FT2_DEBUG_MEMORY" ) ) + return; + + table = (FT_MemTable)memory->alloc( memory, sizeof ( *table ) ); + + if ( table ) { - table = ft_mem_table_new( memory ); - if ( table ) + FT_ZERO( table ); + + table->memory = memory; + table->memory_user = memory->user; + table->alloc = memory->alloc; + table->realloc = memory->realloc; + table->free = memory->free; + + ft_mem_table_resize( table ); + + if ( table->size ) { const char* p; @@ -876,28 +845,31 @@ if ( keep_alive > 0 ) table->keep_alive = 1; } - - result = 1; } + else + memory->free( memory, table ); } - return result; } extern void ft_mem_debug_done( FT_Memory memory ) { - FT_MemTable table = (FT_MemTable)memory->user; + if ( memory->free == ft_mem_debug_free ) + { + FT_MemTable table = (FT_MemTable)memory->user; - if ( table ) - { + FT_DumpMemory( memory ); + + ft_mem_table_destroy( table ); + memory->free = table->free; memory->realloc = table->realloc; memory->alloc = table->alloc; + memory->user = table->memory_user; - ft_mem_table_destroy( table ); - memory->user = NULL; + memory->free( memory, table ); } } @@ -922,11 +894,9 @@ extern void FT_DumpMemory( FT_Memory memory ) { - FT_MemTable table = (FT_MemTable)memory->user; - - - if ( table ) + if ( memory->free == ft_mem_debug_free ) { + FT_MemTable table = (FT_MemTable)memory->user; FT_MemSource* bucket = table->sources; FT_MemSource* limit = bucket + FT_MEM_SOURCE_BUCKETS; FT_MemSource* sources; diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftdebug.c b/Build/source/libs/freetype2/freetype-src/src/base/ftdebug.c index bf4018652c8..34857913065 100644 --- a/Build/source/libs/freetype2/freetype-src/src/base/ftdebug.c +++ b/Build/source/libs/freetype2/freetype-src/src/base/ftdebug.c @@ -88,7 +88,7 @@ dlg_handler ft_default_log_handler = NULL; FT_Custom_Log_Handler custom_output_handler = NULL; -#endif /* FT_DEBUG_LOGGING*/ +#endif /* FT_DEBUG_LOGGING */ #ifdef FT_DEBUG_LEVEL_ERROR diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftglyph.c b/Build/source/libs/freetype2/freetype-src/src/base/ftglyph.c index 9e3c3cd35cf..e2c6f73f80f 100644 --- a/Build/source/libs/freetype2/freetype-src/src/base/ftglyph.c +++ b/Build/source/libs/freetype2/freetype-src/src/base/ftglyph.c @@ -453,9 +453,9 @@ /* documentation is in ftglyph.h */ FT_EXPORT_DEF( FT_Error ) - FT_Glyph_Transform( FT_Glyph glyph, - FT_Matrix* matrix, - FT_Vector* delta ) + FT_Glyph_Transform( FT_Glyph glyph, + const FT_Matrix* matrix, + const FT_Vector* delta ) { FT_Error error = FT_Err_Ok; @@ -533,10 +533,10 @@ /* documentation is in ftglyph.h */ FT_EXPORT_DEF( FT_Error ) - FT_Glyph_To_Bitmap( FT_Glyph* the_glyph, - FT_Render_Mode render_mode, - FT_Vector* origin, - FT_Bool destroy ) + FT_Glyph_To_Bitmap( FT_Glyph* the_glyph, + FT_Render_Mode render_mode, + const FT_Vector* origin, + FT_Bool destroy ) { FT_GlyphSlotRec dummy; FT_GlyphSlot_InternalRec dummy_internal; @@ -585,7 +585,7 @@ #if 1 /* if `origin' is set, translate the glyph image */ if ( origin ) - FT_Glyph_Transform( glyph, 0, origin ); + FT_Glyph_Transform( glyph, NULL, origin ); #else FT_UNUSED( origin ); #endif @@ -603,7 +603,7 @@ v.x = -origin->x; v.y = -origin->y; - FT_Glyph_Transform( glyph, 0, &v ); + FT_Glyph_Transform( glyph, NULL, &v ); } #endif diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftmac.c b/Build/source/libs/freetype2/freetype-src/src/base/ftmac.c index f41c5eeab1c..36a860979e1 100644 --- a/Build/source/libs/freetype2/freetype-src/src/base/ftmac.c +++ b/Build/source/libs/freetype2/freetype-src/src/base/ftmac.c @@ -560,7 +560,7 @@ if ( lwfn_file_name[0] ) { err = lookup_lwfn_by_fond( pathname, lwfn_file_name, - buff, sizeof ( buff ) ); + buff, sizeof ( buff ) ); if ( !err ) have_lwfn = 1; } diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftobjs.c b/Build/source/libs/freetype2/freetype-src/src/base/ftobjs.c index 0ded2440fca..883f1a8970c 100644 --- a/Build/source/libs/freetype2/freetype-src/src/base/ftobjs.c +++ b/Build/source/libs/freetype2/freetype-src/src/base/ftobjs.c @@ -221,6 +221,7 @@ FT_Stream_OpenMemory( stream, (const FT_Byte*)args->memory_base, (FT_ULong)args->memory_size ); + stream->memory = memory; } #ifndef FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT @@ -231,6 +232,7 @@ if ( FT_NEW( stream ) ) goto Exit; + stream->memory = memory; error = FT_Stream_Open( stream, args->pathname ); if ( error ) FT_FREE( stream ); @@ -241,8 +243,9 @@ /* in this case, we do not need to allocate a new stream object */ /* since the caller is responsible for closing it himself */ - stream = args->stream; - error = FT_Err_Ok; + stream = args->stream; + stream->memory = memory; + error = FT_Err_Ok; } #endif @@ -255,10 +258,7 @@ } if ( !error ) - { - stream->memory = memory; *astream = stream; - } Exit: return error; @@ -535,7 +535,7 @@ else slot->internal->flags |= FT_GLYPH_OWN_BITMAP; - (void)FT_ALLOC( slot->bitmap.buffer, size ); + FT_MEM_ALLOC( slot->bitmap.buffer, size ); return error; } @@ -2610,7 +2610,7 @@ FT_TRACE4(( "FT_Open_Face: New face object, adding to list\n" )); /* add the face object to its driver's list */ - if ( FT_NEW( node ) ) + if ( FT_QNEW( node ) ) goto Fail; node->data = face; @@ -2895,7 +2895,7 @@ memory = face->memory; /* Allocate new size object and perform basic initialisation */ - if ( FT_ALLOC( size, clazz->size_object_size ) || FT_NEW( node ) ) + if ( FT_ALLOC( size, clazz->size_object_size ) || FT_QNEW( node ) ) goto Exit; size->face = face; @@ -3132,10 +3132,12 @@ } - FT_BASE_DEF( void ) + FT_BASE_DEF( FT_Error ) FT_Request_Metrics( FT_Face face, FT_Size_Request req ) { + FT_Error error = FT_Err_Ok; + FT_Size_Metrics* metrics; @@ -3226,8 +3228,18 @@ scaled_h = FT_MulFix( face->units_per_EM, metrics->y_scale ); } - metrics->x_ppem = (FT_UShort)( ( scaled_w + 32 ) >> 6 ); - metrics->y_ppem = (FT_UShort)( ( scaled_h + 32 ) >> 6 ); + scaled_w = ( scaled_w + 32 ) >> 6; + scaled_h = ( scaled_h + 32 ) >> 6; + if ( scaled_w > (FT_Long)FT_USHORT_MAX || + scaled_h > (FT_Long)FT_USHORT_MAX ) + { + FT_ERROR(( "FT_Request_Metrics: Resulting ppem size too large\n" )); + error = FT_ERR( Invalid_Pixel_Size ); + goto Exit; + } + + metrics->x_ppem = (FT_UShort)scaled_w; + metrics->y_ppem = (FT_UShort)scaled_h; ft_recompute_scaled_metrics( face, metrics ); } @@ -3237,6 +3249,9 @@ metrics->x_scale = 1L << 16; metrics->y_scale = 1L << 16; } + + Exit: + return error; } @@ -3300,7 +3315,7 @@ FT_Request_Size( FT_Face face, FT_Size_Request req ) { - FT_Error error = FT_Err_Ok; + FT_Error error; FT_Driver_Class clazz; FT_ULong strike_index; @@ -3336,13 +3351,15 @@ */ error = FT_Match_Size( face, req, 0, &strike_index ); if ( error ) - return error; + goto Exit; return FT_Select_Size( face, (FT_Int)strike_index ); } else { - FT_Request_Metrics( face, req ); + error = FT_Request_Metrics( face, req ); + if ( error ) + goto Exit; FT_TRACE5(( "FT_Request_Size:\n" )); } @@ -3365,6 +3382,7 @@ } #endif + Exit: return error; } @@ -3689,9 +3707,9 @@ FT_CharMap last_charmap = face->charmaps[face->num_charmaps - 1]; - if ( FT_RENEW_ARRAY( face->charmaps, - face->num_charmaps, - face->num_charmaps - 1 ) ) + if ( FT_QRENEW_ARRAY( face->charmaps, + face->num_charmaps, + face->num_charmaps - 1 ) ) return; /* remove it from our list of charmaps */ @@ -3723,7 +3741,7 @@ FT_CharMap charmap, FT_CMap *acmap ) { - FT_Error error = FT_Err_Ok; + FT_Error error; FT_Face face; FT_Memory memory; FT_CMap cmap = NULL; @@ -3748,9 +3766,9 @@ } /* add it to our list of charmaps */ - if ( FT_RENEW_ARRAY( face->charmaps, - face->num_charmaps, - face->num_charmaps + 1 ) ) + if ( FT_QRENEW_ARRAY( face->charmaps, + face->num_charmaps, + face->num_charmaps + 1 ) ) goto Fail; face->charmaps[face->num_charmaps++] = (FT_CharMap)cmap; @@ -4444,7 +4462,7 @@ FT_ListNode node = NULL; - if ( FT_NEW( node ) ) + if ( FT_QNEW( node ) ) goto Exit; { @@ -4685,7 +4703,7 @@ else renderer = FT_Lookup_Renderer( library, slot->format, &node ); - error = FT_ERR( Unimplemented_Feature ); + error = FT_ERR( Cannot_Render_Glyph ); while ( renderer ) { error = renderer->render( renderer, slot, render_mode, NULL ); @@ -4701,6 +4719,11 @@ /* format. */ renderer = FT_Lookup_Renderer( library, slot->format, &node ); } + + /* it is not an error if we cannot render a bitmap glyph */ + if ( FT_ERR_EQ( error, Cannot_Render_Glyph ) && + slot->format == FT_GLYPH_FORMAT_BITMAP ) + error = FT_Err_Ok; } } @@ -5639,6 +5662,35 @@ } + /* documentation is in ftcolor.h */ + + FT_EXPORT_DEF( FT_Bool ) + FT_Get_Color_Glyph_ClipBox( FT_Face face, + FT_UInt base_glyph, + FT_ClipBox* clip_box ) + { + TT_Face ttface; + SFNT_Service sfnt; + + + if ( !face || !clip_box ) + return 0; + + if ( !FT_IS_SFNT( face ) ) + return 0; + + ttface = (TT_Face)face; + sfnt = (SFNT_Service)ttface->sfnt; + + if ( sfnt->get_color_glyph_clipbox ) + return sfnt->get_color_glyph_clipbox( ttface, + base_glyph, + clip_box ); + else + return 0; + } + + /* documentation is in freetype.h */ FT_EXPORT_DEF( FT_Bool ) diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftstream.c b/Build/source/libs/freetype2/freetype-src/src/base/ftstream.c index f14c7012cf1..5992998ba3e 100644 --- a/Build/source/libs/freetype2/freetype-src/src/base/ftstream.c +++ b/Build/source/libs/freetype2/freetype-src/src/base/ftstream.c @@ -61,7 +61,7 @@ if ( stream->read ) { - if ( stream->read( stream, pos, 0, 0 ) ) + if ( stream->read( stream, pos, NULL, 0 ) ) { FT_ERROR(( "FT_Stream_Seek:" " invalid i/o; pos = 0x%lx, size = 0x%lx\n", @@ -347,17 +347,17 @@ } - FT_BASE_DEF( FT_Char ) - FT_Stream_GetChar( FT_Stream stream ) + FT_BASE_DEF( FT_Byte ) + FT_Stream_GetByte( FT_Stream stream ) { - FT_Char result; + FT_Byte result; FT_ASSERT( stream && stream->cursor ); result = 0; if ( stream->cursor < stream->limit ) - result = (FT_Char)*stream->cursor++; + result = *stream->cursor++; return result; } @@ -455,8 +455,8 @@ } - FT_BASE_DEF( FT_Char ) - FT_Stream_ReadChar( FT_Stream stream, + FT_BASE_DEF( FT_Byte ) + FT_Stream_ReadByte( FT_Stream stream, FT_Error* error ) { FT_Byte result = 0; @@ -464,31 +464,32 @@ FT_ASSERT( stream ); - *error = FT_Err_Ok; - - if ( stream->read ) + if ( stream->pos < stream->size ) { - if ( stream->read( stream, stream->pos, &result, 1L ) != 1L ) - goto Fail; - } - else - { - if ( stream->pos < stream->size ) - result = stream->base[stream->pos]; + if ( stream->read ) + { + if ( stream->read( stream, stream->pos, &result, 1L ) != 1L ) + goto Fail; + } else - goto Fail; + result = stream->base[stream->pos]; } + else + goto Fail; + stream->pos++; - return (FT_Char)result; + *error = FT_Err_Ok; + + return result; Fail: *error = FT_THROW( Invalid_Stream_Operation ); - FT_ERROR(( "FT_Stream_ReadChar:" + FT_ERROR(( "FT_Stream_ReadByte:" " invalid i/o; pos = 0x%lx, size = 0x%lx\n", stream->pos, stream->size )); - return 0; + return result; } @@ -497,14 +498,12 @@ FT_Error* error ) { FT_Byte reads[2]; - FT_Byte* p = 0; + FT_Byte* p; FT_UShort result = 0; FT_ASSERT( stream ); - *error = FT_Err_Ok; - if ( stream->pos + 1 < stream->size ) { if ( stream->read ) @@ -525,6 +524,8 @@ stream->pos += 2; + *error = FT_Err_Ok; + return result; Fail: @@ -533,7 +534,7 @@ " invalid i/o; pos = 0x%lx, size = 0x%lx\n", stream->pos, stream->size )); - return 0; + return result; } @@ -542,14 +543,12 @@ FT_Error* error ) { FT_Byte reads[2]; - FT_Byte* p = 0; + FT_Byte* p; FT_UShort result = 0; FT_ASSERT( stream ); - *error = FT_Err_Ok; - if ( stream->pos + 1 < stream->size ) { if ( stream->read ) @@ -570,6 +569,8 @@ stream->pos += 2; + *error = FT_Err_Ok; + return result; Fail: @@ -578,7 +579,7 @@ " invalid i/o; pos = 0x%lx, size = 0x%lx\n", stream->pos, stream->size )); - return 0; + return result; } @@ -587,14 +588,12 @@ FT_Error* error ) { FT_Byte reads[3]; - FT_Byte* p = 0; + FT_Byte* p; FT_ULong result = 0; FT_ASSERT( stream ); - *error = FT_Err_Ok; - if ( stream->pos + 2 < stream->size ) { if ( stream->read ) @@ -615,6 +614,8 @@ stream->pos += 3; + *error = FT_Err_Ok; + return result; Fail: @@ -623,7 +624,7 @@ " invalid i/o; pos = 0x%lx, size = 0x%lx\n", stream->pos, stream->size )); - return 0; + return result; } @@ -632,14 +633,12 @@ FT_Error* error ) { FT_Byte reads[4]; - FT_Byte* p = 0; + FT_Byte* p; FT_ULong result = 0; FT_ASSERT( stream ); - *error = FT_Err_Ok; - if ( stream->pos + 3 < stream->size ) { if ( stream->read ) @@ -660,6 +659,8 @@ stream->pos += 4; + *error = FT_Err_Ok; + return result; Fail: @@ -668,7 +669,7 @@ " invalid i/o; pos = 0x%lx, size = 0x%lx\n", stream->pos, stream->size )); - return 0; + return result; } @@ -677,14 +678,12 @@ FT_Error* error ) { FT_Byte reads[4]; - FT_Byte* p = 0; + FT_Byte* p; FT_ULong result = 0; FT_ASSERT( stream ); - *error = FT_Err_Ok; - if ( stream->pos + 3 < stream->size ) { if ( stream->read ) @@ -705,6 +704,8 @@ stream->pos += 4; + *error = FT_Err_Ok; + return result; Fail: @@ -713,7 +714,7 @@ " invalid i/o; pos = 0x%lx, size = 0x%lx\n", stream->pos, stream->size )); - return 0; + return result; } diff --git a/Build/source/libs/freetype2/freetype-src/src/base/fttrigon.c b/Build/source/libs/freetype2/freetype-src/src/base/fttrigon.c index 990c46d9939..0ca6d7810a5 100644 --- a/Build/source/libs/freetype2/freetype-src/src/base/fttrigon.c +++ b/Build/source/libs/freetype2/freetype-src/src/base/fttrigon.c @@ -53,7 +53,7 @@ }; -#ifdef FT_LONG64 +#ifdef FT_INT64 /* multiply a given value by the CORDIC shrink factor */ static FT_Fixed @@ -76,7 +76,7 @@ return s < 0 ? -val : val; } -#else /* !FT_LONG64 */ +#else /* !FT_INT64 */ /* multiply a given value by the CORDIC shrink factor */ static FT_Fixed @@ -125,7 +125,7 @@ return s < 0 ? -val : val; } -#endif /* !FT_LONG64 */ +#endif /* !FT_INT64 */ /* undefined and never called for zero vector */ diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftver.rc b/Build/source/libs/freetype2/freetype-src/src/base/ftver.rc index 5fe433cbd7f..a3d05b37806 100644 --- a/Build/source/libs/freetype2/freetype-src/src/base/ftver.rc +++ b/Build/source/libs/freetype2/freetype-src/src/base/ftver.rc @@ -18,8 +18,8 @@ #include -#define FT_VERSION 2,11,0,0 -#define FT_VERSION_STR "2.11.0" +#define FT_VERSION 2,11,1,0 +#define FT_VERSION_STR "2.11.1" VS_VERSION_INFO VERSIONINFO FILEVERSION FT_VERSION -- cgit v1.2.3