diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2022-04-05 21:27:03 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2022-04-05 21:27:03 +0000 |
commit | 37e731f0bd81249f8b43bada12adaa611b7a595b (patch) | |
tree | 99e477a2cd57a94782ae182b8c5e2c0024751356 /Build/source/libs/freetype2/freetype-src/src/sfnt | |
parent | 7c200a413ce80d2d09a0dda338e9407bba0d3855 (diff) |
freetype2 : revert
git-svn-id: svn://tug.org/texlive/trunk@62919 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/freetype2/freetype-src/src/sfnt')
37 files changed, 102 insertions, 681 deletions
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/module.mk b/Build/source/libs/freetype2/freetype-src/src/sfnt/module.mk index dbdde1564ec..eabd48f6093 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/module.mk +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/module.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2021 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/pngshim.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/pngshim.c index a7670766076..02fe37440c0 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/pngshim.c +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/pngshim.c @@ -4,7 +4,7 @@ * * PNG Bitmap glyph support. * - * Copyright (C) 2013-2022 by + * Copyright (C) 2013-2021 by * Google, Inc. * Written by Stuart Gill and Behdad Esfahbod. * diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/pngshim.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/pngshim.h index 36d749c3c35..89efd27545b 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/pngshim.h +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/pngshim.h @@ -4,7 +4,7 @@ * * PNG Bitmap glyph support. * - * Copyright (C) 2013-2022 by + * Copyright (C) 2013-2021 by * Google, Inc. * Written by Stuart Gill and Behdad Esfahbod. * diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/rules.mk b/Build/source/libs/freetype2/freetype-src/src/sfnt/rules.mk index ac4b5712262..d41305c0ad6 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/rules.mk +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/rules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2022 by +# Copyright (C) 1996-2021 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -36,7 +36,6 @@ SFNT_DRV_SRC := $(SFNT_DIR)/pngshim.c \ $(SFNT_DIR)/ttbdf.c \ $(SFNT_DIR)/ttcmap.c \ $(SFNT_DIR)/ttcolr.c \ - $(SFNT_DIR)/ttsvg.c \ $(SFNT_DIR)/ttcpal.c \ $(SFNT_DIR)/ttkern.c \ $(SFNT_DIR)/ttload.c \ diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfdriver.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfdriver.c index cc121e57907..d1d01c99e52 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfdriver.c +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfdriver.c @@ -4,7 +4,7 @@ * * High-level SFNT driver interface (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -36,10 +36,6 @@ #include "ttcpal.h" #endif -#ifdef FT_CONFIG_OPTION_SVG -#include "ttsvg.h" -#endif - #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES #include "ttpost.h" #endif @@ -495,13 +491,15 @@ char_type_func char_type, FT_Bool report_invalid_characters ) { - FT_Error error; + FT_Error error = FT_Err_Ok; char* result = NULL; FT_String* r; FT_Char* p; FT_UInt len; + FT_UNUSED( error ); + if ( FT_QALLOC( result, entry->stringLength / 2 + 1 ) ) return NULL; @@ -552,13 +550,15 @@ char_type_func char_type, FT_Bool report_invalid_characters ) { - FT_Error error; + FT_Error error = FT_Err_Ok; char* result = NULL; FT_String* r; FT_Char* p; FT_UInt len; + FT_UNUSED( error ); + if ( FT_QALLOC( result, entry->stringLength + 1 ) ) return NULL; @@ -1214,12 +1214,6 @@ #define PUT_COLOR_LAYERS( a ) NULL #endif -#ifdef FT_CONFIG_OPTION_SVG -#define PUT_SVG_SUPPORT( a ) a -#else -#define PUT_SVG_SUPPORT( a ) NULL -#endif - #define PUT_COLOR_LAYERS_V1( a ) PUT_COLOR_LAYERS( a ) #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES @@ -1314,14 +1308,7 @@ tt_face_get_metrics, /* TT_Get_Metrics_Func get_metrics */ tt_face_get_name, /* TT_Get_Name_Func get_name */ - sfnt_get_name_id, /* TT_Get_Name_ID_Func get_name_id */ - - PUT_SVG_SUPPORT( tt_face_load_svg ), - /* TT_Load_Table_Func load_svg */ - PUT_SVG_SUPPORT( tt_face_free_svg ), - /* TT_Free_Table_Func free_svg */ - PUT_SVG_SUPPORT( tt_face_load_svg_doc ) - /* TT_Load_Svg_Doc_Func load_svg_doc */ + sfnt_get_name_id /* TT_Get_Name_ID_Func get_name_id */ ) diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfdriver.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfdriver.h index 6a2e3e9c7b0..8d5b5ce367c 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfdriver.h +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfdriver.h @@ -4,7 +4,7 @@ * * High-level SFNT driver interface (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/sferrors.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/sferrors.h index 99ef3f9fce9..78e6f03513a 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sferrors.h +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sferrors.h @@ -4,7 +4,7 @@ * * SFNT error codes (specification only). * - * Copyright (C) 2001-2022 by + * Copyright (C) 2001-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfnt.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfnt.c index 9b3ceaedc08..97692cdfb0a 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfnt.c +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfnt.c @@ -4,7 +4,7 @@ * * Single object library component. * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -27,7 +27,6 @@ #include "ttcmap.c" #include "ttcolr.c" #include "ttcpal.c" -#include "ttsvg.c" #include "ttkern.c" #include "ttload.c" diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfobjs.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfobjs.c index 35d3d6c78ff..78910247900 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfobjs.c +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfobjs.c @@ -4,7 +4,7 @@ * * SFNT object management (base). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -566,7 +566,7 @@ face_index = FT_ABS( face_instance_index ) & 0xFFFF; /* 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 >= face->ttc_header.count ) @@ -784,23 +784,17 @@ FT_Int num_params, FT_Parameter* params ) { - FT_Error error; + FT_Error error; #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES - FT_Error psnames_error; + FT_Error psnames_error; #endif - - FT_Bool has_outline; - FT_Bool is_apple_sbit; - - FT_Bool has_CBLC; - FT_Bool has_CBDT; - FT_Bool has_EBLC; - FT_Bool has_bloc; - FT_Bool has_sbix; - - FT_Bool ignore_typographic_family = FALSE; - FT_Bool ignore_typographic_subfamily = FALSE; - FT_Bool ignore_sbix = FALSE; + FT_Bool has_outline; + FT_Bool is_apple_sbit; + FT_Bool is_apple_sbix; + FT_Bool has_CBLC; + FT_Bool has_CBDT; + FT_Bool ignore_typographic_family = FALSE; + FT_Bool ignore_typographic_subfamily = FALSE; SFNT_Service sfnt = (SFNT_Service)face->sfnt; @@ -819,8 +813,6 @@ ignore_typographic_family = TRUE; else if ( params[i].tag == FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY ) ignore_typographic_subfamily = TRUE; - else if ( params[i].tag == FT_PARAM_TAG_IGNORE_SBIX ) - ignore_sbix = TRUE; } } @@ -856,17 +848,14 @@ tt_face_lookup_table( face, TTAG_CFF2 ) ); #endif - /* check which sbit formats are present */ - has_CBLC = !face->goto_table( face, TTAG_CBLC, stream, 0 ); - has_CBDT = !face->goto_table( face, TTAG_CBDT, stream, 0 ); - has_EBLC = !face->goto_table( face, TTAG_EBLC, stream, 0 ); - has_bloc = !face->goto_table( face, TTAG_bloc, stream, 0 ); - has_sbix = !face->goto_table( face, TTAG_sbix, stream, 0 ); - - is_apple_sbit = FALSE; + is_apple_sbit = 0; + is_apple_sbix = !face->goto_table( face, TTAG_sbix, stream, 0 ); - if ( ignore_sbix ) - has_sbix = FALSE; + /* Apple 'sbix' color bitmaps are rendered scaled and then the 'glyf' + * outline rendered on top. We don't support that yet, so just ignore + * the 'glyf' outline and advertise it as a bitmap-only font. */ + if ( is_apple_sbix ) + has_outline = FALSE; /* if this font doesn't contain outlines, we try to load */ /* a `bhed' table */ @@ -878,13 +867,16 @@ /* load the font header (`head' table) if this isn't an Apple */ /* sbit font file */ - if ( !is_apple_sbit || has_sbix ) + if ( !is_apple_sbit || is_apple_sbix ) { LOAD_( head ); if ( error ) goto Exit; } + has_CBLC = !face->goto_table( face, TTAG_CBLC, stream, 0 ); + has_CBDT = !face->goto_table( face, TTAG_CBDT, stream, 0 ); + /* Ignore outlines for CBLC/CBDT fonts. */ if ( has_CBLC || has_CBDT ) has_outline = FALSE; @@ -994,11 +986,7 @@ /* the optional tables */ /* embedded bitmap support */ - /* TODO: Replace this clumsy check for all possible sbit tables */ - /* with something better (for example, by passing a parameter */ - /* to suppress 'sbix' loading). */ - if ( sfnt->load_eblc && - ( has_CBLC || has_EBLC || has_bloc || has_sbix ) ) + if ( sfnt->load_eblc ) LOAD_( eblc ); /* colored glyph support */ @@ -1008,10 +996,6 @@ LOAD_( colr ); } - /* OpenType-SVG glyph support */ - if ( sfnt->load_svg ) - LOAD_( svg ); - /* consider the pclt, kerning, and gasp tables as optional */ LOAD_( pclt ); LOAD_( gasp ); @@ -1070,14 +1054,7 @@ flags |= FT_FACE_FLAG_COLOR; /* color glyphs */ if ( has_outline == TRUE ) - { - /* by default (and for backward compatibility) we handle */ - /* fonts with an 'sbix' table as bitmap-only */ - if ( has_sbix ) - flags |= FT_FACE_FLAG_SBIX; /* with 'sbix' bitmaps */ - else - flags |= FT_FACE_FLAG_SCALABLE; /* scalable outlines */ - } + flags |= FT_FACE_FLAG_SCALABLE; /* scalable outlines */ /* The sfnt driver only supports bitmap fonts natively, thus we */ /* don't set FT_FACE_FLAG_HINTER. */ @@ -1300,8 +1277,7 @@ * * Set up metrics. */ - if ( FT_IS_SCALABLE( root ) || - FT_HAS_SBIX( root ) ) + if ( FT_IS_SCALABLE( root ) ) { /* XXX What about if outline header is missing */ /* (e.g. sfnt wrapped bitmap)? */ @@ -1440,12 +1416,6 @@ sfnt->free_cpal( face ); sfnt->free_colr( face ); } - -#ifdef FT_CONFIG_OPTION_SVG - /* free SVG data */ - if ( sfnt->free_svg ) - sfnt->free_svg( face ); -#endif } #ifdef TT_CONFIG_OPTION_BDF diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfobjs.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfobjs.h index 1d99bfede47..172c47ebb48 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfobjs.h +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfobjs.h @@ -4,7 +4,7 @@ * * SFNT object management (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.c index 0e8ec3fa932..422c816a215 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.c +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.c @@ -4,7 +4,7 @@ * * WOFF format management (base). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -64,6 +64,7 @@ FT_FREE( stream->base ); stream->size = 0; + stream->base = NULL; stream->close = NULL; } diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.h index 5866a16194e..3fbdac0fde7 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.h +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.h @@ -4,7 +4,7 @@ * * WOFFF format management (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, 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 ) diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.h index e84982ed9c3..fa78b024297 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.h +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.h @@ -4,7 +4,7 @@ * * WOFFF2 format management (specification). * - * 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, @@ -56,7 +56,6 @@ FT_BEGIN_HEADER #define GLYF_REPEAT 1 << 3 #define GLYF_THIS_X_IS_SAME 1 << 4 #define GLYF_THIS_Y_IS_SAME 1 << 5 -#define GLYF_OVERLAP_SIMPLE 1 << 6 /* Other constants */ #define CONTOUR_OFFSET_END_POINT 10 diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttbdf.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttbdf.c index 4d2faf2385e..b8d9473a632 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttbdf.c +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttbdf.c @@ -4,7 +4,7 @@ * * TrueType and OpenType embedded BDF properties (body). * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttbdf.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttbdf.h index b7b11c9bec5..91271d916f7 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttbdf.h +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttbdf.h @@ -4,7 +4,7 @@ * * TrueType and OpenType embedded BDF properties (specification). * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmap.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmap.c index 6d099a4877c..b369d837884 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmap.c +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmap.c @@ -4,7 +4,7 @@ * * TrueType character mapping table (cmap) support (body). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmap.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmap.h index b10860b345e..504fc951c41 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmap.h +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmap.h @@ -4,7 +4,7 @@ * * TrueType character mapping table (cmap) support (specification). * - * Copyright (C) 2002-2022 by + * Copyright (C) 2002-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmapc.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmapc.h index 6822a9cd6b9..4e6cd46ba88 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmapc.h +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcmapc.h @@ -4,7 +4,7 @@ * * TT CMAP classes definitions (specification only). * - * Copyright (C) 2009-2022 by + * Copyright (C) 2009-2021 by * Oran Agra and Mickey Gabel. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.c index d54231fd647..8f5cc8bcd1f 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.c +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.c @@ -4,7 +4,7 @@ * * TrueType and OpenType colored glyph layer support (body). * - * Copyright (C) 2018-2022 by + * Copyright (C) 2018-2021 by * David Turner, Robert Wilhelm, Dominik Röttsches, and Werner Lemberg. * * Originally written by Shao Yu Zhang <shaozhang@fb.com>. @@ -522,29 +522,19 @@ else if ( apaint->format == FT_COLR_PAINTFORMAT_RADIAL_GRADIENT ) { - FT_Pos tmp; - - if ( !read_color_line( child_table_p, &apaint->u.radial_gradient.colorline ) ) return 0; - /* In the OpenType specification, `r0` and `r1` are defined as */ - /* `UFWORD`. Since FreeType doesn't have a corresponding 16.16 */ - /* format we convert to `FWORD` and replace negative values with */ - /* (32bit) `FT_INT_MAX`. */ - apaint->u.radial_gradient.c0.x = INT_TO_FIXED( FT_NEXT_SHORT( p ) ); apaint->u.radial_gradient.c0.y = INT_TO_FIXED( FT_NEXT_SHORT( p ) ); - tmp = INT_TO_FIXED( FT_NEXT_SHORT( p ) ); - apaint->u.radial_gradient.r0 = tmp < 0 ? FT_INT_MAX : tmp; + apaint->u.radial_gradient.r0 = FT_NEXT_USHORT( p ) << 16; apaint->u.radial_gradient.c1.x = INT_TO_FIXED( FT_NEXT_SHORT( p ) ); apaint->u.radial_gradient.c1.y = INT_TO_FIXED( FT_NEXT_SHORT( p ) ); - tmp = INT_TO_FIXED( FT_NEXT_SHORT( p ) ); - apaint->u.radial_gradient.r1 = tmp < 0 ? FT_INT_MAX : tmp; + apaint->u.radial_gradient.r1 = FT_NEXT_USHORT( p ) << 16; return 1; } @@ -834,7 +824,7 @@ { Colr* colr; - FT_Byte *p, *p1, *clip_base, *limit; + FT_Byte *p, *p1, *clip_base; FT_Byte clip_list_format; FT_ULong num_clip_boxes, i; @@ -857,32 +847,16 @@ p = colr->clip_list; - /* Limit points to the first byte after the end of the color table. */ - /* Thus, in subsequent limit checks below we need to check whether the */ - /* read pointer is strictly greater than a position offset by certain */ - /* field sizes to the left of that position. */ - limit = (FT_Byte*)colr->table + colr->table_size; - - /* Check whether we can extract one `uint8` and one `uint32`. */ - if ( p > limit - ( 1 + 4 ) ) - return 0; - clip_base = p; clip_list_format = FT_NEXT_BYTE ( p ); /* Format byte used here to be able to upgrade ClipList for >16bit */ - /* glyph ids; for now we can expect it to be 0. */ + /* glyph ids; for now we can expect it to be 0. */ if ( !( clip_list_format == 1 ) ) return 0; num_clip_boxes = FT_NEXT_ULONG( p ); - /* Check whether we can extract two `uint16` and one `Offset24`, */ - /* `num_clip_boxes` times. */ - if ( colr->table_size / ( 2 + 2 + 3 ) < num_clip_boxes || - p > limit - ( 2 + 2 + 3 ) * num_clip_boxes ) - return 0; - for ( i = 0; i < num_clip_boxes; ++i ) { gid_start = FT_NEXT_USHORT( p ); @@ -893,8 +867,7 @@ { p1 = (FT_Byte*)( clip_base + clip_box_offset ); - /* Check whether we can extract one `uint8`. */ - if ( p1 > limit - 1 ) + if ( p1 >= ( (FT_Byte*)colr->table + colr->table_size ) ) return 0; format = FT_NEXT_BYTE( p1 ); @@ -902,10 +875,6 @@ if ( format > 1 ) return 0; - /* Check whether we can extract four `FWORD`. */ - if ( p1 > limit - ( 2 + 2 + 2 + 2 ) ) - return 0; - /* `face->root.size->metrics.x_scale` and `y_scale` are factors */ /* that scale a font unit value in integers to a 26.6 fixed value */ /* according to the requested size, see for example */ diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.h index 4200cb29765..b81e4cb958c 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.h +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.h @@ -4,7 +4,7 @@ * * TrueType and OpenType colored glyph layer support (specification). * - * Copyright (C) 2018-2022 by + * Copyright (C) 2018-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Originally written by Shao Yu Zhang <shaozhang@fb.com>. diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcpal.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcpal.c index 9ae535cbda4..a0d84bca3a6 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcpal.c +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcpal.c @@ -4,7 +4,7 @@ * * TrueType and OpenType color palette support (body). * - * Copyright (C) 2018-2022 by + * Copyright (C) 2018-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Originally written by Shao Yu Zhang <shaozhang@fb.com>. diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcpal.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcpal.h index 4717d224fc8..1c5586855b9 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcpal.h +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcpal.h @@ -4,7 +4,7 @@ * * TrueType and OpenType color palette support (specification). * - * Copyright (C) 2018-2022 by + * Copyright (C) 2018-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Originally written by Shao Yu Zhang <shaozhang@fb.com>. diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttkern.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttkern.c index ca1c5094065..bb1922caf95 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttkern.c +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttkern.c @@ -5,7 +5,7 @@ * Load the basic TrueType kerning table. This doesn't handle * kerning data within the GPOS table at the moment. * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -94,7 +94,7 @@ p_next = p; - p += 2; /* skip version */ + p += 2; /* skip version */ length = FT_NEXT_USHORT( p ); coverage = FT_NEXT_USHORT( p ); @@ -144,7 +144,7 @@ cur_pair = FT_NEXT_ULONG( p ); - if ( cur_pair < old_pair ) + if ( cur_pair <= old_pair ) break; p += 2; @@ -187,18 +187,11 @@ FT_UInt left_glyph, FT_UInt right_glyph ) { - FT_Int result = 0; - FT_UInt count, mask; + FT_Int result = 0; + FT_UInt count, mask; + FT_Byte* p = face->kern_table; + FT_Byte* p_limit = p + face->kern_table_size; - FT_Byte* p; - FT_Byte* p_limit; - - - if ( !face->kern_table ) - return result; - - p = face->kern_table; - p_limit = p + face->kern_table_size; p += 4; mask = 0x0001; diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttkern.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttkern.h index f063558313e..3d8f1e83477 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttkern.h +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttkern.h @@ -5,7 +5,7 @@ * Load the basic TrueType kerning table. This doesn't handle * kerning data within the GPOS table at the moment. * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttload.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttload.c index c83bd197fe7..51416d80b4a 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttload.c +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttload.c @@ -5,7 +5,7 @@ * Load the basic TrueType tables, i.e., tables that can be either in * TTF or OTF fonts (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -205,6 +205,7 @@ if ( FT_STREAM_READ_FIELDS( table_dir_entry_fields, &table ) ) { + nn--; FT_TRACE2(( "check_table_dir:" " can read only %d table%s in font (instead of %d)\n", nn, nn == 1 ? "" : "s", sfnt->num_tables )); diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttload.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttload.h index 5368971c316..cab15cd2387 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttload.h +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttload.h @@ -5,7 +5,7 @@ * Load the basic TrueType tables, i.e., tables that can be either in * TTF or OTF fonts (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttmtx.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttmtx.c index 88377327c61..7aece36fb01 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttmtx.c +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttmtx.c @@ -4,7 +4,7 @@ * * Load the metrics tables common to TTF and OTF fonts (body). * - * Copyright (C) 2006-2022 by + * Copyright (C) 2006-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttmtx.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttmtx.h index 1e45b949a55..270170d4782 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttmtx.h +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttmtx.h @@ -4,7 +4,7 @@ * * Load the metrics tables common to TTF and OTF fonts (specification). * - * Copyright (C) 2006-2022 by + * Copyright (C) 2006-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttpost.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttpost.c index 1a885a15c53..b92ca5db149 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttpost.c +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttpost.c @@ -5,7 +5,7 @@ * PostScript name table processing for TrueType and OpenType fonts * (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttpost.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttpost.h index bf9342a9f5e..6d65b5766c2 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttpost.h +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttpost.h @@ -5,7 +5,7 @@ * PostScript name table processing for TrueType and OpenType fonts * (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttsbit.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttsbit.c index bf73d04e540..e9ba697dba0 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttsbit.c +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttsbit.c @@ -4,7 +4,7 @@ * * TrueType and OpenType embedded bitmap support (body). * - * Copyright (C) 2005-2022 by + * Copyright (C) 2005-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Copyright 2013 by Google, Inc. @@ -172,8 +172,17 @@ goto Exit; } +#ifdef FT_DEBUG_LEVEL_TRACE + /* we currently don't support bit 1; however, it is better to */ + /* draw at least something... */ if ( flags == 3 ) - face->root.face_flags |= FT_FACE_FLAG_SBIX_OVERLAY; + { + FT_TRACE1(( "tt_face_load_sbit_strikes:" + " sbix overlay not supported yet\n" )); + FT_TRACE1(( " " + " expect bad rendering results\n" )); + } +#endif /* * Count the number of strikes available in the table. We are a bit @@ -721,9 +730,6 @@ pitch = bitmap->pitch; line = bitmap->buffer; - if ( !line ) - goto Exit; - width = decoder->metrics->width; height = decoder->metrics->height; @@ -1571,34 +1577,17 @@ if ( !error ) { - FT_Short abearing; /* not used here */ + FT_Short abearing; FT_UShort aadvance; tt_face_get_metrics( face, FALSE, glyph_index, &abearing, &aadvance ); metrics->horiBearingX = (FT_Short)originOffsetX; - metrics->vertBearingX = (FT_Short)originOffsetX; - - metrics->horiBearingY = (FT_Short)( originOffsetY + metrics->height ); - metrics->vertBearingY = (FT_Short)originOffsetY; - + metrics->horiBearingY = (FT_Short)( -originOffsetY + metrics->height ); metrics->horiAdvance = (FT_UShort)( aadvance * face->root.size->metrics.x_ppem / face->header.Units_Per_EM ); - - if ( face->vertical_info ) - tt_face_get_metrics( face, TRUE, glyph_index, &abearing, &aadvance ); - else if ( face->os2.version != 0xFFFFU ) - aadvance = (FT_UShort)FT_ABS( face->os2.sTypoAscender - - face->os2.sTypoDescender ); - else - aadvance = (FT_UShort)FT_ABS( face->horizontal.Ascender - - face->horizontal.Descender ); - - metrics->vertAdvance = (FT_UShort)( aadvance * - face->root.size->metrics.x_ppem / - face->header.Units_Per_EM ); } return error; diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttsbit.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttsbit.h index c967bffba3e..7a0ed92e920 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttsbit.h +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttsbit.h @@ -4,7 +4,7 @@ * * TrueType and OpenType embedded bitmap support (specification). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2021 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttsvg.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttsvg.c deleted file mode 100644 index 69277da5777..00000000000 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttsvg.c +++ /dev/null @@ -1,403 +0,0 @@ -/**************************************************************************** - * - * ttsvg.c - * - * OpenType SVG Color (specification). - * - * Copyright (C) 2022 by - * David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti. - * - * This file is part of the FreeType project, and may only be used, - * modified, and distributed under the terms of the FreeType project - * license, LICENSE.TXT. By continuing to use, modify, or distribute - * this file you indicate that you have read the license and - * understand and accept it fully. - * - */ - - - /************************************************************************** - * - * 'SVG' table specification: - * - * https://docs.microsoft.com/en-us/typography/opentype/spec/svg - * - */ - -#include <ft2build.h> -#include <freetype/internal/ftstream.h> -#include <freetype/internal/ftobjs.h> -#include <freetype/internal/ftdebug.h> -#include <freetype/tttags.h> -#include <freetype/ftgzip.h> -#include <freetype/otsvg.h> - - -#ifdef FT_CONFIG_OPTION_SVG - -#include "ttsvg.h" - - - /* NOTE: These table sizes are given by the specification. */ -#define SVG_TABLE_HEADER_SIZE (10U) -#define SVG_DOCUMENT_RECORD_SIZE (12U) -#define SVG_DOCUMENT_LIST_MINIMUM_SIZE (2U + SVG_DOCUMENT_RECORD_SIZE) -#define SVG_MINIMUM_SIZE (SVG_TABLE_HEADER_SIZE + \ - SVG_DOCUMENT_LIST_MINIMUM_SIZE) - - - typedef struct Svg_ - { - FT_UShort version; /* table version (starting at 0) */ - FT_UShort num_entries; /* number of SVG document records */ - - FT_Byte* svg_doc_list; /* pointer to the start of SVG Document List */ - - void* table; /* memory that backs up SVG */ - FT_ULong table_size; - - } Svg; - - - /************************************************************************** - * - * The macro FT_COMPONENT is used in trace mode. It is an implicit - * parameter of the FT_TRACE() and FT_ERROR() macros, usued to print/log - * messages during execution. - */ -#undef FT_COMPONENT -#define FT_COMPONENT ttsvg - - - FT_LOCAL_DEF( FT_Error ) - tt_face_load_svg( TT_Face face, - FT_Stream stream ) - { - FT_Error error; - FT_Memory memory = face->root.memory; - - FT_ULong table_size; - FT_Byte* table = NULL; - FT_Byte* p = NULL; - Svg* svg = NULL; - FT_ULong offsetToSVGDocumentList; - - - error = face->goto_table( face, TTAG_SVG, stream, &table_size ); - if ( error ) - goto NoSVG; - - if ( table_size < SVG_MINIMUM_SIZE ) - goto InvalidTable; - - if ( FT_FRAME_EXTRACT( table_size, table ) ) - goto NoSVG; - - /* Allocate memory for the SVG object */ - if ( FT_NEW( svg ) ) - goto NoSVG; - - p = table; - svg->version = FT_NEXT_USHORT( p ); - offsetToSVGDocumentList = FT_NEXT_ULONG( p ); - - if ( offsetToSVGDocumentList < SVG_TABLE_HEADER_SIZE || - offsetToSVGDocumentList > table_size - - SVG_DOCUMENT_LIST_MINIMUM_SIZE ) - goto InvalidTable; - - svg->svg_doc_list = (FT_Byte*)( table + offsetToSVGDocumentList ); - - p = svg->svg_doc_list; - svg->num_entries = FT_NEXT_USHORT( p ); - - FT_TRACE3(( "version: %d\n", svg->version )); - FT_TRACE3(( "number of entries: %d\n", svg->num_entries )); - - if ( offsetToSVGDocumentList + - svg->num_entries * SVG_DOCUMENT_RECORD_SIZE > table_size ) - goto InvalidTable; - - svg->table = table; - svg->table_size = table_size; - - face->svg = svg; - face->root.face_flags |= FT_FACE_FLAG_SVG; - - return FT_Err_Ok; - - InvalidTable: - error = FT_THROW( Invalid_Table ); - - NoSVG: - FT_FRAME_RELEASE( table ); - FT_FREE( svg ); - face->svg = NULL; - - return error; - } - - - FT_LOCAL_DEF( void ) - tt_face_free_svg( TT_Face face ) - { - FT_Memory memory = face->root.memory; - FT_Stream stream = face->root.stream; - - Svg* svg = (Svg*)face->svg; - - - if ( svg ) - { - FT_FRAME_RELEASE( svg->table ); - FT_FREE( svg ); - } - } - - - typedef struct Svg_doc_ - { - FT_UShort start_glyph_id; - FT_UShort end_glyph_id; - - FT_ULong offset; - FT_ULong length; - - } Svg_doc; - - - static Svg_doc - extract_svg_doc( FT_Byte* stream ) - { - Svg_doc doc; - - - doc.start_glyph_id = FT_NEXT_USHORT( stream ); - doc.end_glyph_id = FT_NEXT_USHORT( stream ); - - doc.offset = FT_NEXT_ULONG( stream ); - doc.length = FT_NEXT_ULONG( stream ); - - return doc; - } - - - static FT_Int - compare_svg_doc( Svg_doc doc, - FT_UInt glyph_index ) - { - if ( glyph_index < doc.start_glyph_id ) - return -1; - else if ( glyph_index > doc.end_glyph_id ) - return 1; - else - return 0; - } - - - static FT_Error - find_doc( FT_Byte* stream, - FT_UShort num_entries, - FT_UInt glyph_index, - FT_ULong *doc_offset, - FT_ULong *doc_length, - FT_UShort *start_glyph, - FT_UShort *end_glyph ) - { - FT_Error error; - - Svg_doc start_doc; - Svg_doc mid_doc; - Svg_doc end_doc; - - FT_Bool found = FALSE; - FT_UInt i = 0; - - FT_UInt start_index = 0; - FT_UInt end_index = num_entries - 1; - FT_Int comp_res; - - - /* search algorithm */ - if ( num_entries == 0 ) - { - error = FT_THROW( Invalid_Table ); - return error; - } - - start_doc = extract_svg_doc( stream + start_index * 12 ); - end_doc = extract_svg_doc( stream + end_index * 12 ); - - if ( ( compare_svg_doc( start_doc, glyph_index ) == -1 ) || - ( compare_svg_doc( end_doc, glyph_index ) == 1 ) ) - { - error = FT_THROW( Invalid_Glyph_Index ); - return error; - } - - while ( start_index <= end_index ) - { - i = ( start_index + end_index ) / 2; - mid_doc = extract_svg_doc( stream + i * 12 ); - comp_res = compare_svg_doc( mid_doc, glyph_index ); - - if ( comp_res == 1 ) - { - start_index = i + 1; - start_doc = extract_svg_doc( stream + start_index * 4 ); - } - else if ( comp_res == -1 ) - { - end_index = i - 1; - end_doc = extract_svg_doc( stream + end_index * 4 ); - } - else - { - found = TRUE; - break; - } - } - /* search algorithm end */ - - if ( found != TRUE ) - { - FT_TRACE5(( "SVG glyph not found\n" )); - error = FT_THROW( Invalid_Glyph_Index ); - } - else - { - *doc_offset = mid_doc.offset; - *doc_length = mid_doc.length; - - *start_glyph = mid_doc.start_glyph_id; - *end_glyph = mid_doc.end_glyph_id; - - error = FT_Err_Ok; - } - - return error; - } - - - FT_LOCAL_DEF( FT_Error ) - tt_face_load_svg_doc( FT_GlyphSlot glyph, - FT_UInt glyph_index ) - { - FT_Byte* doc_list; /* pointer to the SVG doc list */ - FT_UShort num_entries; /* total number of entries in doc list */ - FT_ULong doc_offset; - FT_ULong doc_length; - - FT_UShort start_glyph_id; - FT_UShort end_glyph_id; - - FT_Error error = FT_Err_Ok; - TT_Face face = (TT_Face)glyph->face; - FT_Memory memory = face->root.memory; - Svg* svg = (Svg*)face->svg; - - FT_SVG_Document svg_document = (FT_SVG_Document)glyph->other; - - - FT_ASSERT( !( svg == NULL ) ); - - doc_list = svg->svg_doc_list; - num_entries = FT_NEXT_USHORT( doc_list ); - - error = find_doc( doc_list, num_entries, glyph_index, - &doc_offset, &doc_length, - &start_glyph_id, &end_glyph_id ); - if ( error != FT_Err_Ok ) - goto Exit; - - doc_list = svg->svg_doc_list; /* reset, so we can use it again */ - doc_list = (FT_Byte*)( doc_list + doc_offset ); - - if ( ( doc_list[0] == 0x1F ) && ( doc_list[1] == 0x8B ) - && ( doc_list[2] == 0x08 ) ) - { -#ifdef FT_CONFIG_OPTION_USE_ZLIB - - FT_ULong uncomp_size; - FT_Byte* uncomp_buffer = NULL; - - - /* - * Get the size of the original document. This helps in allotting the - * buffer to accommodate the uncompressed version. The last 4 bytes - * of the compressed document are equal to the original size modulo - * 2^32. Since the size of SVG documents is less than 2^32 bytes we - * can use this accurately. The four bytes are stored in - * little-endian format. - */ - FT_TRACE4(( "SVG document is GZIP compressed\n" )); - uncomp_size = (FT_ULong)doc_list[doc_length - 1] << 24 | - (FT_ULong)doc_list[doc_length - 2] << 16 | - (FT_ULong)doc_list[doc_length - 3] << 8 | - (FT_ULong)doc_list[doc_length - 4]; - - if ( FT_QALLOC( uncomp_buffer, uncomp_size ) ) - goto Exit; - - error = FT_Gzip_Uncompress( memory, - uncomp_buffer, - &uncomp_size, - doc_list, - doc_length ); - if ( error ) - { - FT_FREE( uncomp_buffer ); - error = FT_THROW( Invalid_Table ); - goto Exit; - } - - glyph->internal->flags |= FT_GLYPH_OWN_GZIP_SVG; - - doc_list = uncomp_buffer; - doc_length = uncomp_size; - -#else /* !FT_CONFIG_OPTION_USE_ZLIB */ - - error = FT_THROW( Unimplemented_Feature ); - goto Exit; - -#endif /* !FT_CONFIG_OPTION_USE_ZLIB */ - } - - svg_document->svg_document = doc_list; - svg_document->svg_document_length = doc_length; - - svg_document->metrics = glyph->face->size->metrics; - svg_document->units_per_EM = glyph->face->units_per_EM; - - svg_document->start_glyph_id = start_glyph_id; - svg_document->end_glyph_id = end_glyph_id; - - svg_document->transform.xx = 0x10000; - svg_document->transform.xy = 0; - svg_document->transform.yx = 0; - svg_document->transform.yy = 0x10000; - - svg_document->delta.x = 0; - svg_document->delta.y = 0; - - FT_TRACE5(( "start_glyph_id: %d\n", start_glyph_id )); - FT_TRACE5(( "end_glyph_id: %d\n", end_glyph_id )); - FT_TRACE5(( "svg_document:\n" )); - FT_TRACE5(( " %.*s\n", (FT_UInt)doc_length, doc_list )); - - glyph->other = svg_document; - - Exit: - return error; - } - -#else /* !FT_CONFIG_OPTION_SVG */ - - /* ANSI C doesn't like empty source files */ - typedef int _tt_svg_dummy; - -#endif /* !FT_CONFIG_OPTION_SVG */ - - -/* END */ diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttsvg.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttsvg.h deleted file mode 100644 index 7c234fd5247..00000000000 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttsvg.h +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** - * - * ttsvg.h - * - * OpenType SVG Color (specification). - * - * Copyright (C) 2022 by - * David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti. - * - * This file is part of the FreeType project, and may only be used, - * modified, and distributed under the terms of the FreeType project - * license, LICENSE.TXT. By continuing to use, modify, or distribute - * this file you indicate that you have read the license and - * understand and accept it fully. - * - */ - -#ifndef TTSVG_H_ -#define TTSVG_H_ - -#include <freetype/internal/ftstream.h> -#include <freetype/internal/tttypes.h> - - -FT_BEGIN_HEADER - - FT_LOCAL( FT_Error ) - tt_face_load_svg( TT_Face face, - FT_Stream stream ); - - FT_LOCAL( void ) - tt_face_free_svg( TT_Face face ); - - FT_LOCAL( FT_Error ) - tt_face_load_svg_doc( FT_GlyphSlot glyph, - FT_UInt glyph_index ); - -FT_END_HEADER - -#endif /* TTSVG_H_ */ - - -/* END */ diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.c index 7d79fef39a8..fe8f5cf76f6 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.c +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.c @@ -4,7 +4,7 @@ * * WOFF2 Font table tags (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, diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.h index 05df85aba02..4ef0a651c3e 100644 --- a/Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.h +++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.h @@ -4,7 +4,7 @@ * * WOFF2 Font table tags (specification). * - * 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, |