diff options
Diffstat (limited to 'Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.c')
-rw-r--r-- | Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.c | 64 |
1 files changed, 12 insertions, 52 deletions
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.c index 49396476545..5ee8dea28a7 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.c +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.c @@ -4,7 +4,7 @@ * * WOFF2 format management (base). * - * Copyright (C) 2019-2022 by + * Copyright (C) 2019-2021 by * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -84,8 +84,6 @@ #define BBOX_STREAM 5 #define INSTRUCTION_STREAM 6 -#define HAVE_OVERLAP_SIMPLE_BITMAP 0x1 - static void stream_close( FT_Stream stream ) @@ -96,6 +94,7 @@ FT_FREE( stream->base ); stream->size = 0; + stream->base = NULL; stream->close = NULL; } @@ -524,7 +523,6 @@ const WOFF2_Point points, FT_UShort n_contours, FT_UShort instruction_len, - FT_Bool have_overlap, FT_Byte* dst, FT_ULong dst_size, FT_ULong* glyph_size ) @@ -552,9 +550,6 @@ FT_Int dy = point.y - last_y; - if ( i == 0 && have_overlap ) - flag |= GLYF_OVERLAP_SIMPLE; - if ( dx == 0 ) flag |= GLYF_THIS_X_IS_SAME; else if ( dx > -256 && dx < 256 ) @@ -839,18 +834,15 @@ FT_UInt num_substreams = 7; - FT_UShort option_flags; FT_UShort num_glyphs; FT_UShort index_format; FT_ULong expected_loca_length; FT_UInt offset; FT_UInt i; FT_ULong points_size; + FT_ULong bitmap_length; FT_ULong glyph_buf_size; FT_ULong bbox_bitmap_offset; - FT_ULong bbox_bitmap_length; - FT_ULong overlap_bitmap_offset = 0; - FT_ULong overlap_bitmap_length = 0; const FT_ULong glyf_start = *out_offset; FT_ULong dest_offset = *out_offset; @@ -866,17 +858,15 @@ if ( FT_NEW_ARRAY( substreams, num_substreams ) ) goto Fail; - if ( FT_STREAM_SKIP( 2 ) ) - goto Fail; - if ( FT_READ_USHORT( option_flags ) ) + if ( FT_STREAM_SKIP( 4 ) ) goto Fail; if ( FT_READ_USHORT( num_glyphs ) ) goto Fail; if ( FT_READ_USHORT( index_format ) ) goto Fail; - FT_TRACE4(( "option_flags = %u; num_glyphs = %u; index_format = %u\n", - option_flags, num_glyphs, index_format )); + FT_TRACE4(( "num_glyphs = %u; index_format = %u\n", + num_glyphs, index_format )); info->num_glyphs = num_glyphs; @@ -889,7 +879,7 @@ if ( info->loca_table->dst_length != expected_loca_length ) goto Fail; - offset = 2 + 2 + 2 + 2 + ( num_substreams * 4 ); + offset = ( 2 + num_substreams ) * 4; if ( offset > info->glyf_table->TransformLength ) goto Fail; @@ -912,20 +902,6 @@ offset += substream_size; } - if ( option_flags & HAVE_OVERLAP_SIMPLE_BITMAP ) - { - /* Size of overlapBitmap = floor((numGlyphs + 7) / 8) */ - overlap_bitmap_length = ( num_glyphs + 7U ) >> 3; - if ( overlap_bitmap_length > info->glyf_table->TransformLength - offset ) - goto Fail; - - overlap_bitmap_offset = pos + offset; - - FT_TRACE5(( " Overlap bitmap: offset = %lu; size = %lu;\n", - overlap_bitmap_offset, overlap_bitmap_length )); - offset += overlap_bitmap_length; - } - if ( FT_NEW_ARRAY( loca_values, num_glyphs + 1 ) ) goto Fail; @@ -933,9 +909,8 @@ bbox_bitmap_offset = substreams[BBOX_STREAM].offset; /* Size of bboxBitmap = 4 * floor((numGlyphs + 31) / 32) */ - bbox_bitmap_length = ( ( num_glyphs + 31U ) >> 5 ) << 2; - /* bboxStreamSize is the combined size of bboxBitmap and bboxStream. */ - substreams[BBOX_STREAM].offset += bbox_bitmap_length; + bitmap_length = ( ( num_glyphs + 31U ) >> 5 ) << 2; + substreams[BBOX_STREAM].offset += bitmap_length; glyph_buf_size = WOFF2_DEFAULT_GLYPH_BUF; if ( FT_NEW_ARRAY( glyph_buf, glyph_buf_size ) ) @@ -1051,11 +1026,8 @@ FT_ULong flag_size; FT_ULong triplet_size; FT_ULong triplet_bytes_used; - FT_Bool have_overlap = FALSE; - FT_Byte overlap_bitmap; - FT_ULong overlap_offset; - FT_Byte* flags_buf = NULL; - FT_Byte* triplet_buf = NULL; + FT_Byte* flags_buf = NULL; + FT_Byte* triplet_buf = NULL; FT_UShort instruction_size; FT_ULong size_needed; FT_Int end_point; @@ -1064,17 +1036,6 @@ FT_Byte* pointer = NULL; - /* Set `have_overlap`. */ - if ( overlap_bitmap_offset ) - { - overlap_offset = overlap_bitmap_offset + ( i >> 3 ); - if ( FT_STREAM_SEEK( overlap_offset ) || - FT_READ_BYTE( overlap_bitmap ) ) - goto Fail; - if ( overlap_bitmap & ( 0x80 >> ( i & 7 ) ) ) - have_overlap = TRUE; - } - if ( FT_NEW_ARRAY( n_points_arr, n_contours ) ) goto Fail; @@ -1195,7 +1156,6 @@ points, n_contours, instruction_size, - have_overlap, glyph_buf, glyph_buf_size, &glyph_size ) ) @@ -2126,7 +2086,7 @@ /* Validate requested face index. */ *num_faces = woff2.num_fonts; /* value -(N+1) requests information on index N */ - if ( *face_instance_index < 0 && face_index > 0 ) + if ( *face_instance_index < 0 ) face_index--; if ( face_index >= woff2.num_fonts ) |