--- old/src/java.desktop/share/legal/freetype.md 2020-08-20 13:30:46.760212490 -0700 +++ new/src/java.desktop/share/legal/freetype.md 2020-08-20 13:30:46.488212494 -0700 @@ -1,4 +1,4 @@ -## The FreeType Project: Freetype v2.10.1 +## The FreeType Project: Freetype v2.10.2 ### FreeType Notice --- old/src/java.desktop/share/native/libfreetype/include/freetype/config/ftconfig.h 2020-08-20 13:30:47.808212473 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/config/ftconfig.h 2020-08-20 13:30:47.580212476 -0700 @@ -4,7 +4,7 @@ * * ANSI-specific configuration file (specification only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/config/ftheader.h 2020-08-20 13:30:48.712212458 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/config/ftheader.h 2020-08-20 13:30:48.488212461 -0700 @@ -4,7 +4,7 @@ * * Build macros of the FreeType 2 library. * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/config/ftoption.h 2020-08-20 13:30:49.496212445 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/config/ftoption.h 2020-08-20 13:30:49.232212449 -0700 @@ -4,7 +4,7 @@ * * User-selectable configuration macros (specification only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -294,6 +294,22 @@ /************************************************************************** * + * Brotli support. + * + * FreeType uses the Brotli library to provide support for decompressing + * WOFF2 streams. + * + * Define this macro if you want to enable this 'feature'. + * + * If you use a build system like cmake or the `configure` script, + * options set by those programs have precedence, overwriting the value + * here with the configured one. + */ +/* #define FT_CONFIG_OPTION_USE_BROTLI */ + + + /************************************************************************** + * * Glyph Postscript Names handling * * By default, FreeType 2 is compiled with the 'psnames' module. This @@ -871,9 +887,11 @@ * * Compile 'autofit' module with fallback Indic script support, covering * some scripts that the 'latin' submodule of the 'autofit' module doesn't - * (yet) handle. + * (yet) handle. Currently, this needs option `AF_CONFIG_OPTION_CJK`. */ +#ifdef AF_CONFIG_OPTION_CJK #define AF_CONFIG_OPTION_INDIC +#endif /************************************************************************** --- old/src/java.desktop/share/native/libfreetype/include/freetype/config/ftstdlib.h 2020-08-20 13:30:50.268212432 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/config/ftstdlib.h 2020-08-20 13:30:49.996212437 -0700 @@ -5,7 +5,7 @@ * ANSI-specific library and header configuration file (specification * only). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/freetype.h 2020-08-20 13:30:51.060212419 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/freetype.h 2020-08-20 13:30:50.772212424 -0700 @@ -4,7 +4,7 @@ * * FreeType high-level API and common types (specification only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -1239,7 +1239,7 @@ * */ #define FT_HAS_HORIZONTAL( face ) \ - ( (face)->face_flags & FT_FACE_FLAG_HORIZONTAL ) + ( !!( (face)->face_flags & FT_FACE_FLAG_HORIZONTAL ) ) /************************************************************************** @@ -1253,7 +1253,7 @@ * */ #define FT_HAS_VERTICAL( face ) \ - ( (face)->face_flags & FT_FACE_FLAG_VERTICAL ) + ( !!( (face)->face_flags & FT_FACE_FLAG_VERTICAL ) ) /************************************************************************** @@ -1267,7 +1267,7 @@ * */ #define FT_HAS_KERNING( face ) \ - ( (face)->face_flags & FT_FACE_FLAG_KERNING ) + ( !!( (face)->face_flags & FT_FACE_FLAG_KERNING ) ) /************************************************************************** @@ -1282,7 +1282,7 @@ * */ #define FT_IS_SCALABLE( face ) \ - ( (face)->face_flags & FT_FACE_FLAG_SCALABLE ) + ( !!( (face)->face_flags & FT_FACE_FLAG_SCALABLE ) ) /************************************************************************** @@ -1301,7 +1301,7 @@ * */ #define FT_IS_SFNT( face ) \ - ( (face)->face_flags & FT_FACE_FLAG_SFNT ) + ( !!( (face)->face_flags & FT_FACE_FLAG_SFNT ) ) /************************************************************************** @@ -1316,7 +1316,7 @@ * */ #define FT_IS_FIXED_WIDTH( face ) \ - ( (face)->face_flags & FT_FACE_FLAG_FIXED_WIDTH ) + ( !!( (face)->face_flags & FT_FACE_FLAG_FIXED_WIDTH ) ) /************************************************************************** @@ -1331,7 +1331,7 @@ * */ #define FT_HAS_FIXED_SIZES( face ) \ - ( (face)->face_flags & FT_FACE_FLAG_FIXED_SIZES ) + ( !!( (face)->face_flags & FT_FACE_FLAG_FIXED_SIZES ) ) /************************************************************************** @@ -1357,7 +1357,7 @@ * */ #define FT_HAS_GLYPH_NAMES( face ) \ - ( (face)->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) + ( !!( (face)->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) ) /************************************************************************** @@ -1372,7 +1372,7 @@ * */ #define FT_HAS_MULTIPLE_MASTERS( face ) \ - ( (face)->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS ) + ( !!( (face)->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS ) ) /************************************************************************** @@ -1394,7 +1394,7 @@ * */ #define FT_IS_NAMED_INSTANCE( face ) \ - ( (face)->face_index & 0x7FFF0000L ) + ( !!( (face)->face_index & 0x7FFF0000L ) ) /************************************************************************** @@ -1412,7 +1412,7 @@ * */ #define FT_IS_VARIATION( face ) \ - ( (face)->face_flags & FT_FACE_FLAG_VARIATION ) + ( !!( (face)->face_flags & FT_FACE_FLAG_VARIATION ) ) /************************************************************************** @@ -1429,7 +1429,7 @@ * */ #define FT_IS_CID_KEYED( face ) \ - ( (face)->face_flags & FT_FACE_FLAG_CID_KEYED ) + ( !!( (face)->face_flags & FT_FACE_FLAG_CID_KEYED ) ) /************************************************************************** @@ -1443,7 +1443,7 @@ * */ #define FT_IS_TRICKY( face ) \ - ( (face)->face_flags & FT_FACE_FLAG_TRICKY ) + ( !!( (face)->face_flags & FT_FACE_FLAG_TRICKY ) ) /************************************************************************** @@ -1460,7 +1460,7 @@ * */ #define FT_HAS_COLOR( face ) \ - ( (face)->face_flags & FT_FACE_FLAG_COLOR ) + ( !!( (face)->face_flags & FT_FACE_FLAG_COLOR ) ) /************************************************************************** @@ -2078,7 +2078,8 @@ * The size in bytes of the file in memory. * * pathname :: - * A pointer to an 8-bit file pathname. + * A pointer to an 8-bit file pathname. The pointer is not owned by + * FreeType. * * stream :: * A handle to a source stream object. @@ -4781,7 +4782,7 @@ */ #define FREETYPE_MAJOR 2 #define FREETYPE_MINOR 10 -#define FREETYPE_PATCH 1 +#define FREETYPE_PATCH 2 /************************************************************************** --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftadvanc.h 2020-08-20 13:30:51.884212405 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftadvanc.h 2020-08-20 13:30:51.616212410 -0700 @@ -4,7 +4,7 @@ * * Quick computation of advance widths (specification only). * - * Copyright (C) 2008-2019 by + * Copyright (C) 2008-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftbbox.h 2020-08-20 13:30:52.876212389 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftbbox.h 2020-08-20 13:30:52.588212394 -0700 @@ -4,7 +4,7 @@ * * FreeType exact bbox computation (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftbdf.h 2020-08-20 13:30:53.832212373 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftbdf.h 2020-08-20 13:30:53.544212378 -0700 @@ -4,7 +4,7 @@ * * FreeType API for accessing BDF-specific strings (specification). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftbitmap.h 2020-08-20 13:30:54.732212359 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftbitmap.h 2020-08-20 13:30:54.508212362 -0700 @@ -4,7 +4,7 @@ * * FreeType utility functions for bitmaps (specification). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftcid.h 2020-08-20 13:30:55.708212342 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftcid.h 2020-08-20 13:30:55.428212347 -0700 @@ -4,7 +4,7 @@ * * FreeType API for accessing CID font information (specification). * - * Copyright (C) 2007-2019 by + * Copyright (C) 2007-2020 by * Dereg Clegg and Michael Toftdal. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftcolor.h 2020-08-20 13:30:56.424212331 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftcolor.h 2020-08-20 13:30:56.184212335 -0700 @@ -4,7 +4,7 @@ * * FreeType's glyph color management (specification). * - * Copyright (C) 2018-2019 by + * Copyright (C) 2018-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -125,9 +125,9 @@ * The number of palettes. * * palette_name_ids :: - * A read-only array of palette name IDs with `num_palettes` elements, - * corresponding to entries like 'dark' or 'light' in the font's 'name' - * table. + * An optional read-only array of palette name IDs with `num_palettes` + * elements, corresponding to entries like 'dark' or 'light' in the + * font's 'name' table. * * An empty name ID in the 'CPAL' table gets represented as value * 0xFFFF. @@ -135,8 +135,8 @@ * `NULL` if the font's 'CPAL' table doesn't contain appropriate data. * * palette_flags :: - * A read-only array of palette flags with `num_palettes` elements. - * Possible values are an ORed combination of + * An optional read-only array of palette flags with `num_palettes` + * elements. Possible values are an ORed combination of * @FT_PALETTE_FOR_LIGHT_BACKGROUND and * @FT_PALETTE_FOR_DARK_BACKGROUND. * @@ -147,7 +147,7 @@ * same size. * * palette_entry_name_ids :: - * A read-only array of palette entry name IDs with + * An optional read-only array of palette entry name IDs with * `num_palette_entries`. In each palette, entries with the same index * have the same function. For example, index~0 might correspond to * string 'outline' in the font's 'name' table to indicate that this @@ -163,6 +163,9 @@ * Use function @FT_Get_Sfnt_Name to map name IDs and entry name IDs to * name strings. * + * Use function @FT_Palette_Select to get the colors associated with a + * palette entry. + * * @since: * 2.10 */ --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftdriver.h 2020-08-20 13:30:57.124212319 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftdriver.h 2020-08-20 13:30:56.852212324 -0700 @@ -4,7 +4,7 @@ * * FreeType API for controlling driver modules (specification only). * - * Copyright (C) 2017-2019 by + * Copyright (C) 2017-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/fterrdef.h 2020-08-20 13:30:58.064212304 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/fterrdef.h 2020-08-20 13:30:57.776212308 -0700 @@ -4,7 +4,7 @@ * * FreeType error codes (specification). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/fterrors.h 2020-08-20 13:30:58.988212288 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/fterrors.h 2020-08-20 13:30:58.696212293 -0700 @@ -4,7 +4,7 @@ * * FreeType error code handling (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftfntfmt.h 2020-08-20 13:30:59.888212274 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftfntfmt.h 2020-08-20 13:30:59.636212278 -0700 @@ -4,7 +4,7 @@ * * Support functions for font formats. * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftgasp.h 2020-08-20 13:31:00.844212258 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftgasp.h 2020-08-20 13:31:00.608212262 -0700 @@ -4,7 +4,7 @@ * * Access of TrueType's 'gasp' table (specification). * - * Copyright (C) 2007-2019 by + * Copyright (C) 2007-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftglyph.h 2020-08-20 13:31:01.836212241 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftglyph.h 2020-08-20 13:31:01.548212246 -0700 @@ -4,7 +4,7 @@ * * FreeType convenience functions to handle glyphs (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftgzip.h 2020-08-20 13:31:02.756212226 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftgzip.h 2020-08-20 13:31:02.484212231 -0700 @@ -4,7 +4,7 @@ * * Gzip-compressed stream support. * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftimage.h 2020-08-20 13:31:03.656212212 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftimage.h 2020-08-20 13:31:03.368212216 -0700 @@ -5,7 +5,7 @@ * FreeType glyph image formats and default raster interface * (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftincrem.h 2020-08-20 13:31:04.668212195 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftincrem.h 2020-08-20 13:31:04.380212200 -0700 @@ -4,7 +4,7 @@ * * FreeType incremental loading (specification). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftlcdfil.h 2020-08-20 13:31:05.612212179 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftlcdfil.h 2020-08-20 13:31:05.324212184 -0700 @@ -5,7 +5,7 @@ * FreeType API for color filtering of subpixel bitmap glyphs * (specification). * - * Copyright (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftlist.h 2020-08-20 13:31:06.524212164 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftlist.h 2020-08-20 13:31:06.252212169 -0700 @@ -4,7 +4,7 @@ * * Generic list support for FreeType (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftmac.h 2020-08-20 13:31:07.396212150 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftmac.h 2020-08-20 13:31:07.128212154 -0700 @@ -4,7 +4,7 @@ * * Additional Mac-specific API. * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftmm.h 2020-08-20 13:31:08.332212134 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftmm.h 2020-08-20 13:31:08.080212139 -0700 @@ -4,7 +4,7 @@ * * FreeType Multiple Master font interface (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftmodapi.h 2020-08-20 13:31:09.272212119 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftmodapi.h 2020-08-20 13:31:09.000212123 -0700 @@ -4,7 +4,7 @@ * * FreeType modules public interface (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftmoderr.h 2020-08-20 13:31:10.212212103 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftmoderr.h 2020-08-20 13:31:09.940212108 -0700 @@ -4,7 +4,7 @@ * * FreeType module error offsets (specification). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftoutln.h 2020-08-20 13:31:11.100212089 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftoutln.h 2020-08-20 13:31:10.832212093 -0700 @@ -5,7 +5,7 @@ * Support for the FT_Outline type used to store glyph shapes of * most scalable font formats (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftparams.h 2020-08-20 13:31:12.044212073 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftparams.h 2020-08-20 13:31:11.768212078 -0700 @@ -4,7 +4,7 @@ * * FreeType API for possible FT_Parameter tags (specification only). * - * Copyright (C) 2017-2019 by + * Copyright (C) 2017-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftrender.h 2020-08-20 13:31:12.964212058 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftrender.h 2020-08-20 13:31:12.684212063 -0700 @@ -4,7 +4,7 @@ * * FreeType renderer modules public interface (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftsizes.h 2020-08-20 13:31:13.912212043 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftsizes.h 2020-08-20 13:31:13.652212047 -0700 @@ -4,7 +4,7 @@ * * FreeType size objects management (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftsnames.h 2020-08-20 13:31:14.864212027 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftsnames.h 2020-08-20 13:31:14.592212031 -0700 @@ -7,7 +7,7 @@ * * This is _not_ used to retrieve glyph names! * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftstroke.h 2020-08-20 13:31:15.596212015 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftstroke.h 2020-08-20 13:31:15.304212020 -0700 @@ -4,7 +4,7 @@ * * FreeType path stroker (specification). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -114,22 +114,19 @@ * FT_STROKER_LINEJOIN_MITER_FIXED :: * Used to render mitered line joins, with fixed bevels if the miter * limit is exceeded. The outer edges of the strokes for the two - * segments are extended until they meet at an angle. If the segments - * meet at too sharp an angle (such that the miter would extend from - * the intersection of the segments a distance greater than the product - * of the miter limit value and the border radius), then a bevel join - * (see above) is used instead. This prevents long spikes being - * created. `FT_STROKER_LINEJOIN_MITER_FIXED` generates a miter line - * join as used in PostScript and PDF. + * segments are extended until they meet at an angle. A bevel join + * (see above) is used if the segments meet at too sharp an angle and + * the outer edges meet beyond a distance corresponding to the meter + * limit. This prevents long spikes being created. + * `FT_STROKER_LINEJOIN_MITER_FIXED` generates a miter line join as + * used in PostScript and PDF. * * FT_STROKER_LINEJOIN_MITER_VARIABLE :: * FT_STROKER_LINEJOIN_MITER :: * Used to render mitered line joins, with variable bevels if the miter - * limit is exceeded. The intersection of the strokes is clipped at a - * line perpendicular to the bisector of the angle between the strokes, - * at the distance from the intersection of the segments equal to the - * product of the miter limit value and the border radius. This - * prevents long spikes being created. + * limit is exceeded. The intersection of the strokes is clipped + * perpendicularly to the bisector, at a distance corresponding to + * the miter limit. This prevents long spikes being created. * `FT_STROKER_LINEJOIN_MITER_VARIABLE` generates a mitered line join * as used in XPS. `FT_STROKER_LINEJOIN_MITER` is an alias for * `FT_STROKER_LINEJOIN_MITER_VARIABLE`, retained for backward @@ -296,12 +293,17 @@ * The line join style. * * miter_limit :: - * The miter limit for the `FT_STROKER_LINEJOIN_MITER_FIXED` and - * `FT_STROKER_LINEJOIN_MITER_VARIABLE` line join styles, expressed as - * 16.16 fixed-point value. + * The maximum reciprocal sine of half-angle at the miter join, + * expressed as 16.16 fixed point value. * * @note: - * The radius is expressed in the same units as the outline coordinates. + * The `radius` is expressed in the same units as the outline + * coordinates. + * + * The `miter_limit` multiplied by the `radius` gives the maximum size + * of a miter spike, at which it is clipped for + * @FT_STROKER_LINEJOIN_MITER_VARIABLE or replaced with a bevel join for + * @FT_STROKER_LINEJOIN_MITER_FIXED. * * This function calls @FT_Stroker_Rewind automatically. */ --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftsynth.h 2020-08-20 13:31:16.544211999 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftsynth.h 2020-08-20 13:31:16.256212004 -0700 @@ -5,7 +5,7 @@ * FreeType synthesizing code for emboldening and slanting * (specification). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/ftsystem.h 2020-08-20 13:31:17.496211983 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ftsystem.h 2020-08-20 13:31:17.232211988 -0700 @@ -4,7 +4,7 @@ * * FreeType low-level system interface definition (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/fttrigon.h 2020-08-20 13:31:18.416211968 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/fttrigon.h 2020-08-20 13:31:18.188211972 -0700 @@ -4,7 +4,7 @@ * * FreeType trigonometric functions (specification). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/fttypes.h 2020-08-20 13:31:19.304211954 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/fttypes.h 2020-08-20 13:31:19.016211958 -0700 @@ -4,7 +4,7 @@ * * FreeType simple types definitions (specification only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/autohint.h 2020-08-20 13:31:20.232211938 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/autohint.h 2020-08-20 13:31:19.968211943 -0700 @@ -4,7 +4,7 @@ * * High-level 'autohint' module-specific interface (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/cffotypes.h 2020-08-20 13:31:21.140211923 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/cffotypes.h 2020-08-20 13:31:20.852211928 -0700 @@ -4,7 +4,7 @@ * * Basic OpenType/CFF object type definitions (specification). * - * Copyright (C) 2017-2019 by + * Copyright (C) 2017-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/cfftypes.h 2020-08-20 13:31:22.056211908 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/cfftypes.h 2020-08-20 13:31:21.768211913 -0700 @@ -5,7 +5,7 @@ * Basic OpenType/CFF type definitions and interface (specification * only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftcalc.h 2020-08-20 13:31:22.980211893 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftcalc.h 2020-08-20 13:31:22.704211898 -0700 @@ -4,7 +4,7 @@ * * Arithmetic computations (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftdebug.h 2020-08-20 13:31:23.948211877 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftdebug.h 2020-08-20 13:31:23.660211882 -0700 @@ -4,7 +4,7 @@ * * Debugging and logging component (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftdrv.h 2020-08-20 13:31:24.924211861 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftdrv.h 2020-08-20 13:31:24.636211866 -0700 @@ -4,7 +4,7 @@ * * FreeType internal font driver interface (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftgloadr.h 2020-08-20 13:31:25.872211845 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftgloadr.h 2020-08-20 13:31:25.580211850 -0700 @@ -4,7 +4,7 @@ * * The FreeType glyph loader (specification). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftmemory.h 2020-08-20 13:31:26.648211833 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftmemory.h 2020-08-20 13:31:26.360211837 -0700 @@ -4,7 +4,7 @@ * * The FreeType memory management macros (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg * * This file is part of the FreeType project, and may only be used, @@ -57,6 +57,14 @@ /*************************************************************************/ + /* The calculation `NULL + n' is undefined in C. Even if the resulting */ + /* pointer doesn't get dereferenced, this causes warnings with */ + /* sanitizers. */ + /* */ + /* We thus provide a macro that should be used if `base' can be NULL. */ +#define FT_OFFSET( base, count ) ( (base) ? (base) + (count) : NULL ) + + /* * C++ refuses to handle statements like p = (void*)anything, with `p' a * typed pointer. Since we don't have a `typeof' operator in standard C++, @@ -153,10 +161,10 @@ (FT_Long)(size), \ &error ) ) -#define FT_MEM_FREE( ptr ) \ - FT_BEGIN_STMNT \ - ft_mem_free( memory, (ptr) ); \ - (ptr) = NULL; \ +#define FT_MEM_FREE( ptr ) \ + FT_BEGIN_STMNT \ + FT_DEBUG_INNER( ft_mem_free( memory, (ptr) ) ); \ + (ptr) = NULL; \ FT_END_STMNT #define FT_MEM_NEW( ptr ) \ --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftobjs.h 2020-08-20 13:31:27.360211821 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftobjs.h 2020-08-20 13:31:27.108211825 -0700 @@ -4,7 +4,7 @@ * * The FreeType private base classes (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftpsprop.h 2020-08-20 13:31:28.276211806 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftpsprop.h 2020-08-20 13:31:28.048211810 -0700 @@ -4,7 +4,7 @@ * * Get and set properties of PostScript drivers (specification). * - * Copyright (C) 2017-2019 by + * Copyright (C) 2017-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftrfork.h 2020-08-20 13:31:29.252211790 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftrfork.h 2020-08-20 13:31:28.964211795 -0700 @@ -4,7 +4,7 @@ * * Embedded resource forks accessor (specification). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * Masatake YAMATO and Redhat K.K. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftserv.h 2020-08-20 13:31:30.168211775 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftserv.h 2020-08-20 13:31:29.904211779 -0700 @@ -4,7 +4,7 @@ * * The FreeType services (specification only). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftstream.h 2020-08-20 13:31:31.156211758 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftstream.h 2020-08-20 13:31:30.884211763 -0700 @@ -4,7 +4,7 @@ * * Stream handling (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/fttrace.h 2020-08-20 13:31:31.872211747 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/fttrace.h 2020-08-20 13:31:31.596211751 -0700 @@ -4,7 +4,7 @@ * * Tracing handling (specification only). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -49,6 +49,7 @@ FT_TRACE_DEF( sfdriver ) /* SFNT font driver (sfdriver.c) */ FT_TRACE_DEF( sfobjs ) /* SFNT object handler (sfobjs.c) */ FT_TRACE_DEF( sfwoff ) /* WOFF format handler (sfwoff.c) */ +FT_TRACE_DEF( sfwoff2 ) /* WOFF2 format handler (sfwoff2.c) */ FT_TRACE_DEF( ttbdf ) /* TrueType embedded BDF (ttbdf.c) */ FT_TRACE_DEF( ttcmap ) /* charmap handler (ttcmap.c) */ FT_TRACE_DEF( ttcolr ) /* glyph layer table (ttcolr.c) */ --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftvalid.h 2020-08-20 13:31:32.620211734 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftvalid.h 2020-08-20 13:31:32.332211739 -0700 @@ -4,7 +4,7 @@ * * FreeType validation support (specification). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/internal.h 2020-08-20 13:31:33.572211719 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/internal.h 2020-08-20 13:31:33.300211723 -0700 @@ -4,7 +4,7 @@ * * Internal header files (specification only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/psaux.h 2020-08-20 13:31:34.528211703 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/psaux.h 2020-08-20 13:31:34.236211708 -0700 @@ -5,7 +5,7 @@ * Auxiliary functions and data structures related to PostScript fonts * (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/pshints.h 2020-08-20 13:31:35.556211686 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/pshints.h 2020-08-20 13:31:35.264211691 -0700 @@ -6,7 +6,7 @@ * recorders (specification only). These are used to support native * T1/T2 hints in the 'type1', 'cid', and 'cff' font drivers. * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svbdf.h 2020-08-20 13:31:36.544211670 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svbdf.h 2020-08-20 13:31:36.268211674 -0700 @@ -4,7 +4,7 @@ * * The FreeType BDF services (specification). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svcfftl.h 2020-08-20 13:31:37.420211655 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svcfftl.h 2020-08-20 13:31:37.184211659 -0700 @@ -4,7 +4,7 @@ * * The FreeType CFF tables loader service (specification). * - * Copyright (C) 2017-2019 by + * Copyright (C) 2017-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svcid.h 2020-08-20 13:31:38.320211640 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svcid.h 2020-08-20 13:31:38.092211644 -0700 @@ -4,7 +4,7 @@ * * The FreeType CID font services (specification). * - * Copyright (C) 2007-2019 by + * Copyright (C) 2007-2020 by * Derek Clegg and Michael Toftdal. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svfntfmt.h 2020-08-20 13:31:39.188211626 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svfntfmt.h 2020-08-20 13:31:38.928211630 -0700 @@ -4,7 +4,7 @@ * * The FreeType font format service (specification only). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svgldict.h 2020-08-20 13:31:40.060211612 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svgldict.h 2020-08-20 13:31:39.824211616 -0700 @@ -4,7 +4,7 @@ * * The FreeType glyph dictionary services (specification). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svgxval.h 2020-08-20 13:31:41.028211596 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svgxval.h 2020-08-20 13:31:40.752211600 -0700 @@ -4,7 +4,7 @@ * * FreeType API for validating TrueTypeGX/AAT tables (specification). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * Masatake YAMATO, Red Hat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svkern.h 2020-08-20 13:31:41.980211580 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svkern.h 2020-08-20 13:31:41.688211585 -0700 @@ -4,7 +4,7 @@ * * The FreeType Kerning service (specification). * - * Copyright (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svmetric.h 2020-08-20 13:31:42.940211564 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svmetric.h 2020-08-20 13:31:42.664211569 -0700 @@ -4,7 +4,7 @@ * * The FreeType services for metrics variations (specification). * - * Copyright (C) 2016-2019 by + * Copyright (C) 2016-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svmm.h 2020-08-20 13:31:43.800211550 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svmm.h 2020-08-20 13:31:43.576211554 -0700 @@ -4,7 +4,7 @@ * * The FreeType Multiple Masters and GX var services (specification). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svotval.h 2020-08-20 13:31:44.716211535 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svotval.h 2020-08-20 13:31:44.424211540 -0700 @@ -4,7 +4,7 @@ * * The FreeType OpenType validation service (specification). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpfr.h 2020-08-20 13:31:45.616211520 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpfr.h 2020-08-20 13:31:45.392211524 -0700 @@ -4,7 +4,7 @@ * * Internal PFR service functions (specification). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpostnm.h 2020-08-20 13:31:46.488211506 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpostnm.h 2020-08-20 13:31:46.264211510 -0700 @@ -4,7 +4,7 @@ * * The FreeType PostScript name services (specification). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svprop.h 2020-08-20 13:31:47.440211490 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svprop.h 2020-08-20 13:31:47.152211495 -0700 @@ -4,7 +4,7 @@ * * The FreeType property service (specification). * - * Copyright (C) 2012-2019 by + * Copyright (C) 2012-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpscmap.h 2020-08-20 13:31:48.364211475 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpscmap.h 2020-08-20 13:31:48.092211479 -0700 @@ -4,7 +4,7 @@ * * The FreeType PostScript charmap service (specification). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpsinfo.h 2020-08-20 13:31:49.248211460 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpsinfo.h 2020-08-20 13:31:49.024211464 -0700 @@ -4,7 +4,7 @@ * * The FreeType PostScript info service (specification). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svsfnt.h 2020-08-20 13:31:50.116211446 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svsfnt.h 2020-08-20 13:31:49.880211450 -0700 @@ -4,7 +4,7 @@ * * The FreeType SFNT table loading service (specification). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svttcmap.h 2020-08-20 13:31:51.020211431 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svttcmap.h 2020-08-20 13:31:50.792211435 -0700 @@ -4,7 +4,7 @@ * * The FreeType TrueType/sfnt cmap extra information service. * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * Masatake YAMATO, Redhat K.K., * David Turner, Robert Wilhelm, and Werner Lemberg. * --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svtteng.h 2020-08-20 13:31:51.956211416 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svtteng.h 2020-08-20 13:31:51.668211421 -0700 @@ -4,7 +4,7 @@ * * The FreeType TrueType engine query service (specification). * - * Copyright (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svttglyf.h 2020-08-20 13:31:52.840211401 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svttglyf.h 2020-08-20 13:31:52.616211405 -0700 @@ -4,7 +4,7 @@ * * The FreeType TrueType glyph service. * - * Copyright (C) 2007-2019 by + * Copyright (C) 2007-2020 by * David Turner. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svwinfnt.h 2020-08-20 13:31:53.728211387 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svwinfnt.h 2020-08-20 13:31:53.452211391 -0700 @@ -4,7 +4,7 @@ * * The FreeType Windows FNT/FONT service (specification). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/sfnt.h 2020-08-20 13:31:54.648211371 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/sfnt.h 2020-08-20 13:31:54.412211375 -0700 @@ -4,7 +4,7 @@ * * High-level 'sfnt' driver interface (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/t1types.h 2020-08-20 13:31:55.604211356 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/t1types.h 2020-08-20 13:31:55.320211360 -0700 @@ -5,7 +5,7 @@ * Basic Type1/Type2 type definitions and interface (specification * only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/tttypes.h 2020-08-20 13:31:56.476211341 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/tttypes.h 2020-08-20 13:31:56.224211345 -0700 @@ -5,7 +5,7 @@ * Basic SFNT/TrueType type definitions and interface (specification * only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/internal/wofftypes.h 2020-08-20 13:31:57.172211330 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/internal/wofftypes.h 2020-08-20 13:31:56.916211334 -0700 @@ -5,7 +5,7 @@ * Basic WOFF/WOFF2 type definitions and interface (specification * only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -104,6 +104,207 @@ } WOFF_TableRec, *WOFF_Table; + /************************************************************************** + * + * @struct: + * WOFF2_TtcFontRec + * + * @description: + * Metadata for a TTC font entry in WOFF2. + * + * @fields: + * flavor :: + * TTC font flavor. + * + * num_tables :: + * Number of tables in TTC, indicating number of elements in + * `table_indices`. + * + * table_indices :: + * Array of table indices for each TTC font. + */ + typedef struct WOFF2_TtcFontRec_ + { + FT_ULong flavor; + FT_UShort num_tables; + FT_UShort* table_indices; + + } WOFF2_TtcFontRec, *WOFF2_TtcFont; + + + /************************************************************************** + * + * @struct: + * WOFF2_HeaderRec + * + * @description: + * WOFF2 file format header. + * + * @fields: + * See + * + * https://www.w3.org/TR/WOFF2/#woff20Header + * + * @note: + * We don't care about the fields `reserved`, `majorVersion` and + * `minorVersion`, so they are not included. The `totalSfntSize` field + * does not necessarily represent the actual size of the uncompressed + * SFNT font stream, so that is used as a reference value instead. + */ + typedef struct WOFF2_HeaderRec_ + { + FT_ULong signature; + FT_ULong flavor; + FT_ULong length; + FT_UShort num_tables; + FT_ULong totalSfntSize; + FT_ULong totalCompressedSize; + FT_ULong metaOffset; + FT_ULong metaLength; + FT_ULong metaOrigLength; + FT_ULong privOffset; + FT_ULong privLength; + + FT_ULong uncompressed_size; /* uncompressed brotli stream size */ + FT_ULong compressed_offset; /* compressed stream offset */ + FT_ULong header_version; /* version of original TTC Header */ + FT_UShort num_fonts; /* number of fonts in TTC */ + FT_ULong actual_sfnt_size; /* actual size of sfnt stream */ + + WOFF2_TtcFont ttc_fonts; /* metadata for fonts in a TTC */ + + } WOFF2_HeaderRec, *WOFF2_Header; + + + /************************************************************************** + * + * @struct: + * WOFF2_TableRec + * + * @description: + * This structure describes a given table of a WOFF2 font. + * + * @fields: + * See + * + * https://www.w3.org/TR/WOFF2/#table_dir_format + */ + typedef struct WOFF2_TableRec_ + { + FT_Byte FlagByte; /* table type and flags */ + FT_ULong Tag; /* table file offset */ + FT_ULong dst_length; /* uncompressed table length */ + FT_ULong TransformLength; /* transformed length */ + + FT_ULong flags; /* calculated flags */ + FT_ULong src_offset; /* compressed table offset */ + FT_ULong src_length; /* compressed table length */ + FT_ULong dst_offset; /* uncompressed table offset */ + + } WOFF2_TableRec, *WOFF2_Table; + + + /************************************************************************** + * + * @struct: + * WOFF2_InfoRec + * + * @description: + * Metadata for WOFF2 font that may be required for reconstruction of + * sfnt tables. + * + * @fields: + * header_checksum :: + * Checksum of SFNT offset table. + * + * num_glyphs :: + * Number of glyphs in the font. + * + * num_hmetrics :: + * `numberOfHMetrics` field in the 'hhea' table. + * + * x_mins :: + * `xMin` values of glyph bounding box. + * + * glyf_table :: + * A pointer to the `glyf' table record. + * + * loca_table :: + * A pointer to the `loca' table record. + * + * head_table :: + * A pointer to the `head' table record. + */ + typedef struct WOFF2_InfoRec_ + { + FT_ULong header_checksum; + FT_UShort num_glyphs; + FT_UShort num_hmetrics; + FT_Short* x_mins; + + WOFF2_Table glyf_table; + WOFF2_Table loca_table; + WOFF2_Table head_table; + + } WOFF2_InfoRec, *WOFF2_Info; + + + /************************************************************************** + * + * @struct: + * WOFF2_SubstreamRec + * + * @description: + * This structure stores information about a substream in the transformed + * 'glyf' table in a WOFF2 stream. + * + * @fields: + * start :: + * Beginning of the substream relative to uncompressed table stream. + * + * offset :: + * Offset of the substream relative to uncompressed table stream. + * + * size :: + * Size of the substream. + */ + typedef struct WOFF2_SubstreamRec_ + { + FT_ULong start; + FT_ULong offset; + FT_ULong size; + + } WOFF2_SubstreamRec, *WOFF2_Substream; + + + /************************************************************************** + * + * @struct: + * WOFF2_PointRec + * + * @description: + * This structure stores information about a point in the transformed + * 'glyf' table in a WOFF2 stream. + * + * @fields: + * x :: + * x-coordinate of point. + * + * y :: + * y-coordinate of point. + * + * on_curve :: + * Set if point is on-curve. + */ + typedef struct WOFF2_PointRec_ + { + FT_Int x; + FT_Int y; + FT_Bool on_curve; + + } WOFF2_PointRec, *WOFF2_Point; + + FT_END_HEADER #endif /* WOFFTYPES_H_ */ --- old/src/java.desktop/share/native/libfreetype/include/freetype/t1tables.h 2020-08-20 13:31:57.956211317 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/t1tables.h 2020-08-20 13:31:57.688211321 -0700 @@ -5,7 +5,7 @@ * Basic Type 1/Type 2 tables definitions and interface (specification * only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/ttnameid.h 2020-08-20 13:31:58.884211302 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/ttnameid.h 2020-08-20 13:31:58.604211306 -0700 @@ -4,7 +4,7 @@ * * TrueType name ID definitions (specification only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/tttables.h 2020-08-20 13:31:59.800211287 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/tttables.h 2020-08-20 13:31:59.520211291 -0700 @@ -5,7 +5,7 @@ * Basic SFNT/TrueType tables definitions and interface * (specification only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/include/freetype/tttags.h 2020-08-20 13:32:00.508211275 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/freetype/tttags.h 2020-08-20 13:32:00.256211279 -0700 @@ -4,7 +4,7 @@ * * Tags for TrueType and OpenType tables (specification only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -107,6 +107,7 @@ #define TTAG_vmtx FT_MAKE_TAG( 'v', 'm', 't', 'x' ) #define TTAG_VVAR FT_MAKE_TAG( 'V', 'V', 'A', 'R' ) #define TTAG_wOFF FT_MAKE_TAG( 'w', 'O', 'F', 'F' ) +#define TTAG_wOF2 FT_MAKE_TAG( 'w', 'O', 'F', '2' ) /* used by "Keyboard.dfont" on legacy Mac OS X */ #define TTAG_0xA5kbd FT_MAKE_TAG( 0xA5, 'k', 'b', 'd' ) --- old/src/java.desktop/share/native/libfreetype/include/ft2build.h 2020-08-20 13:32:01.192211264 -0700 +++ new/src/java.desktop/share/native/libfreetype/include/ft2build.h 2020-08-20 13:32:00.960211267 -0700 @@ -4,7 +4,7 @@ * * FreeType 2 build and setup macros. * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afangles.c 2020-08-20 13:32:02.116211248 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afangles.c 2020-08-20 13:32:01.872211252 -0700 @@ -5,7 +5,7 @@ * Routines used to compute vector angles with limited accuracy * and very high speed. It also contains sorting routines (body). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afblue.c 2020-08-20 13:32:02.756211238 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afblue.c 2020-08-20 13:32:02.532211242 -0700 @@ -7,7 +7,7 @@ * * Auto-fitter data for blue strings (body). * - * Copyright (C) 2013-2019 by + * Copyright (C) 2013-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -340,6 +340,12 @@ '\0', '\xF0', '\x90', '\x92', '\x80', ' ', '\xF0', '\x90', '\x92', '\x82', ' ', '\xF0', '\x90', '\x92', '\x86', ' ', '\xF0', '\x90', '\x92', '\x88', ' ', '\xF0', '\x90', '\x92', '\x8A', ' ', '\xF0', '\x90', '\x92', '\x92', ' ', '\xF0', '\x90', '\x92', '\xA0', ' ', '\xF0', '\x90', '\x92', '\xA9', /* ๐’€ ๐’‚ ๐’† ๐’ˆ ๐’Š ๐’’ ๐’  ๐’ฉ */ '\0', + '\xF0', '\x90', '\xB4', '\x83', ' ', '\xF0', '\x90', '\xB4', '\x80', ' ', '\xF0', '\x90', '\xB4', '\x86', ' ', '\xF0', '\x90', '\xB4', '\x96', ' ', '\xF0', '\x90', '\xB4', '\x95', /* ๐ดƒ ๐ด€ ๐ด† ๐ด– ๐ด• */ + '\0', + '\xF0', '\x90', '\xB4', '\x94', ' ', '\xF0', '\x90', '\xB4', '\x96', ' ', '\xF0', '\x90', '\xB4', '\x95', ' ', '\xF0', '\x90', '\xB4', '\x91', ' ', '\xF0', '\x90', '\xB4', '\x90', /* ๐ด” ๐ด– ๐ด• ๐ด‘ ๐ด */ + '\0', + '\xD9', '\x80', /* ู€ */ + '\0', '\xEA', '\xA2', '\x9C', ' ', '\xEA', '\xA2', '\x9E', ' ', '\xEA', '\xA2', '\xB3', ' ', '\xEA', '\xA2', '\x82', ' ', '\xEA', '\xA2', '\x96', ' ', '\xEA', '\xA2', '\x92', ' ', '\xEA', '\xA2', '\x9D', ' ', '\xEA', '\xA2', '\x9B', /* ๊ขœ ๊ขž ๊ขณ ๊ข‚ ๊ข– ๊ข’ ๊ข ๊ข› */ '\0', '\xEA', '\xA2', '\x82', ' ', '\xEA', '\xA2', '\xA8', ' ', '\xEA', '\xA2', '\xBA', ' ', '\xEA', '\xA2', '\xA4', ' ', '\xEA', '\xA2', '\x8E', /* ๊ข‚ ๊ขจ ๊ขบ ๊ขค ๊ขŽ */ @@ -687,6 +693,10 @@ { AF_BLUE_STRING_OSMANYA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_OSMANYA_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, + { AF_BLUE_STRING_ROHINGYA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, + { AF_BLUE_STRING_ROHINGYA_BOTTOM, 0 }, + { AF_BLUE_STRING_ROHINGYA_JOIN, AF_BLUE_PROPERTY_LATIN_NEUTRAL }, + { AF_BLUE_STRING_MAX, 0 }, { AF_BLUE_STRING_SAURASHTRA_TOP, AF_BLUE_PROPERTY_LATIN_TOP }, { AF_BLUE_STRING_SAURASHTRA_BOTTOM, 0 }, { AF_BLUE_STRING_MAX, 0 }, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afblue.cin 2020-08-20 13:32:03.480211226 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afblue.cin 2020-08-20 13:32:03.212211230 -0700 @@ -4,7 +4,7 @@ * * Auto-fitter data for blue strings (body). * - * Copyright (C) 2013-2019 by + * Copyright (C) 2013-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afblue.dat 2020-08-20 13:32:04.200211214 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afblue.dat 2020-08-20 13:32:03.912211219 -0700 @@ -2,7 +2,7 @@ // // Auto-fitter data for blue strings. // -// Copyright (C) 2013-2019 by +// Copyright (C) 2013-2020 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, @@ -443,6 +443,13 @@ AF_BLUE_STRING_OSMANYA_BOTTOM "๐’€ ๐’‚ ๐’† ๐’ˆ ๐’Š ๐’’ ๐’  ๐’ฉ" + AF_BLUE_STRING_ROHINGYA_TOP + "๐ดƒ ๐ด€ ๐ด† ๐ด– ๐ด•" + AF_BLUE_STRING_ROHINGYA_BOTTOM + "๐ด” ๐ด– ๐ด• ๐ด‘ ๐ด" + AF_BLUE_STRING_ROHINGYA_JOIN + "ู€" + AF_BLUE_STRING_SAURASHTRA_TOP "๊ขœ ๊ขž ๊ขณ ๊ข‚ ๊ข– ๊ข’ ๊ข ๊ข›" AF_BLUE_STRING_SAURASHTRA_BOTTOM @@ -1002,6 +1009,12 @@ { AF_BLUE_STRING_OSMANYA_BOTTOM, 0 } { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_ROHG + { AF_BLUE_STRING_ROHINGYA_TOP, AF_BLUE_PROPERTY_LATIN_TOP } + { AF_BLUE_STRING_ROHINGYA_BOTTOM, 0 } + { AF_BLUE_STRING_ROHINGYA_JOIN, AF_BLUE_PROPERTY_LATIN_NEUTRAL } + { AF_BLUE_STRING_MAX, 0 } + AF_BLUE_STRINGSET_SAUR { AF_BLUE_STRING_SAURASHTRA_TOP, AF_BLUE_PROPERTY_LATIN_TOP } { AF_BLUE_STRING_SAURASHTRA_BOTTOM, 0 } --- old/src/java.desktop/share/native/libfreetype/src/autofit/afblue.h 2020-08-20 13:32:04.676211206 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afblue.h 2020-08-20 13:32:04.448211210 -0700 @@ -7,7 +7,7 @@ * * Auto-fitter data for blue strings (specification). * - * Copyright (C) 2013-2019 by + * Copyright (C) 2013-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -234,36 +234,39 @@ AF_BLUE_STRING_OSAGE_SMALL_DESCENDER = 4095, AF_BLUE_STRING_OSMANYA_TOP = 4110, AF_BLUE_STRING_OSMANYA_BOTTOM = 4150, - AF_BLUE_STRING_SAURASHTRA_TOP = 4190, - AF_BLUE_STRING_SAURASHTRA_BOTTOM = 4222, - AF_BLUE_STRING_SHAVIAN_TOP = 4242, - AF_BLUE_STRING_SHAVIAN_BOTTOM = 4252, - AF_BLUE_STRING_SHAVIAN_DESCENDER = 4277, - AF_BLUE_STRING_SHAVIAN_SMALL_TOP = 4287, - AF_BLUE_STRING_SHAVIAN_SMALL_BOTTOM = 4322, - AF_BLUE_STRING_SINHALA_TOP = 4337, - AF_BLUE_STRING_SINHALA_BOTTOM = 4369, - AF_BLUE_STRING_SINHALA_DESCENDER = 4401, - AF_BLUE_STRING_SUNDANESE_TOP = 4445, - AF_BLUE_STRING_SUNDANESE_BOTTOM = 4469, - AF_BLUE_STRING_SUNDANESE_DESCENDER = 4501, - AF_BLUE_STRING_TAI_VIET_TOP = 4509, - AF_BLUE_STRING_TAI_VIET_BOTTOM = 4529, - AF_BLUE_STRING_TAMIL_TOP = 4541, - AF_BLUE_STRING_TAMIL_BOTTOM = 4573, - AF_BLUE_STRING_TELUGU_TOP = 4605, - AF_BLUE_STRING_TELUGU_BOTTOM = 4633, - AF_BLUE_STRING_THAI_TOP = 4661, - AF_BLUE_STRING_THAI_BOTTOM = 4685, - AF_BLUE_STRING_THAI_ASCENDER = 4713, - AF_BLUE_STRING_THAI_LARGE_ASCENDER = 4725, - AF_BLUE_STRING_THAI_DESCENDER = 4737, - AF_BLUE_STRING_THAI_LARGE_DESCENDER = 4753, - AF_BLUE_STRING_THAI_DIGIT_TOP = 4761, - AF_BLUE_STRING_TIFINAGH = 4773, - AF_BLUE_STRING_VAI_TOP = 4805, - AF_BLUE_STRING_VAI_BOTTOM = 4837, - af_blue_1_1 = 4868, + AF_BLUE_STRING_ROHINGYA_TOP = 4190, + AF_BLUE_STRING_ROHINGYA_BOTTOM = 4215, + AF_BLUE_STRING_ROHINGYA_JOIN = 4240, + AF_BLUE_STRING_SAURASHTRA_TOP = 4243, + AF_BLUE_STRING_SAURASHTRA_BOTTOM = 4275, + AF_BLUE_STRING_SHAVIAN_TOP = 4295, + AF_BLUE_STRING_SHAVIAN_BOTTOM = 4305, + AF_BLUE_STRING_SHAVIAN_DESCENDER = 4330, + AF_BLUE_STRING_SHAVIAN_SMALL_TOP = 4340, + AF_BLUE_STRING_SHAVIAN_SMALL_BOTTOM = 4375, + AF_BLUE_STRING_SINHALA_TOP = 4390, + AF_BLUE_STRING_SINHALA_BOTTOM = 4422, + AF_BLUE_STRING_SINHALA_DESCENDER = 4454, + AF_BLUE_STRING_SUNDANESE_TOP = 4498, + AF_BLUE_STRING_SUNDANESE_BOTTOM = 4522, + AF_BLUE_STRING_SUNDANESE_DESCENDER = 4554, + AF_BLUE_STRING_TAI_VIET_TOP = 4562, + AF_BLUE_STRING_TAI_VIET_BOTTOM = 4582, + AF_BLUE_STRING_TAMIL_TOP = 4594, + AF_BLUE_STRING_TAMIL_BOTTOM = 4626, + AF_BLUE_STRING_TELUGU_TOP = 4658, + AF_BLUE_STRING_TELUGU_BOTTOM = 4686, + AF_BLUE_STRING_THAI_TOP = 4714, + AF_BLUE_STRING_THAI_BOTTOM = 4738, + AF_BLUE_STRING_THAI_ASCENDER = 4766, + AF_BLUE_STRING_THAI_LARGE_ASCENDER = 4778, + AF_BLUE_STRING_THAI_DESCENDER = 4790, + AF_BLUE_STRING_THAI_LARGE_DESCENDER = 4806, + AF_BLUE_STRING_THAI_DIGIT_TOP = 4814, + AF_BLUE_STRING_TIFINAGH = 4826, + AF_BLUE_STRING_VAI_TOP = 4858, + AF_BLUE_STRING_VAI_BOTTOM = 4890, + af_blue_1_1 = 4921, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRING_CJK_TOP = af_blue_1_1 + 1, AF_BLUE_STRING_CJK_BOTTOM = af_blue_1_1 + 203, @@ -365,17 +368,18 @@ AF_BLUE_STRINGSET_ORKH = 196, AF_BLUE_STRINGSET_OSGE = 199, AF_BLUE_STRINGSET_OSMA = 207, - AF_BLUE_STRINGSET_SAUR = 210, - AF_BLUE_STRINGSET_SHAW = 213, - AF_BLUE_STRINGSET_SINH = 219, - AF_BLUE_STRINGSET_SUND = 223, - AF_BLUE_STRINGSET_TAML = 227, - AF_BLUE_STRINGSET_TAVT = 230, - AF_BLUE_STRINGSET_TELU = 233, - AF_BLUE_STRINGSET_TFNG = 236, - AF_BLUE_STRINGSET_THAI = 239, - AF_BLUE_STRINGSET_VAII = 247, - af_blue_2_1 = 250, + AF_BLUE_STRINGSET_ROHG = 210, + AF_BLUE_STRINGSET_SAUR = 214, + AF_BLUE_STRINGSET_SHAW = 217, + AF_BLUE_STRINGSET_SINH = 223, + AF_BLUE_STRINGSET_SUND = 227, + AF_BLUE_STRINGSET_TAML = 231, + AF_BLUE_STRINGSET_TAVT = 234, + AF_BLUE_STRINGSET_TELU = 237, + AF_BLUE_STRINGSET_TFNG = 240, + AF_BLUE_STRINGSET_THAI = 243, + AF_BLUE_STRINGSET_VAII = 251, + af_blue_2_1 = 254, #ifdef AF_CONFIG_OPTION_CJK AF_BLUE_STRINGSET_HANI = af_blue_2_1 + 0, af_blue_2_1_1 = af_blue_2_1 + 2, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afblue.hin 2020-08-20 13:32:05.408211194 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afblue.hin 2020-08-20 13:32:05.176211198 -0700 @@ -4,7 +4,7 @@ * * Auto-fitter data for blue strings (specification). * - * Copyright (C) 2013-2019 by + * Copyright (C) 2013-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afcjk.c 2020-08-20 13:32:06.080211183 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afcjk.c 2020-08-20 13:32:05.844211187 -0700 @@ -4,7 +4,7 @@ * * Auto-fitter hinting routines for CJK writing system (body). * - * Copyright (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -806,7 +806,7 @@ { AF_AxisHints axis = &hints->axis[dim]; AF_Segment segments = axis->segments; - AF_Segment segment_limit = segments + axis->num_segments; + AF_Segment segment_limit = FT_OFFSET( segments, axis->num_segments ); FT_Error error; AF_Segment seg; --- old/src/java.desktop/share/native/libfreetype/src/autofit/afcjk.h 2020-08-20 13:32:06.756211172 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afcjk.h 2020-08-20 13:32:06.512211176 -0700 @@ -4,7 +4,7 @@ * * Auto-fitter hinting routines for CJK writing system (specification). * - * Copyright (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afcover.h 2020-08-20 13:32:07.660211157 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afcover.h 2020-08-20 13:32:07.384211162 -0700 @@ -4,7 +4,7 @@ * * Auto-fitter coverages (specification only). * - * Copyright (C) 2013-2019 by + * Copyright (C) 2013-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afdummy.c 2020-08-20 13:32:08.588211142 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afdummy.c 2020-08-20 13:32:08.304211146 -0700 @@ -5,7 +5,7 @@ * Auto-fitter dummy routines to be used if no hinting should be * performed (body). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afdummy.h 2020-08-20 13:32:09.544211126 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afdummy.h 2020-08-20 13:32:09.252211131 -0700 @@ -5,7 +5,7 @@ * Auto-fitter dummy routines to be used if no hinting should be * performed (specification). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/aferrors.h 2020-08-20 13:32:10.484211111 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/aferrors.h 2020-08-20 13:32:10.196211115 -0700 @@ -4,7 +4,7 @@ * * Autofitter error codes (specification only). * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afglobal.c 2020-08-20 13:32:11.376211096 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afglobal.c 2020-08-20 13:32:11.100211100 -0700 @@ -4,7 +4,7 @@ * * Auto-fitter routines to compute global hinting values (body). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afglobal.h 2020-08-20 13:32:12.236211082 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afglobal.h 2020-08-20 13:32:12.008211085 -0700 @@ -5,7 +5,7 @@ * Auto-fitter routines to compute global hinting values * (specification). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afhints.c 2020-08-20 13:32:13.120211067 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afhints.c 2020-08-20 13:32:12.848211072 -0700 @@ -4,7 +4,7 @@ * * Auto-fitter hinting routines (body). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afhints.h 2020-08-20 13:32:13.968211053 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afhints.h 2020-08-20 13:32:13.744211057 -0700 @@ -4,7 +4,7 @@ * * Auto-fitter hinting routines (specification). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afindic.c 2020-08-20 13:32:14.864211038 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afindic.c 2020-08-20 13:32:14.584211043 -0700 @@ -4,7 +4,7 @@ * * Auto-fitter hinting routines for Indic writing system (body). * - * Copyright (C) 2007-2019 by + * Copyright (C) 2007-2020 by * Rahul Bhalerao , . * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afindic.h 2020-08-20 13:32:15.748211024 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afindic.h 2020-08-20 13:32:15.512211028 -0700 @@ -5,7 +5,7 @@ * Auto-fitter hinting routines for Indic writing system * (specification). * - * Copyright (C) 2007-2019 by + * Copyright (C) 2007-2020 by * Rahul Bhalerao , . * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/aflatin.c 2020-08-20 13:32:16.436211012 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/aflatin.c 2020-08-20 13:32:16.204211016 -0700 @@ -4,7 +4,7 @@ * * Auto-fitter hinting routines for latin writing system (body). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -1910,7 +1910,7 @@ /* sense -- this is used to better detect and ignore serifs */ { AF_Segment segments = axis->segments; - AF_Segment segments_end = segments + axis->num_segments; + AF_Segment segments_end = FT_OFFSET( segments, axis->num_segments ); for ( segment = segments; segment < segments_end; segment++ ) @@ -2314,7 +2314,7 @@ */ { AF_Edge edges = axis->edges; - AF_Edge edge_limit = edges + axis->num_edges; + AF_Edge edge_limit = FT_OFFSET( edges, axis->num_edges ); AF_Edge edge; --- old/src/java.desktop/share/native/libfreetype/src/autofit/aflatin.h 2020-08-20 13:32:17.160211001 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/aflatin.h 2020-08-20 13:32:16.900211005 -0700 @@ -5,7 +5,7 @@ * Auto-fitter hinting routines for latin writing system * (specification). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afloader.c 2020-08-20 13:32:18.144210984 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afloader.c 2020-08-20 13:32:17.852210989 -0700 @@ -4,7 +4,7 @@ * * Auto-fitter glyph loading routines (body). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afloader.h 2020-08-20 13:32:19.024210970 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afloader.h 2020-08-20 13:32:18.752210974 -0700 @@ -4,7 +4,7 @@ * * Auto-fitter glyph loading routines (specification). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afmodule.c 2020-08-20 13:32:19.952210955 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afmodule.c 2020-08-20 13:32:19.680210959 -0700 @@ -4,7 +4,7 @@ * * Auto-fitter module implementation (body). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afmodule.h 2020-08-20 13:32:20.828210940 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afmodule.h 2020-08-20 13:32:20.600210944 -0700 @@ -4,7 +4,7 @@ * * Auto-fitter module implementation (specification). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afranges.c 2020-08-20 13:32:21.580210928 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afranges.c 2020-08-20 13:32:21.292210932 -0700 @@ -4,7 +4,7 @@ * * Auto-fitter Unicode script ranges (body). * - * Copyright (C) 2013-2019 by + * Copyright (C) 2013-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -776,6 +776,18 @@ { AF_UNIRANGE_REC( 0, 0 ) }; + + + const AF_Script_UniRangeRec af_rohg_uniranges[] = + { + AF_UNIRANGE_REC( 0x10D00, 0x10D3F ), /* Hanifi Rohingya */ + AF_UNIRANGE_REC( 0, 0 ) + }; + + const AF_Script_UniRangeRec af_rohg_nonbase_uniranges[] = + { + AF_UNIRANGE_REC( 0, 0 ) + }; const AF_Script_UniRangeRec af_saur_uniranges[] = --- old/src/java.desktop/share/native/libfreetype/src/autofit/afranges.h 2020-08-20 13:32:22.300210916 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afranges.h 2020-08-20 13:32:22.020210920 -0700 @@ -4,7 +4,7 @@ * * Auto-fitter Unicode script ranges (specification). * - * Copyright (C) 2013-2019 by + * Copyright (C) 2013-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afscript.h 2020-08-20 13:32:23.020210904 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afscript.h 2020-08-20 13:32:22.780210908 -0700 @@ -4,7 +4,7 @@ * * Auto-fitter scripts (specification only). * - * Copyright (C) 2013-2019 by + * Copyright (C) 2013-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -291,6 +291,12 @@ HINTING_BOTTOM_TO_TOP, "\xF0\x90\x92\x86 \xF0\x90\x92\xA0" ) /* ๐’† ๐’  */ + SCRIPT( rohg, ROHG, + "Hanifi Rohingya", + HB_SCRIPT_HANIFI_ROHINGYA, + HINTING_BOTTOM_TO_TOP, + "\xF0\x90\xB4\xB0" ) /* ๐ดฐ */ + SCRIPT( saur, SAUR, "Saurashtra", HB_SCRIPT_SAURASHTRA, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afshaper.c 2020-08-20 13:32:23.720210892 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afshaper.c 2020-08-20 13:32:23.440210897 -0700 @@ -4,7 +4,7 @@ * * HarfBuzz interface for accessing OpenType features (body). * - * Copyright (C) 2013-2019 by + * Copyright (C) 2013-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afshaper.h 2020-08-20 13:32:24.688210876 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afshaper.h 2020-08-20 13:32:24.424210881 -0700 @@ -4,7 +4,7 @@ * * HarfBuzz interface for accessing OpenType features (specification). * - * Copyright (C) 2013-2019 by + * Copyright (C) 2013-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afstyles.h 2020-08-20 13:32:25.396210865 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afstyles.h 2020-08-20 13:32:25.164210869 -0700 @@ -4,7 +4,7 @@ * * Auto-fitter styles (specification only). * - * Copyright (C) 2013-2019 by + * Copyright (C) 2013-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -378,6 +378,13 @@ AF_BLUE_STRINGSET_OSMA, AF_COVERAGE_DEFAULT ) + STYLE( rohg_dflt, ROHG_DFLT, + "Hanifi Rohingya default style", + AF_WRITING_SYSTEM_LATIN, + AF_SCRIPT_ROHG, + AF_BLUE_STRINGSET_ROHG, + AF_COVERAGE_DEFAULT ) + STYLE( saur_dflt, SAUR_DFLT, "Saurashtra default style", AF_WRITING_SYSTEM_LATIN, --- old/src/java.desktop/share/native/libfreetype/src/autofit/aftypes.h 2020-08-20 13:32:26.188210852 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/aftypes.h 2020-08-20 13:32:25.912210856 -0700 @@ -4,7 +4,7 @@ * * Auto-fitter types (specification only). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afwarp.c 2020-08-20 13:32:27.088210837 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afwarp.c 2020-08-20 13:32:26.820210841 -0700 @@ -4,7 +4,7 @@ * * Auto-fitter warping algorithm (body). * - * Copyright (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afwarp.h 2020-08-20 13:32:28.056210821 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afwarp.h 2020-08-20 13:32:27.768210826 -0700 @@ -4,7 +4,7 @@ * * Auto-fitter warping algorithm (specification). * - * Copyright (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/autofit/afwrtsys.h 2020-08-20 13:32:29.004210805 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/autofit/afwrtsys.h 2020-08-20 13:32:28.732210810 -0700 @@ -4,7 +4,7 @@ * * Auto-fitter writing systems (specification only). * - * Copyright (C) 2013-2019 by + * Copyright (C) 2013-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/base/ftadvanc.c 2020-08-20 13:32:29.944210790 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftadvanc.c 2020-08-20 13:32:29.652210795 -0700 @@ -4,7 +4,7 @@ * * Quick computation of advance widths (body). * - * Copyright (C) 2008-2019 by + * Copyright (C) 2008-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/base/ftbase.h 2020-08-20 13:32:30.896210774 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftbase.h 2020-08-20 13:32:30.624210779 -0700 @@ -4,7 +4,7 @@ * * Private functions used in the `base' module (specification). * - * Copyright (C) 2008-2019 by + * Copyright (C) 2008-2020 by * David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/base/ftbbox.c 2020-08-20 13:32:31.632210762 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftbbox.c 2020-08-20 13:32:31.356210767 -0700 @@ -4,7 +4,7 @@ * * FreeType bbox computation (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used @@ -294,10 +294,10 @@ if ( shift > 2 ) shift = 2; - q1 <<= shift; - q2 <<= shift; - q3 <<= shift; - q4 <<= shift; + q1 *= 1 << shift; + q2 *= 1 << shift; + q3 *= 1 << shift; + q4 *= 1 << shift; } else { --- old/src/java.desktop/share/native/libfreetype/src/base/ftbitmap.c 2020-08-20 13:32:32.372210750 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftbitmap.c 2020-08-20 13:32:32.084210755 -0700 @@ -4,7 +4,7 @@ * * FreeType utility functions for bitmaps (body). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/base/ftcalc.c 2020-08-20 13:32:33.280210735 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftcalc.c 2020-08-20 13:32:32.992210740 -0700 @@ -4,7 +4,7 @@ * * Arithmetic computations (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/base/ftcid.c 2020-08-20 13:32:34.272210719 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftcid.c 2020-08-20 13:32:33.984210723 -0700 @@ -4,7 +4,7 @@ * * FreeType API for accessing CID font information. * - * Copyright (C) 2007-2019 by + * Copyright (C) 2007-2020 by * Derek Clegg and Michael Toftdal. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/base/ftdbgmem.c 2020-08-20 13:32:34.940210708 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftdbgmem.c 2020-08-20 13:32:34.708210711 -0700 @@ -4,7 +4,7 @@ * * Memory debugger (body). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -621,8 +621,10 @@ if ( node->size < 0 ) ft_mem_debug_panic( - "freeing memory block at %p more than once at (%s:%ld)\n" - "block allocated at (%s:%ld) and released at (%s:%ld)", + "freeing memory block at %p more than once\n" + " at (%s:%ld)!\n" + " Block was allocated at (%s:%ld)\n" + " and released at (%s:%ld).", address, FT_FILENAME( _ft_debug_file ), _ft_debug_lineno, FT_FILENAME( node->source->file_name ), node->source->line_no, --- old/src/java.desktop/share/native/libfreetype/src/base/ftdebug.c 2020-08-20 13:32:35.676210695 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftdebug.c 2020-08-20 13:32:35.384210700 -0700 @@ -4,7 +4,7 @@ * * Debugging and logging component (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/base/ftfntfmt.c 2020-08-20 13:32:36.536210681 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftfntfmt.c 2020-08-20 13:32:36.296210685 -0700 @@ -4,7 +4,7 @@ * * FreeType utility file for font formats (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/base/ftfstype.c 2020-08-20 13:32:37.516210665 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftfstype.c 2020-08-20 13:32:37.224210670 -0700 @@ -4,7 +4,7 @@ * * FreeType utility file to access FSType data (body). * - * Copyright (C) 2008-2019 by + * Copyright (C) 2008-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/base/ftgasp.c 2020-08-20 13:32:38.384210651 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftgasp.c 2020-08-20 13:32:38.136210655 -0700 @@ -4,7 +4,7 @@ * * Access of TrueType's `gasp' table (body). * - * Copyright (C) 2007-2019 by + * Copyright (C) 2007-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/base/ftgloadr.c 2020-08-20 13:32:39.080210639 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftgloadr.c 2020-08-20 13:32:38.844210643 -0700 @@ -4,7 +4,7 @@ * * The FreeType glyph loader (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg * * This file is part of the FreeType project, and may only be used, @@ -146,9 +146,9 @@ FT_Outline* current = &loader->current.outline; - current->points = base->points + base->n_points; - current->tags = base->tags + base->n_points; - current->contours = base->contours + base->n_contours; + current->points = FT_OFFSET( base->points, base->n_points ); + current->tags = FT_OFFSET( base->tags, base->n_points ); + current->contours = FT_OFFSET( base->contours, base->n_contours ); /* handle extra points table - if any */ if ( loader->use_extra ) @@ -169,6 +169,10 @@ FT_Memory memory = loader->memory; + if ( loader->max_points == 0 || + loader->base.extra_points != NULL ) + return FT_Err_Ok; + if ( !FT_NEW_ARRAY( loader->base.extra_points, 2 * loader->max_points ) ) { loader->use_extra = 1; @@ -189,7 +193,7 @@ FT_GlyphLoad current = &loader->current; - current->subglyphs = base->subglyphs + base->num_subglyphs; + current->subglyphs = FT_OFFSET( base->subglyphs, base->num_subglyphs ); } @@ -211,6 +215,10 @@ FT_UInt new_max, old_max; + error = FT_GlyphLoader_CreateExtra( loader ); + if ( error ) + return error; + /* check points & tags */ new_max = (FT_UInt)base->n_points + (FT_UInt)current->n_points + n_points; @@ -244,6 +252,10 @@ loader->max_points = new_max; } + error = FT_GlyphLoader_CreateExtra( loader ); + if ( error ) + return error; + /* check contours */ old_max = loader->max_contours; new_max = (FT_UInt)base->n_contours + (FT_UInt)current->n_contours + --- old/src/java.desktop/share/native/libfreetype/src/base/ftglyph.c 2020-08-20 13:32:39.800210628 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftglyph.c 2020-08-20 13:32:39.528210632 -0700 @@ -4,7 +4,7 @@ * * FreeType convenience functions to handle glyphs (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/base/ftinit.c 2020-08-20 13:32:40.764210612 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftinit.c 2020-08-20 13:32:40.484210616 -0700 @@ -4,7 +4,7 @@ * * FreeType initialization layer (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/base/ftlcdfil.c 2020-08-20 13:32:41.756210595 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftlcdfil.c 2020-08-20 13:32:41.468210600 -0700 @@ -4,7 +4,7 @@ * * FreeType API for color filtering of subpixel bitmap glyphs (body). * - * Copyright (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/base/ftmac.c 2020-08-20 13:32:42.700210580 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftmac.c 2020-08-20 13:32:42.420210584 -0700 @@ -8,7 +8,7 @@ * This file is for Mac OS X only; see builds/mac/ftoldmac.c for * classic platforms built by MPW. * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/base/ftmm.c 2020-08-20 13:32:43.544210566 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftmm.c 2020-08-20 13:32:43.316210570 -0700 @@ -4,7 +4,7 @@ * * Multiple Master font support (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/base/ftobjs.c 2020-08-20 13:32:44.520210550 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftobjs.c 2020-08-20 13:32:44.232210555 -0700 @@ -4,7 +4,7 @@ * * The FreeType private base classes (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/base/ftoutln.c 2020-08-20 13:32:45.256210538 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftoutln.c 2020-08-20 13:32:45.008210542 -0700 @@ -4,7 +4,7 @@ * * FreeType outline management (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -711,7 +711,7 @@ FT_Vector* limit; - if ( !outline || !matrix ) + if ( !outline || !matrix || !outline->points ) return; vec = outline->points; --- old/src/java.desktop/share/native/libfreetype/src/base/ftpatent.c 2020-08-20 13:32:45.968210526 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftpatent.c 2020-08-20 13:32:45.676210531 -0700 @@ -5,7 +5,7 @@ * FreeType API for checking patented TrueType bytecode instructions * (body). Obsolete, retained for backward compatibility. * - * Copyright (C) 2007-2019 by + * Copyright (C) 2007-2020 by * David Turner. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/base/ftpsprop.c 2020-08-20 13:32:46.824210512 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftpsprop.c 2020-08-20 13:32:46.528210517 -0700 @@ -5,7 +5,7 @@ * Get and set properties of PostScript drivers (body). * See `ftdriver.h' for available properties. * - * Copyright (C) 2017-2019 by + * Copyright (C) 2017-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -165,9 +165,9 @@ driver->hinting_engine = *hinting_engine; else error = FT_ERR( Unimplemented_Feature ); - - return error; } + + return error; } else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) --- old/src/java.desktop/share/native/libfreetype/src/base/ftrfork.c 2020-08-20 13:32:47.520210500 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftrfork.c 2020-08-20 13:32:47.256210505 -0700 @@ -4,7 +4,7 @@ * * Embedded resource forks accessor (body). * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * Masatake YAMATO and Redhat K.K. * * FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are --- old/src/java.desktop/share/native/libfreetype/src/base/ftsnames.c 2020-08-20 13:32:48.480210485 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftsnames.c 2020-08-20 13:32:48.200210489 -0700 @@ -7,7 +7,7 @@ * * This is _not_ used to retrieve glyph names! * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/base/ftstream.c 2020-08-20 13:32:49.168210473 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftstream.c 2020-08-20 13:32:48.932210477 -0700 @@ -4,7 +4,7 @@ * * I/O stream support (body). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -286,7 +286,7 @@ } stream->cursor = stream->base; - stream->limit = stream->cursor + count; + stream->limit = FT_OFFSET( stream->cursor, count ); stream->pos += read_bytes; } else --- old/src/java.desktop/share/native/libfreetype/src/base/ftstroke.c 2020-08-20 13:32:49.692210465 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftstroke.c 2020-08-20 13:32:49.456210468 -0700 @@ -4,7 +4,7 @@ * * FreeType path stroker (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -540,63 +540,52 @@ FT_Angle angle_start, FT_Angle angle_diff ) { - FT_Angle total, angle, step, rotate, next, theta; - FT_Vector a, b, a2, b2; - FT_Fixed length; + FT_Fixed coef; + FT_Vector a0, a1, a2, a3; + FT_Int i, arcs = 1; FT_Error error = FT_Err_Ok; - /* compute start point */ - FT_Vector_From_Polar( &a, radius, angle_start ); - a.x += center->x; - a.y += center->y; - - total = angle_diff; - angle = angle_start; - rotate = ( angle_diff >= 0 ) ? FT_ANGLE_PI2 : -FT_ANGLE_PI2; - - while ( total != 0 ) - { - step = total; - if ( step > FT_ARC_CUBIC_ANGLE ) - step = FT_ARC_CUBIC_ANGLE; - - else if ( step < -FT_ARC_CUBIC_ANGLE ) - step = -FT_ARC_CUBIC_ANGLE; - - next = angle + step; - theta = step; - if ( theta < 0 ) - theta = -theta; - - theta >>= 1; - - /* compute end point */ - FT_Vector_From_Polar( &b, radius, next ); - b.x += center->x; - b.y += center->y; - - /* compute first and second control points */ - length = FT_MulDiv( radius, FT_Sin( theta ) * 4, - ( 0x10000L + FT_Cos( theta ) ) * 3 ); - - FT_Vector_From_Polar( &a2, length, angle + rotate ); - a2.x += a.x; - a2.y += a.y; - - FT_Vector_From_Polar( &b2, length, next - rotate ); - b2.x += b.x; - b2.y += b.y; + /* number of cubic arcs to draw */ + while ( angle_diff > FT_ARC_CUBIC_ANGLE * arcs || + -angle_diff > FT_ARC_CUBIC_ANGLE * arcs ) + arcs++; + + /* control tangents */ + coef = FT_Tan( angle_diff / ( 4 * arcs ) ); + coef += coef / 3; + + /* compute start and first control point */ + FT_Vector_From_Polar( &a0, radius, angle_start ); + a1.x = FT_MulFix( -a0.y, coef ); + a1.y = FT_MulFix( a0.x, coef ); + + a0.x += center->x; + a0.y += center->y; + a1.x += a0.x; + a1.y += a0.y; + + for ( i = 1; i <= arcs; i++ ) + { + /* compute end and second control point */ + FT_Vector_From_Polar( &a3, radius, + angle_start + i * angle_diff / arcs ); + a2.x = FT_MulFix( a3.y, coef ); + a2.y = FT_MulFix( -a3.x, coef ); + + a3.x += center->x; + a3.y += center->y; + a2.x += a3.x; + a2.y += a3.y; /* add cubic arc */ - error = ft_stroke_border_cubicto( border, &a2, &b2, &b ); + error = ft_stroke_border_cubicto( border, &a1, &a2, &a3 ); if ( error ) break; - /* process the rest of the arc ?? */ - a = b; - total -= step; - angle = next; + /* a0 = a3; */ + a1.x = a3.x - a2.x + a3.x; + a1.y = a3.y - a2.y + a3.y; } return error; @@ -934,55 +923,40 @@ error = ft_stroker_arcto( stroker, side ); } - else if ( stroker->line_cap == FT_STROKER_LINECAP_SQUARE ) + else { - /* add a square cap */ - FT_Vector delta, delta2; - FT_Angle rotate = FT_SIDE_TO_ROTATE( side ); + /* add a square or butt cap */ + FT_Vector middle, delta; FT_Fixed radius = stroker->radius; FT_StrokeBorder border = stroker->borders + side; - FT_Vector_From_Polar( &delta2, radius, angle + rotate ); - FT_Vector_From_Polar( &delta, radius, angle ); - - delta.x += stroker->center.x + delta2.x; - delta.y += stroker->center.y + delta2.y; - - error = ft_stroke_border_lineto( border, &delta, FALSE ); - if ( error ) - goto Exit; - - FT_Vector_From_Polar( &delta2, radius, angle - rotate ); - FT_Vector_From_Polar( &delta, radius, angle ); - - delta.x += delta2.x + stroker->center.x; - delta.y += delta2.y + stroker->center.y; - - error = ft_stroke_border_lineto( border, &delta, FALSE ); - } - else if ( stroker->line_cap == FT_STROKER_LINECAP_BUTT ) - { - /* add a butt ending */ - FT_Vector delta; - FT_Angle rotate = FT_SIDE_TO_ROTATE( side ); - FT_Fixed radius = stroker->radius; - FT_StrokeBorder border = stroker->borders + side; + /* compute middle point and first angle point */ + FT_Vector_From_Polar( &middle, radius, angle ); + delta.x = side ? middle.y : -middle.y; + delta.y = side ? -middle.x : middle.x; + if ( stroker->line_cap == FT_STROKER_LINECAP_SQUARE ) + { + middle.x += stroker->center.x; + middle.y += stroker->center.y; + } + else /* FT_STROKER_LINECAP_BUTT */ + { + middle.x = stroker->center.x; + middle.y = stroker->center.y; + } - FT_Vector_From_Polar( &delta, radius, angle + rotate ); - - delta.x += stroker->center.x; - delta.y += stroker->center.y; + delta.x += middle.x; + delta.y += middle.y; error = ft_stroke_border_lineto( border, &delta, FALSE ); if ( error ) goto Exit; - FT_Vector_From_Polar( &delta, radius, angle - rotate ); - - delta.x += stroker->center.x; - delta.y += stroker->center.y; + /* compute second angle point */ + delta.x = middle.x - delta.x + middle.x; + delta.y = middle.y - delta.y + middle.y; error = ft_stroke_border_lineto( border, &delta, FALSE ); } @@ -1000,8 +974,8 @@ { FT_StrokeBorder border = stroker->borders + side; FT_Angle phi, theta, rotate; - FT_Fixed length, thcos; - FT_Vector delta; + FT_Fixed length; + FT_Vector sigma, delta; FT_Error error = FT_Err_Ok; FT_Bool intersect; /* use intersection of lines? */ @@ -1019,9 +993,12 @@ else { /* compute minimum required length of lines */ - FT_Fixed min_length = ft_pos_abs( FT_MulFix( stroker->radius, - FT_Tan( theta ) ) ); + FT_Fixed min_length; + + FT_Vector_Unit( &sigma, theta ); + min_length = + ft_pos_abs( FT_MulDiv( stroker->radius, sigma.y, sigma.x ) ); intersect = FT_BOOL( min_length && stroker->line_length >= min_length && @@ -1040,13 +1017,11 @@ else { /* compute median angle */ - phi = stroker->angle_in + theta; + phi = stroker->angle_in + theta + rotate; - thcos = FT_Cos( theta ); + length = FT_DivFix( stroker->radius, sigma.x ); - length = FT_DivFix( stroker->radius, thcos ); - - FT_Vector_From_Polar( &delta, length, phi + rotate ); + FT_Vector_From_Polar( &delta, length, phi ); delta.x += stroker->center.x; delta.y += stroker->center.y; } @@ -1073,10 +1048,10 @@ else { /* this is a mitered (pointed) or beveled (truncated) corner */ - FT_Fixed sigma = 0, radius = stroker->radius; - FT_Angle theta = 0, phi = 0; - FT_Fixed thcos = 0; - FT_Bool bevel, fixed_bevel; + FT_Fixed radius = stroker->radius; + FT_Vector sigma; + FT_Angle theta = 0, phi = 0; + FT_Bool bevel, fixed_bevel; rotate = FT_SIDE_TO_ROTATE( side ); @@ -1087,26 +1062,20 @@ fixed_bevel = FT_BOOL( stroker->line_join != FT_STROKER_LINEJOIN_MITER_VARIABLE ); + /* check miter limit first */ if ( !bevel ) { - theta = FT_Angle_Diff( stroker->angle_in, stroker->angle_out ); + theta = FT_Angle_Diff( stroker->angle_in, stroker->angle_out ) / 2; - if ( theta == FT_ANGLE_PI ) - { - theta = rotate; - phi = stroker->angle_in; - } - else - { - theta /= 2; - phi = stroker->angle_in + theta + rotate; - } + if ( theta == FT_ANGLE_PI2 ) + theta = -rotate; - thcos = FT_Cos( theta ); - sigma = FT_MulFix( stroker->miter_limit, thcos ); + phi = stroker->angle_in + theta + rotate; + + FT_Vector_From_Polar( &sigma, stroker->miter_limit, theta ); /* is miter limit exceeded? */ - if ( sigma < 0x10000L ) + if ( sigma.x < 0x10000L ) { /* don't create variable bevels for very small deviations; */ /* FT_Sin(x) = 0 for x <= 57 */ @@ -1133,36 +1102,34 @@ border->movable = FALSE; error = ft_stroke_border_lineto( border, &delta, FALSE ); } - else /* variable bevel */ + else /* variable bevel or clipped miter */ { /* the miter is truncated */ FT_Vector middle, delta; - FT_Fixed length; + FT_Fixed coef; - /* compute middle point */ + /* compute middle point and first angle point */ FT_Vector_From_Polar( &middle, FT_MulFix( radius, stroker->miter_limit ), phi ); + + coef = FT_DivFix( 0x10000L - sigma.x, sigma.y ); + delta.x = FT_MulFix( middle.y, coef ); + delta.y = FT_MulFix( -middle.x, coef ); + middle.x += stroker->center.x; middle.y += stroker->center.y; - - /* compute first angle point */ - length = FT_MulDiv( radius, 0x10000L - sigma, - ft_pos_abs( FT_Sin( theta ) ) ); - - FT_Vector_From_Polar( &delta, length, phi + rotate ); - delta.x += middle.x; - delta.y += middle.y; + delta.x += middle.x; + delta.y += middle.y; error = ft_stroke_border_lineto( border, &delta, FALSE ); if ( error ) goto Exit; /* compute second angle point */ - FT_Vector_From_Polar( &delta, length, phi - rotate ); - delta.x += middle.x; - delta.y += middle.y; + delta.x = middle.x - delta.x + middle.x; + delta.y = middle.y - delta.y + middle.y; error = ft_stroke_border_lineto( border, &delta, FALSE ); if ( error ) @@ -1189,7 +1156,7 @@ FT_Vector delta; - length = FT_DivFix( stroker->radius, thcos ); + length = FT_MulDiv( stroker->radius, stroker->miter_limit, sigma.x ); FT_Vector_From_Polar( &delta, length, phi ); delta.x += stroker->center.x; --- old/src/java.desktop/share/native/libfreetype/src/base/ftsynth.c 2020-08-20 13:32:50.424210452 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftsynth.c 2020-08-20 13:32:50.188210456 -0700 @@ -4,7 +4,7 @@ * * FreeType synthesizing code for emboldening and slanting (body). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/base/ftsystem.c 2020-08-20 13:32:51.436210436 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftsystem.c 2020-08-20 13:32:51.160210440 -0700 @@ -4,7 +4,7 @@ * * ANSI-specific FreeType low-level system interface (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/base/fttrigon.c 2020-08-20 13:32:52.284210422 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/fttrigon.c 2020-08-20 13:32:52.060210426 -0700 @@ -4,7 +4,7 @@ * * FreeType trigonometric functions (body). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/base/fttype1.c 2020-08-20 13:32:53.256210406 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/fttype1.c 2020-08-20 13:32:52.968210411 -0700 @@ -4,7 +4,7 @@ * * FreeType utility file for PS names support (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/base/ftutil.c 2020-08-20 13:32:54.080210392 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/base/ftutil.c 2020-08-20 13:32:53.852210396 -0700 @@ -4,7 +4,7 @@ * * FreeType utility file for memory and list management (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/cff/cffcmap.c 2020-08-20 13:32:55.004210377 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cff/cffcmap.c 2020-08-20 13:32:54.772210381 -0700 @@ -4,7 +4,7 @@ * * CFF character mapping table (cmap) support (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/cff/cffcmap.h 2020-08-20 13:32:55.932210362 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cff/cffcmap.h 2020-08-20 13:32:55.680210366 -0700 @@ -4,7 +4,7 @@ * * CFF character mapping table (cmap) support (specification). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/cff/cffdrivr.c 2020-08-20 13:32:56.796210348 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cff/cffdrivr.c 2020-08-20 13:32:56.568210351 -0700 @@ -4,7 +4,7 @@ * * OpenType font driver implementation (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/cff/cffdrivr.h 2020-08-20 13:32:57.712210332 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cff/cffdrivr.h 2020-08-20 13:32:57.436210337 -0700 @@ -4,7 +4,7 @@ * * High-level OpenType driver interface (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/cff/cfferrs.h 2020-08-20 13:32:58.676210317 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cff/cfferrs.h 2020-08-20 13:32:58.392210321 -0700 @@ -4,7 +4,7 @@ * * CFF error codes (specification only). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/cff/cffgload.c 2020-08-20 13:32:59.608210301 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cff/cffgload.c 2020-08-20 13:32:59.320210306 -0700 @@ -4,7 +4,7 @@ * * OpenType Glyph Loader (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/cff/cffgload.h 2020-08-20 13:33:00.544210286 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cff/cffgload.h 2020-08-20 13:33:00.252210291 -0700 @@ -4,7 +4,7 @@ * * OpenType Glyph Loader (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/cff/cffload.c 2020-08-20 13:33:01.264210274 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cff/cffload.c 2020-08-20 13:33:01.020210278 -0700 @@ -4,7 +4,7 @@ * * OpenType and CFF data/program tables loader (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -2057,7 +2057,7 @@ if ( !error ) { FT_TRACE4(( " top dictionary:\n" )); - error = cff_parser_run( &parser, dict, dict + dict_len ); + error = cff_parser_run( &parser, dict, FT_OFFSET( dict, dict_len ) ); } /* clean up regardless of error */ --- old/src/java.desktop/share/native/libfreetype/src/cff/cffload.h 2020-08-20 13:33:02.016210262 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cff/cffload.h 2020-08-20 13:33:01.732210266 -0700 @@ -4,7 +4,7 @@ * * OpenType & CFF data/program tables loader (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/cff/cffobjs.c 2020-08-20 13:33:02.688210250 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cff/cffobjs.c 2020-08-20 13:33:02.432210255 -0700 @@ -4,7 +4,7 @@ * * OpenType objects manager (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -1018,9 +1018,9 @@ } #ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES - /* CID-keyed CFF fonts don't have glyph names -- the SFNT loader */ - /* has unset this flag because of the 3.0 `post' table. */ - if ( dict->cid_registry == 0xFFFFU ) + /* CID-keyed CFF or CFF2 fonts don't have glyph names -- the SFNT */ + /* loader has unset this flag because of the 3.0 `post' table. */ + if ( dict->cid_registry == 0xFFFFU && !cff2 ) cffface->face_flags |= FT_FACE_FLAG_GLYPH_NAMES; #endif --- old/src/java.desktop/share/native/libfreetype/src/cff/cffobjs.h 2020-08-20 13:33:03.460210238 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cff/cffobjs.h 2020-08-20 13:33:03.172210242 -0700 @@ -4,7 +4,7 @@ * * OpenType objects manager (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/cff/cffparse.c 2020-08-20 13:33:04.348210223 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cff/cffparse.c 2020-08-20 13:33:04.112210227 -0700 @@ -4,7 +4,7 @@ * * CFF token stream parser (body) * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/cff/cffparse.h 2020-08-20 13:33:05.300210207 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cff/cffparse.h 2020-08-20 13:33:05.020210212 -0700 @@ -4,7 +4,7 @@ * * CFF token stream parser (specification) * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/cff/cfftoken.h 2020-08-20 13:33:06.176210193 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cff/cfftoken.h 2020-08-20 13:33:05.924210197 -0700 @@ -4,7 +4,7 @@ * * CFF token definitions (specification only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/cid/ciderrs.h 2020-08-20 13:33:07.068210178 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cid/ciderrs.h 2020-08-20 13:33:06.824210182 -0700 @@ -4,7 +4,7 @@ * * CID error codes (specification only). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/cid/cidgload.c 2020-08-20 13:33:08.000210163 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cid/cidgload.c 2020-08-20 13:33:07.724210167 -0700 @@ -4,7 +4,7 @@ * * CID-keyed Type1 Glyph Loader (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/cid/cidgload.h 2020-08-20 13:33:08.844210149 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cid/cidgload.h 2020-08-20 13:33:08.620210153 -0700 @@ -4,7 +4,7 @@ * * OpenType Glyph Loader (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/cid/cidload.c 2020-08-20 13:33:09.576210137 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cid/cidload.c 2020-08-20 13:33:09.316210141 -0700 @@ -4,7 +4,7 @@ * * CID-keyed Type1 font loader (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -715,7 +715,7 @@ if ( ft_isdigit( *p ) ) val = (FT_Byte)( *p - '0' ); else if ( *p >= 'a' && *p <= 'f' ) - val = (FT_Byte)( *p - 'a' ); + val = (FT_Byte)( *p - 'a' + 10 ); else if ( *p >= 'A' && *p <= 'F' ) val = (FT_Byte)( *p - 'A' + 10 ); else if ( *p == ' ' || --- old/src/java.desktop/share/native/libfreetype/src/cid/cidload.h 2020-08-20 13:33:10.364210124 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cid/cidload.h 2020-08-20 13:33:10.076210129 -0700 @@ -4,7 +4,7 @@ * * CID-keyed Type1 font loader (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/cid/cidobjs.c 2020-08-20 13:33:11.284210109 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cid/cidobjs.c 2020-08-20 13:33:11.056210113 -0700 @@ -4,7 +4,7 @@ * * CID objects manager (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/cid/cidobjs.h 2020-08-20 13:33:12.112210095 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cid/cidobjs.h 2020-08-20 13:33:11.872210099 -0700 @@ -4,7 +4,7 @@ * * CID objects manager (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/cid/cidparse.c 2020-08-20 13:33:13.060210080 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cid/cidparse.c 2020-08-20 13:33:12.784210084 -0700 @@ -4,7 +4,7 @@ * * CID-keyed Type1 parser (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/cid/cidparse.h 2020-08-20 13:33:13.912210066 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cid/cidparse.h 2020-08-20 13:33:13.672210069 -0700 @@ -4,7 +4,7 @@ * * CID-keyed Type1 parser (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/cid/cidriver.c 2020-08-20 13:33:14.832210050 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cid/cidriver.c 2020-08-20 13:33:14.556210055 -0700 @@ -4,7 +4,7 @@ * * CID driver interface (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/cid/cidriver.h 2020-08-20 13:33:15.736210035 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cid/cidriver.h 2020-08-20 13:33:15.456210040 -0700 @@ -4,7 +4,7 @@ * * High-level CID driver interface (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/cid/cidtoken.h 2020-08-20 13:33:16.644210021 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/cid/cidtoken.h 2020-08-20 13:33:16.360210025 -0700 @@ -4,7 +4,7 @@ * * CID token definitions (specification only). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/psaux/afmparse.c 2020-08-20 13:33:17.804210001 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/psaux/afmparse.c 2020-08-20 13:33:17.520210006 -0700 @@ -4,7 +4,7 @@ * * AFM parser (body). * - * Copyright (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/psaux/afmparse.h 2020-08-20 13:33:18.724209986 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/psaux/afmparse.h 2020-08-20 13:33:18.500209990 -0700 @@ -4,7 +4,7 @@ * * AFM parser (specification). * - * Copyright (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/psaux/cffdecode.c 2020-08-20 13:33:19.492209974 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/psaux/cffdecode.c 2020-08-20 13:33:19.204209978 -0700 @@ -4,7 +4,7 @@ * * PostScript CFF (Type 2) decoding routines (body). * - * Copyright (C) 2017-2019 by + * Copyright (C) 2017-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -330,7 +330,7 @@ builder->left_bearing.x = 0; builder->left_bearing.y = 0; - builder->pos_x = adx - asb; + builder->pos_x = SUB_LONG( adx, asb ); builder->pos_y = ady; /* Now load `achar' on top of the base outline. */ @@ -530,6 +530,9 @@ builder->path_begun = 0; + if ( !charstring_base ) + return FT_Err_Ok; + zone->base = charstring_base; limit = zone->limit = charstring_base + charstring_len; ip = zone->cursor = zone->base; --- old/src/java.desktop/share/native/libfreetype/src/psaux/cffdecode.h 2020-08-20 13:33:20.172209962 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/psaux/cffdecode.h 2020-08-20 13:33:19.944209966 -0700 @@ -4,7 +4,7 @@ * * PostScript CFF (Type 2) decoding routines (specification). * - * Copyright (C) 2017-2019 by + * Copyright (C) 2017-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/psaux/psauxerr.h 2020-08-20 13:33:21.156209946 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/psaux/psauxerr.h 2020-08-20 13:33:20.872209951 -0700 @@ -4,7 +4,7 @@ * * PS auxiliary module error codes (specification only). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/psaux/psauxmod.c 2020-08-20 13:33:22.160209930 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/psaux/psauxmod.c 2020-08-20 13:33:21.880209934 -0700 @@ -4,7 +4,7 @@ * * FreeType auxiliary PostScript module implementation (body). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/psaux/psauxmod.h 2020-08-20 13:33:23.104209914 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/psaux/psauxmod.h 2020-08-20 13:33:22.820209919 -0700 @@ -4,7 +4,7 @@ * * FreeType auxiliary PostScript module implementation (specification). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/psaux/psconv.c 2020-08-20 13:33:24.080209898 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/psaux/psconv.c 2020-08-20 13:33:23.788209903 -0700 @@ -4,7 +4,7 @@ * * Some convenience conversions (body). * - * Copyright (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/psaux/psconv.h 2020-08-20 13:33:25.088209881 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/psaux/psconv.h 2020-08-20 13:33:24.804209886 -0700 @@ -4,7 +4,7 @@ * * Some convenience conversions (specification). * - * Copyright (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/psaux/psft.c 2020-08-20 13:33:25.760209870 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/psaux/psft.c 2020-08-20 13:33:25.532209874 -0700 @@ -313,7 +313,7 @@ FT_Error error = FT_Err_Ok; CF2_Font font; - FT_Bool is_t1 = decoder->builder.is_t1; + FT_Bool is_t1 = decoder->builder.is_t1; FT_ASSERT( decoder && @@ -385,7 +385,7 @@ FT_ZERO( &buf ); buf.start = buf.ptr = charstring_base; - buf.end = charstring_base + charstring_len; + buf.end = FT_OFFSET( charstring_base, charstring_len ); FT_ZERO( &transform ); @@ -697,7 +697,7 @@ FT_ASSERT( charstring + len >= charstring ); buf->start = charstring; - buf->end = charstring + len; + buf->end = FT_OFFSET( charstring, len ); buf->ptr = buf->start; return FT_Err_Ok; @@ -820,7 +820,7 @@ /* The CID driver stores subroutines with seed bytes. This */ /* case is taken care of when decoder->subrs_len == 0. */ if ( decoder->locals_len ) - buf->end = buf->start + decoder->locals_len[idx]; + buf->end = FT_OFFSET( buf->start, decoder->locals_len[idx] ); else { /* We are using subroutines from a CID font. We must adjust */ --- old/src/java.desktop/share/native/libfreetype/src/psaux/psintrp.c 2020-08-20 13:33:26.272209862 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/psaux/psintrp.c 2020-08-20 13:33:26.004209866 -0700 @@ -1433,6 +1433,13 @@ lastError = error2; /* pass FreeType error through */ goto exit; } + + /* save the left bearing and width of the SEAC */ + /* glyph as they will be erased by the next load */ + + left_bearing = *decoder->builder.left_bearing; + advance = *decoder->builder.advance; + cf2_interpT2CharString( font, &component, callbacks, @@ -1443,11 +1450,14 @@ &dummyWidth ); cf2_freeT1SeacComponent( decoder, &component ); - /* save the left bearing and width of the base */ - /* character as they will be erased by the next load */ + /* If the SEAC glyph doesn't have a (H)SBW of its */ + /* own use the values from the base glyph. */ - left_bearing = *decoder->builder.left_bearing; - advance = *decoder->builder.advance; + if ( !haveWidth ) + { + left_bearing = *decoder->builder.left_bearing; + advance = *decoder->builder.advance; + } decoder->builder.left_bearing->x = 0; decoder->builder.left_bearing->y = 0; @@ -1473,8 +1483,8 @@ &dummyWidth ); cf2_freeT1SeacComponent( decoder, &component ); - /* restore the left side bearing and */ - /* advance width of the base character */ + /* restore the left side bearing and advance width */ + /* of the SEAC glyph or base character (saved above) */ *decoder->builder.left_bearing = left_bearing; *decoder->builder.advance = advance; --- old/src/java.desktop/share/native/libfreetype/src/psaux/psobjs.c 2020-08-20 13:33:26.820209853 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/psaux/psobjs.c 2020-08-20 13:33:26.556209857 -0700 @@ -4,7 +4,7 @@ * * Auxiliary functions for PostScript fonts (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -214,7 +214,7 @@ } /* add the object to the base block and adjust offset */ - table->elements[idx] = table->block + table->cursor; + table->elements[idx] = FT_OFFSET( table->block, table->cursor ); table->lengths [idx] = length; FT_MEM_COPY( table->block + table->cursor, object, length ); @@ -2577,7 +2577,7 @@ FT_UShort seed ) { PS_Conv_EexecDecode( &buffer, - buffer + length, + FT_OFFSET( buffer, length ), buffer, length, &seed ); --- old/src/java.desktop/share/native/libfreetype/src/psaux/psobjs.h 2020-08-20 13:33:27.604209840 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/psaux/psobjs.h 2020-08-20 13:33:27.312209845 -0700 @@ -4,7 +4,7 @@ * * Auxiliary functions for PostScript fonts (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/psaux/t1cmap.c 2020-08-20 13:33:28.548209824 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/psaux/t1cmap.c 2020-08-20 13:33:28.268209829 -0700 @@ -4,7 +4,7 @@ * * Type 1 character map support (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/psaux/t1cmap.h 2020-08-20 13:33:29.480209809 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/psaux/t1cmap.h 2020-08-20 13:33:29.208209814 -0700 @@ -4,7 +4,7 @@ * * Type 1 character map support (specification). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/psaux/t1decode.c 2020-08-20 13:33:30.208209797 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/psaux/t1decode.c 2020-08-20 13:33:29.940209801 -0700 @@ -4,7 +4,7 @@ * * PostScript Type 1 decoding routines (body). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -367,6 +367,12 @@ FT_GlyphLoader_Prepare( decoder->builder.loader ); /* prepare loader */ + /* save the left bearing and width of the SEAC */ + /* glyph as they will be erased by the next load */ + + left_bearing = decoder->builder.left_bearing; + advance = decoder->builder.advance; + /* the seac operator must not be nested */ decoder->seac = TRUE; error = t1_decoder_parse_glyph( decoder, (FT_UInt)bchar_index ); @@ -374,11 +380,14 @@ if ( error ) goto Exit; - /* save the left bearing and width of the base character */ - /* as they will be erased by the next load. */ + /* If the SEAC glyph doesn't have a (H)SBW of its */ + /* own use the values from the base glyph. */ - left_bearing = decoder->builder.left_bearing; - advance = decoder->builder.advance; + if ( decoder->builder.parse_state != T1_Parse_Have_Width ) + { + left_bearing = decoder->builder.left_bearing; + advance = decoder->builder.advance; + } decoder->builder.left_bearing.x = 0; decoder->builder.left_bearing.y = 0; @@ -396,8 +405,8 @@ if ( error ) goto Exit; - /* restore the left side bearing and */ - /* advance width of the base character */ + /* restore the left side bearing and advance width */ + /* of the SEAC glyph or base character (saved above) */ decoder->builder.left_bearing = left_bearing; decoder->builder.advance = advance; @@ -650,10 +659,8 @@ if ( value > 32000 || value < -32000 ) { if ( large_int ) - { FT_ERROR(( "t1_decoder_parse_charstrings:" " no `div' after large integer\n" )); - } else large_int = TRUE; } @@ -1690,6 +1697,7 @@ FT_Byte* ip; FT_Byte* limit; T1_Builder builder = &decoder->builder; + FT_Bool large_int; #ifdef FT_DEBUG_LEVEL_TRACE FT_Bool bol = TRUE; @@ -1707,6 +1715,8 @@ limit = zone->limit = charstring_base + charstring_len; ip = zone->cursor = zone->base; + large_int = FALSE; + /* now, execute loop */ while ( ip < limit ) { @@ -1767,6 +1777,9 @@ case 7: op = op_sbw; break; + case 12: + op = op_div; + break; default: goto No_Width; @@ -1796,13 +1809,19 @@ /* anyway. */ if ( value > 32000 || value < -32000 ) { - FT_ERROR(( "t1_decoder_parse_metrics:" - " large integer found for width\n" )); - goto Syntax_Error; + if ( large_int ) + { + FT_ERROR(( "t1_decoder_parse_metrics:" + " no `div' after large integer\n" )); + goto Syntax_Error; + } + else + large_int = TRUE; } else { - value = (FT_Int32)( (FT_UInt32)value << 16 ); + if ( !large_int ) + value = (FT_Int32)( (FT_UInt32)value << 16 ); } break; @@ -1827,7 +1846,8 @@ value = -( ( ( ip[-2] - 251 ) * 256 ) + ip[-1] + 108 ); } - value = (FT_Int32)( (FT_UInt32)value << 16 ); + if ( !large_int ) + value = (FT_Int32)( (FT_UInt32)value << 16 ); } else { @@ -1837,6 +1857,13 @@ } } + if ( large_int && !( op == op_none || op == op_div ) ) + { + FT_ERROR(( "t1_decoder_parse_metrics:" + " no `div' after large integer\n" )); + goto Syntax_Error; + } + /********************************************************************** * * Push value on stack, or process operator @@ -1851,6 +1878,9 @@ } #ifdef FT_DEBUG_LEVEL_TRACE + if ( large_int ) + FT_TRACE4(( " %d", value )); + else FT_TRACE4(( " %d", value / 65536 )); #endif @@ -1869,11 +1899,14 @@ #ifdef FT_DEBUG_LEVEL_TRACE - if ( top - decoder->stack != num_args ) - FT_TRACE0(( "t1_decoder_parse_metrics:" - " too much operands on the stack" - " (seen %d, expected %d)\n", - top - decoder->stack, num_args )); + if ( op != op_div ) + { + if ( top - decoder->stack != num_args ) + FT_TRACE0(( "t1_decoder_parse_metrics:" + " too much operands on the stack" + " (seen %d, expected %d)\n", + top - decoder->stack, num_args )); + } #endif /* FT_DEBUG_LEVEL_TRACE */ @@ -1917,12 +1950,26 @@ FT_TRACE4(( "\n" )); return FT_Err_Ok; + case op_div: + FT_TRACE4(( " div" )); + + /* if `large_int' is set, we divide unscaled numbers; */ + /* otherwise, we divide numbers in 16.16 format -- */ + /* in both cases, it is the same operation */ + *top = FT_DivFix( top[0], top[1] ); + top++; + + large_int = FALSE; + break; + default: FT_ERROR(( "t1_decoder_parse_metrics:" " unhandled opcode %d\n", op )); goto Syntax_Error; } + decoder->top = top; + } /* general operator processing */ } /* while ip < limit */ --- old/src/java.desktop/share/native/libfreetype/src/psaux/t1decode.h 2020-08-20 13:33:30.920209785 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/psaux/t1decode.h 2020-08-20 13:33:30.676209789 -0700 @@ -4,7 +4,7 @@ * * PostScript Type 1 decoding routines (specification). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/pshinter/pshalgo.c 2020-08-20 13:33:31.832209770 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/pshinter/pshalgo.c 2020-08-20 13:33:31.548209775 -0700 @@ -4,7 +4,7 @@ * * PostScript hinting algorithm (body). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used --- old/src/java.desktop/share/native/libfreetype/src/pshinter/pshalgo.h 2020-08-20 13:33:32.808209754 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/pshinter/pshalgo.h 2020-08-20 13:33:32.528209759 -0700 @@ -4,7 +4,7 @@ * * PostScript hinting algorithm (specification). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/pshinter/pshglob.c 2020-08-20 13:33:33.792209738 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/pshinter/pshglob.c 2020-08-20 13:33:33.504209743 -0700 @@ -5,7 +5,7 @@ * PostScript hinter global hinting management (body). * Inspired by the new auto-hinter module. * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used --- old/src/java.desktop/share/native/libfreetype/src/pshinter/pshglob.h 2020-08-20 13:33:34.684209723 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/pshinter/pshglob.h 2020-08-20 13:33:34.396209728 -0700 @@ -4,7 +4,7 @@ * * PostScript hinter global hinting management. * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/pshinter/pshmod.c 2020-08-20 13:33:35.604209708 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/pshinter/pshmod.c 2020-08-20 13:33:35.328209713 -0700 @@ -4,7 +4,7 @@ * * FreeType PostScript hinter module implementation (body). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/pshinter/pshmod.h 2020-08-20 13:33:36.484209694 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/pshinter/pshmod.h 2020-08-20 13:33:36.212209698 -0700 @@ -4,7 +4,7 @@ * * PostScript hinter module interface (specification). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/pshinter/pshnterr.h 2020-08-20 13:33:37.348209679 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/pshinter/pshnterr.h 2020-08-20 13:33:37.088209684 -0700 @@ -4,7 +4,7 @@ * * PS Hinter error codes (specification only). * - * Copyright (C) 2003-2019 by + * Copyright (C) 2003-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/pshinter/pshrec.c 2020-08-20 13:33:38.248209665 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/pshinter/pshrec.c 2020-08-20 13:33:38.020209668 -0700 @@ -4,7 +4,7 @@ * * FreeType PostScript hints recorder (body). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/pshinter/pshrec.h 2020-08-20 13:33:39.124209650 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/pshinter/pshrec.h 2020-08-20 13:33:38.844209655 -0700 @@ -4,7 +4,7 @@ * * Postscript (Type1/Type2) hints recorder (specification). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/psnames/psmodule.c 2020-08-20 13:33:40.048209635 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/psnames/psmodule.c 2020-08-20 13:33:39.808209639 -0700 @@ -4,7 +4,7 @@ * * psnames module implementation (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/psnames/psmodule.h 2020-08-20 13:33:40.984209620 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/psnames/psmodule.h 2020-08-20 13:33:40.708209624 -0700 @@ -4,7 +4,7 @@ * * High-level psnames module interface (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/psnames/psnamerr.h 2020-08-20 13:33:41.828209606 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/psnames/psnamerr.h 2020-08-20 13:33:41.604209609 -0700 @@ -4,7 +4,7 @@ * * PS names module error codes (specification only). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/psnames/pstables.h 2020-08-20 13:33:42.732209591 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/psnames/pstables.h 2020-08-20 13:33:42.484209595 -0700 @@ -4,7 +4,7 @@ * * PostScript glyph names. * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/raster/ftmisc.h 2020-08-20 13:33:43.668209575 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/raster/ftmisc.h 2020-08-20 13:33:43.440209579 -0700 @@ -5,7 +5,7 @@ * Miscellaneous macros for stand-alone rasterizer (specification * only). * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used --- old/src/java.desktop/share/native/libfreetype/src/raster/ftraster.c 2020-08-20 13:33:44.664209559 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/raster/ftraster.c 2020-08-20 13:33:44.380209564 -0700 @@ -4,7 +4,7 @@ * * The FreeType glyph rasterizer (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/raster/ftraster.h 2020-08-20 13:33:45.672209542 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/raster/ftraster.h 2020-08-20 13:33:45.384209547 -0700 @@ -4,7 +4,7 @@ * * The FreeType glyph rasterizer (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used --- old/src/java.desktop/share/native/libfreetype/src/raster/ftrend1.c 2020-08-20 13:33:46.640209526 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/raster/ftrend1.c 2020-08-20 13:33:46.356209531 -0700 @@ -4,7 +4,7 @@ * * The FreeType glyph rasterizer interface (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/raster/ftrend1.h 2020-08-20 13:33:47.560209511 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/raster/ftrend1.h 2020-08-20 13:33:47.276209516 -0700 @@ -4,7 +4,7 @@ * * The FreeType glyph rasterizer interface (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/raster/rasterrs.h 2020-08-20 13:33:48.500209496 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/raster/rasterrs.h 2020-08-20 13:33:48.220209500 -0700 @@ -4,7 +4,7 @@ * * monochrome renderer error codes (specification only). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/sfnt/pngshim.c 2020-08-20 13:33:49.224209484 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/pngshim.c 2020-08-20 13:33:48.984209488 -0700 @@ -4,7 +4,7 @@ * * PNG Bitmap glyph support. * - * Copyright (C) 2013-2019 by + * Copyright (C) 2013-2020 by * Google, Inc. * Written by Stuart Gill and Behdad Esfahbod. * @@ -68,6 +68,7 @@ ( ( __clang_major__ >= 4 ) || \ ( ( __clang_major__ == 3 ) && ( __clang_minor__ >= 2 ) ) ) ) ) && \ defined( __OPTIMIZE__ ) && \ + defined( __SSE__ ) && \ __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #ifdef __clang__ --- old/src/java.desktop/share/native/libfreetype/src/sfnt/pngshim.h 2020-08-20 13:33:49.964209472 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/pngshim.h 2020-08-20 13:33:49.724209476 -0700 @@ -4,7 +4,7 @@ * * PNG Bitmap glyph support. * - * Copyright (C) 2013-2019 by + * Copyright (C) 2013-2020 by * Google, Inc. * Written by Stuart Gill and Behdad Esfahbod. * --- old/src/java.desktop/share/native/libfreetype/src/sfnt/sfdriver.c 2020-08-20 13:33:50.856209457 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/sfdriver.c 2020-08-20 13:33:50.624209461 -0700 @@ -4,7 +4,7 @@ * * High-level SFNT driver interface (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/sfnt/sfdriver.h 2020-08-20 13:33:51.736209442 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/sfdriver.h 2020-08-20 13:33:51.468209447 -0700 @@ -4,7 +4,7 @@ * * High-level SFNT driver interface (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/sfnt/sferrors.h 2020-08-20 13:33:52.640209427 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/sferrors.h 2020-08-20 13:33:52.380209432 -0700 @@ -4,7 +4,7 @@ * * SFNT error codes (specification only). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/sfnt/sfobjs.c 2020-08-20 13:33:53.400209415 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/sfobjs.c 2020-08-20 13:33:53.116209420 -0700 @@ -4,7 +4,7 @@ * * SFNT object management (base). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -22,6 +22,7 @@ #include "ttcmap.h" #include "ttkern.h" #include "sfwoff.h" +#include "sfwoff2.h" #include FT_INTERNAL_SFNT_H #include FT_INTERNAL_DEBUG_H #include FT_TRUETYPE_IDS_H @@ -341,7 +342,9 @@ /* synthesized into a TTC with one offset table. */ static FT_Error sfnt_open_font( FT_Stream stream, - TT_Face face ) + TT_Face face, + FT_Int* face_instance_index, + FT_Long* woff2_num_faces ) { FT_Memory memory = stream->memory; FT_Error error; @@ -385,6 +388,25 @@ goto retry; } + if ( tag == TTAG_wOF2 ) + { + FT_TRACE2(( "sfnt_open_font: file is a WOFF2; synthesizing SFNT\n" )); + + if ( FT_STREAM_SEEK( offset ) ) + return error; + + error = woff2_open_font( stream, + face, + face_instance_index, + woff2_num_faces ); + if ( error ) + return error; + + /* Swap out stream and retry! */ + stream = face->root.stream; + goto retry; + } + if ( tag != 0x00010000UL && tag != TTAG_ttcf && tag != TTAG_OTTO && @@ -461,9 +483,10 @@ FT_Parameter* params ) { FT_Error error; - FT_Library library = face->root.driver->root.library; + FT_Library library = face->root.driver->root.library; SFNT_Service sfnt; FT_Int face_index; + FT_Long woff2_num_faces = 0; /* for now, parameters are unused */ @@ -514,7 +537,10 @@ FT_TRACE2(( "SFNT driver\n" )); - error = sfnt_open_font( stream, face ); + error = sfnt_open_font( stream, + face, + &face_instance_index, + &woff2_num_faces ); if ( error ) return error; @@ -689,6 +715,10 @@ face->root.num_faces = face->ttc_header.count; face->root.face_index = face_instance_index; + /* `num_faces' for a WOFF2 needs to be handled separately. */ + if ( woff2_num_faces ) + face->root.num_faces = woff2_num_faces; + return error; } --- old/src/java.desktop/share/native/libfreetype/src/sfnt/sfobjs.h 2020-08-20 13:33:54.152209403 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/sfobjs.h 2020-08-20 13:33:53.864209407 -0700 @@ -4,7 +4,7 @@ * * SFNT object management (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff.c 2020-08-20 13:33:54.836209391 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff.c 2020-08-20 13:33:54.612209395 -0700 @@ -4,7 +4,7 @@ * * WOFF format management (base). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -371,18 +371,18 @@ sfnt + table->OrigOffset, &output_len, stream->cursor, table->CompLength ); if ( error ) - goto Exit; + goto Exit1; if ( output_len != table->OrigLength ) { FT_ERROR(( "woff_font_open: compressed table length mismatch\n" )); error = FT_THROW( Invalid_Table ); - goto Exit; + goto Exit1; } #else /* !FT_CONFIG_OPTION_USE_ZLIB */ error = FT_THROW( Unimplemented_Feature ); - goto Exit; + goto Exit1; #endif /* !FT_CONFIG_OPTION_USE_ZLIB */ } @@ -424,6 +424,10 @@ } return error; + + Exit1: + FT_FRAME_EXIT(); + goto Exit; } --- old/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff.h 2020-08-20 13:33:55.560209379 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff.h 2020-08-20 13:33:55.272209384 -0700 @@ -4,7 +4,7 @@ * * WOFFF format management (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmap.c 2020-08-20 13:33:56.212209369 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmap.c 2020-08-20 13:33:55.984209372 -0700 @@ -4,7 +4,7 @@ * * TrueType character mapping table (cmap) support (body). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -3764,28 +3764,31 @@ FT_LOCAL_DEF( FT_Error ) tt_face_build_cmaps( TT_Face face ) { - FT_Byte* table = face->cmap_table; - FT_Byte* limit = table + face->cmap_size; + FT_Byte* const table = face->cmap_table; + FT_Byte* limit; FT_UInt volatile num_cmaps; - FT_Byte* volatile p = table; + FT_Byte* volatile p = table; FT_Library library = FT_FACE_LIBRARY( face ); FT_UNUSED( library ); - if ( !p || p + 4 > limit ) + if ( !p || face->cmap_size < 4 ) return FT_THROW( Invalid_Table ); - /* only recognize format 0 */ - if ( TT_NEXT_USHORT( p ) != 0 ) - { - FT_ERROR(( "tt_face_build_cmaps:" - " unsupported `cmap' table format = %d\n", - TT_PEEK_USHORT( p - 2 ) )); - return FT_THROW( Invalid_Table ); - } + /* Version 1.8.3 of the OpenType specification contains the following */ + /* (https://docs.microsoft.com/en-us/typography/opentype/spec/cmap): */ + /* */ + /* The 'cmap' table version number remains at 0x0000 for fonts that */ + /* make use of the newer subtable formats. */ + /* */ + /* This essentially means that a version format test is useless. */ + + /* ignore format */ + p += 2; num_cmaps = TT_NEXT_USHORT( p ); + limit = table + face->cmap_size; for ( ; num_cmaps > 0 && p + 8 <= limit; num_cmaps-- ) { --- old/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmap.h 2020-08-20 13:33:56.940209357 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmap.h 2020-08-20 13:33:56.680209361 -0700 @@ -4,7 +4,7 @@ * * TrueType character mapping table (cmap) support (specification). * - * Copyright (C) 2002-2019 by + * Copyright (C) 2002-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmapc.h 2020-08-20 13:33:57.880209341 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmapc.h 2020-08-20 13:33:57.608209346 -0700 @@ -4,7 +4,7 @@ * * TT CMAP classes definitions (specification only). * - * Copyright (C) 2009-2019 by + * Copyright (C) 2009-2020 by * Oran Agra and Mickey Gabel. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/sfnt/ttcolr.c 2020-08-20 13:33:58.848209325 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/ttcolr.c 2020-08-20 13:33:58.576209330 -0700 @@ -4,7 +4,7 @@ * * TrueType and OpenType colored glyph layer support (body). * - * Copyright (C) 2018-2019 by + * Copyright (C) 2018-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Originally written by Shao Yu Zhang . --- old/src/java.desktop/share/native/libfreetype/src/sfnt/ttcolr.h 2020-08-20 13:33:59.788209310 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/ttcolr.h 2020-08-20 13:33:59.504209314 -0700 @@ -4,7 +4,7 @@ * * TrueType and OpenType colored glyph layer support (specification). * - * Copyright (C) 2018-2019 by + * Copyright (C) 2018-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Originally written by Shao Yu Zhang . --- old/src/java.desktop/share/native/libfreetype/src/sfnt/ttcpal.c 2020-08-20 13:34:00.696209295 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/ttcpal.c 2020-08-20 13:34:00.428209299 -0700 @@ -4,7 +4,7 @@ * * TrueType and OpenType color palette support (body). * - * Copyright (C) 2018-2019 by + * Copyright (C) 2018-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Originally written by Shao Yu Zhang . --- old/src/java.desktop/share/native/libfreetype/src/sfnt/ttcpal.h 2020-08-20 13:34:01.640209279 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/ttcpal.h 2020-08-20 13:34:01.356209284 -0700 @@ -4,7 +4,7 @@ * * TrueType and OpenType color palette support (specification). * - * Copyright (C) 2018-2019 by + * Copyright (C) 2018-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Originally written by Shao Yu Zhang . --- old/src/java.desktop/share/native/libfreetype/src/sfnt/ttkern.c 2020-08-20 13:34:02.576209264 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/ttkern.c 2020-08-20 13:34:02.296209268 -0700 @@ -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-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/sfnt/ttkern.h 2020-08-20 13:34:03.488209249 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/ttkern.h 2020-08-20 13:34:03.200209253 -0700 @@ -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-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/sfnt/ttload.c 2020-08-20 13:34:04.188209237 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/ttload.c 2020-08-20 13:34:03.952209241 -0700 @@ -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-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -397,7 +397,15 @@ } } else + { valid_entries = sfnt.num_tables; + if ( !valid_entries ) + { + FT_TRACE2(( "tt_face_load_font_dir: no valid tables found\n" )); + error = FT_THROW( Unknown_File_Format ); + goto Exit; + } + } face->num_tables = valid_entries; face->format_tag = sfnt.format_tag; @@ -916,7 +924,7 @@ /* load language tags */ { TT_LangTag entry = table->langTags; - TT_LangTag limit = entry + table->numLangTagRecords; + TT_LangTag limit = FT_OFFSET( entry, table->numLangTagRecords ); for ( ; entry < limit; entry++ ) --- old/src/java.desktop/share/native/libfreetype/src/sfnt/ttload.h 2020-08-20 13:34:04.972209224 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/ttload.h 2020-08-20 13:34:04.684209229 -0700 @@ -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-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/sfnt/ttmtx.c 2020-08-20 13:34:05.952209208 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/ttmtx.c 2020-08-20 13:34:05.664209213 -0700 @@ -4,7 +4,7 @@ * * Load the metrics tables common to TTF and OTF fonts (body). * - * Copyright (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/sfnt/ttmtx.h 2020-08-20 13:34:06.860209193 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/ttmtx.h 2020-08-20 13:34:06.568209198 -0700 @@ -4,7 +4,7 @@ * * Load the metrics tables common to TTF and OTF fonts (specification). * - * Copyright (C) 2006-2019 by + * Copyright (C) 2006-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/sfnt/ttpost.c 2020-08-20 13:34:07.796209178 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/ttpost.c 2020-08-20 13:34:07.508209183 -0700 @@ -5,7 +5,7 @@ * PostScript name table processing for TrueType and OpenType fonts * (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/sfnt/ttpost.h 2020-08-20 13:34:08.680209163 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/ttpost.h 2020-08-20 13:34:08.436209167 -0700 @@ -5,7 +5,7 @@ * PostScript name table processing for TrueType and OpenType fonts * (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/sfnt/ttsbit.c 2020-08-20 13:34:09.600209148 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/ttsbit.c 2020-08-20 13:34:09.320209153 -0700 @@ -4,7 +4,7 @@ * * TrueType and OpenType embedded bitmap support (body). * - * Copyright (C) 2005-2019 by + * Copyright (C) 2005-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * Copyright 2013 by Google, Inc. --- old/src/java.desktop/share/native/libfreetype/src/sfnt/ttsbit.h 2020-08-20 13:34:10.476209134 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/ttsbit.h 2020-08-20 13:34:10.252209137 -0700 @@ -4,7 +4,7 @@ * * TrueType and OpenType embedded bitmap support (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.c 2020-08-20 13:34:11.424209118 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.c 2020-08-20 13:34:11.144209123 -0700 @@ -4,7 +4,7 @@ * * A new `perfect' anti-aliasing renderer (body). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.h 2020-08-20 13:34:12.376209102 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.h 2020-08-20 13:34:12.112209107 -0700 @@ -4,7 +4,7 @@ * * FreeType smooth renderer declaration * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/smooth/ftsmerrs.h 2020-08-20 13:34:13.296209087 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/smooth/ftsmerrs.h 2020-08-20 13:34:13.044209091 -0700 @@ -4,7 +4,7 @@ * * smooth renderer error codes (specification only). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/smooth/ftsmooth.c 2020-08-20 13:34:14.056209075 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/smooth/ftsmooth.c 2020-08-20 13:34:13.768209079 -0700 @@ -4,7 +4,7 @@ * * Anti-aliasing renderer interface (body). * - * Copyright (C) 2000-2019 by + * Copyright (C) 2000-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -155,6 +155,9 @@ goto Exit; } + if ( !bitmap->rows || !bitmap->pitch ) + goto Exit; + /* allocate new one */ if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, bitmap->pitch ) ) goto Exit; @@ -188,7 +191,7 @@ /* implode outline if needed */ { FT_Vector* points = outline->points; - FT_Vector* points_end = points + outline->n_points; + FT_Vector* points_end = FT_OFFSET( points, outline->n_points ); FT_Vector* vec; @@ -207,7 +210,7 @@ /* deflate outline if needed */ { FT_Vector* points = outline->points; - FT_Vector* points_end = points + outline->n_points; + FT_Vector* points_end = FT_OFFSET( points, outline->n_points ); FT_Vector* vec; --- old/src/java.desktop/share/native/libfreetype/src/smooth/ftsmooth.h 2020-08-20 13:34:14.796209062 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/smooth/ftsmooth.h 2020-08-20 13:34:14.516209067 -0700 @@ -4,7 +4,7 @@ * * Anti-aliasing renderer interface (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/truetype/ttdriver.c 2020-08-20 13:34:15.688209048 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/truetype/ttdriver.c 2020-08-20 13:34:15.408209052 -0700 @@ -4,7 +4,7 @@ * * TrueType font driver implementation (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/truetype/ttdriver.h 2020-08-20 13:34:16.628209032 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/truetype/ttdriver.h 2020-08-20 13:34:16.352209037 -0700 @@ -4,7 +4,7 @@ * * High-level TrueType driver interface (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/truetype/tterrors.h 2020-08-20 13:34:17.536209017 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/truetype/tterrors.h 2020-08-20 13:34:17.300209021 -0700 @@ -4,7 +4,7 @@ * * TrueType error codes (specification only). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.c 2020-08-20 13:34:18.268209005 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.c 2020-08-20 13:34:18.024209009 -0700 @@ -4,7 +4,7 @@ * * TrueType Glyph Loader (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -1102,9 +1102,16 @@ } #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - /* if we have a HVAR table, `pp1' and/or `pp2' are already adjusted */ - if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) || - !IS_HINTED( loader->load_flags ) ) + /* if we have a HVAR table, `pp1' and/or `pp2' */ + /* are already adjusted but unscaled */ + if ( ( loader->face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) && + IS_HINTED( loader->load_flags ) ) + { + loader->pp1.x = FT_MulFix( loader->pp1.x, x_scale ); + loader->pp2.x = FT_MulFix( loader->pp2.x, x_scale ); + /* pp1.y and pp2.y are always zero */ + } + else #endif { loader->pp1 = outline->points[n_points - 4]; @@ -1112,9 +1119,17 @@ } #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - /* if we have a VVAR table, `pp3' and/or `pp4' are already adjusted */ - if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) || - !IS_HINTED( loader->load_flags ) ) + /* if we have a VVAR table, `pp3' and/or `pp4' */ + /* are already adjusted but unscaled */ + if ( ( loader->face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) && + IS_HINTED( loader->load_flags ) ) + { + loader->pp3.x = FT_MulFix( loader->pp3.x, x_scale ); + loader->pp3.y = FT_MulFix( loader->pp3.y, y_scale ); + loader->pp4.x = FT_MulFix( loader->pp4.x, x_scale ); + loader->pp4.y = FT_MulFix( loader->pp4.y, y_scale ); + } + else #endif { loader->pp3 = outline->points[n_points - 2]; @@ -2287,13 +2302,14 @@ if ( face->vertical_info && face->vertical.number_Of_VMetrics > 0 ) { - top = (FT_Short)FT_DivFix( loader->pp3.y - bbox.yMax, + top = (FT_Short)FT_DivFix( SUB_LONG( loader->pp3.y, bbox.yMax ), y_scale ); if ( loader->pp3.y <= loader->pp4.y ) advance = 0; else - advance = (FT_UShort)FT_DivFix( loader->pp3.y - loader->pp4.y, + advance = (FT_UShort)FT_DivFix( SUB_LONG( loader->pp3.y, + loader->pp4.y ), y_scale ); } else --- old/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.h 2020-08-20 13:34:19.012208993 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.h 2020-08-20 13:34:18.724208998 -0700 @@ -4,7 +4,7 @@ * * TrueType Glyph Loader (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/truetype/ttgxvar.c 2020-08-20 13:34:19.684208982 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/truetype/ttgxvar.c 2020-08-20 13:34:19.456208986 -0700 @@ -4,7 +4,7 @@ * * TrueType GX Font Variation loader * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. * * This file is part of the FreeType project, and may only be used, @@ -1470,6 +1470,7 @@ FT_ULong table_len; FT_ULong gvar_start; FT_ULong offsetToData; + FT_ULong offsets_len; GX_GVar_Head gvar_head; static const FT_Frame_Field gvar_fields[] = @@ -1530,9 +1531,13 @@ goto Exit; } - /* rough sanity check: offsets can be either 2 or 4 bytes */ - if ( (FT_ULong)gvar_head.glyphCount * - ( ( gvar_head.flags & 1 ) ? 4 : 2 ) > table_len ) + /* offsets can be either 2 or 4 bytes */ + /* (one more offset than glyphs, to mark size of last) */ + offsets_len = ( gvar_head.glyphCount + 1 ) * + ( ( gvar_head.flags & 1 ) ? 4L : 2L ); + + /* rough sanity check */ + if (offsets_len > table_len ) { FT_TRACE1(( "ft_var_load_gvar: invalid number of glyphs\n" )); error = FT_THROW( Invalid_Table ); @@ -1541,81 +1546,102 @@ FT_TRACE2(( "loaded\n" )); - blend->gvar_size = table_len; - blend->tuplecount = gvar_head.globalCoordCount; - blend->gv_glyphcnt = gvar_head.glyphCount; - offsetToData = gvar_start + gvar_head.offsetToData; + blend->gvar_size = table_len; + offsetToData = gvar_start + gvar_head.offsetToData; FT_TRACE5(( "gvar: there %s %d shared coordinate%s:\n", - blend->tuplecount == 1 ? "is" : "are", - blend->tuplecount, - blend->tuplecount == 1 ? "" : "s" )); + gvar_head.globalCoordCount == 1 ? "is" : "are", + gvar_head.globalCoordCount, + gvar_head.globalCoordCount == 1 ? "" : "s" )); - if ( FT_NEW_ARRAY( blend->glyphoffsets, blend->gv_glyphcnt + 1 ) ) + if ( FT_FRAME_ENTER( offsets_len ) ) goto Exit; + /* offsets (one more offset than glyphs, to mark size of last) */ + if ( FT_NEW_ARRAY( blend->glyphoffsets, gvar_head.glyphCount + 1 ) ) + goto Fail2; + if ( gvar_head.flags & 1 ) { - FT_ULong limit = gvar_start + table_len; + FT_ULong limit = gvar_start + table_len; + FT_ULong max_offset = 0; - /* long offsets (one more offset than glyphs, to mark size of last) */ - if ( FT_FRAME_ENTER( ( blend->gv_glyphcnt + 1 ) * 4L ) ) - goto Exit; - - for ( i = 0; i <= blend->gv_glyphcnt; i++ ) + for ( i = 0; i <= gvar_head.glyphCount; i++ ) { blend->glyphoffsets[i] = offsetToData + FT_GET_ULONG(); - /* use `>', not `>=' */ - if ( blend->glyphoffsets[i] > limit ) + + if ( max_offset <= blend->glyphoffsets[i] ) + max_offset = blend->glyphoffsets[i]; + else { FT_TRACE2(( "ft_var_load_gvar:" - " invalid glyph variation data offset for index %d\n", + " glyph variation data offset %d not monotonic\n", i )); - error = FT_THROW( Invalid_Table ); - break; + blend->glyphoffsets[i] = max_offset; + } + + /* use `<', not `<=' */ + if ( limit < blend->glyphoffsets[i] ) + { + FT_TRACE2(( "ft_var_load_gvar:" + " glyph variation data offset %d out of range\n", + i )); + blend->glyphoffsets[i] = limit; } } } else { - FT_ULong limit = gvar_start + table_len; - + FT_ULong limit = gvar_start + table_len; + FT_ULong max_offset = 0; - /* short offsets (one more offset than glyphs, to mark size of last) */ - if ( FT_FRAME_ENTER( ( blend->gv_glyphcnt + 1 ) * 2L ) ) - goto Exit; - for ( i = 0; i <= blend->gv_glyphcnt; i++ ) + for ( i = 0; i <= gvar_head.glyphCount; i++ ) { blend->glyphoffsets[i] = offsetToData + FT_GET_USHORT() * 2; - /* use `>', not `>=' */ - if ( blend->glyphoffsets[i] > limit ) + + if ( max_offset <= blend->glyphoffsets[i] ) + max_offset = blend->glyphoffsets[i]; + else { FT_TRACE2(( "ft_var_load_gvar:" - " invalid glyph variation data offset for index %d\n", + " glyph variation data offset %d not monotonic\n", i )); - error = FT_THROW( Invalid_Table ); - break; + blend->glyphoffsets[i] = max_offset; + } + + /* use `<', not `<=' */ + if ( limit < blend->glyphoffsets[i] ) + { + FT_TRACE2(( "ft_var_load_gvar:" + " glyph variation data offset %d out of range\n", + i )); + blend->glyphoffsets[i] = limit; } } } + blend->gv_glyphcnt = gvar_head.glyphCount; + FT_FRAME_EXIT(); - if ( error ) - goto Exit; - if ( blend->tuplecount != 0 ) + if ( gvar_head.globalCoordCount != 0 ) { - if ( FT_NEW_ARRAY( blend->tuplecoords, - gvar_head.axisCount * blend->tuplecount ) ) - goto Exit; + if ( FT_STREAM_SEEK( gvar_start + gvar_head.offsetToCoord ) || + FT_FRAME_ENTER( gvar_head.globalCoordCount * + gvar_head.axisCount * 2L ) ) + { + FT_TRACE2(( "ft_var_load_gvar:" + " glyph variation shared tuples missing\n" )); + goto Fail; + } - if ( FT_STREAM_SEEK( gvar_start + gvar_head.offsetToCoord ) || - FT_FRAME_ENTER( blend->tuplecount * gvar_head.axisCount * 2L ) ) - goto Exit; + if ( FT_NEW_ARRAY( blend->tuplecoords, + gvar_head.axisCount * gvar_head.globalCoordCount ) ) + goto Fail2; - for ( i = 0; i < blend->tuplecount; i++ ) + for ( i = 0; i < gvar_head.globalCoordCount; i++ ) { FT_TRACE5(( " [ " )); for ( j = 0; j < (FT_UInt)gvar_head.axisCount; j++ ) @@ -1628,6 +1654,8 @@ FT_TRACE5(( "]\n" )); } + blend->tuplecount = gvar_head.globalCoordCount; + FT_TRACE5(( "\n" )); FT_FRAME_EXIT(); @@ -1635,6 +1663,14 @@ Exit: return error; + + Fail2: + FT_FRAME_EXIT(); + + Fail: + FT_FREE( blend->glyphoffsets ); + blend->gv_glyphcnt = 0; + goto Exit; } @@ -2127,7 +2163,7 @@ /* `fvar' table validity check in `sfnt_init_face' */ /* the various `*_size' variables, which we also use as */ - /* offsets into the `mmlen' array, must be multiples of the */ + /* offsets into the `mmvar' array, must be multiples of the */ /* pointer size (except the last one); without such an */ /* alignment there might be runtime errors due to */ /* misaligned addresses */ @@ -3037,7 +3073,7 @@ TT_Set_Named_Instance( TT_Face face, FT_UInt instance_index ) { - FT_Error error = FT_ERR( Invalid_Argument ); + FT_Error error; GX_Blend blend; FT_MM_Var* mmvar; @@ -3057,7 +3093,10 @@ /* `instance_index' starts with value 1, thus `>' */ if ( instance_index > num_instances ) + { + error = FT_ERR( Invalid_Argument ); goto Exit; + } if ( instance_index > 0 ) { @@ -3766,7 +3805,7 @@ blend->glyphoffsets[glyph_index + 1] ) { FT_TRACE2(( "TT_Vary_Apply_Glyph_Deltas:" - " no variation data for this glyph\n" )); + " no variation data for glyph %d\n", glyph_index )); return FT_Err_Ok; } --- old/src/java.desktop/share/native/libfreetype/src/truetype/ttgxvar.h 2020-08-20 13:34:20.412208970 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/truetype/ttgxvar.h 2020-08-20 13:34:20.156208974 -0700 @@ -4,7 +4,7 @@ * * TrueType GX Font Variation loader (specification) * - * Copyright (C) 2004-2019 by + * Copyright (C) 2004-2020 by * David Turner, Robert Wilhelm, Werner Lemberg and George Williams. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/truetype/ttinterp.c 2020-08-20 13:34:21.164208958 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/truetype/ttinterp.c 2020-08-20 13:34:20.880208962 -0700 @@ -4,7 +4,7 @@ * * TrueType bytecode interpreter (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -3718,7 +3718,7 @@ /* We will then parse the current table. */ rec = exc->FDefs; - limit = rec + exc->numFDefs; + limit = FT_OFFSET( rec, exc->numFDefs ); n = (FT_ULong)args[0]; for ( ; rec < limit; rec++ ) @@ -3965,6 +3965,9 @@ if ( BOUNDSL( F, exc->maxFunc + 1 ) ) goto Fail; + if ( !exc->FDefs ) + goto Fail; + /* Except for some old Apple fonts, all functions in a TrueType */ /* font are defined in increasing order, starting from 0. This */ /* means that we normally have */ @@ -4062,7 +4065,7 @@ /* */ /* If this isn't true, we need to look up the function table. */ - def = exc->FDefs + F; + def = FT_OFFSET( exc->FDefs, F ); if ( exc->maxFunc + 1 != exc->numFDefs || def->opc != F ) { /* look up the FDefs table */ @@ -4070,7 +4073,7 @@ def = exc->FDefs; - limit = def + exc->numFDefs; + limit = FT_OFFSET( def, exc->numFDefs ); while ( def < limit && def->opc != F ) def++; @@ -4150,7 +4153,7 @@ /* First of all, look for the same function in our table */ def = exc->IDefs; - limit = def + exc->numIDefs; + limit = FT_OFFSET( def, exc->numIDefs ); for ( ; def < limit; def++ ) if ( def->opc == (FT_ULong)args[0] ) @@ -6346,12 +6349,14 @@ /* twilight points (confirmed by Greg Hitchcock) */ if ( exc->GS.gep1 == 0 ) { - exc->zp1.org[point].x = exc->zp0.org[exc->GS.rp0].x + - TT_MulFix14( cvt_dist, - exc->GS.freeVector.x ); - exc->zp1.org[point].y = exc->zp0.org[exc->GS.rp0].y + - TT_MulFix14( cvt_dist, - exc->GS.freeVector.y ); + exc->zp1.org[point].x = ADD_LONG( + exc->zp0.org[exc->GS.rp0].x, + TT_MulFix14( cvt_dist, + exc->GS.freeVector.x ) ); + exc->zp1.org[point].y = ADD_LONG( + exc->zp0.org[exc->GS.rp0].y, + TT_MulFix14( cvt_dist, + exc->GS.freeVector.y ) ); exc->zp1.cur[point] = exc->zp1.org[point]; } @@ -7715,7 +7720,7 @@ Ins_UNKNOWN( TT_ExecContext exc ) { TT_DefRecord* def = exc->IDefs; - TT_DefRecord* limit = def + exc->numIDefs; + TT_DefRecord* limit = FT_OFFSET( def, exc->numIDefs ); for ( ; def < limit; def++ ) @@ -7867,7 +7872,7 @@ FT_MAX( 50, exc->cvtSize / 10 ); else - exc->loopcall_counter_max = 300 + 8 * exc->cvtSize; + exc->loopcall_counter_max = 300 + 22 * exc->cvtSize; /* as a protection against an unreasonable number of CVT entries */ /* we assume at most 100 control values per glyph for the counter */ @@ -8567,7 +8572,7 @@ case FT_ERR( Invalid_Opcode ): { TT_DefRecord* def = exc->IDefs; - TT_DefRecord* limit = def + exc->numIDefs; + TT_DefRecord* limit = FT_OFFSET( def, exc->numIDefs ); for ( ; def < limit; def++ ) --- old/src/java.desktop/share/native/libfreetype/src/truetype/ttinterp.h 2020-08-20 13:34:21.944208945 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/truetype/ttinterp.h 2020-08-20 13:34:21.696208949 -0700 @@ -4,7 +4,7 @@ * * TrueType bytecode interpreter (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/truetype/ttobjs.c 2020-08-20 13:34:22.888208929 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/truetype/ttobjs.c 2020-08-20 13:34:22.628208933 -0700 @@ -4,7 +4,7 @@ * * Objects manager (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/truetype/ttobjs.h 2020-08-20 13:34:23.852208913 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/truetype/ttobjs.h 2020-08-20 13:34:23.580208918 -0700 @@ -4,7 +4,7 @@ * * Objects manager (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/truetype/ttpload.c 2020-08-20 13:34:24.632208900 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/truetype/ttpload.c 2020-08-20 13:34:24.344208905 -0700 @@ -4,7 +4,7 @@ * * TrueType-specific tables loader (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -633,7 +633,7 @@ FT_UInt nn; FT_Byte* result = NULL; FT_ULong record_size = face->hdmx_record_size; - FT_Byte* record = face->hdmx_table + 8; + FT_Byte* record = FT_OFFSET( face->hdmx_table, 8 ); for ( nn = 0; nn < face->hdmx_record_count; nn++ ) --- old/src/java.desktop/share/native/libfreetype/src/truetype/ttpload.h 2020-08-20 13:34:25.348208889 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/truetype/ttpload.h 2020-08-20 13:34:25.072208893 -0700 @@ -4,7 +4,7 @@ * * TrueType-specific tables loader (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/truetype/ttsubpix.c 2020-08-20 13:34:26.276208873 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/truetype/ttsubpix.c 2020-08-20 13:34:25.996208878 -0700 @@ -4,7 +4,7 @@ * * TrueType Subpixel Hinting. * - * Copyright (C) 2010-2019 by + * Copyright (C) 2010-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/truetype/ttsubpix.h 2020-08-20 13:34:27.172208859 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/truetype/ttsubpix.h 2020-08-20 13:34:26.884208863 -0700 @@ -4,7 +4,7 @@ * * TrueType Subpixel Hinting. * - * Copyright (C) 2010-2019 by + * Copyright (C) 2010-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/type1/t1afm.c 2020-08-20 13:34:28.148208842 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/type1/t1afm.c 2020-08-20 13:34:27.876208847 -0700 @@ -4,7 +4,7 @@ * * AFM support for Type 1 fonts (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/type1/t1afm.h 2020-08-20 13:34:29.080208827 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/type1/t1afm.h 2020-08-20 13:34:28.792208832 -0700 @@ -4,7 +4,7 @@ * * AFM support for Type 1 fonts (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/type1/t1driver.c 2020-08-20 13:34:29.992208812 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/type1/t1driver.c 2020-08-20 13:34:29.720208817 -0700 @@ -4,7 +4,7 @@ * * Type 1 driver interface (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/type1/t1driver.h 2020-08-20 13:34:30.936208797 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/type1/t1driver.h 2020-08-20 13:34:30.648208801 -0700 @@ -4,7 +4,7 @@ * * High-level Type 1 driver interface (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/type1/t1errors.h 2020-08-20 13:34:31.780208783 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/type1/t1errors.h 2020-08-20 13:34:31.536208787 -0700 @@ -4,7 +4,7 @@ * * Type 1 error codes (specification only). * - * Copyright (C) 2001-2019 by + * Copyright (C) 2001-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/type1/t1gload.c 2020-08-20 13:34:32.696208768 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/type1/t1gload.c 2020-08-20 13:34:32.416208772 -0700 @@ -4,7 +4,7 @@ * * Type 1 Glyph Loader (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/type1/t1gload.h 2020-08-20 13:34:33.604208753 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/type1/t1gload.h 2020-08-20 13:34:33.336208757 -0700 @@ -4,7 +4,7 @@ * * Type 1 Glyph Loader (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/type1/t1load.c 2020-08-20 13:34:34.364208740 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/type1/t1load.c 2020-08-20 13:34:34.096208744 -0700 @@ -4,7 +4,7 @@ * * Type 1 font loader (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -309,31 +309,55 @@ FT_UInt i; FT_Fixed axiscoords[T1_MAX_MM_AXIS]; PS_Blend blend = face->blend; + FT_UShort* axis_flags; + + FT_Offset mmvar_size; + FT_Offset axis_flags_size; + FT_Offset axis_size; error = T1_Get_Multi_Master( face, &mmaster ); if ( error ) goto Exit; - if ( FT_ALLOC( mmvar, - sizeof ( FT_MM_Var ) + - mmaster.num_axis * sizeof ( FT_Var_Axis ) ) ) + + /* the various `*_size' variables, which we also use as */ + /* offsets into the `mmvar' array, must be multiples of the */ + /* pointer size (except the last one); without such an */ + /* alignment there might be runtime errors due to */ + /* misaligned addresses */ +#undef ALIGN_SIZE +#define ALIGN_SIZE( n ) \ + ( ( (n) + sizeof (void*) - 1 ) & ~( sizeof (void*) - 1 ) ) + + mmvar_size = ALIGN_SIZE( sizeof ( FT_MM_Var ) ); + axis_flags_size = ALIGN_SIZE( mmaster.num_axis * + sizeof ( FT_UShort ) ); + axis_size = mmaster.num_axis * sizeof ( FT_Var_Axis ); + + if ( FT_ALLOC( mmvar, mmvar_size + + axis_flags_size + + axis_size ) ) goto Exit; mmvar->num_axis = mmaster.num_axis; mmvar->num_designs = mmaster.num_designs; mmvar->num_namedstyles = 0; /* Not supported */ - mmvar->axis = (FT_Var_Axis*)&mmvar[1]; - /* Point to axes after MM_Var struct */ - mmvar->namedstyle = NULL; + + /* while axis flags are meaningless here, we have to provide the array */ + /* to make `FT_Get_Var_Axis_Flags' work: the function expects that the */ + /* values directly follow the data of `FT_MM_Var' */ + axis_flags = (FT_UShort*)( (char*)mmvar + mmvar_size ); + for ( i = 0; i < mmaster.num_axis; i++ ) + axis_flags[i] = 0; + + mmvar->axis = (FT_Var_Axis*)( (char*)axis_flags + axis_flags_size ); + mmvar->namedstyle = NULL; for ( i = 0; i < mmaster.num_axis; i++ ) { mmvar->axis[i].name = mmaster.axis[i].name; mmvar->axis[i].minimum = INT_TO_FIXED( mmaster.axis[i].minimum ); mmvar->axis[i].maximum = INT_TO_FIXED( mmaster.axis[i].maximum ); - mmvar->axis[i].def = ( mmvar->axis[i].minimum + - mmvar->axis[i].maximum ) / 2; - /* Does not apply. But this value is in range */ mmvar->axis[i].strid = ~0U; /* Does not apply */ mmvar->axis[i].tag = ~0U; /* Does not apply */ --- old/src/java.desktop/share/native/libfreetype/src/type1/t1load.h 2020-08-20 13:34:35.084208728 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/type1/t1load.h 2020-08-20 13:34:34.824208732 -0700 @@ -4,7 +4,7 @@ * * Type 1 font loader (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/type1/t1objs.c 2020-08-20 13:34:36.048208712 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/type1/t1objs.c 2020-08-20 13:34:35.784208717 -0700 @@ -4,7 +4,7 @@ * * Type 1 objects manager (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/type1/t1objs.h 2020-08-20 13:34:36.928208698 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/type1/t1objs.h 2020-08-20 13:34:36.700208702 -0700 @@ -4,7 +4,7 @@ * * Type 1 objects manager (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/type1/t1parse.c 2020-08-20 13:34:37.840208683 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/type1/t1parse.c 2020-08-20 13:34:37.560208687 -0700 @@ -4,7 +4,7 @@ * * Type 1 parser (body). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/type1/t1parse.h 2020-08-20 13:34:38.740208668 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/type1/t1parse.h 2020-08-20 13:34:38.488208672 -0700 @@ -4,7 +4,7 @@ * * Type 1 parser (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- old/src/java.desktop/share/native/libfreetype/src/type1/t1tokens.h 2020-08-20 13:34:39.696208652 -0700 +++ new/src/java.desktop/share/native/libfreetype/src/type1/t1tokens.h 2020-08-20 13:34:39.424208657 -0700 @@ -4,7 +4,7 @@ * * Type 1 tokenizer (specification). * - * Copyright (C) 1996-2019 by + * Copyright (C) 1996-2020 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, --- /dev/null 2020-01-23 11:31:37.155195123 -0800 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff2.c 2020-08-20 13:34:40.144208645 -0700 @@ -0,0 +1,2328 @@ +/**************************************************************************** + * + * sfwoff2.c + * + * WOFF2 format management (base). + * + * Copyright (C) 2019-2020 by + * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg. + * + * 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. + * + */ + +#include +#include "sfwoff2.h" +#include "woff2tags.h" +#include FT_TRUETYPE_TAGS_H +#include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_STREAM_H + + +#ifdef FT_CONFIG_OPTION_USE_BROTLI + +#include + +#endif + + + /************************************************************************** + * + * The macro FT_COMPONENT is used in trace mode. It is an implicit + * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log + * messages during execution. + */ +#undef FT_COMPONENT +#define FT_COMPONENT sfwoff2 + + +#define READ_255USHORT( var ) FT_SET_ERROR( Read255UShort( stream, &var ) ) + +#define READ_BASE128( var ) FT_SET_ERROR( ReadBase128( stream, &var ) ) + +#define ROUND4( var ) ( ( var + 3 ) & ~3 ) + +#define WRITE_USHORT( p, v ) \ + do \ + { \ + *(p)++ = (FT_Byte)( (v) >> 8 ); \ + *(p)++ = (FT_Byte)( (v) >> 0 ); \ + \ + } while ( 0 ) + +#define WRITE_ULONG( p, v ) \ + do \ + { \ + *(p)++ = (FT_Byte)( (v) >> 24 ); \ + *(p)++ = (FT_Byte)( (v) >> 16 ); \ + *(p)++ = (FT_Byte)( (v) >> 8 ); \ + *(p)++ = (FT_Byte)( (v) >> 0 ); \ + \ + } while ( 0 ) + +#define WRITE_SHORT( p, v ) \ + do \ + { \ + *(p)++ = ( (v) >> 8 ); \ + *(p)++ = ( (v) >> 0 ); \ + \ + } while ( 0 ) + +#define WRITE_SFNT_BUF( buf, s ) \ + write_buf( &sfnt, sfnt_size, &dest_offset, buf, s, memory ) + +#define WRITE_SFNT_BUF_AT( offset, buf, s ) \ + write_buf( &sfnt, sfnt_size, &offset, buf, s, memory ) + +#define N_CONTOUR_STREAM 0 +#define N_POINTS_STREAM 1 +#define FLAG_STREAM 2 +#define GLYPH_STREAM 3 +#define COMPOSITE_STREAM 4 +#define BBOX_STREAM 5 +#define INSTRUCTION_STREAM 6 + + + static void + stream_close( FT_Stream stream ) + { + FT_Memory memory = stream->memory; + + + FT_FREE( stream->base ); + + stream->size = 0; + stream->base = NULL; + stream->close = NULL; + } + + + FT_CALLBACK_DEF( int ) + compare_tags( const void* a, + const void* b ) + { + WOFF2_Table table1 = *(WOFF2_Table*)a; + WOFF2_Table table2 = *(WOFF2_Table*)b; + + FT_ULong tag1 = table1->Tag; + FT_ULong tag2 = table2->Tag; + + + if ( tag1 > tag2 ) + return 1; + else if ( tag1 < tag2 ) + return -1; + else + return 0; + } + + + static FT_Error + Read255UShort( FT_Stream stream, + FT_UShort* value ) + { + static const FT_Int oneMoreByteCode1 = 255; + static const FT_Int oneMoreByteCode2 = 254; + static const FT_Int wordCode = 253; + static const FT_Int lowestUCode = 253; + + FT_Error error = FT_Err_Ok; + FT_Byte code; + FT_Byte result_byte = 0; + FT_UShort result_short = 0; + + + if ( FT_READ_BYTE( code ) ) + return error; + if ( code == wordCode ) + { + /* Read next two bytes and store `FT_UShort' value. */ + if ( FT_READ_USHORT( result_short ) ) + return error; + *value = result_short; + return FT_Err_Ok; + } + else if ( code == oneMoreByteCode1 ) + { + if ( FT_READ_BYTE( result_byte ) ) + return error; + *value = result_byte + lowestUCode; + return FT_Err_Ok; + } + else if ( code == oneMoreByteCode2 ) + { + if ( FT_READ_BYTE( result_byte ) ) + return error; + *value = result_byte + lowestUCode * 2; + return FT_Err_Ok; + } + else + { + *value = code; + return FT_Err_Ok; + } + } + + + static FT_Error + ReadBase128( FT_Stream stream, + FT_ULong* value ) + { + FT_ULong result = 0; + FT_Int i; + FT_Byte code; + FT_Error error = FT_Err_Ok; + + + for ( i = 0; i < 5; ++i ) + { + code = 0; + if ( FT_READ_BYTE( code ) ) + return error; + + /* Leading zeros are invalid. */ + if ( i == 0 && code == 0x80 ) + return FT_THROW( Invalid_Table ); + + /* If any of top seven bits are set then we're about to overflow. */ + if ( result & 0xfe000000 ) + return FT_THROW( Invalid_Table ); + + result = ( result << 7 ) | ( code & 0x7f ); + + /* Spin until most significant bit of data byte is false. */ + if ( ( code & 0x80 ) == 0 ) + { + *value = result; + return FT_Err_Ok; + } + } + + /* Make sure not to exceed the size bound. */ + return FT_THROW( Invalid_Table ); + } + + + /* Extend memory of `dst_bytes' buffer and copy data from `src'. */ + static FT_Error + write_buf( FT_Byte** dst_bytes, + FT_ULong* dst_size, + FT_ULong* offset, + FT_Byte* src, + FT_ULong size, + FT_Memory memory ) + { + FT_Error error = FT_Err_Ok; + /* We are reallocating memory for `dst', so its pointer may change. */ + FT_Byte* dst = *dst_bytes; + + + /* Check whether we are within limits. */ + if ( ( *offset + size ) > WOFF2_DEFAULT_MAX_SIZE ) + return FT_THROW( Array_Too_Large ); + + /* Reallocate `dst'. */ + if ( ( *offset + size ) > *dst_size ) + { + FT_TRACE6(( "Reallocating %lu to %lu.\n", + *dst_size, (*offset + size) )); + if ( FT_REALLOC( dst, + (FT_ULong)( *dst_size ), + (FT_ULong)( *offset + size ) ) ) + goto Exit; + + *dst_size = *offset + size; + } + + /* Copy data. */ + ft_memcpy( dst + *offset, src, size ); + + *offset += size; + /* Set pointer of `dst' to its correct value. */ + *dst_bytes = dst; + + Exit: + return error; + } + + + /* Pad buffer to closest multiple of 4. */ + static FT_Error + pad4( FT_Byte** sfnt_bytes, + FT_ULong* sfnt_size, + FT_ULong* out_offset, + FT_Memory memory ) + { + FT_Byte* sfnt = *sfnt_bytes; + FT_ULong dest_offset = *out_offset; + + FT_Byte zeroes[] = { 0, 0, 0 }; + FT_ULong pad_bytes; + + + if ( dest_offset + 3 < dest_offset ) + return FT_THROW( Invalid_Table ); + + pad_bytes = ROUND4( dest_offset ) - dest_offset; + if ( pad_bytes > 0 ) + { + if ( WRITE_SFNT_BUF( &zeroes[0], pad_bytes ) ) + return FT_THROW( Invalid_Table ); + } + + *sfnt_bytes = sfnt; + *out_offset = dest_offset; + return FT_Err_Ok; + } + + + /* Calculate table checksum of `buf'. */ + static FT_Long + compute_ULong_sum( FT_Byte* buf, + FT_ULong size ) + { + FT_ULong checksum = 0; + FT_ULong aligned_size = size & ~3; + FT_ULong i; + FT_ULong v; + + + for ( i = 0; i < aligned_size; i += 4 ) + checksum += ( (FT_ULong)buf[i ] << 24 ) | + ( (FT_ULong)buf[i + 1] << 16 ) | + ( (FT_ULong)buf[i + 2] << 8 ) | + ( (FT_ULong)buf[i + 3] << 0 ); + + /* If size is not aligned to 4, treat as if it is padded with 0s. */ + if ( size != aligned_size ) + { + v = 0; + for ( i = aligned_size ; i < size; ++i ) + v |= (FT_ULong)buf[i] << ( 24 - 8 * ( i & 3 ) ); + checksum += v; + } + + return checksum; + } + + + static FT_Error + woff2_decompress( FT_Byte* dst, + FT_ULong dst_size, + const FT_Byte* src, + FT_ULong src_size ) + { +#ifdef FT_CONFIG_OPTION_USE_BROTLI + + FT_ULong uncompressed_size = dst_size; + BrotliDecoderResult result; + + + result = BrotliDecoderDecompress( src_size, + src, + &uncompressed_size, + dst ); + + if ( result != BROTLI_DECODER_RESULT_SUCCESS || + uncompressed_size != dst_size ) + { + FT_ERROR(( "woff2_decompress: Stream length mismatch.\n" )); + return FT_THROW( Invalid_Table ); + } + + FT_TRACE2(( "woff2_decompress: Brotli stream decompressed.\n" )); + return FT_Err_Ok; + +#else /* !FT_CONFIG_OPTION_USE_BROTLI */ + + FT_ERROR(( "woff2_decompress: Brotli support not available.\n" )); + return FT_THROW( Unimplemented_Feature ); + +#endif /* !FT_CONFIG_OPTION_USE_BROTLI */ + } + + + static WOFF2_Table + find_table( WOFF2_Table* tables, + FT_UShort num_tables, + FT_ULong tag ) + { + FT_Int i; + + + for ( i = 0; i < num_tables; i++ ) + { + if ( tables[i]->Tag == tag ) + return tables[i]; + } + return NULL; + } + + + /* Read `numberOfHMetrics' field from `hhea' table. */ + static FT_Error + read_num_hmetrics( FT_Stream stream, + FT_UShort* num_hmetrics ) + { + FT_Error error = FT_Err_Ok; + FT_UShort num_metrics; + + + if ( FT_STREAM_SKIP( 34 ) ) + return FT_THROW( Invalid_Table ); + + if ( FT_READ_USHORT( num_metrics ) ) + return FT_THROW( Invalid_Table ); + + *num_hmetrics = num_metrics; + + return error; + } + + + /* An auxiliary function for overflow-safe addition. */ + static FT_Int + with_sign( FT_Byte flag, + FT_Int base_val ) + { + /* Precondition: 0 <= base_val < 65536 (to avoid overflow). */ + return ( flag & 1 ) ? base_val : -base_val; + } + + + /* An auxiliary function for overflow-safe addition. */ + static FT_Int + safe_int_addition( FT_Int a, + FT_Int b, + FT_Int* result ) + { + if ( ( ( a > 0 ) && ( b > FT_INT_MAX - a ) ) || + ( ( a < 0 ) && ( b < FT_INT_MIN - a ) ) ) + return FT_THROW( Invalid_Table ); + + *result = a + b; + return FT_Err_Ok; + } + + + /* + * Decode variable-length (flag, xCoordinate, yCoordinate) triplet for a + * simple glyph. See + * + * https://www.w3.org/TR/WOFF2/#triplet_decoding + */ + static FT_Error + triplet_decode( const FT_Byte* flags_in, + const FT_Byte* in, + FT_ULong in_size, + FT_ULong n_points, + WOFF2_Point result, + FT_ULong* in_bytes_used ) + { + FT_Int x = 0; + FT_Int y = 0; + FT_Int dx; + FT_Int dy; + FT_Int b0, b1, b2; + + FT_ULong triplet_index = 0; + FT_ULong data_bytes; + + FT_UInt i; + + + if ( n_points > in_size ) + return FT_THROW( Invalid_Table ); + + for ( i = 0; i < n_points; ++i ) + { + FT_Byte flag = flags_in[i]; + FT_Bool on_curve = !( flag >> 7 ); + + + flag &= 0x7f; + if ( flag < 84 ) + data_bytes = 1; + else if ( flag < 120 ) + data_bytes = 2; + else if ( flag < 124 ) + data_bytes = 3; + else + data_bytes = 4; + + /* Overflow checks */ + if ( triplet_index + data_bytes > in_size || + triplet_index + data_bytes < triplet_index ) + return FT_THROW( Invalid_Table ); + + if ( flag < 10 ) + { + dx = 0; + dy = with_sign( flag, + ( ( flag & 14 ) << 7 ) + in[triplet_index] ); + } + else if ( flag < 20 ) + { + dx = with_sign( flag, + ( ( ( flag - 10 ) & 14 ) << 7 ) + + in[triplet_index] ); + dy = 0; + } + else if ( flag < 84 ) + { + b0 = flag - 20; + b1 = in[triplet_index]; + dx = with_sign( flag, + 1 + ( b0 & 0x30 ) + ( b1 >> 4 ) ); + dy = with_sign( flag >> 1, + 1 + ( ( b0 & 0x0c ) << 2 ) + ( b1 & 0x0f ) ); + } + else if ( flag < 120 ) + { + b0 = flag - 84; + dx = with_sign( flag, + 1 + ( ( b0 / 12 ) << 8 ) + in[triplet_index] ); + dy = with_sign( flag >> 1, + 1 + ( ( ( b0 % 12 ) >> 2 ) << 8 ) + + in[triplet_index + 1] ); + } + else if ( flag < 124 ) + { + b2 = in[triplet_index + 1]; + dx = with_sign( flag, + ( in[triplet_index] << 4 ) + ( b2 >> 4 ) ); + dy = with_sign( flag >> 1, + ( ( b2 & 0x0f ) << 8 ) + in[triplet_index + 2] ); + } + else + { + dx = with_sign( flag, + ( in[triplet_index] << 8 ) + + in[triplet_index + 1] ); + dy = with_sign( flag >> 1, + ( in[triplet_index + 2] << 8 ) + + in[triplet_index + 3] ); + } + + triplet_index += data_bytes; + + if ( safe_int_addition( x, dx, &x ) ) + return FT_THROW( Invalid_Table ); + + if ( safe_int_addition( y, dy, &y ) ) + return FT_THROW( Invalid_Table ); + + result[i].x = x; + result[i].y = y; + result[i].on_curve = on_curve; + } + + *in_bytes_used = triplet_index; + return FT_Err_Ok; + } + + + /* Store decoded points in glyph buffer. */ + static FT_Error + store_points( FT_ULong n_points, + const WOFF2_Point points, + FT_UShort n_contours, + FT_UShort instruction_len, + FT_Byte* dst, + FT_ULong dst_size, + FT_ULong* glyph_size ) + { + FT_UInt flag_offset = 10 + ( 2 * n_contours ) + 2 + instruction_len; + FT_Int last_flag = -1; + FT_Int repeat_count = 0; + FT_Int last_x = 0; + FT_Int last_y = 0; + FT_UInt x_bytes = 0; + FT_UInt y_bytes = 0; + FT_UInt xy_bytes; + FT_UInt i; + FT_UInt x_offset; + FT_UInt y_offset; + FT_Byte* pointer; + + + for ( i = 0; i < n_points; ++i ) + { + const WOFF2_PointRec point = points[i]; + + FT_Int flag = point.on_curve ? GLYF_ON_CURVE : 0; + FT_Int dx = point.x - last_x; + FT_Int dy = point.y - last_y; + + + if ( dx == 0 ) + flag |= GLYF_THIS_X_IS_SAME; + else if ( dx > -256 && dx < 256 ) + { + flag |= GLYF_X_SHORT | ( dx > 0 ? GLYF_THIS_X_IS_SAME : 0 ); + x_bytes += 1; + } + else + x_bytes += 2; + + if ( dy == 0 ) + flag |= GLYF_THIS_Y_IS_SAME; + else if ( dy > -256 && dy < 256 ) + { + flag |= GLYF_Y_SHORT | ( dy > 0 ? GLYF_THIS_Y_IS_SAME : 0 ); + y_bytes += 1; + } + else + y_bytes += 2; + + if ( flag == last_flag && repeat_count != 255 ) + { + dst[flag_offset - 1] |= GLYF_REPEAT; + repeat_count++; + } + else + { + if ( repeat_count != 0 ) + { + if ( flag_offset >= dst_size ) + return FT_THROW( Invalid_Table ); + + dst[flag_offset++] = repeat_count; + } + if ( flag_offset >= dst_size ) + return FT_THROW( Invalid_Table ); + + dst[flag_offset++] = flag; + repeat_count = 0; + } + + last_x = point.x; + last_y = point.y; + last_flag = flag; + } + + if ( repeat_count != 0 ) + { + if ( flag_offset >= dst_size ) + return FT_THROW( Invalid_Table ); + + dst[flag_offset++] = repeat_count; + } + + xy_bytes = x_bytes + y_bytes; + if ( xy_bytes < x_bytes || + flag_offset + xy_bytes < flag_offset || + flag_offset + xy_bytes > dst_size ) + return FT_THROW( Invalid_Table ); + + x_offset = flag_offset; + y_offset = flag_offset + x_bytes; + last_x = 0; + last_y = 0; + + for ( i = 0; i < n_points; ++i ) + { + FT_Int dx = points[i].x - last_x; + FT_Int dy = points[i].y - last_y; + + + if ( dx == 0 ) + ; + else if ( dx > -256 && dx < 256 ) + dst[x_offset++] = FT_ABS( dx ); + else + { + pointer = dst + x_offset; + WRITE_SHORT( pointer, dx ); + x_offset += 2; + } + + last_x += dx; + + if ( dy == 0 ) + ; + else if ( dy > -256 && dy < 256 ) + dst[y_offset++] = FT_ABS( dy ); + else + { + pointer = dst + y_offset; + WRITE_SHORT( pointer, dy ); + y_offset += 2; + } + + last_y += dy; + } + + *glyph_size = y_offset; + return FT_Err_Ok; + } + + + static void + compute_bbox( FT_ULong n_points, + const WOFF2_Point points, + FT_Byte* dst, + FT_UShort* src_x_min ) + { + FT_Int x_min = 0; + FT_Int y_min = 0; + FT_Int x_max = 0; + FT_Int y_max = 0; + + FT_UInt i; + + FT_ULong offset; + FT_Byte* pointer; + + + if ( n_points > 0 ) + { + x_min = points[0].x; + y_min = points[0].y; + x_max = points[0].x; + y_max = points[0].y; + } + + for ( i = 1; i < n_points; ++i ) + { + FT_Int x = points[i].x; + FT_Int y = points[i].y; + + + x_min = FT_MIN( x, x_min ); + y_min = FT_MIN( y, y_min ); + x_max = FT_MAX( x, x_max ); + y_max = FT_MAX( y, y_max ); + } + + /* Write values to `glyf' record. */ + offset = 2; + pointer = dst + offset; + + WRITE_SHORT( pointer, x_min ); + WRITE_SHORT( pointer, y_min ); + WRITE_SHORT( pointer, x_max ); + WRITE_SHORT( pointer, y_max ); + + *src_x_min = (FT_UShort)x_min; + } + + + static FT_Error + compositeGlyph_size( FT_Stream stream, + FT_ULong offset, + FT_ULong* size, + FT_Bool* have_instructions ) + { + FT_Error error = FT_Err_Ok; + FT_ULong start_offset = offset; + FT_Bool we_have_inst = FALSE; + FT_UShort flags = FLAG_MORE_COMPONENTS; + + + if ( FT_STREAM_SEEK( start_offset ) ) + goto Exit; + while ( flags & FLAG_MORE_COMPONENTS ) + { + FT_ULong arg_size; + + + if ( FT_READ_USHORT( flags ) ) + goto Exit; + we_have_inst |= ( flags & FLAG_WE_HAVE_INSTRUCTIONS ) != 0; + /* glyph index */ + arg_size = 2; + if ( flags & FLAG_ARG_1_AND_2_ARE_WORDS ) + arg_size += 4; + else + arg_size += 2; + + if ( flags & FLAG_WE_HAVE_A_SCALE ) + arg_size += 2; + else if ( flags & FLAG_WE_HAVE_AN_X_AND_Y_SCALE ) + arg_size += 4; + else if ( flags & FLAG_WE_HAVE_A_TWO_BY_TWO ) + arg_size += 8; + + if ( FT_STREAM_SKIP( arg_size ) ) + goto Exit; + } + + *size = FT_STREAM_POS() - start_offset; + *have_instructions = we_have_inst; + + Exit: + return error; + } + + + /* Store loca values (provided by `reconstruct_glyf') to output stream. */ + static FT_Error + store_loca( FT_ULong* loca_values, + FT_ULong loca_values_size, + FT_UShort index_format, + FT_ULong* checksum, + FT_Byte** sfnt_bytes, + FT_ULong* sfnt_size, + FT_ULong* out_offset, + FT_Memory memory ) + { + FT_Error error = FT_Err_Ok; + FT_Byte* sfnt = *sfnt_bytes; + FT_ULong dest_offset = *out_offset; + + FT_Byte* loca_buf = NULL; + FT_Byte* dst = NULL; + + FT_UInt i = 0; + FT_ULong loca_buf_size; + + const FT_ULong offset_size = index_format ? 4 : 2; + + + if ( ( loca_values_size << 2 ) >> 2 != loca_values_size ) + goto Fail; + + loca_buf_size = loca_values_size * offset_size; + if ( FT_NEW_ARRAY( loca_buf, loca_buf_size ) ) + goto Fail; + + dst = loca_buf; + for ( i = 0; i < loca_values_size; i++ ) + { + FT_ULong value = loca_values[i]; + + + if ( index_format ) + WRITE_ULONG( dst, value ); + else + WRITE_USHORT( dst, ( value >> 1 ) ); + } + + *checksum = compute_ULong_sum( loca_buf, loca_buf_size ); + /* Write `loca' table to sfnt buffer. */ + if ( WRITE_SFNT_BUF( loca_buf, loca_buf_size ) ) + goto Fail; + + /* Set pointer `sfnt_bytes' to its correct value. */ + *sfnt_bytes = sfnt; + *out_offset = dest_offset; + + FT_FREE( loca_buf ); + return error; + + Fail: + if ( !error ) + error = FT_THROW( Invalid_Table ); + + FT_FREE( loca_buf ); + + return error; + } + + + static FT_Error + reconstruct_glyf( FT_Stream stream, + FT_ULong* glyf_checksum, + FT_ULong* loca_checksum, + FT_Byte** sfnt_bytes, + FT_ULong* sfnt_size, + FT_ULong* out_offset, + WOFF2_Info info, + FT_Memory memory ) + { + FT_Error error = FT_Err_Ok; + FT_Byte* sfnt = *sfnt_bytes; + + /* current position in stream */ + const FT_ULong pos = FT_STREAM_POS(); + + FT_UInt num_substreams = 7; + + 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; + + const FT_ULong glyf_start = *out_offset; + FT_ULong dest_offset = *out_offset; + + WOFF2_Substream substreams = NULL; + + FT_ULong* loca_values = NULL; + FT_UShort* n_points_arr = NULL; + FT_Byte* glyph_buf = NULL; + WOFF2_Point points = NULL; + + + if ( FT_NEW_ARRAY( substreams, num_substreams ) ) + goto Fail; + + 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(( "num_glyphs = %u; index_format = %u\n", + num_glyphs, index_format )); + + info->num_glyphs = num_glyphs; + + /* Calculate expected length of loca and compare. */ + /* See https://www.w3.org/TR/WOFF2/#conform-mustRejectLoca */ + /* index_format = 0 => Short version `loca'. */ + /* index_format = 1 => Long version `loca'. */ + expected_loca_length = ( index_format ? 4 : 2 ) * + ( (FT_ULong)num_glyphs + 1 ); + if ( info->loca_table->dst_length != expected_loca_length ) + goto Fail; + + offset = ( 2 + num_substreams ) * 4; + if ( offset > info->glyf_table->TransformLength ) + goto Fail; + + for ( i = 0; i < num_substreams; ++i ) + { + FT_ULong substream_size; + + + if ( FT_READ_ULONG( substream_size ) ) + goto Fail; + if ( substream_size > info->glyf_table->TransformLength - offset ) + goto Fail; + + substreams[i].start = pos + offset; + substreams[i].offset = pos + offset; + substreams[i].size = substream_size; + + FT_TRACE5(( " Substream %d: offset = %lu; size = %lu;\n", + i, substreams[i].offset, substreams[i].size )); + offset += substream_size; + } + + if ( FT_NEW_ARRAY( loca_values, num_glyphs + 1 ) ) + goto Fail; + + points_size = 0; + bbox_bitmap_offset = substreams[BBOX_STREAM].offset; + + /* Size of bboxBitmap = 4 * floor((numGlyphs + 31) / 32) */ + bitmap_length = ( ( num_glyphs + 31 ) >> 5 ) << 2; + substreams[BBOX_STREAM].offset += bitmap_length; + + glyph_buf_size = WOFF2_DEFAULT_GLYPH_BUF; + if ( FT_NEW_ARRAY( glyph_buf, glyph_buf_size ) ) + goto Fail; + + if ( FT_NEW_ARRAY( info->x_mins, num_glyphs ) ) + goto Fail; + + for ( i = 0; i < num_glyphs; ++i ) + { + FT_ULong glyph_size = 0; + FT_UShort n_contours = 0; + FT_Bool have_bbox = FALSE; + FT_Byte bbox_bitmap; + FT_ULong bbox_offset; + FT_UShort x_min = 0; + + + /* Set `have_bbox'. */ + bbox_offset = bbox_bitmap_offset + ( i >> 3 ); + if ( FT_STREAM_SEEK( bbox_offset ) || + FT_READ_BYTE( bbox_bitmap ) ) + goto Fail; + if ( bbox_bitmap & ( 0x80 >> ( i & 7 ) ) ) + have_bbox = TRUE; + + /* Read value from `nContourStream'. */ + if ( FT_STREAM_SEEK( substreams[N_CONTOUR_STREAM].offset ) || + FT_READ_USHORT( n_contours ) ) + goto Fail; + substreams[N_CONTOUR_STREAM].offset += 2; + + if ( n_contours == 0xffff ) + { + /* composite glyph */ + FT_Bool have_instructions = FALSE; + FT_UShort instruction_size = 0; + FT_ULong composite_size; + FT_ULong size_needed; + FT_Byte* pointer = NULL; + + + /* Composite glyphs must have explicit bbox. */ + if ( !have_bbox ) + goto Fail; + + if ( compositeGlyph_size( stream, + substreams[COMPOSITE_STREAM].offset, + &composite_size, + &have_instructions) ) + goto Fail; + + if ( have_instructions ) + { + if ( FT_STREAM_SEEK( substreams[GLYPH_STREAM].offset ) || + READ_255USHORT( instruction_size ) ) + goto Fail; + substreams[GLYPH_STREAM].offset = FT_STREAM_POS(); + } + + size_needed = 12 + composite_size + instruction_size; + if ( glyph_buf_size < size_needed ) + { + if ( FT_RENEW_ARRAY( glyph_buf, glyph_buf_size, size_needed ) ) + goto Fail; + glyph_buf_size = size_needed; + } + + pointer = glyph_buf + glyph_size; + WRITE_USHORT( pointer, n_contours ); + glyph_size += 2; + + /* Read x_min for current glyph. */ + if ( FT_STREAM_SEEK( substreams[BBOX_STREAM].offset ) || + FT_READ_USHORT( x_min ) ) + goto Fail; + /* No increment here because we read again. */ + + if ( FT_STREAM_SEEK( substreams[BBOX_STREAM].offset ) || + FT_STREAM_READ( glyph_buf + glyph_size, 8 ) ) + goto Fail; + + substreams[BBOX_STREAM].offset += 8; + glyph_size += 8; + + if ( FT_STREAM_SEEK( substreams[COMPOSITE_STREAM].offset ) || + FT_STREAM_READ( glyph_buf + glyph_size, composite_size ) ) + goto Fail; + + substreams[COMPOSITE_STREAM].offset += composite_size; + glyph_size += composite_size; + + if ( have_instructions ) + { + pointer = glyph_buf + glyph_size; + WRITE_USHORT( pointer, instruction_size ); + glyph_size += 2; + + if ( FT_STREAM_SEEK( substreams[INSTRUCTION_STREAM].offset ) || + FT_STREAM_READ( glyph_buf + glyph_size, instruction_size ) ) + goto Fail; + + substreams[INSTRUCTION_STREAM].offset += instruction_size; + glyph_size += instruction_size; + } + } + else if ( n_contours > 0 ) + { + /* simple glyph */ + FT_ULong total_n_points = 0; + FT_UShort n_points_contour; + FT_UInt j; + FT_ULong flag_size; + FT_ULong triplet_size; + FT_ULong triplet_bytes_used; + FT_Byte* flags_buf = NULL; + FT_Byte* triplet_buf = NULL; + FT_UShort instruction_size; + FT_ULong size_needed; + FT_Int end_point; + FT_UInt contour_ix; + + FT_Byte* pointer = NULL; + + + if ( FT_NEW_ARRAY( n_points_arr, n_contours ) ) + goto Fail; + + if ( FT_STREAM_SEEK( substreams[N_POINTS_STREAM].offset ) ) + goto Fail; + + for ( j = 0; j < n_contours; ++j ) + { + if ( READ_255USHORT( n_points_contour ) ) + goto Fail; + n_points_arr[j] = n_points_contour; + /* Prevent negative/overflow. */ + if ( total_n_points + n_points_contour < total_n_points ) + goto Fail; + total_n_points += n_points_contour; + } + substreams[N_POINTS_STREAM].offset = FT_STREAM_POS(); + + flag_size = total_n_points; + if ( flag_size > substreams[FLAG_STREAM].size ) + goto Fail; + + flags_buf = stream->base + substreams[FLAG_STREAM].offset; + triplet_buf = stream->base + substreams[GLYPH_STREAM].offset; + + if ( substreams[GLYPH_STREAM].size < + ( substreams[GLYPH_STREAM].offset - + substreams[GLYPH_STREAM].start ) ) + goto Fail; + + triplet_size = substreams[GLYPH_STREAM].size - + ( substreams[GLYPH_STREAM].offset - + substreams[GLYPH_STREAM].start ); + triplet_bytes_used = 0; + + /* Create array to store point information. */ + points_size = total_n_points; + if ( FT_NEW_ARRAY( points, points_size ) ) + goto Fail; + + if ( triplet_decode( flags_buf, + triplet_buf, + triplet_size, + total_n_points, + points, + &triplet_bytes_used ) ) + goto Fail; + + substreams[FLAG_STREAM].offset += flag_size; + substreams[GLYPH_STREAM].offset += triplet_bytes_used; + + if ( FT_STREAM_SEEK( substreams[GLYPH_STREAM].offset ) || + READ_255USHORT( instruction_size ) ) + goto Fail; + + substreams[GLYPH_STREAM].offset = FT_STREAM_POS(); + + if ( total_n_points >= ( 1 << 27 ) ) + goto Fail; + + size_needed = 12 + + ( 2 * n_contours ) + + ( 5 * total_n_points ) + + instruction_size; + if ( glyph_buf_size < size_needed ) + { + if ( FT_RENEW_ARRAY( glyph_buf, glyph_buf_size, size_needed ) ) + goto Fail; + glyph_buf_size = size_needed; + } + + pointer = glyph_buf + glyph_size; + WRITE_USHORT( pointer, n_contours ); + glyph_size += 2; + + if ( have_bbox ) + { + /* Read x_min for current glyph. */ + if ( FT_STREAM_SEEK( substreams[BBOX_STREAM].offset ) || + FT_READ_USHORT( x_min ) ) + goto Fail; + /* No increment here because we read again. */ + + if ( FT_STREAM_SEEK( substreams[BBOX_STREAM].offset ) || + FT_STREAM_READ( glyph_buf + glyph_size, 8 ) ) + goto Fail; + substreams[BBOX_STREAM].offset += 8; + } + else + compute_bbox( total_n_points, points, glyph_buf, &x_min ); + + glyph_size = CONTOUR_OFFSET_END_POINT; + + pointer = glyph_buf + glyph_size; + end_point = -1; + + for ( contour_ix = 0; contour_ix < n_contours; ++contour_ix ) + { + end_point += n_points_arr[contour_ix]; + if ( end_point >= 65536 ) + goto Fail; + + WRITE_SHORT( pointer, end_point ); + glyph_size += 2; + } + + WRITE_USHORT( pointer, instruction_size ); + glyph_size += 2; + + if ( FT_STREAM_SEEK( substreams[INSTRUCTION_STREAM].offset ) || + FT_STREAM_READ( glyph_buf + glyph_size, instruction_size ) ) + goto Fail; + + substreams[INSTRUCTION_STREAM].offset += instruction_size; + glyph_size += instruction_size; + + if ( store_points( total_n_points, + points, + n_contours, + instruction_size, + glyph_buf, + glyph_buf_size, + &glyph_size ) ) + goto Fail; + + FT_FREE( points ); + FT_FREE( n_points_arr ); + } + else + { + /* Empty glyph. */ + /* Must not have a bbox. */ + if ( have_bbox ) + { + FT_ERROR(( "Empty glyph has a bbox.\n" )); + goto Fail; + } + } + + loca_values[i] = dest_offset - glyf_start; + + if ( WRITE_SFNT_BUF( glyph_buf, glyph_size ) ) + goto Fail; + + if ( pad4( &sfnt, sfnt_size, &dest_offset, memory ) ) + goto Fail; + + *glyf_checksum += compute_ULong_sum( glyph_buf, glyph_size ); + + /* Store x_mins, may be required to reconstruct `hmtx'. */ + if ( n_contours > 0 ) + info->x_mins[i] = x_min; + } + + info->glyf_table->dst_length = dest_offset - info->glyf_table->dst_offset; + info->loca_table->dst_offset = dest_offset; + + /* `loca[n]' will be equal to the length of the `glyf' table. */ + loca_values[num_glyphs] = info->glyf_table->dst_length; + + if ( store_loca( loca_values, + num_glyphs + 1, + index_format, + loca_checksum, + &sfnt, + sfnt_size, + &dest_offset, + memory ) ) + goto Fail; + + info->loca_table->dst_length = dest_offset - info->loca_table->dst_offset; + + FT_TRACE4(( " loca table info:\n" )); + FT_TRACE4(( " dst_offset = %lu\n", info->loca_table->dst_offset )); + FT_TRACE4(( " dst_length = %lu\n", info->loca_table->dst_length )); + FT_TRACE4(( " checksum = %09x\n", *loca_checksum )); + + /* Set pointer `sfnt_bytes' to its correct value. */ + *sfnt_bytes = sfnt; + *out_offset = dest_offset; + + FT_FREE( substreams ); + FT_FREE( loca_values ); + FT_FREE( n_points_arr ); + FT_FREE( glyph_buf ); + FT_FREE( points ); + + return error; + + Fail: + if ( !error ) + error = FT_THROW( Invalid_Table ); + + /* Set pointer `sfnt_bytes' to its correct value. */ + *sfnt_bytes = sfnt; + + FT_FREE( substreams ); + FT_FREE( loca_values ); + FT_FREE( n_points_arr ); + FT_FREE( glyph_buf ); + FT_FREE( points ); + + return error; + } + + + /* Get `x_mins' for untransformed `glyf' table. */ + static FT_Error + get_x_mins( FT_Stream stream, + WOFF2_Table* tables, + FT_UShort num_tables, + WOFF2_Info info, + FT_Memory memory ) + { + FT_UShort num_glyphs; + FT_UShort index_format; + FT_ULong glyf_offset; + FT_UShort glyf_offset_short; + FT_ULong loca_offset; + FT_Int i; + FT_Error error = FT_Err_Ok; + FT_ULong offset_size; + + /* At this point of time those tables might not have been read yet. */ + const WOFF2_Table maxp_table = find_table( tables, num_tables, + TTAG_maxp ); + const WOFF2_Table head_table = find_table( tables, num_tables, + TTAG_head ); + + + if ( !maxp_table ) + { + FT_ERROR(( "`maxp' table is missing.\n" )); + return FT_THROW( Invalid_Table ); + } + + if ( !head_table ) + { + FT_ERROR(( "`head' table is missing.\n" )); + return FT_THROW( Invalid_Table ); + } + + /* Read `numGlyphs' field from `maxp' table. */ + if ( FT_STREAM_SEEK( maxp_table->src_offset ) || FT_STREAM_SKIP( 8 ) ) + return error; + + if ( FT_READ_USHORT( num_glyphs ) ) + return error; + + info->num_glyphs = num_glyphs; + + /* Read `indexToLocFormat' field from `head' table. */ + if ( FT_STREAM_SEEK( head_table->src_offset ) || + FT_STREAM_SKIP( 50 ) ) + return error; + + if ( FT_READ_USHORT( index_format ) ) + return error; + + offset_size = index_format ? 4 : 2; + + /* Create `x_mins' array. */ + if ( FT_NEW_ARRAY( info->x_mins, num_glyphs ) ) + return error; + + loca_offset = info->loca_table->src_offset; + + for ( i = 0; i < num_glyphs; ++i ) + { + if ( FT_STREAM_SEEK( loca_offset ) ) + return error; + + loca_offset += offset_size; + + if ( index_format ) + { + if ( FT_READ_ULONG( glyf_offset ) ) + return error; + } + else + { + if ( FT_READ_USHORT( glyf_offset_short ) ) + return error; + + glyf_offset = (FT_ULong)( glyf_offset_short ); + glyf_offset = glyf_offset << 1; + } + + glyf_offset += info->glyf_table->src_offset; + + if ( FT_STREAM_SEEK( glyf_offset ) || FT_STREAM_SKIP( 2 ) ) + return error; + + if ( FT_READ_USHORT( info->x_mins[i] ) ) + return error; + } + + return error; + } + + + static FT_Error + reconstruct_hmtx( FT_Stream stream, + FT_UShort num_glyphs, + FT_UShort num_hmetrics, + FT_Short* x_mins, + FT_ULong* checksum, + FT_Byte** sfnt_bytes, + FT_ULong* sfnt_size, + FT_ULong* out_offset, + FT_Memory memory ) + { + FT_Error error = FT_Err_Ok; + FT_Byte* sfnt = *sfnt_bytes; + FT_ULong dest_offset = *out_offset; + + FT_Byte hmtx_flags; + FT_Bool has_proportional_lsbs, has_monospace_lsbs; + FT_ULong hmtx_table_size; + FT_Int i; + + FT_UShort* advance_widths = NULL; + FT_Short* lsbs = NULL; + FT_Byte* hmtx_table = NULL; + FT_Byte* dst = NULL; + + + if ( FT_READ_BYTE( hmtx_flags ) ) + goto Fail; + + has_proportional_lsbs = ( hmtx_flags & 1 ) == 0; + has_monospace_lsbs = ( hmtx_flags & 2 ) == 0; + + /* Bits 2-7 are reserved and MUST be zero. */ + if ( ( hmtx_flags & 0xFC ) != 0 ) + goto Fail; + + /* Are you REALLY transformed? */ + if ( has_proportional_lsbs && has_monospace_lsbs ) + goto Fail; + + /* Cannot have a transformed `hmtx' without `glyf'. */ + if ( ( num_hmetrics > num_glyphs ) || + ( num_hmetrics < 1 ) ) + goto Fail; + + /* Must have at least one entry. */ + if ( num_hmetrics < 1 ) + goto Fail; + + if ( FT_NEW_ARRAY( advance_widths, num_hmetrics ) || + FT_NEW_ARRAY( lsbs, num_glyphs ) ) + goto Fail; + + /* Read `advanceWidth' stream. Always present. */ + for ( i = 0; i < num_hmetrics; i++ ) + { + FT_UShort advance_width; + + + if ( FT_READ_USHORT( advance_width ) ) + goto Fail; + + advance_widths[i] = advance_width; + } + + /* lsb values for proportional glyphs. */ + for ( i = 0; i < num_hmetrics; i++ ) + { + FT_Short lsb; + + + if ( has_proportional_lsbs ) + { + if ( FT_READ_SHORT( lsb ) ) + goto Fail; + } + else + lsb = x_mins[i]; + + lsbs[i] = lsb; + } + + /* lsb values for monospaced glyphs. */ + for ( i = num_hmetrics; i < num_glyphs; i++ ) + { + FT_Short lsb; + + + if ( has_monospace_lsbs ) + { + if ( FT_READ_SHORT( lsb ) ) + goto Fail; + } + else + lsb = x_mins[i]; + + lsbs[i] = lsb; + } + + /* Build the hmtx table. */ + hmtx_table_size = 2 * num_hmetrics + 2 * num_glyphs; + if ( FT_NEW_ARRAY( hmtx_table, hmtx_table_size ) ) + goto Fail; + + dst = hmtx_table; + FT_TRACE6(( "hmtx values: \n" )); + for ( i = 0; i < num_glyphs; i++ ) + { + if ( i < num_hmetrics ) + { + WRITE_SHORT( dst, advance_widths[i] ); + FT_TRACE6(( "%d ", advance_widths[i] )); + } + + WRITE_SHORT( dst, lsbs[i] ); + FT_TRACE6(( "%d ", lsbs[i] )); + } + FT_TRACE6(( "\n" )); + + *checksum = compute_ULong_sum( hmtx_table, hmtx_table_size ); + /* Write `hmtx' table to sfnt buffer. */ + if ( WRITE_SFNT_BUF( hmtx_table, hmtx_table_size ) ) + goto Fail; + + /* Set pointer `sfnt_bytes' to its correct value. */ + *sfnt_bytes = sfnt; + *out_offset = dest_offset; + + FT_FREE( advance_widths ); + FT_FREE( lsbs ); + FT_FREE( hmtx_table ); + + return error; + + Fail: + FT_FREE( advance_widths ); + FT_FREE( lsbs ); + FT_FREE( hmtx_table ); + + if ( !error ) + error = FT_THROW( Invalid_Table ); + + return error; + } + + + static FT_Error + reconstruct_font( FT_Byte* transformed_buf, + FT_ULong transformed_buf_size, + WOFF2_Table* indices, + WOFF2_Header woff2, + WOFF2_Info info, + FT_Byte** sfnt_bytes, + FT_ULong* sfnt_size, + FT_Memory memory ) + { + /* Memory management of `transformed_buf' is handled by the caller. */ + + FT_Error error = FT_Err_Ok; + FT_Stream stream = NULL; + FT_Byte* buf_cursor = NULL; + FT_Byte* table_entry = NULL; + + /* We are reallocating memory for `sfnt', so its pointer may change. */ + FT_Byte* sfnt = *sfnt_bytes; + + FT_UShort num_tables = woff2->num_tables; + FT_ULong dest_offset = 12 + num_tables * 16UL; + + FT_ULong checksum = 0; + FT_ULong loca_checksum = 0; + FT_Int nn = 0; + FT_UShort num_hmetrics = 0; + FT_ULong font_checksum = info->header_checksum; + FT_Bool is_glyf_xform = FALSE; + + FT_ULong table_entry_offset = 12; + + + /* A few table checks before reconstruction. */ + /* `glyf' must be present with `loca'. */ + info->glyf_table = find_table( indices, num_tables, TTAG_glyf ); + info->loca_table = find_table( indices, num_tables, TTAG_loca ); + + if ( ( info->glyf_table == NULL ) ^ ( info->loca_table == NULL ) ) + { + FT_ERROR(( "One of `glyf'/`loca' tables missing.\n" )); + return FT_THROW( Invalid_Table ); + } + + /* Both `glyf' and `loca' must have same transformation. */ + if ( info->glyf_table != NULL ) + { + if ( ( info->glyf_table->flags & WOFF2_FLAGS_TRANSFORM ) != + ( info->loca_table->flags & WOFF2_FLAGS_TRANSFORM ) ) + { + FT_ERROR(( "Transformation mismatch" + " between `glyf' and `loca' table." )); + return FT_THROW( Invalid_Table ); + } + } + + /* Create buffer for table entries. */ + if ( FT_NEW_ARRAY( table_entry, 16 ) ) + goto Fail; + + /* Create a stream for the uncompressed buffer. */ + if ( FT_NEW( stream ) ) + goto Fail; + FT_Stream_OpenMemory( stream, transformed_buf, transformed_buf_size ); + + FT_ASSERT( FT_STREAM_POS() == 0 ); + + /* Reconstruct/copy tables to output stream. */ + for ( nn = 0; nn < num_tables; nn++ ) + { + WOFF2_TableRec table = *( indices[nn] ); + + + FT_TRACE3(( "Seeking to %d with table size %d.\n", + table.src_offset, table.src_length )); + FT_TRACE3(( "Table tag: %c%c%c%c.\n", + (FT_Char)( table.Tag >> 24 ), + (FT_Char)( table.Tag >> 16 ), + (FT_Char)( table.Tag >> 8 ), + (FT_Char)( table.Tag ) )); + + if ( FT_STREAM_SEEK( table.src_offset ) ) + goto Fail; + + if ( table.src_offset + table.src_length > transformed_buf_size ) + goto Fail; + + /* Get stream size for fields of `hmtx' table. */ + if ( table.Tag == TTAG_hhea ) + { + if ( read_num_hmetrics( stream, &num_hmetrics ) ) + goto Fail; + } + + info->num_hmetrics = num_hmetrics; + + checksum = 0; + if ( ( table.flags & WOFF2_FLAGS_TRANSFORM ) != WOFF2_FLAGS_TRANSFORM ) + { + /* Check whether `head' is at least 12 bytes. */ + if ( table.Tag == TTAG_head ) + { + if ( table.src_length < 12 ) + goto Fail; + + buf_cursor = transformed_buf + table.src_offset + 8; + /* Set checkSumAdjustment = 0 */ + WRITE_ULONG( buf_cursor, 0 ); + } + + table.dst_offset = dest_offset; + + checksum = compute_ULong_sum( transformed_buf + table.src_offset, + table.src_length ); + FT_TRACE4(( "Checksum = %09x.\n", checksum )); + + if ( WRITE_SFNT_BUF( transformed_buf + table.src_offset, + table.src_length ) ) + goto Fail; + } + else + { + FT_TRACE3(( "This table is transformed.\n" )); + + if ( table.Tag == TTAG_glyf ) + { + is_glyf_xform = TRUE; + table.dst_offset = dest_offset; + + if ( reconstruct_glyf( stream, + &checksum, + &loca_checksum, + &sfnt, + sfnt_size, + &dest_offset, + info, + memory ) ) + goto Fail; + + FT_TRACE4(( "Checksum = %09x.\n", checksum )); + } + + else if ( table.Tag == TTAG_loca ) + checksum = loca_checksum; + + else if ( table.Tag == TTAG_hmtx ) + { + /* If glyf is not transformed and hmtx is, handle separately. */ + if ( !is_glyf_xform ) + { + if ( get_x_mins( stream, indices, num_tables, info, memory ) ) + goto Fail; + } + + table.dst_offset = dest_offset; + + if ( reconstruct_hmtx( stream, + info->num_glyphs, + info->num_hmetrics, + info->x_mins, + &checksum, + &sfnt, + sfnt_size, + &dest_offset, + memory ) ) + goto Fail; + } + else + { + /* Unknown transform. */ + FT_ERROR(( "Unknown table transform.\n" )); + goto Fail; + } + } + + font_checksum += checksum; + + buf_cursor = &table_entry[0]; + WRITE_ULONG( buf_cursor, table.Tag ); + WRITE_ULONG( buf_cursor, checksum ); + WRITE_ULONG( buf_cursor, table.dst_offset ); + WRITE_ULONG( buf_cursor, table.dst_length ); + + WRITE_SFNT_BUF_AT( table_entry_offset, table_entry, 16 ); + + /* Update checksum. */ + font_checksum += compute_ULong_sum( table_entry, 16 ); + + if ( pad4( &sfnt, sfnt_size, &dest_offset, memory ) ) + goto Fail; + + /* Sanity check. */ + if ( (FT_ULong)( table.dst_offset + table.dst_length ) > dest_offset ) + { + FT_ERROR(( "Table was partially written.\n" )); + goto Fail; + } + } + + /* Update `head' checkSumAdjustment. */ + info->head_table = find_table( indices, num_tables, TTAG_head ); + if ( !info->head_table ) + { + FT_ERROR(( "`head' table is missing.\n" )); + goto Fail; + } + + if ( info->head_table->dst_length < 12 ) + goto Fail; + + buf_cursor = sfnt + info->head_table->dst_offset + 8; + font_checksum = 0xB1B0AFBA - font_checksum; + + WRITE_ULONG( buf_cursor, font_checksum ); + + FT_TRACE2(( "Final checksum = %09x.\n", font_checksum )); + + woff2->actual_sfnt_size = dest_offset; + + /* Set pointer of sfnt stream to its correct value. */ + *sfnt_bytes = sfnt; + + FT_FREE( table_entry ); + FT_Stream_Close( stream ); + FT_FREE( stream ); + + return error; + + Fail: + if ( !error ) + error = FT_THROW( Invalid_Table ); + + /* Set pointer of sfnt stream to its correct value. */ + *sfnt_bytes = sfnt; + + FT_FREE( table_entry ); + FT_Stream_Close( stream ); + FT_FREE( stream ); + + return error; + } + + + /* Replace `face->root.stream' with a stream containing the extracted */ + /* SFNT of a WOFF2 font. */ + + FT_LOCAL_DEF( FT_Error ) + woff2_open_font( FT_Stream stream, + TT_Face face, + FT_Int* face_instance_index, + FT_Long* num_faces ) + { + FT_Memory memory = stream->memory; + FT_Error error = FT_Err_Ok; + FT_Int face_index; + + WOFF2_HeaderRec woff2; + WOFF2_InfoRec info = { 0, 0, 0, NULL, NULL, NULL, NULL }; + WOFF2_Table tables = NULL; + WOFF2_Table* indices = NULL; + WOFF2_Table* temp_indices = NULL; + WOFF2_Table last_table; + + FT_Int nn; + FT_ULong j; + FT_ULong flags; + FT_UShort xform_version; + FT_ULong src_offset = 0; + + FT_UInt glyf_index; + FT_UInt loca_index; + FT_UInt32 file_offset; + + FT_Byte* sfnt = NULL; + FT_Stream sfnt_stream = NULL; + FT_Byte* sfnt_header; + FT_ULong sfnt_size; + + FT_Byte* uncompressed_buf = NULL; + + static const FT_Frame_Field woff2_header_fields[] = + { +#undef FT_STRUCTURE +#define FT_STRUCTURE WOFF2_HeaderRec + + FT_FRAME_START( 48 ), + FT_FRAME_ULONG ( signature ), + FT_FRAME_ULONG ( flavor ), + FT_FRAME_ULONG ( length ), + FT_FRAME_USHORT ( num_tables ), + FT_FRAME_SKIP_BYTES( 2 ), + FT_FRAME_ULONG ( totalSfntSize ), + FT_FRAME_ULONG ( totalCompressedSize ), + FT_FRAME_SKIP_BYTES( 2 * 2 ), + FT_FRAME_ULONG ( metaOffset ), + FT_FRAME_ULONG ( metaLength ), + FT_FRAME_ULONG ( metaOrigLength ), + FT_FRAME_ULONG ( privOffset ), + FT_FRAME_ULONG ( privLength ), + FT_FRAME_END + }; + + + FT_ASSERT( stream == face->root.stream ); + FT_ASSERT( FT_STREAM_POS() == 0 ); + + face_index = FT_ABS( *face_instance_index ) & 0xFFFF; + + /* Read WOFF2 Header. */ + if ( FT_STREAM_READ_FIELDS( woff2_header_fields, &woff2 ) ) + return error; + + FT_TRACE4(( "signature -> 0x%X\n", woff2.signature )); + FT_TRACE2(( "flavor -> 0x%08lx\n", woff2.flavor )); + FT_TRACE4(( "length -> %lu\n", woff2.length )); + FT_TRACE2(( "num_tables -> %hu\n", woff2.num_tables )); + FT_TRACE4(( "totalSfntSize -> %lu\n", woff2.totalSfntSize )); + FT_TRACE4(( "metaOffset -> %hu\n", woff2.metaOffset )); + FT_TRACE4(( "metaLength -> %hu\n", woff2.metaLength )); + FT_TRACE4(( "privOffset -> %hu\n", woff2.privOffset )); + FT_TRACE4(( "privLength -> %hu\n", woff2.privLength )); + + /* Make sure we don't recurse back here. */ + if ( woff2.flavor == TTAG_wOF2 ) + return FT_THROW( Invalid_Table ); + + /* Miscellaneous checks. */ + if ( woff2.length != stream->size || + woff2.num_tables == 0 || + 48 + woff2.num_tables * 20UL >= woff2.length || + ( woff2.metaOffset == 0 && ( woff2.metaLength != 0 || + woff2.metaOrigLength != 0 ) ) || + ( woff2.metaLength != 0 && woff2.metaOrigLength == 0 ) || + ( woff2.metaOffset >= woff2.length ) || + ( woff2.length - woff2.metaOffset < woff2.metaLength ) || + ( woff2.privOffset == 0 && woff2.privLength != 0 ) || + ( woff2.privOffset >= woff2.length ) || + ( woff2.length - woff2.privOffset < woff2.privLength ) ) + { + FT_ERROR(( "woff2_open_font: invalid WOFF2 header\n" )); + return FT_THROW( Invalid_Table ); + } + + FT_TRACE2(( "woff2_open_font: WOFF2 Header is valid.\n" )); + + woff2.ttc_fonts = NULL; + + /* Read table directory. */ + if ( FT_NEW_ARRAY( tables, woff2.num_tables ) || + FT_NEW_ARRAY( indices, woff2.num_tables ) ) + goto Exit; + + FT_TRACE2(( "\n" + " tag flags transform origLen transformLen\n" + " --------------------------------------------------\n" )); + + for ( nn = 0; nn < woff2.num_tables; nn++ ) + { + WOFF2_Table table = tables + nn; + + + if ( FT_READ_BYTE( table->FlagByte ) ) + goto Exit; + + if ( ( table->FlagByte & 0x3f ) == 0x3f ) + { + if ( FT_READ_ULONG( table->Tag ) ) + goto Exit; + } + else + { + table->Tag = woff2_known_tags( table->FlagByte & 0x3f ); + if ( !table->Tag ) + { + FT_ERROR(( "woff2_open_font: Unknown table tag." )); + error = FT_THROW( Invalid_Table ); + goto Exit; + } + } + + flags = 0; + xform_version = ( table->FlagByte >> 6 ) & 0x03; + + /* 0 means xform for glyph/loca, non-0 for others. */ + if ( table->Tag == TTAG_glyf || table->Tag == TTAG_loca ) + { + if ( xform_version == 0 ) + flags |= WOFF2_FLAGS_TRANSFORM; + } + else if ( xform_version != 0 ) + flags |= WOFF2_FLAGS_TRANSFORM; + + flags |= xform_version; + + if ( READ_BASE128( table->dst_length ) ) + goto Exit; + + table->TransformLength = table->dst_length; + + if ( ( flags & WOFF2_FLAGS_TRANSFORM ) != 0 ) + { + if ( READ_BASE128( table->TransformLength ) ) + goto Exit; + + if ( table->Tag == TTAG_loca && table->TransformLength ) + { + FT_ERROR(( "woff2_open_font: Invalid loca `transformLength'.\n" )); + error = FT_THROW( Invalid_Table ); + goto Exit; + } + } + + if ( src_offset + table->TransformLength < src_offset ) + { + FT_ERROR(( "woff2_open_font: invalid WOFF2 table directory.\n" )); + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + table->src_offset = src_offset; + table->src_length = table->TransformLength; + src_offset += table->TransformLength; + table->flags = flags; + + FT_TRACE2(( " %c%c%c%c %08d %08d %08ld %08ld\n", + (FT_Char)( table->Tag >> 24 ), + (FT_Char)( table->Tag >> 16 ), + (FT_Char)( table->Tag >> 8 ), + (FT_Char)( table->Tag ), + table->FlagByte & 0x3f, + ( table->FlagByte >> 6 ) & 0x03, + table->dst_length, + table->TransformLength, + table->src_length, + table->src_offset )); + + indices[nn] = table; + } + + /* End of last table is uncompressed size. */ + last_table = indices[woff2.num_tables - 1]; + + woff2.uncompressed_size = last_table->src_offset + + last_table->src_length; + if ( woff2.uncompressed_size < last_table->src_offset ) + { + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + FT_TRACE2(( "Table directory parsed.\n" )); + + /* Check for and read collection directory. */ + woff2.num_fonts = 1; + woff2.header_version = 0; + + if ( woff2.flavor == TTAG_ttcf ) + { + FT_TRACE2(( "Font is a TTC, reading collection directory.\n" )); + + if ( FT_READ_ULONG( woff2.header_version ) ) + goto Exit; + + if ( woff2.header_version != 0x00010000 && + woff2.header_version != 0x00020000 ) + { + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + if ( READ_255USHORT( woff2.num_fonts ) ) + goto Exit; + + if ( !woff2.num_fonts ) + { + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + FT_TRACE4(( "Number of fonts in TTC: %ld\n", woff2.num_fonts )); + + if ( FT_NEW_ARRAY( woff2.ttc_fonts, woff2.num_fonts ) ) + goto Exit; + + for ( nn = 0; nn < woff2.num_fonts; nn++ ) + { + WOFF2_TtcFont ttc_font = woff2.ttc_fonts + nn; + + + if ( READ_255USHORT( ttc_font->num_tables ) ) + goto Exit; + if ( FT_READ_ULONG( ttc_font->flavor ) ) + goto Exit; + + if ( FT_NEW_ARRAY( ttc_font->table_indices, ttc_font->num_tables ) ) + goto Exit; + + FT_TRACE5(( "Number of tables in font %d: %ld\n", + nn, ttc_font->num_tables )); + +#ifdef FT_DEBUG_LEVEL_TRACE + if ( ttc_font->num_tables ) + FT_TRACE6(( " Indices: " )); +#endif + + glyf_index = 0; + loca_index = 0; + + for ( j = 0; j < ttc_font->num_tables; j++ ) + { + FT_UShort table_index; + WOFF2_Table table; + + + if ( READ_255USHORT( table_index ) ) + goto Exit; + + FT_TRACE6(( "%hu ", table_index )); + if ( table_index >= woff2.num_tables ) + { + FT_ERROR(( "woff2_open_font: invalid table index\n" )); + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + ttc_font->table_indices[j] = table_index; + + table = indices[table_index]; + if ( table->Tag == TTAG_loca ) + loca_index = table_index; + if ( table->Tag == TTAG_glyf ) + glyf_index = table_index; + } + +#ifdef FT_DEBUG_LEVEL_TRACE + if ( ttc_font->num_tables ) + FT_TRACE6(( "\n" )); +#endif + + /* glyf and loca must be consecutive */ + if ( glyf_index > 0 || loca_index > 0 ) + { + if ( glyf_index > loca_index || + loca_index - glyf_index != 1 ) + { + error = FT_THROW( Invalid_Table ); + goto Exit; + } + } + } + + /* Collection directory reading complete. */ + FT_TRACE2(( "WOFF2 collection directory is valid.\n" )); + } + else + woff2.ttc_fonts = NULL; + + woff2.compressed_offset = FT_STREAM_POS(); + file_offset = ROUND4( woff2.compressed_offset + + woff2.totalCompressedSize ); + + /* Some more checks before we start reading the tables. */ + if ( file_offset > woff2.length ) + { + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + if ( woff2.metaOffset ) + { + if ( file_offset != woff2.metaOffset ) + { + error = FT_THROW( Invalid_Table ); + goto Exit; + } + file_offset = ROUND4(woff2.metaOffset + woff2.metaLength); + } + + if ( woff2.privOffset ) + { + if ( file_offset != woff2.privOffset ) + { + error = FT_THROW( Invalid_Table ); + goto Exit; + } + file_offset = ROUND4(woff2.privOffset + woff2.privLength); + } + + if ( file_offset != ( ROUND4( woff2.length ) ) ) + { + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + /* Validate requested face index. */ + *num_faces = woff2.num_fonts; + /* value -(N+1) requests information on index N */ + if ( *face_instance_index < 0 ) + face_index--; + + if ( face_index >= woff2.num_fonts ) + { + if ( *face_instance_index >= 0 ) + { + error = FT_THROW( Invalid_Argument ); + goto Exit; + } + else + face_index = 0; + } + + /* Only retain tables of the requested face in a TTC. */ + if ( woff2.header_version ) + { + WOFF2_TtcFont ttc_font = woff2.ttc_fonts + face_index; + + + /* Create a temporary array. */ + if ( FT_NEW_ARRAY( temp_indices, + ttc_font->num_tables ) ) + goto Exit; + + FT_TRACE4(( "Storing tables for TTC face index %d.\n", face_index )); + for ( nn = 0; nn < ttc_font->num_tables; nn++ ) + temp_indices[nn] = indices[ttc_font->table_indices[nn]]; + + /* Resize array to required size. */ + if ( FT_RENEW_ARRAY( indices, + woff2.num_tables, + ttc_font->num_tables ) ) + goto Exit; + + for ( nn = 0; nn < ttc_font->num_tables; nn++ ) + indices[nn] = temp_indices[nn]; + + FT_FREE( temp_indices ); + + /* Change header values. */ + woff2.flavor = ttc_font->flavor; + woff2.num_tables = ttc_font->num_tables; + } + + /* We need to allocate this much at the minimum. */ + sfnt_size = 12 + woff2.num_tables * 16UL; + /* This is what we normally expect. */ + /* Initially trust `totalSfntSize' and change later as required. */ + if ( woff2.totalSfntSize > sfnt_size ) + { + /* However, adjust the value to something reasonable. */ + + /* Factor 64 is heuristic. */ + if ( ( woff2.totalSfntSize >> 6 ) > woff2.length ) + sfnt_size = woff2.length << 6; + else + sfnt_size = woff2.totalSfntSize; + + /* Value 1<<26 = 67108864 is heuristic. */ + if (sfnt_size >= (1 << 26)) + sfnt_size = 1 << 26; + +#ifdef FT_DEBUG_LEVEL_TRACE + if ( sfnt_size != woff2.totalSfntSize ) + FT_TRACE4(( "adjusting estimate of uncompressed font size" + " to %lu bytes\n", + sfnt_size )); +#endif + } + + /* Write sfnt header. */ + if ( FT_ALLOC( sfnt, sfnt_size ) || + FT_NEW( sfnt_stream ) ) + goto Exit; + + sfnt_header = sfnt; + + WRITE_ULONG( sfnt_header, woff2.flavor ); + + if ( woff2.num_tables ) + { + FT_UInt searchRange, entrySelector, rangeShift, x; + + + x = woff2.num_tables; + entrySelector = 0; + while ( x ) + { + x >>= 1; + entrySelector += 1; + } + entrySelector--; + + searchRange = ( 1 << entrySelector ) * 16; + rangeShift = ( woff2.num_tables * 16 ) - searchRange; + + WRITE_USHORT( sfnt_header, woff2.num_tables ); + WRITE_USHORT( sfnt_header, searchRange ); + WRITE_USHORT( sfnt_header, entrySelector ); + WRITE_USHORT( sfnt_header, rangeShift ); + } + + info.header_checksum = compute_ULong_sum( sfnt, 12 ); + + /* Sort tables by tag. */ + ft_qsort( indices, + woff2.num_tables, + sizeof ( WOFF2_Table ), + compare_tags ); + + if ( woff2.uncompressed_size < 1 ) + { + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + if ( woff2.uncompressed_size > sfnt_size ) + { + FT_ERROR(( "woff2_open_font: SFNT table lengths are too large.\n" )); + error = FT_THROW( Invalid_Table ); + goto Exit; + } + + /* Allocate memory for uncompressed table data. */ + if ( FT_ALLOC( uncompressed_buf, woff2.uncompressed_size ) || + FT_FRAME_ENTER( woff2.totalCompressedSize ) ) + goto Exit; + + /* Uncompress the stream. */ + error = woff2_decompress( uncompressed_buf, + woff2.uncompressed_size, + stream->cursor, + woff2.totalCompressedSize ); + + FT_FRAME_EXIT(); + + if ( error ) + goto Exit; + + error = reconstruct_font( uncompressed_buf, + woff2.uncompressed_size, + indices, + &woff2, + &info, + &sfnt, + &sfnt_size, + memory ); + + if ( error ) + goto Exit; + + /* Resize `sfnt' to actual size of sfnt stream. */ + if ( woff2.actual_sfnt_size < sfnt_size ) + { + FT_TRACE5(( "Trimming sfnt stream from %lu to %lu.\n", + sfnt_size, woff2.actual_sfnt_size )); + if ( FT_REALLOC( sfnt, + (FT_ULong)( sfnt_size ), + (FT_ULong)( woff2.actual_sfnt_size ) ) ) + goto Exit; + } + + /* `reconstruct_font' has done all the work. */ + /* Swap out stream and return. */ + FT_Stream_OpenMemory( sfnt_stream, sfnt, woff2.actual_sfnt_size ); + sfnt_stream->memory = stream->memory; + sfnt_stream->close = stream_close; + + FT_Stream_Free( + face->root.stream, + ( face->root.face_flags & FT_FACE_FLAG_EXTERNAL_STREAM ) != 0 ); + + face->root.stream = sfnt_stream; + face->root.face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM; + + /* Set face_index to 0 or -1. */ + if ( *face_instance_index >= 0 ) + *face_instance_index = 0; + else + *face_instance_index = -1; + + FT_TRACE2(( "woff2_open_font: SFNT synthesized.\n" )); + + Exit: + FT_FREE( tables ); + FT_FREE( indices ); + FT_FREE( uncompressed_buf ); + FT_FREE( info.x_mins ); + + if ( woff2.ttc_fonts ) + { + WOFF2_TtcFont ttc_font = woff2.ttc_fonts; + + + for ( nn = 0; nn < woff2.num_fonts; nn++ ) + { + FT_FREE( ttc_font->table_indices ); + ttc_font++; + } + + FT_FREE( woff2.ttc_fonts ); + } + + if ( error ) + { + FT_FREE( sfnt ); + if ( sfnt_stream ) + { + FT_Stream_Close( sfnt_stream ); + FT_FREE( sfnt_stream ); + } + } + + return error; + } + + +#undef READ_255USHORT +#undef READ_BASE128 +#undef ROUND4 +#undef WRITE_USHORT +#undef WRITE_ULONG +#undef WRITE_SHORT +#undef WRITE_SFNT_BUF +#undef WRITE_SFNT_BUF_AT + +#undef N_CONTOUR_STREAM +#undef N_POINTS_STREAM +#undef FLAG_STREAM +#undef GLYPH_STREAM +#undef COMPOSITE_STREAM +#undef BBOX_STREAM +#undef INSTRUCTION_STREAM + + +/* END */ --- /dev/null 2020-01-23 11:31:37.155195123 -0800 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff2.h 2020-08-20 13:34:40.724208635 -0700 @@ -0,0 +1,76 @@ +/**************************************************************************** + * + * sfwoff2.h + * + * WOFFF2 format management (specification). + * + * Copyright (C) 2019-2020 by + * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg. + * + * 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 SFWOFF2_H_ +#define SFWOFF2_H_ + + +#include +#include FT_INTERNAL_SFNT_H +#include FT_INTERNAL_OBJECTS_H + + +FT_BEGIN_HEADER + + + /* Leave the first byte open to store `flag_byte'. */ +#define WOFF2_FLAGS_TRANSFORM 1 << 8 + +#define WOFF2_SFNT_HEADER_SIZE 12 +#define WOFF2_SFNT_ENTRY_SIZE 16 + + /* Suggested maximum size for output. */ +#define WOFF2_DEFAULT_MAX_SIZE 30 * 1024 * 1024 + + /* 98% of Google Fonts have no glyph above 5k bytes. */ +#define WOFF2_DEFAULT_GLYPH_BUF 5120 + + /* Composite glyph flags. */ + /* See `CompositeGlyph.java' in `sfntly' for full definitions. */ +#define FLAG_ARG_1_AND_2_ARE_WORDS 1 << 0 +#define FLAG_WE_HAVE_A_SCALE 1 << 3 +#define FLAG_MORE_COMPONENTS 1 << 5 +#define FLAG_WE_HAVE_AN_X_AND_Y_SCALE 1 << 6 +#define FLAG_WE_HAVE_A_TWO_BY_TWO 1 << 7 +#define FLAG_WE_HAVE_INSTRUCTIONS 1 << 8 + + /* Simple glyph flags */ +#define GLYF_ON_CURVE 1 << 0 +#define GLYF_X_SHORT 1 << 1 +#define GLYF_Y_SHORT 1 << 2 +#define GLYF_REPEAT 1 << 3 +#define GLYF_THIS_X_IS_SAME 1 << 4 +#define GLYF_THIS_Y_IS_SAME 1 << 5 + + /* Other constants */ +#define CONTOUR_OFFSET_END_POINT 10 + + + FT_LOCAL( FT_Error ) + woff2_open_font( FT_Stream stream, + TT_Face face, + FT_Int* face_index, + FT_Long* num_faces ); + + +FT_END_HEADER + +#endif /* SFWOFF2_H_ */ + + +/* END */ --- /dev/null 2020-01-23 11:31:37.155195123 -0800 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/woff2tags.c 2020-08-20 13:34:41.356208625 -0700 @@ -0,0 +1,110 @@ +/**************************************************************************** + * + * woff2tags.c + * + * WOFF2 Font table tags (base). + * + * Copyright (C) 2019-2020 by + * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg. + * + * 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. + * + */ + + +#include +#include FT_TRUETYPE_TAGS_H + + + /* + * Return tag from index in the order given in WOFF2 specification. + * + * See + * + * https://www.w3.org/TR/WOFF2/#table_dir_format + * + * for details. + */ + FT_LOCAL_DEF( FT_ULong ) + woff2_known_tags( FT_Byte index ) + { + const FT_ULong known_tags[63] = + { + FT_MAKE_TAG('c', 'm', 'a', 'p'), /* 0 */ + FT_MAKE_TAG('h', 'e', 'a', 'd'), /* 1 */ + FT_MAKE_TAG('h', 'h', 'e', 'a'), /* 2 */ + FT_MAKE_TAG('h', 'm', 't', 'x'), /* 3 */ + FT_MAKE_TAG('m', 'a', 'x', 'p'), /* 4 */ + FT_MAKE_TAG('n', 'a', 'm', 'e'), /* 5 */ + FT_MAKE_TAG('O', 'S', '/', '2'), /* 6 */ + FT_MAKE_TAG('p', 'o', 's', 't'), /* 7 */ + FT_MAKE_TAG('c', 'v', 't', ' '), /* 8 */ + FT_MAKE_TAG('f', 'p', 'g', 'm'), /* 9 */ + FT_MAKE_TAG('g', 'l', 'y', 'f'), /* 10 */ + FT_MAKE_TAG('l', 'o', 'c', 'a'), /* 11 */ + FT_MAKE_TAG('p', 'r', 'e', 'p'), /* 12 */ + FT_MAKE_TAG('C', 'F', 'F', ' '), /* 13 */ + FT_MAKE_TAG('V', 'O', 'R', 'G'), /* 14 */ + FT_MAKE_TAG('E', 'B', 'D', 'T'), /* 15 */ + FT_MAKE_TAG('E', 'B', 'L', 'C'), /* 16 */ + FT_MAKE_TAG('g', 'a', 's', 'p'), /* 17 */ + FT_MAKE_TAG('h', 'd', 'm', 'x'), /* 18 */ + FT_MAKE_TAG('k', 'e', 'r', 'n'), /* 19 */ + FT_MAKE_TAG('L', 'T', 'S', 'H'), /* 20 */ + FT_MAKE_TAG('P', 'C', 'L', 'T'), /* 21 */ + FT_MAKE_TAG('V', 'D', 'M', 'X'), /* 22 */ + FT_MAKE_TAG('v', 'h', 'e', 'a'), /* 23 */ + FT_MAKE_TAG('v', 'm', 't', 'x'), /* 24 */ + FT_MAKE_TAG('B', 'A', 'S', 'E'), /* 25 */ + FT_MAKE_TAG('G', 'D', 'E', 'F'), /* 26 */ + FT_MAKE_TAG('G', 'P', 'O', 'S'), /* 27 */ + FT_MAKE_TAG('G', 'S', 'U', 'B'), /* 28 */ + FT_MAKE_TAG('E', 'B', 'S', 'C'), /* 29 */ + FT_MAKE_TAG('J', 'S', 'T', 'F'), /* 30 */ + FT_MAKE_TAG('M', 'A', 'T', 'H'), /* 31 */ + FT_MAKE_TAG('C', 'B', 'D', 'T'), /* 32 */ + FT_MAKE_TAG('C', 'B', 'L', 'C'), /* 33 */ + FT_MAKE_TAG('C', 'O', 'L', 'R'), /* 34 */ + FT_MAKE_TAG('C', 'P', 'A', 'L'), /* 35 */ + FT_MAKE_TAG('S', 'V', 'G', ' '), /* 36 */ + FT_MAKE_TAG('s', 'b', 'i', 'x'), /* 37 */ + FT_MAKE_TAG('a', 'c', 'n', 't'), /* 38 */ + FT_MAKE_TAG('a', 'v', 'a', 'r'), /* 39 */ + FT_MAKE_TAG('b', 'd', 'a', 't'), /* 40 */ + FT_MAKE_TAG('b', 'l', 'o', 'c'), /* 41 */ + FT_MAKE_TAG('b', 's', 'l', 'n'), /* 42 */ + FT_MAKE_TAG('c', 'v', 'a', 'r'), /* 43 */ + FT_MAKE_TAG('f', 'd', 's', 'c'), /* 44 */ + FT_MAKE_TAG('f', 'e', 'a', 't'), /* 45 */ + FT_MAKE_TAG('f', 'm', 't', 'x'), /* 46 */ + FT_MAKE_TAG('f', 'v', 'a', 'r'), /* 47 */ + FT_MAKE_TAG('g', 'v', 'a', 'r'), /* 48 */ + FT_MAKE_TAG('h', 's', 't', 'y'), /* 49 */ + FT_MAKE_TAG('j', 'u', 's', 't'), /* 50 */ + FT_MAKE_TAG('l', 'c', 'a', 'r'), /* 51 */ + FT_MAKE_TAG('m', 'o', 'r', 't'), /* 52 */ + FT_MAKE_TAG('m', 'o', 'r', 'x'), /* 53 */ + FT_MAKE_TAG('o', 'p', 'b', 'd'), /* 54 */ + FT_MAKE_TAG('p', 'r', 'o', 'p'), /* 55 */ + FT_MAKE_TAG('t', 'r', 'a', 'k'), /* 56 */ + FT_MAKE_TAG('Z', 'a', 'p', 'f'), /* 57 */ + FT_MAKE_TAG('S', 'i', 'l', 'f'), /* 58 */ + FT_MAKE_TAG('G', 'l', 'a', 't'), /* 59 */ + FT_MAKE_TAG('G', 'l', 'o', 'c'), /* 60 */ + FT_MAKE_TAG('F', 'e', 'a', 't'), /* 61 */ + FT_MAKE_TAG('S', 'i', 'l', 'l'), /* 62 */ + }; + + + if ( index > 62 ) + return 0; + + return known_tags[index]; + } + + +/* END */ --- /dev/null 2020-01-23 11:31:37.155195123 -0800 +++ new/src/java.desktop/share/native/libfreetype/src/sfnt/woff2tags.h 2020-08-20 13:34:41.908208616 -0700 @@ -0,0 +1,39 @@ +/**************************************************************************** + * + * woff2tags.h + * + * WOFFF2 Font table tags (specification). + * + * Copyright (C) 1996-2020 by + * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg. + * + * 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 WOFF2TAGS_H +#define WOFF2TAGS_H + + +#include +#include FT_INTERNAL_OBJECTS_H + + +FT_BEGIN_HEADER + + + FT_LOCAL( FT_ULong ) + woff2_known_tags( FT_Byte index ); + + +FT_END_HEADER + +#endif /* WOFF2TAGS_H */ + + +/* END */