diff --git a/thirdparty/README.md b/thirdparty/README.md index ee6a8558f9..91297d82bc 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -61,7 +61,7 @@ ## FreeType - Upstream: https://www.freetype.org/ -- Version: 2.11.1 +- Version: 2.12.0 - License: BSD-style (The FreeType Project) ## Glad diff --git a/thirdparty/freetype/CMakeLists.txt b/thirdparty/freetype/CMakeLists.txt index 4335d66dc3..7168cc14d2 100644 --- a/thirdparty/freetype/CMakeLists.txt +++ b/thirdparty/freetype/CMakeLists.txt @@ -1,6 +1,6 @@ # CMakeLists.txt # -# Copyright (C) 2013-2021 by +# Copyright (C) 2013-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # Written originally by John Cary @@ -106,10 +106,9 @@ # (this is compatible with the same CMake variables in zlib's CMake # support). -# FreeType explicitly marks the API to be exported and relies on the compiler -# to hide all other symbols. CMake supports a C_VISBILITY_PRESET property -# starting with 2.8.12. -cmake_minimum_required(VERSION 2.8.12) +# To minimize the number of cmake_policy() workarounds, +# CMake >= 3 is requested. +cmake_minimum_required(VERSION 3.0) if (NOT CMAKE_VERSION VERSION_LESS 3.3) # Allow symbol visibility settings also on static libraries. CMake < 3.3 @@ -122,6 +121,7 @@ endif () include(CheckIncludeFile) include(CMakeDependentOption) +include(FindPkgConfig) # CMAKE_TOOLCHAIN_FILE must be set before `project' is called, which # configures the base build environment and references the toolchain file @@ -162,8 +162,8 @@ endif () project(freetype C) set(VERSION_MAJOR "2") -set(VERSION_MINOR "11") -set(VERSION_PATCH "1") +set(VERSION_MINOR "12") +set(VERSION_PATCH "0") # Generate LIBRARY_VERSION and LIBRARY_SOVERSION. set(LIBTOOL_REGEX "version_info='([0-9]+):([0-9]+):([0-9]+)'") @@ -239,7 +239,7 @@ if (BUILD_FRAMEWORK) message(FATAL_ERROR "You should use Xcode generator with BUILD_FRAMEWORK enabled") endif () - set(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD_32_64_BIT)") + set(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD)") set(BUILD_SHARED_LIBS ON) endif () @@ -271,11 +271,16 @@ if (NOT FT_DISABLE_ZLIB) endif () if (NOT FT_DISABLE_BZIP2) + # Genuine BZip2 does not provide bzip2.pc, but some platforms have it. + # For better dependency in freetype2.pc, bzip2.pc is searched + # regardless of the availability of libbz2. If bzip2.pc is found, + # Requires.private is used instead of Libs.private. if (FT_REQUIRE_BZIP2) find_package(BZip2 REQUIRED) else () find_package(BZip2) endif () + pkg_check_modules(PC_BZIP2 bzip2) endif () if (NOT FT_DISABLE_BROTLI) @@ -400,6 +405,7 @@ set(BASE_SRCS src/sdf/sdf.c src/sfnt/sfnt.c src/smooth/smooth.c + src/svg/svg.c src/truetype/truetype.c src/type1/type1.c src/type42/type42.c @@ -503,7 +509,11 @@ endif () if (BZIP2_FOUND) target_link_libraries(freetype PRIVATE ${BZIP2_LIBRARIES}) target_include_directories(freetype PRIVATE ${BZIP2_INCLUDE_DIR}) # not BZIP2_INCLUDE_DIRS - list(APPEND PKG_CONFIG_LIBS_PRIVATE "-lbz2") + if (PC_BZIP2_FOUND) + list(APPEND PKG_CONFIG_REQUIRED_PRIVATE "bzip2") + else () + list(APPEND PKG_CONFIG_LIBS_PRIVATE "-lbz2") + endif () endif () if (PNG_FOUND) target_link_libraries(freetype PRIVATE ${PNG_LIBRARIES}) diff --git a/thirdparty/freetype/README b/thirdparty/freetype/README index 6a320df90f..a33cb11aab 100644 --- a/thirdparty/freetype/README +++ b/thirdparty/freetype/README @@ -1,4 +1,4 @@ -FreeType 2.11.1 +FreeType 2.12.0 =============== Homepage: https://www.freetype.org @@ -30,9 +30,9 @@ sites. Go to and download one of the following files. - freetype-doc-2.11.1.tar.xz - freetype-doc-2.11.1.tar.gz - ftdoc2111.zip + freetype-doc-2.12.0.tar.xz + freetype-doc-2.12.0.tar.gz + ftdoc2120.zip To view the documentation online, go to @@ -92,7 +92,7 @@ Enjoy! ---------------------------------------------------------------------- -Copyright (C) 2006-2021 by +Copyright (C) 2006-2022 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/thirdparty/freetype/README.git b/thirdparty/freetype/README.git index ad3c74cad9..258de14b72 100644 --- a/thirdparty/freetype/README.git +++ b/thirdparty/freetype/README.git @@ -89,7 +89,7 @@ address: ---------------------------------------------------------------------- -Copyright (C) 2005-2021 by +Copyright (C) 2005-2022 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/thirdparty/freetype/builds/amiga/README b/thirdparty/freetype/builds/amiga/README index 4ec8770ba5..e77435527a 100644 --- a/thirdparty/freetype/builds/amiga/README +++ b/thirdparty/freetype/builds/amiga/README @@ -1,7 +1,7 @@ README for the builds/amiga subdirectory. -Copyright (C) 2005-2021 by +Copyright (C) 2005-2022 by Werner Lemberg and Detlef Würkner. This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/amiga/include/config/ftconfig.h b/thirdparty/freetype/builds/amiga/include/config/ftconfig.h index 6deea6b7e1..211f170e92 100644 --- a/thirdparty/freetype/builds/amiga/include/config/ftconfig.h +++ b/thirdparty/freetype/builds/amiga/include/config/ftconfig.h @@ -4,7 +4,7 @@ /* */ /* Amiga-specific configuration file (specification only). */ /* */ -/* Copyright (C) 2005-2021 by */ +/* Copyright (C) 2005-2022 by */ /* Werner Lemberg and Detlef Würkner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/thirdparty/freetype/builds/amiga/include/config/ftmodule.h b/thirdparty/freetype/builds/amiga/include/config/ftmodule.h index 873537cab6..73e86d5b62 100644 --- a/thirdparty/freetype/builds/amiga/include/config/ftmodule.h +++ b/thirdparty/freetype/builds/amiga/include/config/ftmodule.h @@ -4,7 +4,7 @@ /* */ /* Amiga-specific FreeType module selection. */ /* */ -/* Copyright (C) 2005-2021 by */ +/* Copyright (C) 2005-2022 by */ /* Werner Lemberg and Detlef Würkner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/thirdparty/freetype/builds/amiga/makefile.os4 b/thirdparty/freetype/builds/amiga/makefile.os4 index 58c89208b6..02742ea464 100644 --- a/thirdparty/freetype/builds/amiga/makefile.os4 +++ b/thirdparty/freetype/builds/amiga/makefile.os4 @@ -4,7 +4,7 @@ # -# Copyright (C) 2005-2021 by +# Copyright (C) 2005-2022 by # Werner Lemberg and Detlef Würkner. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/amiga/smakefile b/thirdparty/freetype/builds/amiga/smakefile index aaddd1995f..311375d0ea 100644 --- a/thirdparty/freetype/builds/amiga/smakefile +++ b/thirdparty/freetype/builds/amiga/smakefile @@ -3,7 +3,7 @@ # -# Copyright (C) 2005-2021 by +# Copyright (C) 2005-2022 by # Werner Lemberg and Detlef Würkner. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/amiga/src/base/ftdebug.c b/thirdparty/freetype/builds/amiga/src/base/ftdebug.c index dc7e968db9..84e2c8bac7 100644 --- a/thirdparty/freetype/builds/amiga/src/base/ftdebug.c +++ b/thirdparty/freetype/builds/amiga/src/base/ftdebug.c @@ -4,7 +4,7 @@ * * Debugging and logging component for amiga (body). * - * Copyright (C) 1996-2021 by + * Copyright (C) 1996-2022 by * David Turner, Robert Wilhelm, Werner Lemberg, and Detlef Wuerkner. * * This file is part of the FreeType project, and may only be used, diff --git a/thirdparty/freetype/builds/amiga/src/base/ftsystem.c b/thirdparty/freetype/builds/amiga/src/base/ftsystem.c index 5c69e3ac9f..ed34a779ff 100644 --- a/thirdparty/freetype/builds/amiga/src/base/ftsystem.c +++ b/thirdparty/freetype/builds/amiga/src/base/ftsystem.c @@ -4,7 +4,7 @@ /* */ /* Amiga-specific FreeType low-level system interface (body). */ /* */ -/* Copyright (C) 1996-2021 by */ +/* Copyright (C) 1996-2022 by */ /* David Turner, Robert Wilhelm, Werner Lemberg and Detlef Würkner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/thirdparty/freetype/builds/ansi/ansi-def.mk b/thirdparty/freetype/builds/ansi/ansi-def.mk index 218d5c0d15..d91894c069 100644 --- a/thirdparty/freetype/builds/ansi/ansi-def.mk +++ b/thirdparty/freetype/builds/ansi/ansi-def.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/ansi/ansi.mk b/thirdparty/freetype/builds/ansi/ansi.mk index b36c64e2f9..96c1576d04 100644 --- a/thirdparty/freetype/builds/ansi/ansi.mk +++ b/thirdparty/freetype/builds/ansi/ansi.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/beos/beos-def.mk b/thirdparty/freetype/builds/beos/beos-def.mk index d7d63b37c6..0b3ef60991 100644 --- a/thirdparty/freetype/builds/beos/beos-def.mk +++ b/thirdparty/freetype/builds/beos/beos-def.mk @@ -5,7 +5,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/beos/beos.mk b/thirdparty/freetype/builds/beos/beos.mk index f3e3fbbe91..a5e6a82c00 100644 --- a/thirdparty/freetype/builds/beos/beos.mk +++ b/thirdparty/freetype/builds/beos/beos.mk @@ -2,7 +2,7 @@ # FreeType 2 configuration rules for a BeOS system # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/beos/detect.mk b/thirdparty/freetype/builds/beos/detect.mk index 521ecae98f..7b27ff9f93 100644 --- a/thirdparty/freetype/builds/beos/detect.mk +++ b/thirdparty/freetype/builds/beos/detect.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/cmake/FindBrotliDec.cmake b/thirdparty/freetype/builds/cmake/FindBrotliDec.cmake index 46356b1fd4..0a3d899268 100644 --- a/thirdparty/freetype/builds/cmake/FindBrotliDec.cmake +++ b/thirdparty/freetype/builds/cmake/FindBrotliDec.cmake @@ -1,6 +1,6 @@ # FindBrotliDec.cmake # -# Copyright (C) 2019-2021 by +# Copyright (C) 2019-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # Written by Werner Lemberg diff --git a/thirdparty/freetype/builds/cmake/iOS.cmake b/thirdparty/freetype/builds/cmake/iOS.cmake index 258654d4cb..011e7ef025 100644 --- a/thirdparty/freetype/builds/cmake/iOS.cmake +++ b/thirdparty/freetype/builds/cmake/iOS.cmake @@ -1,6 +1,6 @@ # iOS.cmake # -# Copyright (C) 2014-2021 by +# Copyright (C) 2014-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # Written by David Wimsey diff --git a/thirdparty/freetype/builds/cmake/testbuild.sh b/thirdparty/freetype/builds/cmake/testbuild.sh index c6c637206a..312b47697a 100755 --- a/thirdparty/freetype/builds/cmake/testbuild.sh +++ b/thirdparty/freetype/builds/cmake/testbuild.sh @@ -1,6 +1,6 @@ #!/bin/sh -e -# Copyright (C) 2015-2021 by +# Copyright (C) 2015-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/compiler/ansi-cc.mk b/thirdparty/freetype/builds/compiler/ansi-cc.mk index e73e6fca30..98cb05776e 100644 --- a/thirdparty/freetype/builds/compiler/ansi-cc.mk +++ b/thirdparty/freetype/builds/compiler/ansi-cc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/compiler/bcc-dev.mk b/thirdparty/freetype/builds/compiler/bcc-dev.mk index 71804529b3..83ed28cf19 100644 --- a/thirdparty/freetype/builds/compiler/bcc-dev.mk +++ b/thirdparty/freetype/builds/compiler/bcc-dev.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/compiler/bcc.mk b/thirdparty/freetype/builds/compiler/bcc.mk index 321db10897..76b5dc2124 100644 --- a/thirdparty/freetype/builds/compiler/bcc.mk +++ b/thirdparty/freetype/builds/compiler/bcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/compiler/emx.mk b/thirdparty/freetype/builds/compiler/emx.mk index b3b6047e5e..f791836233 100644 --- a/thirdparty/freetype/builds/compiler/emx.mk +++ b/thirdparty/freetype/builds/compiler/emx.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2003-2021 by +# Copyright (C) 2003-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/compiler/gcc-dev.mk b/thirdparty/freetype/builds/compiler/gcc-dev.mk index f01192f7ed..0d1b0da711 100644 --- a/thirdparty/freetype/builds/compiler/gcc-dev.mk +++ b/thirdparty/freetype/builds/compiler/gcc-dev.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/compiler/gcc.mk b/thirdparty/freetype/builds/compiler/gcc.mk index ede20b2fc6..fbb12cc5bf 100644 --- a/thirdparty/freetype/builds/compiler/gcc.mk +++ b/thirdparty/freetype/builds/compiler/gcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/compiler/intelc.mk b/thirdparty/freetype/builds/compiler/intelc.mk index e5dcf90b3f..b1fdbe729d 100644 --- a/thirdparty/freetype/builds/compiler/intelc.mk +++ b/thirdparty/freetype/builds/compiler/intelc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/compiler/unix-lcc.mk b/thirdparty/freetype/builds/compiler/unix-lcc.mk index 40322b4be3..09da86f4fb 100644 --- a/thirdparty/freetype/builds/compiler/unix-lcc.mk +++ b/thirdparty/freetype/builds/compiler/unix-lcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/compiler/visualage.mk b/thirdparty/freetype/builds/compiler/visualage.mk index ebc3e48cf8..8c14d6f041 100644 --- a/thirdparty/freetype/builds/compiler/visualage.mk +++ b/thirdparty/freetype/builds/compiler/visualage.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/compiler/visualc.mk b/thirdparty/freetype/builds/compiler/visualc.mk index dc6998ad1d..2635a9fec5 100644 --- a/thirdparty/freetype/builds/compiler/visualc.mk +++ b/thirdparty/freetype/builds/compiler/visualc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/compiler/watcom.mk b/thirdparty/freetype/builds/compiler/watcom.mk index c1d1b66519..6484d4180a 100644 --- a/thirdparty/freetype/builds/compiler/watcom.mk +++ b/thirdparty/freetype/builds/compiler/watcom.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/compiler/win-lcc.mk b/thirdparty/freetype/builds/compiler/win-lcc.mk index 27fbc30343..1faad49400 100644 --- a/thirdparty/freetype/builds/compiler/win-lcc.mk +++ b/thirdparty/freetype/builds/compiler/win-lcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/detect.mk b/thirdparty/freetype/builds/detect.mk index 78e9e750ec..4068ca2a65 100644 --- a/thirdparty/freetype/builds/detect.mk +++ b/thirdparty/freetype/builds/detect.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/dos/detect.mk b/thirdparty/freetype/builds/dos/detect.mk index d95a2caa52..46f9a630c4 100644 --- a/thirdparty/freetype/builds/dos/detect.mk +++ b/thirdparty/freetype/builds/dos/detect.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/dos/dos-def.mk b/thirdparty/freetype/builds/dos/dos-def.mk index f7fbc4d656..307047da5b 100644 --- a/thirdparty/freetype/builds/dos/dos-def.mk +++ b/thirdparty/freetype/builds/dos/dos-def.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/dos/dos-emx.mk b/thirdparty/freetype/builds/dos/dos-emx.mk index dd9947962c..4ab7b6c7ed 100644 --- a/thirdparty/freetype/builds/dos/dos-emx.mk +++ b/thirdparty/freetype/builds/dos/dos-emx.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2003-2021 by +# Copyright (C) 2003-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/dos/dos-gcc.mk b/thirdparty/freetype/builds/dos/dos-gcc.mk index 9abdabea12..24d14a9b27 100644 --- a/thirdparty/freetype/builds/dos/dos-gcc.mk +++ b/thirdparty/freetype/builds/dos/dos-gcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/dos/dos-wat.mk b/thirdparty/freetype/builds/dos/dos-wat.mk index 7ab82afeb0..07d54e8967 100644 --- a/thirdparty/freetype/builds/dos/dos-wat.mk +++ b/thirdparty/freetype/builds/dos/dos-wat.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2003-2021 by +# Copyright (C) 2003-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/exports.mk b/thirdparty/freetype/builds/exports.mk index 67c7c99356..a3342ecb98 100644 --- a/thirdparty/freetype/builds/exports.mk +++ b/thirdparty/freetype/builds/exports.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 2005-2021 by +# Copyright (C) 2005-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/freetype.mk b/thirdparty/freetype/builds/freetype.mk index bae8145564..7b30c79d61 100644 --- a/thirdparty/freetype/builds/freetype.mk +++ b/thirdparty/freetype/builds/freetype.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/link_dos.mk b/thirdparty/freetype/builds/link_dos.mk index 8716be51be..dd97fbe7c0 100644 --- a/thirdparty/freetype/builds/link_dos.mk +++ b/thirdparty/freetype/builds/link_dos.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/link_std.mk b/thirdparty/freetype/builds/link_std.mk index 03f77721ff..d94e06d01c 100644 --- a/thirdparty/freetype/builds/link_std.mk +++ b/thirdparty/freetype/builds/link_std.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/mac/freetype-Info.plist b/thirdparty/freetype/builds/mac/freetype-Info.plist index 4b5d79b815..344e5ac0b3 100644 --- a/thirdparty/freetype/builds/mac/freetype-Info.plist +++ b/thirdparty/freetype/builds/mac/freetype-Info.plist @@ -9,7 +9,7 @@ English CFBundleExecutable - FreeType + freetype CFBundleGetInfoString FreeType ${PROJECT_VERSION} diff --git a/thirdparty/freetype/builds/mac/ftmac.c b/thirdparty/freetype/builds/mac/ftmac.c index cd3f4844b4..f30ffc7d17 100644 --- a/thirdparty/freetype/builds/mac/ftmac.c +++ b/thirdparty/freetype/builds/mac/ftmac.c @@ -5,7 +5,7 @@ /* Mac FOND support. Written by just@letterror.com. */ /* Heavily Fixed by mpsuzuki, George Williams and Sean McBride */ /* */ -/* Copyright (C) 1996-2021 by */ +/* Copyright (C) 1996-2022 by */ /* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -97,7 +97,7 @@ #define FT_DEPRECATED_ATTRIBUTE -#include FT_MAC_H +#include /* undefine blocking-macros in ftmac.h */ #undef FT_GetFile_From_Mac_Name diff --git a/thirdparty/freetype/builds/meson/extract_freetype_version.py b/thirdparty/freetype/builds/meson/extract_freetype_version.py index ab79fdb3b4..66b5bc8558 100644 --- a/thirdparty/freetype/builds/meson/extract_freetype_version.py +++ b/thirdparty/freetype/builds/meson/extract_freetype_version.py @@ -1,6 +1,6 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -# Copyright (C) 2020-2021 by +# Copyright (C) 2020-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/meson/extract_libtool_version.py b/thirdparty/freetype/builds/meson/extract_libtool_version.py index 4527f11b21..580f645c1c 100644 --- a/thirdparty/freetype/builds/meson/extract_libtool_version.py +++ b/thirdparty/freetype/builds/meson/extract_libtool_version.py @@ -1,6 +1,6 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -# Copyright (C) 2020-2021 by +# Copyright (C) 2020-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/meson/generate_reference_docs.py b/thirdparty/freetype/builds/meson/generate_reference_docs.py index 15d9b06600..eb44806336 100644 --- a/thirdparty/freetype/builds/meson/generate_reference_docs.py +++ b/thirdparty/freetype/builds/meson/generate_reference_docs.py @@ -1,6 +1,6 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -# Copyright (C) 2020-2021 by +# Copyright (C) 2020-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/meson/parse_modules_cfg.py b/thirdparty/freetype/builds/meson/parse_modules_cfg.py index aa6e9e1763..f68110cf0c 100644 --- a/thirdparty/freetype/builds/meson/parse_modules_cfg.py +++ b/thirdparty/freetype/builds/meson/parse_modules_cfg.py @@ -1,6 +1,6 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -# Copyright (C) 2020-2021 by +# Copyright (C) 2020-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -87,6 +87,7 @@ def generate_ftmodule(lists): name = { "raster": "ft_raster1", "smooth": "ft_smooth", + "svg": "ft_svg", }.get(module) result += ( "FT_USE_MODULE( FT_Renderer_Class, %s_renderer_class )\n" % name diff --git a/thirdparty/freetype/builds/meson/process_ftoption_h.py b/thirdparty/freetype/builds/meson/process_ftoption_h.py index fe60887858..d3f8bb9ae4 100644 --- a/thirdparty/freetype/builds/meson/process_ftoption_h.py +++ b/thirdparty/freetype/builds/meson/process_ftoption_h.py @@ -1,6 +1,6 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -# Copyright (C) 2020-2021 by +# Copyright (C) 2020-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/modules.mk b/thirdparty/freetype/builds/modules.mk index 33fccdf96e..abbb0ef9e8 100644 --- a/thirdparty/freetype/builds/modules.mk +++ b/thirdparty/freetype/builds/modules.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/os2/detect.mk b/thirdparty/freetype/builds/os2/detect.mk index 7b8962b197..0bb557680b 100644 --- a/thirdparty/freetype/builds/os2/detect.mk +++ b/thirdparty/freetype/builds/os2/detect.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/os2/os2-def.mk b/thirdparty/freetype/builds/os2/os2-def.mk index 08aab9573c..4f508bb365 100644 --- a/thirdparty/freetype/builds/os2/os2-def.mk +++ b/thirdparty/freetype/builds/os2/os2-def.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/os2/os2-dev.mk b/thirdparty/freetype/builds/os2/os2-dev.mk index 40591ffe38..7c35c1c46c 100644 --- a/thirdparty/freetype/builds/os2/os2-dev.mk +++ b/thirdparty/freetype/builds/os2/os2-dev.mk @@ -5,7 +5,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/os2/os2-gcc.mk b/thirdparty/freetype/builds/os2/os2-gcc.mk index 854c46df85..62003f82c4 100644 --- a/thirdparty/freetype/builds/os2/os2-gcc.mk +++ b/thirdparty/freetype/builds/os2/os2-gcc.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/symbian/bld.inf b/thirdparty/freetype/builds/symbian/bld.inf index b9d000b1a2..6d20af917e 100644 --- a/thirdparty/freetype/builds/symbian/bld.inf +++ b/thirdparty/freetype/builds/symbian/bld.inf @@ -2,7 +2,7 @@ // FreeType 2 project for the symbian platform // -// Copyright (C) 2008-2021 by +// Copyright (C) 2008-2022 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/symbian/freetype.mmp b/thirdparty/freetype/builds/symbian/freetype.mmp index fa49157abf..ef3a96f150 100644 --- a/thirdparty/freetype/builds/symbian/freetype.mmp +++ b/thirdparty/freetype/builds/symbian/freetype.mmp @@ -2,7 +2,7 @@ // FreeType 2 makefile for the symbian platform // -// Copyright (C) 2008-2021 by +// Copyright (C) 2008-2022 by // David Turner, Robert Wilhelm, and Werner Lemberg. // // This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/toplevel.mk b/thirdparty/freetype/builds/toplevel.mk index 53b6d6fc13..fb0838e980 100644 --- a/thirdparty/freetype/builds/toplevel.mk +++ b/thirdparty/freetype/builds/toplevel.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -304,13 +304,12 @@ do-dist: distclean refdoc cp $(CONFIG_GUESS) builds/unix cp $(CONFIG_SUB) builds/unix - @# Generate `ChangeLog' file with commits since previous release. + @# Generate `ChangeLog' file with commits since release 2.11.0 + @# (when we stopped creating this file manually). $(CHANGELOG_SCRIPT) \ --format='%B%n' \ --no-cluster \ - -- `git describe --tags \ - --abbrev=0 \ - $(version_tag)^`..$(version_tag) \ + -- VER-2-11-0..$(version_tag) \ > ChangeLog @# Remove intermediate files created by the `refdoc' target. diff --git a/thirdparty/freetype/builds/unix/config.guess b/thirdparty/freetype/builds/unix/config.guess index e81d3ae7c2..7f76b6228f 100644 --- a/thirdparty/freetype/builds/unix/config.guess +++ b/thirdparty/freetype/builds/unix/config.guess @@ -1,14 +1,14 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2021 Free Software Foundation, Inc. +# Copyright 1992-2022 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268 # see below for rationale -timestamp='2021-06-03' +timestamp='2022-01-09' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or +# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -60,7 +60,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2021 Free Software Foundation, Inc. +Copyright 1992-2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -437,7 +437,7 @@ case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in # This test works for both compilers. if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 @@ -929,6 +929,9 @@ EOF i*:PW*:*) GUESS=$UNAME_MACHINE-pc-pw32 ;; + *:SerenityOS:*:*) + GUESS=$UNAME_MACHINE-pc-serenity + ;; *:Interix*:*) case $UNAME_MACHINE in x86) @@ -1522,6 +1525,9 @@ EOF i*86:rdos:*:*) GUESS=$UNAME_MACHINE-pc-rdos ;; + i*86:Fiwix:*:*) + GUESS=$UNAME_MACHINE-pc-fiwix + ;; *:AROS:*:*) GUESS=$UNAME_MACHINE-unknown-aros ;; diff --git a/thirdparty/freetype/builds/unix/config.sub b/thirdparty/freetype/builds/unix/config.sub index d74fb6deac..dba16e84c7 100644 --- a/thirdparty/freetype/builds/unix/config.sub +++ b/thirdparty/freetype/builds/unix/config.sub @@ -1,14 +1,14 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2021 Free Software Foundation, Inc. +# Copyright 1992-2022 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268 # see below for rationale -timestamp='2021-08-14' +timestamp='2022-01-03' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or +# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -76,7 +76,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright 1992-2021 Free Software Foundation, Inc. +Copyright 1992-2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -1020,6 +1020,11 @@ case $cpu-$vendor in ;; # Here we normalize CPU types with a missing or matching vendor + armh-unknown | armh-alt) + cpu=armv7l + vendor=alt + basic_os=${basic_os:-linux-gnueabihf} + ;; dpx20-unknown | dpx20-bull) cpu=rs6000 vendor=bull @@ -1121,7 +1126,7 @@ case $cpu-$vendor in xscale-* | xscalee[bl]-*) cpu=`echo "$cpu" | sed 's/^xscale/arm/'` ;; - arm64-*) + arm64-* | aarch64le-*) cpu=aarch64 ;; @@ -1304,7 +1309,7 @@ esac if test x$basic_os != x then -# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just +# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just # set os. case $basic_os in gnu/linux*) @@ -1748,7 +1753,8 @@ case $os in | skyos* | haiku* | rdos* | toppers* | drops* | es* \ | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ - | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr*) + | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ + | fiwix* ) ;; # This one is extra strict with allowed versions sco3.2v2 | sco3.2v[4-9]* | sco5v6*) diff --git a/thirdparty/freetype/builds/unix/configure b/thirdparty/freetype/builds/unix/configure index bf1b1cb23b..28bad74ab7 100644 --- a/thirdparty/freetype/builds/unix/configure +++ b/thirdparty/freetype/builds/unix/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for FreeType 2.11.1. +# Generated by GNU Autoconf 2.71 for FreeType 2.12. # # Report bugs to . # @@ -621,8 +621,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='FreeType' PACKAGE_TARNAME='freetype' -PACKAGE_VERSION='2.11.1' -PACKAGE_STRING='FreeType 2.11.1' +PACKAGE_VERSION='2.12' +PACKAGE_STRING='FreeType 2.12' PACKAGE_BUGREPORT='freetype@nongnu.org' PACKAGE_URL='' @@ -666,8 +666,10 @@ build_libtool_libs wl hardcode_libdir_flag_spec LIBSSTATIC_CONFIG -LIBS_PRIVATE -REQUIRES_PRIVATE +PKGCONFIG_LIBS_PRIVATE +PKGCONFIG_REQUIRES_PRIVATE +PKGCONFIG_LIBS +PKGCONFIG_REQUIRES ftmac_c PYTHON_VERSION PYTHON @@ -680,7 +682,10 @@ target_os target_vendor target_cpu target -LIB_CLOCK_GETTIME +FT_DEMO_LDFLAGS +FT_DEMO_CFLAGS +LIBRSVG_LIBS +LIBRSVG_CFLAGS BROTLI_LIBS BROTLI_CFLAGS HARFBUZZ_LIBS @@ -689,6 +694,7 @@ LIBPNG_LIBS LIBPNG_CFLAGS BZIP2_LIBS BZIP2_CFLAGS +SYSTEM_ZLIB ZLIB_LIBS ZLIB_CFLAGS XX_ANSIFLAGS @@ -835,7 +841,9 @@ LIBPNG_LIBS HARFBUZZ_CFLAGS HARFBUZZ_LIBS BROTLI_CFLAGS -BROTLI_LIBS' +BROTLI_LIBS +LIBRSVG_CFLAGS +LIBRSVG_LIBS' # Initialize some variables set by options. @@ -1384,7 +1392,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures FreeType 2.11.1 to adapt to many kinds of systems. +\`configure' configures FreeType 2.12 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1451,7 +1459,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of FreeType 2.11.1:";; + short | recursive ) echo "Configuration of FreeType 2.12:";; esac cat <<\_ACEOF @@ -1537,6 +1545,10 @@ Some influential environment variables: BROTLI_CFLAGS C compiler flags for BROTLI, overriding pkg-config BROTLI_LIBS linker flags for BROTLI, overriding pkg-config + LIBRSVG_CFLAGS + C compiler flags for LIBRSVG, overriding pkg-config + LIBRSVG_LIBS + linker flags for LIBRSVG, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1605,7 +1617,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -FreeType configure 2.11.1 +FreeType configure 2.12 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -1956,7 +1968,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by FreeType $as_me 2.11.1, which was +It was created by FreeType $as_me 2.12, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -2718,7 +2730,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # Don't forget to update `docs/VERSIONS.TXT'! -version_info='24:1:18' +version_info='24:2:18' ft_version=`echo $version_info | tr : .` @@ -13937,6 +13949,12 @@ if test x"$with_zlib" = xyes -a "$have_zlib" = no; then as_fn_error $? "external zlib support requested but library not found" "$LINENO" 5 fi +SYSTEM_ZLIB= +if test "$have_zlib" != no; then + SYSTEM_ZLIB=yes +fi + + # check for system libbz2 @@ -14496,13 +14514,16 @@ if test x"$with_brotli" = xyes -a "$have_brotli" = no; then fi -# check for librt +# Checks for the demo programs. # -# We need `clock_gettime' for the `ftbench' demo program. -# -# The code is modeled after gnulib's file `clock_time.m4', ignoring -# very old Solaris systems. +# FreeType doesn't need this. However, since the demo program repository +# doesn't come with a `configure` script of its own, we integrate the tests +# here for simplicity. +# We need `clock_gettime` from 'librt' for the `ftbench` demo program. +# +# The code is modeled after gnulib's file `clock_time.m4`, ignoring +# very old Solaris systems. LIB_CLOCK_GETTIME= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 printf %s "checking for library containing clock_gettime... " >&6; } @@ -14565,6 +14586,89 @@ then : fi +# 'librsvg' is needed to demonstrate SVG support. + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for LIBRSVG" >&5 +printf %s "checking for LIBRSVG... " >&6; } + +if test -n "$LIBRSVG_CFLAGS"; then + pkg_cv_LIBRSVG_CFLAGS="$LIBRSVG_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"librsvg-2.0 >= 2.46.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "librsvg-2.0 >= 2.46.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBRSVG_CFLAGS=`$PKG_CONFIG --cflags "librsvg-2.0 >= 2.46.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBRSVG_LIBS"; then + pkg_cv_LIBRSVG_LIBS="$LIBRSVG_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"librsvg-2.0 >= 2.46.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "librsvg-2.0 >= 2.46.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBRSVG_LIBS=`$PKG_CONFIG --libs "librsvg-2.0 >= 2.46.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBRSVG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "librsvg-2.0 >= 2.46.0" 2>&1` + else + LIBRSVG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "librsvg-2.0 >= 2.46.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBRSVG_PKG_ERRORS" >&5 + + have_librsvg=no +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + have_librsvg=no +else + LIBRSVG_CFLAGS=$pkg_cv_LIBRSVG_CFLAGS + LIBRSVG_LIBS=$pkg_cv_LIBRSVG_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + have_librsvg="yes (pkg-config)" +fi + +FT_DEMO_CFLAGS="" +FT_DEMO_LDFLAGS="$LIB_CLOCK_GETTIME" + +if test "$have_librsvg" != no; then + FT_DEMO_CFLAGS="$FT_DEMO_CFLAGS $LIBRSVG_CFLAGS -DHAVE_LIBRSVG" + FT_DEMO_LDFLAGS="$FT_DEMO_LDFLAGS $LIBRSVG_LIBS" +fi + + + # Some options handling SDKs/archs in CFLAGS should be copied @@ -16108,32 +16212,32 @@ fi # entries in Requires.private are separated by commas -REQUIRES_PRIVATE="$zlib_reqpriv, \ - $bzip2_reqpriv, \ - $libpng_reqpriv, \ - $harfbuzz_reqpriv, \ - $brotli_reqpriv" +PKGCONFIG_REQUIRES_PRIVATE="$zlib_reqpriv, \ + $bzip2_reqpriv, \ + $libpng_reqpriv, \ + $harfbuzz_reqpriv, \ + $brotli_reqpriv" # beautify -REQUIRES_PRIVATE=`echo "$REQUIRES_PRIVATE" \ - | sed -e 's/^ *//' \ - -e 's/ *$//' \ - -e 's/, */,/g' \ - -e 's/,,*/,/g' \ - -e 's/^,*//' \ - -e 's/,*$//' \ - -e 's/,/, /g'` +PKGCONFIG_REQUIRES_PRIVATE=`echo "$PKGCONFIG_REQUIRES_PRIVATE" \ + | sed -e 's/^ *//' \ + -e 's/ *$//' \ + -e 's/, */,/g' \ + -e 's/,,*/,/g' \ + -e 's/^,*//' \ + -e 's/,*$//' \ + -e 's/,/, /g'` -LIBS_PRIVATE="$zlib_libspriv \ - $bzip2_libspriv \ - $libpng_libspriv \ - $harfbuzz_libspriv \ - $brotli_libspriv \ - $ft2_extra_libs" +PKGCONFIG_LIBS_PRIVATE="$zlib_libspriv \ + $bzip2_libspriv \ + $libpng_libspriv \ + $harfbuzz_libspriv \ + $brotli_libspriv \ + $ft2_extra_libs" # beautify -LIBS_PRIVATE=`echo "$LIBS_PRIVATE" \ - | sed -e 's/^ *//' \ - -e 's/ *$//' \ - -e 's/ */ /g'` +PKGCONFIG_LIBS_PRIVATE=`echo "$PKGCONFIG_LIBS_PRIVATE" \ + | sed -e 's/^ *//' \ + -e 's/ *$//' \ + -e 's/ */ /g'` LIBSSTATIC_CONFIG="-lfreetype \ $zlib_libsstaticconf \ @@ -16151,6 +16255,24 @@ LIBSSTATIC_CONFIG=`echo "$LIBSSTATIC_CONFIG" \ -e 's/ *$//' \ -e 's/ */ /g'` +# If FreeType gets installed with `--disable-shared', don't use +# 'private' fields. `pkg-config' only looks into `.pc' files and is +# completely agnostic to whether shared libraries are actually present +# or not. As a consequence, the user had to specify `--static' while +# calling `pkg-config', which configure scripts are normally not +# prepared for. + +PKGCONFIG_REQUIRES= +PKGCONFIG_LIBS='-L${libdir} -lfreetype' + +if test $enable_shared = "no"; then + PKGCONFIG_REQUIRES="$PKGCONFIG_REQUIRES $PKGCONFIG_REQUIRES_PRIVATE" + PKGCONFIG_REQUIRES_PRIVATE= + PKGCONFIG_LIBS="$PKGCONFIG_LIBS $PKGCONFIG_LIBS_PRIVATE" + PKGCONFIG_LIBS_PRIVATE= +fi + + @@ -16739,7 +16861,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by FreeType $as_me 2.11.1, which was +This file was extended by FreeType $as_me 2.12, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -16807,7 +16929,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -FreeType config.status 2.11.1 +FreeType config.status 2.12 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff --git a/thirdparty/freetype/builds/unix/configure.ac b/thirdparty/freetype/builds/unix/configure.ac index d1b7f1a78c..28f65b9a48 100644 --- a/thirdparty/freetype/builds/unix/configure.ac +++ b/thirdparty/freetype/builds/unix/configure.ac @@ -2,7 +2,7 @@ # # Process this file with autoconf to produce a configure script. # -# Copyright (C) 2001-2021 by +# Copyright (C) 2001-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -11,13 +11,13 @@ # indicate that you have read the license and understand and accept it # fully. -AC_INIT([FreeType], [2.11.1], [freetype@nongnu.org], [freetype]) +AC_INIT([FreeType], [2.12], [freetype@nongnu.org], [freetype]) AC_CONFIG_SRCDIR([ftconfig.h.in]) # Don't forget to update `docs/VERSIONS.TXT'! -version_info='24:1:18' +version_info='24:2:18' AC_SUBST([version_info]) ft_version=`echo $version_info | tr : .` AC_SUBST([ft_version]) @@ -317,6 +317,12 @@ if test x"$with_zlib" = xyes -a "$have_zlib" = no; then AC_MSG_ERROR([external zlib support requested but library not found]) fi +SYSTEM_ZLIB= +if test "$have_zlib" != no; then + SYSTEM_ZLIB=yes +fi +AC_SUBST([SYSTEM_ZLIB]) + # check for system libbz2 @@ -508,19 +514,36 @@ if test x"$with_brotli" = xyes -a "$have_brotli" = no; then fi -# check for librt +# Checks for the demo programs. # -# We need `clock_gettime' for the `ftbench' demo program. -# -# The code is modeled after gnulib's file `clock_time.m4', ignoring -# very old Solaris systems. +# FreeType doesn't need this. However, since the demo program repository +# doesn't come with a `configure` script of its own, we integrate the tests +# here for simplicity. +# We need `clock_gettime` from 'librt' for the `ftbench` demo program. +# +# The code is modeled after gnulib's file `clock_time.m4`, ignoring +# very old Solaris systems. LIB_CLOCK_GETTIME= AC_SEARCH_LIBS([clock_gettime], [rt], [test "$ac_cv_search_clock_gettime" = "none required" \ || LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime]) -AC_SUBST([LIB_CLOCK_GETTIME]) + +# 'librsvg' is needed to demonstrate SVG support. +PKG_CHECK_MODULES([LIBRSVG], [librsvg-2.0 >= 2.46.0], + [have_librsvg="yes (pkg-config)"], [have_librsvg=no]) + +FT_DEMO_CFLAGS="" +FT_DEMO_LDFLAGS="$LIB_CLOCK_GETTIME" + +if test "$have_librsvg" != no; then + FT_DEMO_CFLAGS="$FT_DEMO_CFLAGS $LIBRSVG_CFLAGS -DHAVE_LIBRSVG" + FT_DEMO_LDFLAGS="$FT_DEMO_LDFLAGS $LIBRSVG_LIBS" +fi + +AC_SUBST([FT_DEMO_CFLAGS]) +AC_SUBST([FT_DEMO_LDFLAGS]) # Some options handling SDKs/archs in CFLAGS should be copied @@ -962,32 +985,32 @@ fi # entries in Requires.private are separated by commas -REQUIRES_PRIVATE="$zlib_reqpriv, \ - $bzip2_reqpriv, \ - $libpng_reqpriv, \ - $harfbuzz_reqpriv, \ - $brotli_reqpriv" +PKGCONFIG_REQUIRES_PRIVATE="$zlib_reqpriv, \ + $bzip2_reqpriv, \ + $libpng_reqpriv, \ + $harfbuzz_reqpriv, \ + $brotli_reqpriv" # beautify -REQUIRES_PRIVATE=`echo "$REQUIRES_PRIVATE" \ - | sed -e 's/^ *//' \ - -e 's/ *$//' \ - -e 's/, */,/g' \ - -e 's/,,*/,/g' \ - -e 's/^,*//' \ - -e 's/,*$//' \ - -e 's/,/, /g'` +PKGCONFIG_REQUIRES_PRIVATE=`echo "$PKGCONFIG_REQUIRES_PRIVATE" \ + | sed -e 's/^ *//' \ + -e 's/ *$//' \ + -e 's/, */,/g' \ + -e 's/,,*/,/g' \ + -e 's/^,*//' \ + -e 's/,*$//' \ + -e 's/,/, /g'` -LIBS_PRIVATE="$zlib_libspriv \ - $bzip2_libspriv \ - $libpng_libspriv \ - $harfbuzz_libspriv \ - $brotli_libspriv \ - $ft2_extra_libs" +PKGCONFIG_LIBS_PRIVATE="$zlib_libspriv \ + $bzip2_libspriv \ + $libpng_libspriv \ + $harfbuzz_libspriv \ + $brotli_libspriv \ + $ft2_extra_libs" # beautify -LIBS_PRIVATE=`echo "$LIBS_PRIVATE" \ - | sed -e 's/^ *//' \ - -e 's/ *$//' \ - -e 's/ */ /g'` +PKGCONFIG_LIBS_PRIVATE=`echo "$PKGCONFIG_LIBS_PRIVATE" \ + | sed -e 's/^ *//' \ + -e 's/ *$//' \ + -e 's/ */ /g'` LIBSSTATIC_CONFIG="-lfreetype \ $zlib_libsstaticconf \ @@ -1005,10 +1028,28 @@ LIBSSTATIC_CONFIG=`echo "$LIBSSTATIC_CONFIG" \ -e 's/ *$//' \ -e 's/ */ /g'` +# If FreeType gets installed with `--disable-shared', don't use +# 'private' fields. `pkg-config' only looks into `.pc' files and is +# completely agnostic to whether shared libraries are actually present +# or not. As a consequence, the user had to specify `--static' while +# calling `pkg-config', which configure scripts are normally not +# prepared for. + +PKGCONFIG_REQUIRES= +PKGCONFIG_LIBS='-L${libdir} -lfreetype' + +if test $enable_shared = "no"; then + PKGCONFIG_REQUIRES="$PKGCONFIG_REQUIRES $PKGCONFIG_REQUIRES_PRIVATE" + PKGCONFIG_REQUIRES_PRIVATE= + PKGCONFIG_LIBS="$PKGCONFIG_LIBS $PKGCONFIG_LIBS_PRIVATE" + PKGCONFIG_LIBS_PRIVATE= +fi AC_SUBST([ftmac_c]) -AC_SUBST([REQUIRES_PRIVATE]) -AC_SUBST([LIBS_PRIVATE]) +AC_SUBST([PKGCONFIG_REQUIRES]) +AC_SUBST([PKGCONFIG_LIBS]) +AC_SUBST([PKGCONFIG_REQUIRES_PRIVATE]) +AC_SUBST([PKGCONFIG_LIBS_PRIVATE]) AC_SUBST([LIBSSTATIC_CONFIG]) AC_SUBST([hardcode_libdir_flag_spec]) diff --git a/thirdparty/freetype/builds/unix/configure.raw b/thirdparty/freetype/builds/unix/configure.raw index f326872cbd..cfb073efab 100644 --- a/thirdparty/freetype/builds/unix/configure.raw +++ b/thirdparty/freetype/builds/unix/configure.raw @@ -2,7 +2,7 @@ # # Process this file with autoconf to produce a configure script. # -# Copyright (C) 2001-2021 by +# Copyright (C) 2001-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -17,7 +17,7 @@ AC_CONFIG_SRCDIR([ftconfig.h.in]) # Don't forget to update `docs/VERSIONS.TXT'! -version_info='24:1:18' +version_info='24:2:18' AC_SUBST([version_info]) ft_version=`echo $version_info | tr : .` AC_SUBST([ft_version]) @@ -317,6 +317,12 @@ if test x"$with_zlib" = xyes -a "$have_zlib" = no; then AC_MSG_ERROR([external zlib support requested but library not found]) fi +SYSTEM_ZLIB= +if test "$have_zlib" != no; then + SYSTEM_ZLIB=yes +fi +AC_SUBST([SYSTEM_ZLIB]) + # check for system libbz2 @@ -508,19 +514,36 @@ if test x"$with_brotli" = xyes -a "$have_brotli" = no; then fi -# check for librt +# Checks for the demo programs. # -# We need `clock_gettime' for the `ftbench' demo program. -# -# The code is modeled after gnulib's file `clock_time.m4', ignoring -# very old Solaris systems. +# FreeType doesn't need this. However, since the demo program repository +# doesn't come with a `configure` script of its own, we integrate the tests +# here for simplicity. +# We need `clock_gettime` from 'librt' for the `ftbench` demo program. +# +# The code is modeled after gnulib's file `clock_time.m4`, ignoring +# very old Solaris systems. LIB_CLOCK_GETTIME= AC_SEARCH_LIBS([clock_gettime], [rt], [test "$ac_cv_search_clock_gettime" = "none required" \ || LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime]) -AC_SUBST([LIB_CLOCK_GETTIME]) + +# 'librsvg' is needed to demonstrate SVG support. +PKG_CHECK_MODULES([LIBRSVG], [librsvg-2.0 >= 2.46.0], + [have_librsvg="yes (pkg-config)"], [have_librsvg=no]) + +FT_DEMO_CFLAGS="" +FT_DEMO_LDFLAGS="$LIB_CLOCK_GETTIME" + +if test "$have_librsvg" != no; then + FT_DEMO_CFLAGS="$FT_DEMO_CFLAGS $LIBRSVG_CFLAGS -DHAVE_LIBRSVG" + FT_DEMO_LDFLAGS="$FT_DEMO_LDFLAGS $LIBRSVG_LIBS" +fi + +AC_SUBST([FT_DEMO_CFLAGS]) +AC_SUBST([FT_DEMO_LDFLAGS]) # Some options handling SDKs/archs in CFLAGS should be copied @@ -962,32 +985,32 @@ fi # entries in Requires.private are separated by commas -REQUIRES_PRIVATE="$zlib_reqpriv, \ - $bzip2_reqpriv, \ - $libpng_reqpriv, \ - $harfbuzz_reqpriv, \ - $brotli_reqpriv" +PKGCONFIG_REQUIRES_PRIVATE="$zlib_reqpriv, \ + $bzip2_reqpriv, \ + $libpng_reqpriv, \ + $harfbuzz_reqpriv, \ + $brotli_reqpriv" # beautify -REQUIRES_PRIVATE=`echo "$REQUIRES_PRIVATE" \ - | sed -e 's/^ *//' \ - -e 's/ *$//' \ - -e 's/, */,/g' \ - -e 's/,,*/,/g' \ - -e 's/^,*//' \ - -e 's/,*$//' \ - -e 's/,/, /g'` +PKGCONFIG_REQUIRES_PRIVATE=`echo "$PKGCONFIG_REQUIRES_PRIVATE" \ + | sed -e 's/^ *//' \ + -e 's/ *$//' \ + -e 's/, */,/g' \ + -e 's/,,*/,/g' \ + -e 's/^,*//' \ + -e 's/,*$//' \ + -e 's/,/, /g'` -LIBS_PRIVATE="$zlib_libspriv \ - $bzip2_libspriv \ - $libpng_libspriv \ - $harfbuzz_libspriv \ - $brotli_libspriv \ - $ft2_extra_libs" +PKGCONFIG_LIBS_PRIVATE="$zlib_libspriv \ + $bzip2_libspriv \ + $libpng_libspriv \ + $harfbuzz_libspriv \ + $brotli_libspriv \ + $ft2_extra_libs" # beautify -LIBS_PRIVATE=`echo "$LIBS_PRIVATE" \ - | sed -e 's/^ *//' \ - -e 's/ *$//' \ - -e 's/ */ /g'` +PKGCONFIG_LIBS_PRIVATE=`echo "$PKGCONFIG_LIBS_PRIVATE" \ + | sed -e 's/^ *//' \ + -e 's/ *$//' \ + -e 's/ */ /g'` LIBSSTATIC_CONFIG="-lfreetype \ $zlib_libsstaticconf \ @@ -1005,10 +1028,28 @@ LIBSSTATIC_CONFIG=`echo "$LIBSSTATIC_CONFIG" \ -e 's/ *$//' \ -e 's/ */ /g'` +# If FreeType gets installed with `--disable-shared', don't use +# 'private' fields. `pkg-config' only looks into `.pc' files and is +# completely agnostic to whether shared libraries are actually present +# or not. As a consequence, the user had to specify `--static' while +# calling `pkg-config', which configure scripts are normally not +# prepared for. + +PKGCONFIG_REQUIRES= +PKGCONFIG_LIBS='-L${libdir} -lfreetype' + +if test $enable_shared = "no"; then + PKGCONFIG_REQUIRES="$PKGCONFIG_REQUIRES $PKGCONFIG_REQUIRES_PRIVATE" + PKGCONFIG_REQUIRES_PRIVATE= + PKGCONFIG_LIBS="$PKGCONFIG_LIBS $PKGCONFIG_LIBS_PRIVATE" + PKGCONFIG_LIBS_PRIVATE= +fi AC_SUBST([ftmac_c]) -AC_SUBST([REQUIRES_PRIVATE]) -AC_SUBST([LIBS_PRIVATE]) +AC_SUBST([PKGCONFIG_REQUIRES]) +AC_SUBST([PKGCONFIG_LIBS]) +AC_SUBST([PKGCONFIG_REQUIRES_PRIVATE]) +AC_SUBST([PKGCONFIG_LIBS_PRIVATE]) AC_SUBST([LIBSSTATIC_CONFIG]) AC_SUBST([hardcode_libdir_flag_spec]) diff --git a/thirdparty/freetype/builds/unix/detect.mk b/thirdparty/freetype/builds/unix/detect.mk index 862b43219c..7ed58ff745 100644 --- a/thirdparty/freetype/builds/unix/detect.mk +++ b/thirdparty/freetype/builds/unix/detect.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/unix/freetype-config.in b/thirdparty/freetype/builds/unix/freetype-config.in index 4edb092d09..c076bc1f82 100644 --- a/thirdparty/freetype/builds/unix/freetype-config.in +++ b/thirdparty/freetype/builds/unix/freetype-config.in @@ -1,6 +1,6 @@ #! /bin/sh # -# Copyright (C) 2000-2021 by +# Copyright (C) 2000-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/unix/freetype2.in b/thirdparty/freetype/builds/unix/freetype2.in index 2d759ecf8b..fe389f4b6f 100644 --- a/thirdparty/freetype/builds/unix/freetype2.in +++ b/thirdparty/freetype/builds/unix/freetype2.in @@ -7,8 +7,8 @@ Name: FreeType 2 URL: https://freetype.org Description: A free, high-quality, and portable font engine. Version: %ft_version% -Requires: -Requires.private: %REQUIRES_PRIVATE% -Libs: -L${libdir} -lfreetype -Libs.private: %LIBS_PRIVATE% +Requires: %PKGCONFIG_REQUIRES% +Requires.private: %PKGCONFIG_REQUIRES_PRIVATE% +Libs: %PKGCONFIG_LIBS% +Libs.private: %PKGCONFIG_LIBS_PRIVATE% Cflags: -I${includedir}/freetype2 diff --git a/thirdparty/freetype/builds/unix/freetype2.m4 b/thirdparty/freetype/builds/unix/freetype2.m4 index 478a422105..0cafc8e8cd 100644 --- a/thirdparty/freetype/builds/unix/freetype2.m4 +++ b/thirdparty/freetype/builds/unix/freetype2.m4 @@ -1,7 +1,7 @@ # Configure paths for FreeType2 # Marcelo Magallon 2001-10-26, based on `gtk.m4` by Owen Taylor # -# Copyright (C) 2001-2021 by +# Copyright (C) 2001-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/unix/ft-munmap.m4 b/thirdparty/freetype/builds/unix/ft-munmap.m4 index 275481ba11..c536febb23 100644 --- a/thirdparty/freetype/builds/unix/ft-munmap.m4 +++ b/thirdparty/freetype/builds/unix/ft-munmap.m4 @@ -1,6 +1,6 @@ ## FreeType specific autoconf tests # -# Copyright (C) 2002-2021 by +# Copyright (C) 2002-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/unix/ftconfig.h.in b/thirdparty/freetype/builds/unix/ftconfig.h.in index b42fe42f9b..67474dcef1 100644 --- a/thirdparty/freetype/builds/unix/ftconfig.h.in +++ b/thirdparty/freetype/builds/unix/ftconfig.h.in @@ -4,7 +4,7 @@ * * UNIX-specific configuration file (specification only). * - * Copyright (C) 1996-2021 by + * Copyright (C) 1996-2022 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/thirdparty/freetype/builds/unix/ftsystem.c b/thirdparty/freetype/builds/unix/ftsystem.c index 81ed928584..4d2870b596 100644 --- a/thirdparty/freetype/builds/unix/ftsystem.c +++ b/thirdparty/freetype/builds/unix/ftsystem.c @@ -4,7 +4,7 @@ * * Unix-specific FreeType low-level system interface (body). * - * Copyright (C) 1996-2021 by + * Copyright (C) 1996-2022 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/thirdparty/freetype/builds/unix/install.mk b/thirdparty/freetype/builds/unix/install.mk index 45b761d535..0758d6e1a5 100644 --- a/thirdparty/freetype/builds/unix/install.mk +++ b/thirdparty/freetype/builds/unix/install.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/unix/unix-cc.in b/thirdparty/freetype/builds/unix/unix-cc.in index 89be450167..d5ae467452 100644 --- a/thirdparty/freetype/builds/unix/unix-cc.in +++ b/thirdparty/freetype/builds/unix/unix-cc.in @@ -2,7 +2,7 @@ # FreeType 2 template for Unix-specific compiler definitions # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -106,9 +106,7 @@ endif # Linker flags. # -LDFLAGS := @LDFLAGS@ -LIB_CLOCK_GETTIME := @LIB_CLOCK_GETTIME@ # for ftbench - +LDFLAGS := @LDFLAGS@ # export symbols # @@ -118,11 +116,15 @@ EXPORTS_LIST := $(OBJ_DIR)/ftexport.sym CCexe := $(CCraw_build) # used to compile `apinames' only -# Library linking +# Library linking. # LINK_LIBRARY = $(LIBTOOL) --mode=link $(CCraw) -o $@ $(OBJECTS_LIST) \ -rpath $(libdir) -version-info $(version_info) \ $(LDFLAGS) -no-undefined \ -export-symbols $(EXPORTS_LIST) +# For the demo programs. +FT_DEMO_CFLAGS := @FT_DEMO_CFLAGS@ +FT_DEMO_LDFLAGS := @FT_DEMO_LDFLAGS@ + # EOF diff --git a/thirdparty/freetype/builds/unix/unix-def.in b/thirdparty/freetype/builds/unix/unix-def.in index d0c758d03f..8e298ac591 100644 --- a/thirdparty/freetype/builds/unix/unix-def.in +++ b/thirdparty/freetype/builds/unix/unix-def.in @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -68,12 +68,14 @@ version_info := @version_info@ # Variables needed for `freetype-config' and `freetype.pc'. # -PKG_CONFIG := @PKG_CONFIG@ -REQUIRES_PRIVATE := @REQUIRES_PRIVATE@ -LIBS_PRIVATE := @LIBS_PRIVATE@ -LIBSSTATIC_CONFIG := @LIBSSTATIC_CONFIG@ -build_libtool_libs := @build_libtool_libs@ -ft_version := @ft_version@ +PKG_CONFIG := @PKG_CONFIG@ +PKGCONFIG_REQUIRES := @PKGCONFIG_REQUIRES@ +PKGCONFIG_REQUIRES_PRIVATE := @PKGCONFIG_REQUIRES_PRIVATE@ +PKGCONFIG_LIBS := @PKGCONFIG_LIBS@ +PKGCONFIG_LIBS_PRIVATE := @PKGCONFIG_LIBS_PRIVATE@ +LIBSSTATIC_CONFIG := @LIBSSTATIC_CONFIG@ +build_libtool_libs := @build_libtool_libs@ +ft_version := @ft_version@ # The directory where all library files are placed. # @@ -137,15 +139,17 @@ prefix_x := $(subst $(space),\\$(space),$(prefix)) $(OBJ_BUILD)/freetype2.pc: $(TOP_DIR)/builds/unix/freetype2.in rm -f $@ $@.tmp - sed -e 's|%REQUIRES_PRIVATE%|$(REQUIRES_PRIVATE)|' \ - -e 's|%LIBS_PRIVATE%|$(LIBS_PRIVATE)|' \ - -e 's|%build_libtool_libs%|$(build_libtool_libs)|' \ - -e 's|%exec_prefix%|$(exec_prefix_x)|' \ - -e 's|%ft_version%|$(ft_version)|' \ - -e 's|%includedir%|$(includedir_x)|' \ - -e 's|%libdir%|$(libdir_x)|' \ - -e 's|%prefix%|$(prefix_x)|' \ - $< \ + sed -e 's|%PKGCONFIG_REQUIRES%|$(PKGCONFIG_REQUIRES)|' \ + -e 's|%PKGCONFIG_REQUIRES_PRIVATE%|$(PKGCONFIG_REQUIRES_PRIVATE)|' \ + -e 's|%PKGCONFIG_LIBS%|$(PKGCONFIG_LIBS)|' \ + -e 's|%PKGCONFIG_LIBS_PRIVATE%|$(PKGCONFIG_LIBS_PRIVATE)|' \ + -e 's|%build_libtool_libs%|$(build_libtool_libs)|' \ + -e 's|%exec_prefix%|$(exec_prefix_x)|' \ + -e 's|%ft_version%|$(ft_version)|' \ + -e 's|%includedir%|$(includedir_x)|' \ + -e 's|%libdir%|$(libdir_x)|' \ + -e 's|%prefix%|$(prefix_x)|' \ + $< \ > $@.tmp chmod a-w $@.tmp mv $@.tmp $@ diff --git a/thirdparty/freetype/builds/unix/unix-dev.mk b/thirdparty/freetype/builds/unix/unix-dev.mk index 0b572a034b..37543895b2 100644 --- a/thirdparty/freetype/builds/unix/unix-dev.mk +++ b/thirdparty/freetype/builds/unix/unix-dev.mk @@ -6,7 +6,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/unix/unix-lcc.mk b/thirdparty/freetype/builds/unix/unix-lcc.mk index db57835a0c..0198adfd87 100644 --- a/thirdparty/freetype/builds/unix/unix-lcc.mk +++ b/thirdparty/freetype/builds/unix/unix-lcc.mk @@ -6,7 +6,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/unix/unix.mk b/thirdparty/freetype/builds/unix/unix.mk index 262fafb748..e660fafa9d 100644 --- a/thirdparty/freetype/builds/unix/unix.mk +++ b/thirdparty/freetype/builds/unix/unix.mk @@ -3,7 +3,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/unix/unixddef.mk b/thirdparty/freetype/builds/unix/unixddef.mk index 77c2a0df5c..923773e091 100644 --- a/thirdparty/freetype/builds/unix/unixddef.mk +++ b/thirdparty/freetype/builds/unix/unixddef.mk @@ -4,7 +4,7 @@ # -# Copyright (C) 1996-2021 by +# Copyright (C) 1996-2022 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/thirdparty/freetype/builds/vms/ftconfig.h b/thirdparty/freetype/builds/vms/ftconfig.h index 2445b7d792..8f5ca96713 100644 --- a/thirdparty/freetype/builds/vms/ftconfig.h +++ b/thirdparty/freetype/builds/vms/ftconfig.h @@ -4,7 +4,7 @@ * * VMS-specific configuration file (specification only). * - * Copyright (C) 1996-2021 by + * Copyright (C) 1996-2022 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/thirdparty/freetype/builds/vms/ftsystem.c b/thirdparty/freetype/builds/vms/ftsystem.c index 31b08708f7..e700eac5c8 100644 --- a/thirdparty/freetype/builds/vms/ftsystem.c +++ b/thirdparty/freetype/builds/vms/ftsystem.c @@ -4,7 +4,7 @@ /* */ /* VMS-specific FreeType low-level system interface (body). */ /* */ -/* Copyright (C) 1996-2021 by */ +/* Copyright (C) 1996-2022 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/thirdparty/freetype/builds/wince/ftdebug.c b/thirdparty/freetype/builds/wince/ftdebug.c index 9e17776615..7a4fac5d21 100644 --- a/thirdparty/freetype/builds/wince/ftdebug.c +++ b/thirdparty/freetype/builds/wince/ftdebug.c @@ -4,7 +4,7 @@ * * Debugging and logging component for WinCE (body). * - * Copyright (C) 1996-2021 by + * Copyright (C) 1996-2022 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, diff --git a/thirdparty/freetype/builds/wince/vc2005-ce/index.html b/thirdparty/freetype/builds/wince/vc2005-ce/index.html index 3e42cf9925..2289c76b80 100644 --- a/thirdparty/freetype/builds/wince/vc2005-ce/index.html +++ b/thirdparty/freetype/builds/wince/vc2005-ce/index.html @@ -21,7 +21,7 @@ the following targets:
  • PPC/SP WM6 (Windows Mobile 6)
  • -It compiles the following libraries from the FreeType 2.11.1 sources:

    +It compiles the following libraries from the FreeType 2.12.0 sources:

      diff --git a/thirdparty/freetype/builds/wince/vc2008-ce/index.html b/thirdparty/freetype/builds/wince/vc2008-ce/index.html
      index 645675c721..de0f340581 100644
      --- a/thirdparty/freetype/builds/wince/vc2008-ce/index.html
      +++ b/thirdparty/freetype/builds/wince/vc2008-ce/index.html
      @@ -21,7 +21,7 @@ the following targets:
         
    • PPC/SP WM6 (Windows Mobile 6)
    -It compiles the following libraries from the FreeType 2.11.1 sources:

    +It compiles the following libraries from the FreeType 2.12.0 sources:

      diff --git a/thirdparty/freetype/builds/windows/detect.mk b/thirdparty/freetype/builds/windows/detect.mk
      index 3eef47aaa9..759a2e640a 100644
      --- a/thirdparty/freetype/builds/windows/detect.mk
      +++ b/thirdparty/freetype/builds/windows/detect.mk
      @@ -3,7 +3,7 @@
       #
       
       
      -# Copyright (C) 1996-2021 by
      +# Copyright (C) 1996-2022 by
       # David Turner, Robert Wilhelm, and Werner Lemberg.
       #
       # This file is part of the FreeType project, and may only be used, modified,
      diff --git a/thirdparty/freetype/builds/windows/ftdebug.c b/thirdparty/freetype/builds/windows/ftdebug.c
      index 94c22da752..a65f544694 100644
      --- a/thirdparty/freetype/builds/windows/ftdebug.c
      +++ b/thirdparty/freetype/builds/windows/ftdebug.c
      @@ -4,7 +4,7 @@
        *
        *   Debugging and logging component for Win32 (body).
        *
      - * Copyright (C) 1996-2021 by
      + * Copyright (C) 1996-2022 by
        * David Turner, Robert Wilhelm, and Werner Lemberg.
        *
        * This file is part of the FreeType project, and may only be used,
      @@ -136,6 +136,8 @@
       
           va_start( ap, fmt );
           vfprintf( stderr, fmt, ap );
      +#if ( defined( _WIN32_WINNT ) && _WIN32_WINNT >= 0x0400 ) || \
      +    ( defined( _WIN32_WCE )   && _WIN32_WCE   >= 0x0600 )
           if ( IsDebuggerPresent() )
           {
             static char  buf[1024];
      @@ -144,6 +146,7 @@
             vsnprintf( buf, sizeof buf, fmt, ap );
             OutputDebugStringA( buf );
           }
      +#endif
           va_end( ap );
         }
       
      @@ -159,6 +162,8 @@
       
           va_start( ap, fmt );
           vfprintf( stderr, fmt, ap );
      +#if ( defined( _WIN32_WINNT ) && _WIN32_WINNT >= 0x0400 ) || \
      +    ( defined( _WIN32_WCE )   && _WIN32_WCE   >= 0x0600 )
           if ( IsDebuggerPresent() )
           {
             static char  buf[1024];
      @@ -167,6 +172,7 @@
             vsnprintf( buf, sizeof buf, fmt, ap );
             OutputDebugStringA( buf );
           }
      +#endif
           va_end( ap );
       
           exit( EXIT_FAILURE );
      diff --git a/thirdparty/freetype/builds/windows/ftsystem.c b/thirdparty/freetype/builds/windows/ftsystem.c
      index 1ebadd49ff..4f4ac15f33 100644
      --- a/thirdparty/freetype/builds/windows/ftsystem.c
      +++ b/thirdparty/freetype/builds/windows/ftsystem.c
      @@ -4,7 +4,7 @@
        *
        *   Windows-specific FreeType low-level system interface (body).
        *
      - * Copyright (C) 2021 by
      + * Copyright (C) 2021-2022 by
        * David Turner, Robert Wilhelm, and Werner Lemberg.
        *
        * This file is part of the FreeType project, and may only be used,
      @@ -196,19 +196,78 @@
         }
       
       
      -#ifdef _WIN32_WCE
      +  /* non-desktop Universal Windows Platform */
      +#if defined( WINAPI_FAMILY_PARTITION )                 && \
      +    !WINAPI_FAMILY_PARTITION( WINAPI_PARTITION_DESKTOP )
      +
      +#define PACK_DWORD64( hi, lo )  ( ( (DWORD64)(hi) << 32 ) | (DWORD)(lo) )
      +
      +#define CreateFileMapping( a, b, c, d, e, f )                          \
      +          CreateFileMappingFromApp( a, b, c, PACK_DWORD64( d, e ), f )
      +#define MapViewOfFile( a, b, c, d, e )                                 \
      +          MapViewOfFileFromApp( a, b, PACK_DWORD64( c, d ), e )
       
         FT_LOCAL_DEF( HANDLE )
      -  CreateFileA( LPCSTR                lpFileName,
      -               DWORD                 dwDesiredAccess,
      -               DWORD                 dwShareMode,
      -               LPSECURITY_ATTRIBUTES lpSecurityAttributes,
      -               DWORD                 dwCreationDisposition,
      -               DWORD                 dwFlagsAndAttributes,
      -               HANDLE                hTemplateFile )
      +  CreateFileA( LPCSTR                 lpFileName,
      +               DWORD                  dwDesiredAccess,
      +               DWORD                  dwShareMode,
      +               LPSECURITY_ATTRIBUTES  lpSecurityAttributes,
      +               DWORD                  dwCreationDisposition,
      +               DWORD                  dwFlagsAndAttributes,
      +               HANDLE                 hTemplateFile )
         {
      -    int            len;
      -    LPWSTR         lpFileNameW;
      +    int     len;
      +    LPWSTR  lpFileNameW;
      +
      +    CREATEFILE2_EXTENDED_PARAMETERS  createExParams = {
      +      sizeof ( CREATEFILE2_EXTENDED_PARAMETERS ),
      +      dwFlagsAndAttributes & 0x0000FFFF,
      +      dwFlagsAndAttributes & 0xFFF00000,
      +      dwFlagsAndAttributes & 0x000F0000,
      +      lpSecurityAttributes,
      +      hTemplateFile };
      +
      +
      +    /* allocate memory space for converted path name */
      +    len = MultiByteToWideChar( CP_ACP, MB_ERR_INVALID_CHARS,
      +                               lpFileName, -1, NULL, 0 );
      +
      +    lpFileNameW = (LPWSTR)_alloca( len * sizeof ( WCHAR ) );
      +
      +    if ( !len || !lpFileNameW )
      +    {
      +      FT_ERROR(( "FT_Stream_Open: cannot convert file name to LPWSTR\n" ));
      +      return INVALID_HANDLE_VALUE;
      +    }
      +
      +    /* now it is safe to do the translation */
      +    MultiByteToWideChar( CP_ACP, MB_ERR_INVALID_CHARS,
      +                         lpFileName, -1, lpFileNameW, len );
      +
      +    /* open the file */
      +    return CreateFile2( lpFileNameW, dwDesiredAccess, dwShareMode,
      +                        dwCreationDisposition, &createExParams );
      +  }
      +
      +#endif
      +
      +
      +#if defined( _WIN32_WCE )
      +
      +  /* malloc.h provides implementation of alloca()/_alloca() */
      +  #include 
      +
      +  FT_LOCAL_DEF( HANDLE )
      +  CreateFileA( LPCSTR                 lpFileName,
      +               DWORD                  dwDesiredAccess,
      +               DWORD                  dwShareMode,
      +               LPSECURITY_ATTRIBUTES  lpSecurityAttributes,
      +               DWORD                  dwCreationDisposition,
      +               DWORD                  dwFlagsAndAttributes,
      +               HANDLE                 hTemplateFile )
      +  {
      +    int     len;
      +    LPWSTR  lpFileNameW;
       
       
           /* allocate memory space for converted path name */
      @@ -233,10 +292,15 @@
                               dwFlagsAndAttributes, hTemplateFile );
         }
       
      +#endif
      +
      +
      +#if defined( _WIN32_WCE ) || defined ( _WIN32_WINDOWS ) || \
      +    !defined( _WIN32_WINNT ) || _WIN32_WINNT <= 0x0400
       
         FT_LOCAL_DEF( BOOL )
      -  GetFileSizeEx( HANDLE         hFile,
      -                 PLARGE_INTEGER lpFileSize )
      +  GetFileSizeEx( HANDLE          hFile,
      +                 PLARGE_INTEGER  lpFileSize )
         {
           lpFileSize->u.LowPart = GetFileSize( hFile,
                                                (DWORD *)&lpFileSize->u.HighPart );
      @@ -248,7 +312,7 @@
             return TRUE;
         }
       
      -#endif /* _WIN32_WCE */
      +#endif
       
       
         /* documentation is in ftobjs.h */
      diff --git a/thirdparty/freetype/builds/windows/vc2010/freetype.vcxproj b/thirdparty/freetype/builds/windows/vc2010/freetype.vcxproj
      index def89540a9..7ac4c2b3de 100644
      --- a/thirdparty/freetype/builds/windows/vc2010/freetype.vcxproj
      +++ b/thirdparty/freetype/builds/windows/vc2010/freetype.vcxproj
      @@ -485,6 +485,7 @@
           
      
           
      
           
      
      +    
      
           
      
           
      
           
      
      diff --git a/thirdparty/freetype/builds/windows/vc2010/freetype.vcxproj.filters b/thirdparty/freetype/builds/windows/vc2010/freetype.vcxproj.filters
      index fb27a3637e..0bb4107682 100644
      --- a/thirdparty/freetype/builds/windows/vc2010/freetype.vcxproj.filters
      +++ b/thirdparty/freetype/builds/windows/vc2010/freetype.vcxproj.filters
      @@ -68,6 +68,9 @@
           
      
             Source Files
      
           
      
      +    
      
      +      Source Files
      
      +    
      
           
      
             Source Files
      
           
      
      @@ -143,4 +146,4 @@
             Source Files
      
           
      
         
      
      -
      \ No newline at end of file
      +
      
      diff --git a/thirdparty/freetype/builds/windows/vc2010/index.html b/thirdparty/freetype/builds/windows/vc2010/index.html
      index dcb1944b82..02b9c1b30d 100644
      --- a/thirdparty/freetype/builds/windows/vc2010/index.html
      +++ b/thirdparty/freetype/builds/windows/vc2010/index.html
      @@ -12,7 +12,7 @@
       

      This directory contains solution and project files for Visual C++ 2010 or newer, named freetype.sln, and freetype.vcxproj. It compiles the following libraries -from the FreeType 2.11.1 sources:

      +from the FreeType 2.12.0 sources:

      • freetype.dll using 'Release' or 'Debug' configurations
      • diff --git a/thirdparty/freetype/builds/windows/visualc/freetype.vcproj b/thirdparty/freetype/builds/windows/visualc/freetype.vcproj index 129dc29222..3fafcd4f09 100644 --- a/thirdparty/freetype/builds/windows/visualc/freetype.vcproj +++ b/thirdparty/freetype/builds/windows/visualc/freetype.vcproj @@ -434,10 +434,18 @@ /> + + + + diff --git a/thirdparty/freetype/builds/windows/visualc/index.html b/thirdparty/freetype/builds/windows/visualc/index.html index d0c8f2f947..0dabfe2b9f 100644 --- a/thirdparty/freetype/builds/windows/visualc/index.html +++ b/thirdparty/freetype/builds/windows/visualc/index.html @@ -12,7 +12,7 @@

        This directory contains project files freetype.dsp for Visual C++ 6.0, and freetype.vcproj for Visual C++ 2002 through 2008, which you might need to upgrade automatically. -It compiles the following libraries from the FreeType 2.11.1 sources:

        +It compiles the following libraries from the FreeType 2.12.0 sources:

        • freetype.dll using 'Release' or 'Debug' configurations
        • diff --git a/thirdparty/freetype/builds/windows/visualce/index.html b/thirdparty/freetype/builds/windows/visualce/index.html index b50ef79b06..d11978e37c 100644 --- a/thirdparty/freetype/builds/windows/visualce/index.html +++ b/thirdparty/freetype/builds/windows/visualce/index.html @@ -21,7 +21,7 @@ the following targets:
        • PPC/SP WM6 (Windows Mobile 6)
        -It compiles the following libraries from the FreeType 2.11.1 sources:

        +It compiles the following libraries from the FreeType 2.12.0 sources:

          diff --git a/thirdparty/freetype/builds/windows/w32-bcc.mk b/thirdparty/freetype/builds/windows/w32-bcc.mk
          index d497dd15dc..b88dbac6ed 100644
          --- a/thirdparty/freetype/builds/windows/w32-bcc.mk
          +++ b/thirdparty/freetype/builds/windows/w32-bcc.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/builds/windows/w32-bccd.mk b/thirdparty/freetype/builds/windows/w32-bccd.mk
          index 701b83d25c..2be492cef1 100644
          --- a/thirdparty/freetype/builds/windows/w32-bccd.mk
          +++ b/thirdparty/freetype/builds/windows/w32-bccd.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/builds/windows/w32-dev.mk b/thirdparty/freetype/builds/windows/w32-dev.mk
          index a2f464479e..a58f8247d2 100644
          --- a/thirdparty/freetype/builds/windows/w32-dev.mk
          +++ b/thirdparty/freetype/builds/windows/w32-dev.mk
          @@ -5,7 +5,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/builds/windows/w32-gcc.mk b/thirdparty/freetype/builds/windows/w32-gcc.mk
          index 4117453ec3..52b893339f 100644
          --- a/thirdparty/freetype/builds/windows/w32-gcc.mk
          +++ b/thirdparty/freetype/builds/windows/w32-gcc.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/builds/windows/w32-icc.mk b/thirdparty/freetype/builds/windows/w32-icc.mk
          index ebab45ef2c..a05a3a7896 100644
          --- a/thirdparty/freetype/builds/windows/w32-icc.mk
          +++ b/thirdparty/freetype/builds/windows/w32-icc.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/builds/windows/w32-intl.mk b/thirdparty/freetype/builds/windows/w32-intl.mk
          index 0fef8d7245..fb5c96090f 100644
          --- a/thirdparty/freetype/builds/windows/w32-intl.mk
          +++ b/thirdparty/freetype/builds/windows/w32-intl.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/builds/windows/w32-lcc.mk b/thirdparty/freetype/builds/windows/w32-lcc.mk
          index 7aed5b5177..66de0aa564 100644
          --- a/thirdparty/freetype/builds/windows/w32-lcc.mk
          +++ b/thirdparty/freetype/builds/windows/w32-lcc.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/builds/windows/w32-mingw32.mk b/thirdparty/freetype/builds/windows/w32-mingw32.mk
          index 6731778855..e3b89697a6 100644
          --- a/thirdparty/freetype/builds/windows/w32-mingw32.mk
          +++ b/thirdparty/freetype/builds/windows/w32-mingw32.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/builds/windows/w32-vcc.mk b/thirdparty/freetype/builds/windows/w32-vcc.mk
          index 278624f375..4a48407a27 100644
          --- a/thirdparty/freetype/builds/windows/w32-vcc.mk
          +++ b/thirdparty/freetype/builds/windows/w32-vcc.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/builds/windows/w32-wat.mk b/thirdparty/freetype/builds/windows/w32-wat.mk
          index df2ece3656..4458b23418 100644
          --- a/thirdparty/freetype/builds/windows/w32-wat.mk
          +++ b/thirdparty/freetype/builds/windows/w32-wat.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/builds/windows/win32-def.mk b/thirdparty/freetype/builds/windows/win32-def.mk
          index 15bfd0cfd1..eb96181ddc 100644
          --- a/thirdparty/freetype/builds/windows/win32-def.mk
          +++ b/thirdparty/freetype/builds/windows/win32-def.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/configure b/thirdparty/freetype/configure
          index 584e6ec380..404f13ce2d 100755
          --- a/thirdparty/freetype/configure
          +++ b/thirdparty/freetype/configure
          @@ -1,6 +1,6 @@
           #!/bin/sh
           #
          -# Copyright (C) 2002-2021 by
          +# Copyright (C) 2002-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/devel/ft2build.h b/thirdparty/freetype/devel/ft2build.h
          index 117532ba49..92bc9e01a1 100644
          --- a/thirdparty/freetype/devel/ft2build.h
          +++ b/thirdparty/freetype/devel/ft2build.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType 2 build and setup macros (development version).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/devel/ftoption.h b/thirdparty/freetype/devel/ftoption.h
          index f92b4167aa..b2363d74c1 100644
          --- a/thirdparty/freetype/devel/ftoption.h
          +++ b/thirdparty/freetype/devel/ftoption.h
          @@ -4,7 +4,7 @@
            *
            *   User-selectable configuration macros (specification only).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -219,6 +219,10 @@ FT_BEGIN_HEADER
              *   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.
          +   *
          +   *   If you use the GNU make build system directly (that is, without the
          +   *   `configure` script) and you define this macro, you also have to pass
          +   *   `SYSTEM_ZLIB=yes` as an argument to make.
              */
           /* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */
           
          @@ -521,6 +525,20 @@ FT_BEGIN_HEADER
           #undef FT_CONFIG_OPTION_USE_MODULE_ERRORS
           
           
          +  /**************************************************************************
          +   *
          +   * OpenType SVG Glyph Support
          +   *
          +   *   Setting this macro enables support for OpenType SVG glyphs.  By
          +   *   default, FreeType can only fetch SVG documents.  However, it can also
          +   *   render them if external rendering hook functions are plugged in at
          +   *   runtime.
          +   *
          +   *   More details on the hooks can be found in file `otsvg.h`.
          +   */
          +#define FT_CONFIG_OPTION_SVG
          +
          +
             /**************************************************************************
              *
              * Error Strings
          @@ -1000,8 +1018,8 @@ FT_BEGIN_HEADER
           #error "Invalid CFF darkening parameters!"
           #endif
           
          -FT_END_HEADER
           
          +FT_END_HEADER
           
           #endif /* FTOPTION_H_ */
           
          diff --git a/thirdparty/freetype/include/freetype/config/ftconfig.h b/thirdparty/freetype/include/freetype/config/ftconfig.h
          index 65effcbe63..c696e900a6 100644
          --- a/thirdparty/freetype/include/freetype/config/ftconfig.h
          +++ b/thirdparty/freetype/include/freetype/config/ftconfig.h
          @@ -4,7 +4,7 @@
            *
            *   ANSI-specific configuration file (specification only).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/config/ftheader.h b/thirdparty/freetype/include/freetype/config/ftheader.h
          index e46d314e33..a8c6833df7 100644
          --- a/thirdparty/freetype/include/freetype/config/ftheader.h
          +++ b/thirdparty/freetype/include/freetype/config/ftheader.h
          @@ -4,7 +4,7 @@
            *
            *   Build macros of the FreeType 2 library.
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -777,6 +777,18 @@
           #define FT_COLOR_H  
           
           
          +  /**************************************************************************
          +   *
          +   * @macro:
          +   *   FT_OTSVG_H
          +   *
          +   * @description:
          +   *   A macro used in `#include` statements to name the file containing the
          +   *   FreeType~2 API which handles the OpenType 'SVG~' glyphs.
          +   */
          +#define FT_OTSVG_H  
          +
          +
             /* */
           
             /* These header files don't need to be included by the user. */
          diff --git a/thirdparty/freetype/include/freetype/config/ftmodule.h b/thirdparty/freetype/include/freetype/config/ftmodule.h
          index d4ba3f784d..b315baba8a 100644
          --- a/thirdparty/freetype/include/freetype/config/ftmodule.h
          +++ b/thirdparty/freetype/include/freetype/config/ftmodule.h
          @@ -28,5 +28,6 @@ FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
           FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )
           FT_USE_MODULE( FT_Renderer_Class, ft_sdf_renderer_class )
           FT_USE_MODULE( FT_Renderer_Class, ft_bitmap_sdf_renderer_class )
          +FT_USE_MODULE( FT_Renderer_Class, ft_svg_renderer_class )
           
           /* EOF */
          diff --git a/thirdparty/freetype/include/freetype/config/ftoption.h b/thirdparty/freetype/include/freetype/config/ftoption.h
          index 4227fd376e..c5bde243b1 100644
          --- a/thirdparty/freetype/include/freetype/config/ftoption.h
          +++ b/thirdparty/freetype/include/freetype/config/ftoption.h
          @@ -4,7 +4,7 @@
            *
            *   User-selectable configuration macros (specification only).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -219,6 +219,10 @@ FT_BEGIN_HEADER
              *   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.
          +   *
          +   *   If you use the GNU make build system directly (that is, without the
          +   *   `configure` script) and you define this macro, you also have to pass
          +   *   `SYSTEM_ZLIB=yes` as an argument to make.
              */
           /* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */
           
          @@ -523,6 +527,20 @@ FT_BEGIN_HEADER
           #undef FT_CONFIG_OPTION_USE_MODULE_ERRORS
           
           
          +  /**************************************************************************
          +   *
          +   * OpenType SVG Glyph Support
          +   *
          +   *   Setting this macro enables support for OpenType SVG glyphs.  By
          +   *   default, FreeType can only fetch SVG documents.  However, it can also
          +   *   render them if external rendering hook functions are plugged in at
          +   *   runtime.
          +   *
          +   *   More details on the hooks can be found in file `otsvg.h`.
          +   */
          +#define FT_CONFIG_OPTION_SVG
          +
          +
             /**************************************************************************
              *
              * Error Strings
          @@ -1002,8 +1020,8 @@ FT_BEGIN_HEADER
           #error "Invalid CFF darkening parameters!"
           #endif
           
          -FT_END_HEADER
           
          +FT_END_HEADER
           
           #endif /* FTOPTION_H_ */
           
          diff --git a/thirdparty/freetype/include/freetype/config/ftstdlib.h b/thirdparty/freetype/include/freetype/config/ftstdlib.h
          index 6ee412a074..7958c2a5f7 100644
          --- a/thirdparty/freetype/include/freetype/config/ftstdlib.h
          +++ b/thirdparty/freetype/include/freetype/config/ftstdlib.h
          @@ -5,7 +5,7 @@
            *   ANSI-specific library and header configuration file (specification
            *   only).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/config/integer-types.h b/thirdparty/freetype/include/freetype/config/integer-types.h
          index 5ef09f1978..d9d2638d1e 100644
          --- a/thirdparty/freetype/include/freetype/config/integer-types.h
          +++ b/thirdparty/freetype/include/freetype/config/integer-types.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType integer types definitions.
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -221,9 +221,10 @@
           #define FT_INT64   __int64
           #define FT_UINT64  unsigned __int64
           
          -#elif defined( __WATCOMC__ )   /* Watcom C++ */
          +#elif defined( __WATCOMC__ ) && __WATCOMC__ >= 1100  /* Watcom C++ */
           
          -  /* Watcom doesn't provide 64-bit data types */
          +#define FT_INT64   long long int
          +#define FT_UINT64  unsigned long long int
           
           #elif defined( __MWERKS__ )    /* Metrowerks CodeWarrior */
           
          diff --git a/thirdparty/freetype/include/freetype/config/mac-support.h b/thirdparty/freetype/include/freetype/config/mac-support.h
          index ef58d8b3f0..e42c9fe410 100644
          --- a/thirdparty/freetype/include/freetype/config/mac-support.h
          +++ b/thirdparty/freetype/include/freetype/config/mac-support.h
          @@ -4,7 +4,7 @@
            *
            *   Mac/OS X support configuration header.
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/config/public-macros.h b/thirdparty/freetype/include/freetype/config/public-macros.h
          index 9fbb3274a0..0074134f1d 100644
          --- a/thirdparty/freetype/include/freetype/config/public-macros.h
          +++ b/thirdparty/freetype/include/freetype/config/public-macros.h
          @@ -4,7 +4,7 @@
            *
            *   Define a set of compiler macros used in public FreeType headers.
            *
          - * Copyright (C) 2020-2021 by
          + * Copyright (C) 2020-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/freetype.h b/thirdparty/freetype/include/freetype/freetype.h
          index f6c66b94ae..0ecd15a35b 100644
          --- a/thirdparty/freetype/include/freetype/freetype.h
          +++ b/thirdparty/freetype/include/freetype/freetype.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType high-level API and common types (specification only).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -153,6 +153,9 @@ FT_BEGIN_HEADER
              *   FT_FACE_FLAG_GLYPH_NAMES
              *   FT_FACE_FLAG_EXTERNAL_STREAM
              *   FT_FACE_FLAG_HINTER
          +   *   FT_FACE_FLAG_SVG
          +   *   FT_FACE_FLAG_SBIX
          +   *   FT_FACE_FLAG_SBIX_OVERLAY
              *
              *   FT_HAS_HORIZONTAL
              *   FT_HAS_VERTICAL
          @@ -161,6 +164,9 @@ FT_BEGIN_HEADER
              *   FT_HAS_GLYPH_NAMES
              *   FT_HAS_COLOR
              *   FT_HAS_MULTIPLE_MASTERS
          +   *   FT_HAS_SVG
          +   *   FT_HAS_SBIX
          +   *   FT_HAS_SBIX_OVERLAY
              *
              *   FT_IS_SFNT
              *   FT_IS_SCALABLE
          @@ -225,6 +231,7 @@ FT_BEGIN_HEADER
              *   FT_LOAD_NO_SCALE
              *   FT_LOAD_NO_HINTING
              *   FT_LOAD_NO_BITMAP
          +   *   FT_LOAD_SBITS_ONLY
              *   FT_LOAD_NO_AUTOHINT
              *   FT_LOAD_COLOR
              *
          @@ -522,13 +529,15 @@ FT_BEGIN_HEADER
              *   size.
              *
              * @note:
          -   *   An @FT_Face has one _active_ @FT_Size object that is used by functions
          -   *   like @FT_Load_Glyph to determine the scaling transformation that in
          -   *   turn is used to load and hint glyphs and metrics.
          +   *   An @FT_Face has one _active_ `FT_Size` object that is used by
          +   *   functions like @FT_Load_Glyph to determine the scaling transformation
          +   *   that in turn is used to load and hint glyphs and metrics.
              *
          -   *   You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, @FT_Request_Size
          +   *   A newly created `FT_Size` object contains only meaningless zero values.
          +   *   You must use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, @FT_Request_Size
              *   or even @FT_Select_Size to change the content (i.e., the scaling
          -   *   values) of the active @FT_Size.
          +   *   values) of the active `FT_Size`.  Otherwise, the scaling and hinting
          +   *   will not be performed.
              *
              *   You can use @FT_New_Size to create additional size objects for a given
              *   @FT_Face, but they won't be used by other functions until you activate
          @@ -1228,6 +1237,19 @@ FT_BEGIN_HEADER
              *     altered with @FT_Set_MM_Design_Coordinates,
              *     @FT_Set_Var_Design_Coordinates, or @FT_Set_Var_Blend_Coordinates.
              *     This flag is unset by a call to @FT_Set_Named_Instance.
          +   *
          +   *   FT_FACE_FLAG_SVG ::
          +   *     [Since 2.12] The face has an 'SVG~' OpenType table.
          +   *
          +   *   FT_FACE_FLAG_SBIX ::
          +   *     [Since 2.12] The face has an 'sbix' OpenType table *and* outlines.
          +   *     For such fonts, @FT_FACE_FLAG_SCALABLE is not set by default to
          +   *     retain backward compatibility.
          +   *
          +   *   FT_FACE_FLAG_SBIX_OVERLAY ::
          +   *     [Since 2.12] The face has an 'sbix' OpenType table where outlines
          +   *     should be drawn on top of bitmap strikes.
          +   *
              */
           #define FT_FACE_FLAG_SCALABLE          ( 1L <<  0 )
           #define FT_FACE_FLAG_FIXED_SIZES       ( 1L <<  1 )
          @@ -1245,6 +1267,9 @@ FT_BEGIN_HEADER
           #define FT_FACE_FLAG_TRICKY            ( 1L << 13 )
           #define FT_FACE_FLAG_COLOR             ( 1L << 14 )
           #define FT_FACE_FLAG_VARIATION         ( 1L << 15 )
          +#define FT_FACE_FLAG_SVG               ( 1L << 16 )
          +#define FT_FACE_FLAG_SBIX              ( 1L << 17 )
          +#define FT_FACE_FLAG_SBIX_OVERLAY      ( 1L << 18 )
           
           
             /**************************************************************************
          @@ -1485,6 +1510,124 @@ FT_BEGIN_HEADER
                     ( !!( (face)->face_flags & FT_FACE_FLAG_COLOR ) )
           
           
          +  /**************************************************************************
          +   *
          +   * @macro:
          +   *   FT_HAS_SVG
          +   *
          +   * @description:
          +   *   A macro that returns true whenever a face object contains an 'SVG~'
          +   *   OpenType table.
          +   *
          +   * @since:
          +   *   2.12
          +   */
          +#define FT_HAS_SVG( face ) \
          +          ( !!( (face)->face_flags & FT_FACE_FLAG_SVG ) )
          +
          +
          +  /**************************************************************************
          +   *
          +   * @macro:
          +   *   FT_HAS_SBIX
          +   *
          +   * @description:
          +   *   A macro that returns true whenever a face object contains an 'sbix'
          +   *   OpenType table *and* outline glyphs.
          +   *
          +   *   Currently, FreeType only supports bitmap glyphs in PNG format for this
          +   *   table (i.e., JPEG and TIFF formats are unsupported, as are
          +   *   Apple-specific formats not part of the OpenType specification).
          +   *
          +   * @note:
          +   *   For backward compatibility, a font with an 'sbix' table is treated as
          +   *   a bitmap-only face.  Using @FT_Open_Face with
          +   *   @FT_PARAM_TAG_IGNORE_SBIX, an application can switch off 'sbix'
          +   *   handling so that the face is treated as an ordinary outline font with
          +   *   scalable outlines.
          +   *
          +   *   Here is some pseudo code that roughly illustrates how to implement
          +   *   'sbix' handling according to the OpenType specification.
          +   *
          +   * ```
          +   *   if ( FT_HAS_SBIX( face ) )
          +   *   {
          +   *     // open font as a scalable one without sbix handling
          +   *     FT_Face       face2;
          +   *     FT_Parameter  param = { FT_PARAM_TAG_IGNORE_SBIX, NULL };
          +   *     FT_Open_Args  args  = { FT_OPEN_PARAMS | ...,
          +   *                             ...,
          +   *                             1, ¶m };
          +   *
          +   *
          +   *     FT_Open_Face( library, &args, 0, &face2 );
          +   *
          +   *     available_size` as necessary into
          +   *      `preferred_sizes`[*]>
          +   *
          +   *     for ( i = 0; i < face->num_fixed_sizes; i++ )
          +   *     {
          +   *       size = preferred_sizes[i].size;
          +   *
          +   *       error = FT_Set_Pixel_Sizes( face, size, size );
          +   *       
          +   *
          +   *       // check whether we have a glyph in a bitmap strike
          +   *       error = FT_Load_Glyph( face,
          +   *                              glyph_index,
          +   *                              FT_LOAD_SBITS_ONLY          |
          +   *                              FT_LOAD_BITMAP_METRICS_ONLY );
          +   *       if ( error == FT_Err_Invalid_Argument )
          +   *         continue;
          +   *       else if ( error )
          +   *         
          +   *       else
          +   *         break;
          +   *     }
          +   *
          +   *     if ( i != face->num_fixed_sizes )
          +   *       
          +   *
          +   *     if ( i == face->num_fixed_sizes  ||
          +   *          FT_HAS_SBIX_OVERLAY( face ) )
          +   *       
          +   *   }
          +   * ```
          +   *
          +   * [*] Assuming a target value of 400dpi and available strike sizes 100,
          +   * 200, 300, and 400dpi, a possible order might be [400, 200, 300, 100]:
          +   * scaling 200dpi to 400dpi usually gives better results than scaling
          +   * 300dpi to 400dpi; it is also much faster.  However, scaling 100dpi to
          +   * 400dpi can yield a too pixelated result, thus the preference might be
          +   * 300dpi over 100dpi.
          +   *
          +   * @since:
          +   *   2.12
          +   */
          +#define FT_HAS_SBIX( face ) \
          +          ( !!( (face)->face_flags & FT_FACE_FLAG_SBIX ) )
          +
          +
          +  /**************************************************************************
          +   *
          +   * @macro:
          +   *   FT_HAS_SBIX_OVERLAY
          +   *
          +   * @description:
          +   *   A macro that returns true whenever a face object contains an 'sbix'
          +   *   OpenType table with bit~1 in its `flags` field set, instructing the
          +   *   application to overlay the bitmap strike with the corresponding
          +   *   outline glyph.  See @FT_HAS_SBIX for pseudo code how to use it.
          +   *
          +   * @since:
          +   *   2.12
          +   */
          +#define FT_HAS_SBIX_OVERLAY( face ) \
          +          ( !!( (face)->face_flags & FT_FACE_FLAG_SBIX_OVERLAY ) )
          +
          +
             /**************************************************************************
              *
              * @enum:
          @@ -2702,8 +2845,8 @@ FT_BEGIN_HEADER
              *   'https://www.freetype.org/freetype2/docs/glyphs/glyphs-2.html'.
              *
              *   Contrary to @FT_Set_Char_Size, this function doesn't have special code
          -   *   to normalize zero-valued widths, heights, or resolutions (which lead
          -   *   to errors in most cases).
          +   *   to normalize zero-valued widths, heights, or resolutions, which are
          +   *   treated as @FT_LOAD_NO_SCALE.
              *
              *   Don't use this function if you are using the FreeType cache API.
              */
          @@ -2819,7 +2962,7 @@ FT_BEGIN_HEADER
              *
              *   load_flags ::
              *     A flag indicating what to load for this glyph.  The @FT_LOAD_XXX
          -   *     constants can be used to control the glyph loading process (e.g.,
          +   *     flags can be used to control the glyph loading process (e.g.,
              *     whether the outline should be scaled, whether to load bitmaps or
              *     not, whether to hint the outline, etc).
              *
          @@ -2827,8 +2970,10 @@ FT_BEGIN_HEADER
              *   FreeType error code.  0~means success.
              *
              * @note:
          -   *   The loaded glyph may be transformed.  See @FT_Set_Transform for the
          -   *   details.
          +   *   For proper scaling and hinting, the active @FT_Size object owned by
          +   *   the face has to be meaningfully initialized by calling
          +   *   @FT_Set_Char_Size before this function, for example.  The loaded
          +   *   glyph may be transformed.  See @FT_Set_Transform for the details.
              *
              *   For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument` is returned
              *   for invalid CID values (this is, for CID values that don't have a
          @@ -2918,6 +3063,8 @@ FT_BEGIN_HEADER
              *
              *   FT_LOAD_NO_SCALE ::
              *     Don't scale the loaded outline glyph but keep it in font units.
          +   *     This flag is also assumed if @FT_Size owned by the face was not
          +   *     properly initialized.
              *
              *     This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and
              *     unsets @FT_LOAD_RENDER.
          @@ -2948,6 +3095,15 @@ FT_BEGIN_HEADER
              *
              *     @FT_LOAD_NO_SCALE always sets this flag.
              *
          +   *   FT_LOAD_SBITS_ONLY ::
          +   *     [Since 2.12] This is the opposite of @FT_LOAD_NO_BITMAP, more or
          +   *     less: @FT_Load_Glyph returns `FT_Err_Invalid_Argument` if the face
          +   *     contains a bitmap strike for the given size (or the strike selected
          +   *     by @FT_Select_Size) but there is no glyph in the strike.
          +   *
          +   *     Note that this load flag was part of FreeType since version 2.0.6
          +   *     but previously tagged as internal.
          +   *
              *   FT_LOAD_VERTICAL_LAYOUT ::
              *     Load the glyph for vertical text layout.  In particular, the
              *     `advance` value in the @FT_GlyphSlotRec structure is set to the
          @@ -3004,21 +3160,31 @@ FT_BEGIN_HEADER
              *     Disable the auto-hinter.  See also the note below.
              *
              *   FT_LOAD_COLOR ::
          -   *     Load colored glyphs.  There are slight differences depending on the
          -   *     font format.
          +   *     Load colored glyphs.  FreeType searches in the following order;
          +   *     there are slight differences depending on the font format.
              *
          -   *     [Since 2.5] Load embedded color bitmap images.  The resulting color
          -   *     bitmaps, if available, will have the @FT_PIXEL_MODE_BGRA format,
          -   *     with pre-multiplied color channels.  If the flag is not set and
          -   *     color bitmaps are found, they are converted to 256-level gray
          -   *     bitmaps, using the @FT_PIXEL_MODE_GRAY format.
          +   *     [Since 2.5] Load embedded color bitmap images (provided
          +   *     @FT_LOAD_NO_BITMAP is not set).  The resulting color bitmaps, if
          +   *     available, have the @FT_PIXEL_MODE_BGRA format, with pre-multiplied
          +   *     color channels.  If the flag is not set and color bitmaps are found,
          +   *     they are converted to 256-level gray bitmaps, using the
          +   *     @FT_PIXEL_MODE_GRAY format.
              *
          -   *     [Since 2.10, experimental] If the glyph index contains an entry in
          +   *     [Since 2.12] If the glyph index maps to an entry in the face's
          +   *     'SVG~' table, load the associated SVG document from this table and
          +   *     set the `format` field of @FT_GlyphSlotRec to @FT_GLYPH_FORMAT_SVG.
          +   *     Note that FreeType itself can't render SVG documents; however, the
          +   *     library provides hooks to seamlessly integrate an external renderer.
          +   *     See sections @ot_svg_driver and @svg_fonts for more.
          +   *
          +   *     [Since 2.10, experimental] If the glyph index maps to an entry in
              *     the face's 'COLR' table with a 'CPAL' palette table (as defined in
              *     the OpenType specification), make @FT_Render_Glyph provide a default
              *     blending of the color glyph layers associated with the glyph index,
              *     using the same bitmap format as embedded color bitmap images.  This
          -   *     is mainly for convenience; for full control of color layers use
          +   *     is mainly for convenience and works only for glyphs in 'COLR' v0
          +   *     tables (or glyphs in 'COLR' v1 tables that exclusively use v0
          +   *     features).  For full control of color layers use
              *     @FT_Get_Color_Glyph_Layer and FreeType's color functions like
              *     @FT_Palette_Select instead of setting @FT_LOAD_COLOR for rendering
              *     so that the client application can handle blending by itself.
          @@ -3069,19 +3235,20 @@ FT_BEGIN_HEADER
              *
              */
           #define FT_LOAD_DEFAULT                      0x0
          -#define FT_LOAD_NO_SCALE                     ( 1L << 0 )
          -#define FT_LOAD_NO_HINTING                   ( 1L << 1 )
          -#define FT_LOAD_RENDER                       ( 1L << 2 )
          -#define FT_LOAD_NO_BITMAP                    ( 1L << 3 )
          -#define FT_LOAD_VERTICAL_LAYOUT              ( 1L << 4 )
          -#define FT_LOAD_FORCE_AUTOHINT               ( 1L << 5 )
          -#define FT_LOAD_CROP_BITMAP                  ( 1L << 6 )
          -#define FT_LOAD_PEDANTIC                     ( 1L << 7 )
          -#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH  ( 1L << 9 )
          +#define FT_LOAD_NO_SCALE                     ( 1L << 0  )
          +#define FT_LOAD_NO_HINTING                   ( 1L << 1  )
          +#define FT_LOAD_RENDER                       ( 1L << 2  )
          +#define FT_LOAD_NO_BITMAP                    ( 1L << 3  )
          +#define FT_LOAD_VERTICAL_LAYOUT              ( 1L << 4  )
          +#define FT_LOAD_FORCE_AUTOHINT               ( 1L << 5  )
          +#define FT_LOAD_CROP_BITMAP                  ( 1L << 6  )
          +#define FT_LOAD_PEDANTIC                     ( 1L << 7  )
          +#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH  ( 1L << 9  )
           #define FT_LOAD_NO_RECURSE                   ( 1L << 10 )
           #define FT_LOAD_IGNORE_TRANSFORM             ( 1L << 11 )
           #define FT_LOAD_MONOCHROME                   ( 1L << 12 )
           #define FT_LOAD_LINEAR_DESIGN                ( 1L << 13 )
          +#define FT_LOAD_SBITS_ONLY                   ( 1L << 14 )
           #define FT_LOAD_NO_AUTOHINT                  ( 1L << 15 )
             /* Bits 16-19 are used by `FT_LOAD_TARGET_` */
           #define FT_LOAD_COLOR                        ( 1L << 20 )
          @@ -3091,8 +3258,8 @@ FT_BEGIN_HEADER
             /* */
           
             /* used internally only by certain font drivers */
          -#define FT_LOAD_ADVANCE_ONLY                 ( 1L << 8 )
          -#define FT_LOAD_SBITS_ONLY                   ( 1L << 14 )
          +#define FT_LOAD_ADVANCE_ONLY                 ( 1L << 8  )
          +#define FT_LOAD_SVG_ONLY                     ( 1L << 23 )
           
           
             /**************************************************************************
          @@ -3370,6 +3537,44 @@ FT_BEGIN_HEADER
              *   }
              *
              *   ```
          +   *
          +   *   FreeType has two rasterizers for generating SDF, namely:
          +   *
          +   *   1. `sdf` for generating SDF directly from glyph's outline, and
          +   *
          +   *   2. `bsdf` for generating SDF from rasterized bitmaps.
          +   *
          +   *   Depending on the glyph type (i.e., outline or bitmap), one of the two
          +   *   rasterizers is chosen at runtime and used for generating SDFs.  To
          +   *   force the use of `bsdf` you should render the glyph with any of the
          +   *   FreeType's other rendering modes (e.g., `FT_RENDER_MODE_NORMAL`) and
          +   *   then re-render with `FT_RENDER_MODE_SDF`.
          +   *
          +   *   There are some issues with stability and possible failures of the SDF
          +   *   renderers (specifically `sdf`).
          +   *
          +   *   1. The `sdf` rasterizer is sensitive to really small features (e.g.,
          +   *      sharp turns that are less than 1~pixel) and imperfections in the
          +   *      glyph's outline, causing artifacts in the final output.
          +   *
          +   *   2. The `sdf` rasterizer has limited support for handling intersecting
          +   *      contours and *cannot* handle self-intersecting contours whatsoever.
          +   *      Self-intersection happens when a single connected contour intersect
          +   *      itself at some point; having these in your font definitely pose a
          +   *      problem to the rasterizer and cause artifacts, too.
          +   *
          +   *   3. Generating SDF for really small glyphs may result in undesirable
          +   *      output; the pixel grid (which stores distance information) becomes
          +   *      too coarse.
          +   *
          +   *   4. Since the output buffer is normalized, precision at smaller spreads
          +   *      is greater than precision at larger spread values because the
          +   *      output range of [0..255] gets mapped to a smaller SDF range.  A
          +   *      spread of~2 should be sufficient in most cases.
          +   *
          +   *   Points (1) and (2) can be avoided by using the `bsdf` rasterizer,
          +   *   which is more stable than the `sdf` rasterizer in general.
          +   *
              */
             typedef enum  FT_Render_Mode_
             {
          @@ -3410,7 +3615,7 @@ FT_BEGIN_HEADER
              *     @FT_Render_Mode for a list of possible values.
              *
              *     If @FT_RENDER_MODE_NORMAL is used, a previous call of @FT_Load_Glyph
          -   *     with flag @FT_LOAD_COLOR makes FT_Render_Glyph provide a default
          +   *     with flag @FT_LOAD_COLOR makes `FT_Render_Glyph` provide a default
              *     blending of colored glyph layers associated with the current glyph
              *     slot (provided the font contains such layers) instead of rendering
              *     the glyph slot's outline.  This is an experimental feature; see
          @@ -3420,9 +3625,6 @@ FT_BEGIN_HEADER
              *   FreeType error code.  0~means success.
              *
              * @note:
          -   *   To get meaningful results, font scaling values must be set with
          -   *   functions like @FT_Set_Char_Size before calling `FT_Render_Glyph`.
          -   *
              *   When FreeType outputs a bitmap of a glyph, it really outputs an alpha
              *   coverage map.  If a pixel is completely covered by a filled-in
              *   outline, the bitmap contains 0xFF at that pixel, meaning that
          @@ -4739,8 +4941,8 @@ FT_BEGIN_HEADER
              *
              */
           #define FREETYPE_MAJOR  2
          -#define FREETYPE_MINOR  11
          -#define FREETYPE_PATCH  1
          +#define FREETYPE_MINOR  12
          +#define FREETYPE_PATCH  0
           
           
             /**************************************************************************
          diff --git a/thirdparty/freetype/include/freetype/ftadvanc.h b/thirdparty/freetype/include/freetype/ftadvanc.h
          index 3a13bd3de4..8ce4846668 100644
          --- a/thirdparty/freetype/include/freetype/ftadvanc.h
          +++ b/thirdparty/freetype/include/freetype/ftadvanc.h
          @@ -4,7 +4,7 @@
            *
            *   Quick computation of advance widths (specification only).
            *
          - * Copyright (C) 2008-2021 by
          + * Copyright (C) 2008-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftbbox.h b/thirdparty/freetype/include/freetype/ftbbox.h
          index 713aedb15f..768478f399 100644
          --- a/thirdparty/freetype/include/freetype/ftbbox.h
          +++ b/thirdparty/freetype/include/freetype/ftbbox.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType exact bbox computation (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftbdf.h b/thirdparty/freetype/include/freetype/ftbdf.h
          index c428506405..04d6094f75 100644
          --- a/thirdparty/freetype/include/freetype/ftbdf.h
          +++ b/thirdparty/freetype/include/freetype/ftbdf.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType API for accessing BDF-specific strings (specification).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftbitmap.h b/thirdparty/freetype/include/freetype/ftbitmap.h
          index 11c45b0ed2..c3462dadc5 100644
          --- a/thirdparty/freetype/include/freetype/ftbitmap.h
          +++ b/thirdparty/freetype/include/freetype/ftbitmap.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType utility functions for bitmaps (specification).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftbzip2.h b/thirdparty/freetype/include/freetype/ftbzip2.h
          index afd2a82afb..c85305806f 100644
          --- a/thirdparty/freetype/include/freetype/ftbzip2.h
          +++ b/thirdparty/freetype/include/freetype/ftbzip2.h
          @@ -4,7 +4,7 @@
            *
            *   Bzip2-compressed stream support.
            *
          - * Copyright (C) 2010-2021 by
          + * Copyright (C) 2010-2022 by
            * Joel Klinghed.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftcache.h b/thirdparty/freetype/include/freetype/ftcache.h
          index 70399a328a..ecbbd7b8fb 100644
          --- a/thirdparty/freetype/include/freetype/ftcache.h
          +++ b/thirdparty/freetype/include/freetype/ftcache.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType Cache subsystem (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftchapters.h b/thirdparty/freetype/include/freetype/ftchapters.h
          index 4f32cc88c8..6a9733ad7c 100644
          --- a/thirdparty/freetype/include/freetype/ftchapters.h
          +++ b/thirdparty/freetype/include/freetype/ftchapters.h
          @@ -62,6 +62,7 @@
              *   cid_fonts
              *   pfr_fonts
              *   winfnt_fonts
          +   *   svg_fonts
              *   font_formats
              *   gasp_table
              *
          @@ -82,6 +83,7 @@
              *   t1_cid_driver
              *   tt_driver
              *   pcf_driver
          +   *   ot_svg_driver
              *   properties
              *   parameter_tags
              *   lcd_rendering
          diff --git a/thirdparty/freetype/include/freetype/ftcid.h b/thirdparty/freetype/include/freetype/ftcid.h
          index 9a415bd98b..d80108387a 100644
          --- a/thirdparty/freetype/include/freetype/ftcid.h
          +++ b/thirdparty/freetype/include/freetype/ftcid.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType API for accessing CID font information (specification).
            *
          - * Copyright (C) 2007-2021 by
          + * Copyright (C) 2007-2022 by
            * Dereg Clegg and Michael Toftdal.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftcolor.h b/thirdparty/freetype/include/freetype/ftcolor.h
          index 08dbac0ccc..777fa8b8ca 100644
          --- a/thirdparty/freetype/include/freetype/ftcolor.h
          +++ b/thirdparty/freetype/include/freetype/ftcolor.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType's glyph color management (specification).
            *
          - * Copyright (C) 2018-2021 by
          + * Copyright (C) 2018-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftdriver.h b/thirdparty/freetype/include/freetype/ftdriver.h
          index 4936639056..0dc91e8b40 100644
          --- a/thirdparty/freetype/include/freetype/ftdriver.h
          +++ b/thirdparty/freetype/include/freetype/ftdriver.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType API for controlling driver modules (specification only).
            *
          - * Copyright (C) 2017-2021 by
          + * Copyright (C) 2017-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -212,16 +212,14 @@ FT_BEGIN_HEADER
              * @description:
              *   While FreeType's TrueType driver doesn't expose API functions by
              *   itself, it is possible to control its behaviour with @FT_Property_Set
          -   *   and @FT_Property_Get.  The following lists the available properties
          -   *   together with the necessary macros and structures.
          +   *   and @FT_Property_Get.
              *
          -   *   The TrueType driver's module name is 'truetype'.
          +   *   The TrueType driver's module name is 'truetype'; a single property
          +   *   @interpreter-version is available, as documented in the @properties
          +   *   section.
              *
          -   *   A single property @interpreter-version is available, as documented in
          -   *   the @properties section.
          -   *
          -   *   We start with a list of definitions, kindly provided by Greg
          -   *   Hitchcock.
          +   *   To help understand the differences between interpreter versions, we
          +   *   introduce a list of definitions, kindly provided by Greg Hitchcock.
              *
              *   _Bi-Level Rendering_
              *
          @@ -300,6 +298,31 @@ FT_BEGIN_HEADER
              */
           
           
          +  /**************************************************************************
          +   *
          +   * @section:
          +   *   ot_svg_driver
          +   *
          +   * @title:
          +   *   The SVG driver
          +   *
          +   * @abstract:
          +   *   Controlling the external rendering of OT-SVG glyphs.
          +   *
          +   * @description:
          +   *   By default, FreeType can only load the 'SVG~' table of OpenType fonts
          +   *   if configuration macro `FT_CONFIG_OPTION_SVG` is defined.  To make it
          +   *   render SVG glyphs, an external SVG rendering library is needed.  All
          +   *   details on the interface between FreeType and the external library
          +   *   via function hooks can be found in section @svg_fonts.
          +   *
          +   *   The OT-SVG driver's module name is 'ot-svg'; it supports a single
          +   *   property called @svg-hooks, documented below in the @properties
          +   *   section.
          +   *
          +   */
          +
          +
             /**************************************************************************
              *
              * @section:
          @@ -798,6 +821,40 @@ FT_BEGIN_HEADER
              */
           
           
          +  /**************************************************************************
          +   *
          +   * @property:
          +   *   svg-hooks
          +   *
          +   * @description:
          +   *   Set up the interface between FreeType and an extern SVG rendering
          +   *   library like 'librsvg'.  All details on the function hooks can be
          +   *   found in section @svg_fonts.
          +   *
          +   * @example:
          +   *   The following example code expects that the four hook functions
          +   *   `svg_*` are defined elsewhere.  Error handling is omitted, too.
          +   *
          +   *   ```
          +   *     FT_Library  library;
          +   *     SVG_RendererHooks  hooks = {
          +   *                          (SVG_Lib_Init_Func)svg_init,
          +   *                          (SVG_Lib_Free_Func)svg_free,
          +   *                          (SVG_Lib_Render_Func)svg_render,
          +   *                          (SVG_Lib_Preset_Slot_Func)svg_preset_slot };
          +   *
          +   *
          +   *     FT_Init_FreeType( &library );
          +   *
          +   *     FT_Property_Set( library, "ot-svg",
          +   *                               "svg-hooks", &hooks );
          +   *   ```
          +   *
          +   * @since:
          +   *   2.12
          +   */
          +
          +
             /**************************************************************************
              *
              * @property:
          diff --git a/thirdparty/freetype/include/freetype/fterrdef.h b/thirdparty/freetype/include/freetype/fterrdef.h
          index 6e9c4ccb97..a3acfce430 100644
          --- a/thirdparty/freetype/include/freetype/fterrdef.h
          +++ b/thirdparty/freetype/include/freetype/fterrdef.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType error codes (specification).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -101,6 +101,8 @@
                           "too many hints" )
             FT_ERRORDEF_( Invalid_Pixel_Size,                          0x17,
                           "invalid pixel size" )
          +  FT_ERRORDEF_( Invalid_SVG_Document,                        0x18,
          +                "invalid SVG document" )
           
             /* handle errors */
           
          @@ -234,6 +236,8 @@
                           "found FDEF or IDEF opcode in glyf bytecode" )
             FT_ERRORDEF_( Missing_Bitmap,                              0x9D,
                           "missing bitmap in strike" )
          +  FT_ERRORDEF_( Missing_SVG_Hooks,                           0x9E,
          +                "SVG hooks have not been set" )
           
             /* CFF, CID, and Type 1 errors */
           
          diff --git a/thirdparty/freetype/include/freetype/fterrors.h b/thirdparty/freetype/include/freetype/fterrors.h
          index 151941dde0..ff1b375d7d 100644
          --- a/thirdparty/freetype/include/freetype/fterrors.h
          +++ b/thirdparty/freetype/include/freetype/fterrors.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType error code handling (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftfntfmt.h b/thirdparty/freetype/include/freetype/ftfntfmt.h
          index 8e68a4a3ac..77d553578b 100644
          --- a/thirdparty/freetype/include/freetype/ftfntfmt.h
          +++ b/thirdparty/freetype/include/freetype/ftfntfmt.h
          @@ -4,7 +4,7 @@
            *
            *   Support functions for font formats.
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftgasp.h b/thirdparty/freetype/include/freetype/ftgasp.h
          index 76c45eb3b1..d4ab9b32db 100644
          --- a/thirdparty/freetype/include/freetype/ftgasp.h
          +++ b/thirdparty/freetype/include/freetype/ftgasp.h
          @@ -4,7 +4,7 @@
            *
            *   Access of TrueType's 'gasp' table (specification).
            *
          - * Copyright (C) 2007-2021 by
          + * Copyright (C) 2007-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftglyph.h b/thirdparty/freetype/include/freetype/ftglyph.h
          index 26b32ed6be..6b77bd3d2a 100644
          --- a/thirdparty/freetype/include/freetype/ftglyph.h
          +++ b/thirdparty/freetype/include/freetype/ftglyph.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType convenience functions to handle glyphs (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -126,7 +126,7 @@ FT_BEGIN_HEADER
              *
              * @description:
              *   A handle to an object used to model a bitmap glyph image.  This is a
          -   *   sub-class of @FT_Glyph, and a pointer to @FT_BitmapGlyphRec.
          +   *   'sub-class' of @FT_Glyph, and a pointer to @FT_BitmapGlyphRec.
              */
             typedef struct FT_BitmapGlyphRec_*  FT_BitmapGlyph;
           
          @@ -142,7 +142,7 @@ FT_BEGIN_HEADER
              *
              * @fields:
              *   root ::
          -   *     The root @FT_Glyph fields.
          +   *     The root fields of @FT_Glyph.
              *
              *   left ::
              *     The left-side bearing, i.e., the horizontal distance from the
          @@ -181,7 +181,7 @@ FT_BEGIN_HEADER
              *
              * @description:
              *   A handle to an object used to model an outline glyph image.  This is a
          -   *   sub-class of @FT_Glyph, and a pointer to @FT_OutlineGlyphRec.
          +   *   'sub-class' of @FT_Glyph, and a pointer to @FT_OutlineGlyphRec.
              */
             typedef struct FT_OutlineGlyphRec_*  FT_OutlineGlyph;
           
          @@ -222,6 +222,92 @@ FT_BEGIN_HEADER
             } FT_OutlineGlyphRec;
           
           
          +  /**************************************************************************
          +   *
          +   * @type:
          +   *   FT_SvgGlyph
          +   *
          +   * @description:
          +   *   A handle to an object used to model an SVG glyph.  This is a
          +   *   'sub-class' of @FT_Glyph, and a pointer to @FT_SvgGlyphRec.
          +   *
          +   * @since:
          +   *   2.12
          +   */
          +  typedef struct FT_SvgGlyphRec_*  FT_SvgGlyph;
          +
          +
          +  /**************************************************************************
          +   *
          +   * @struct:
          +   *   FT_SvgGlyphRec
          +   *
          +   * @description:
          +   *   A structure used for OT-SVG glyphs.  This is a 'sub-class' of
          +   *   @FT_GlyphRec.
          +   *
          +   * @fields:
          +   *   root ::
          +   *     The root @FT_GlyphRec fields.
          +   *
          +   *   svg_document ::
          +   *     A pointer to the SVG document.
          +   *
          +   *   svg_document_length ::
          +   *     The length of `svg_document`.
          +   *
          +   *   glyph_index ::
          +   *     The index of the glyph to be rendered.
          +   *
          +   *   metrics ::
          +   *     A metrics object storing the size information.
          +   *
          +   *   units_per_EM ::
          +   *     The size of the EM square.
          +   *
          +   *   start_glyph_id ::
          +   *     The first glyph ID in the glyph range covered by this document.
          +   *
          +   *   end_glyph_id ::
          +   *     The last glyph ID in the glyph range covered by this document.
          +   *
          +   *   transform ::
          +   *     A 2x2 transformation matrix to apply to the glyph while rendering
          +   *     it.
          +   *
          +   *   delta ::
          +   *     Translation to apply to the glyph while rendering.
          +   *
          +   * @note:
          +   *   The Glyph Management API requires @FT_Glyph or its 'sub-class' to have
          +   *   all the information needed to completely define the glyph's rendering.
          +   *   Outline-based glyphs can directly apply transformations to the outline
          +   *   but this is not possible for an SVG document that hasn't been parsed.
          +   *   Therefore, the transformation is stored along with the document.  In
          +   *   the absence of a 'ViewBox' or 'Width'/'Height' attribute, the size of
          +   *   the ViewPort should be assumed to be 'units_per_EM'.
          +   */
          +  typedef struct  FT_SvgGlyphRec_
          +  {
          +    FT_GlyphRec  root;
          +
          +    FT_Byte*  svg_document;
          +    FT_ULong  svg_document_length;
          +
          +    FT_UInt  glyph_index;
          +
          +    FT_Size_Metrics  metrics;
          +    FT_UShort        units_per_EM;
          +
          +    FT_UShort  start_glyph_id;
          +    FT_UShort  end_glyph_id;
          +
          +    FT_Matrix  transform;
          +    FT_Vector  delta;
          +
          +  } FT_SvgGlyphRec;
          +
          +
             /**************************************************************************
              *
              * @function:
          @@ -498,9 +584,9 @@ FT_BEGIN_HEADER
              *   The glyph image is translated with the `origin` vector before
              *   rendering.
              *
          -   *   The first parameter is a pointer to an @FT_Glyph handle, that will be
          +   *   The first parameter is a pointer to an @FT_Glyph handle that will be
              *   _replaced_ by this function (with newly allocated data).  Typically,
          -   *   you would use (omitting error handling):
          +   *   you would do something like the following (omitting error handling).
              *
              *   ```
              *     FT_Glyph        glyph;
          @@ -517,7 +603,7 @@ FT_BEGIN_HEADER
              *     if ( glyph->format != FT_GLYPH_FORMAT_BITMAP )
              *     {
              *       error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL,
          -   *                                     0, 1 );
          +   *                                   0, 1 );
              *       if ( error ) // `glyph' unchanged
              *         ...
              *     }
          @@ -532,7 +618,7 @@ FT_BEGIN_HEADER
              *     FT_Done_Glyph( glyph );
              *   ```
              *
          -   *   Here is another example, again without error handling:
          +   *   Here is another example, again without error handling.
              *
              *   ```
              *     FT_Glyph  glyphs[MAX_GLYPHS]
          diff --git a/thirdparty/freetype/include/freetype/ftgxval.h b/thirdparty/freetype/include/freetype/ftgxval.h
          index 21bbbde2ae..2d3f382acf 100644
          --- a/thirdparty/freetype/include/freetype/ftgxval.h
          +++ b/thirdparty/freetype/include/freetype/ftgxval.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType API for validating TrueTypeGX/AAT tables (specification).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * Masatake YAMATO, Redhat K.K,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/include/freetype/ftgzip.h b/thirdparty/freetype/include/freetype/ftgzip.h
          index ba82baba64..0880290f9e 100644
          --- a/thirdparty/freetype/include/freetype/ftgzip.h
          +++ b/thirdparty/freetype/include/freetype/ftgzip.h
          @@ -4,7 +4,7 @@
            *
            *   Gzip-compressed stream support.
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftimage.h b/thirdparty/freetype/include/freetype/ftimage.h
          index 88533b8409..7f2d721cdc 100644
          --- a/thirdparty/freetype/include/freetype/ftimage.h
          +++ b/thirdparty/freetype/include/freetype/ftimage.h
          @@ -5,7 +5,7 @@
            *   FreeType glyph image formats and default raster interface
            *   (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -401,11 +401,11 @@ FT_BEGIN_HEADER
              *     information.
              *
              *   FT_OUTLINE_OVERLAP ::
          -   *     This flag indicates that this outline contains overlapping contrours
          -   *     and the anti-aliased renderer should perform oversampling to
          -   *     mitigate possible artifacts.  This flag should _not_ be set for
          -   *     well designed glyphs without overlaps because it quadruples the
          -   *     rendering time.
          +   *     [Since 2.10.3] This flag indicates that this outline contains
          +   *     overlapping contours and the anti-aliased renderer should perform
          +   *     oversampling to mitigate possible artifacts.  This flag should _not_
          +   *     be set for well designed glyphs without overlaps because it quadruples
          +   *     the rendering time.
              *
              *   FT_OUTLINE_HIGH_PRECISION ::
              *     This flag indicates that the scan-line converter should try to
          @@ -741,6 +741,10 @@ FT_BEGIN_HEADER
              *     contours.  Some Type~1 fonts, like those in the Hershey family,
              *     contain glyphs in this format.  These are described as @FT_Outline,
              *     but FreeType isn't currently capable of rendering them correctly.
          +   *
          +   *   FT_GLYPH_FORMAT_SVG ::
          +   *     [Since 2.12] The glyph is represented by an SVG document in the
          +   *     'SVG~' table.
              */
             typedef enum  FT_Glyph_Format_
             {
          @@ -749,7 +753,8 @@ FT_BEGIN_HEADER
               FT_IMAGE_TAG( FT_GLYPH_FORMAT_COMPOSITE, 'c', 'o', 'm', 'p' ),
               FT_IMAGE_TAG( FT_GLYPH_FORMAT_BITMAP,    'b', 'i', 't', 's' ),
               FT_IMAGE_TAG( FT_GLYPH_FORMAT_OUTLINE,   'o', 'u', 't', 'l' ),
          -    FT_IMAGE_TAG( FT_GLYPH_FORMAT_PLOTTER,   'p', 'l', 'o', 't' )
          +    FT_IMAGE_TAG( FT_GLYPH_FORMAT_PLOTTER,   'p', 'l', 'o', 't' ),
          +    FT_IMAGE_TAG( FT_GLYPH_FORMAT_SVG,       'S', 'V', 'G', ' ' )
           
             } FT_Glyph_Format;
           
          diff --git a/thirdparty/freetype/include/freetype/ftincrem.h b/thirdparty/freetype/include/freetype/ftincrem.h
          index 229b947bd8..3b3d93c2d3 100644
          --- a/thirdparty/freetype/include/freetype/ftincrem.h
          +++ b/thirdparty/freetype/include/freetype/ftincrem.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType incremental loading (specification).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftlcdfil.h b/thirdparty/freetype/include/freetype/ftlcdfil.h
          index 18e2544175..c767c6cb48 100644
          --- a/thirdparty/freetype/include/freetype/ftlcdfil.h
          +++ b/thirdparty/freetype/include/freetype/ftlcdfil.h
          @@ -5,7 +5,7 @@
            *   FreeType API for color filtering of subpixel bitmap glyphs
            *   (specification).
            *
          - * Copyright (C) 2006-2021 by
          + * Copyright (C) 2006-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftlist.h b/thirdparty/freetype/include/freetype/ftlist.h
          index 55f015977a..4dca2bf163 100644
          --- a/thirdparty/freetype/include/freetype/ftlist.h
          +++ b/thirdparty/freetype/include/freetype/ftlist.h
          @@ -4,7 +4,7 @@
            *
            *   Generic list support for FreeType (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftlogging.h b/thirdparty/freetype/include/freetype/ftlogging.h
          index a558b85faf..7213dc30a8 100644
          --- a/thirdparty/freetype/include/freetype/ftlogging.h
          +++ b/thirdparty/freetype/include/freetype/ftlogging.h
          @@ -4,7 +4,7 @@
            *
            *   Additional debugging APIs.
            *
          - * Copyright (C) 2020-2021 by
          + * Copyright (C) 2020-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftlzw.h b/thirdparty/freetype/include/freetype/ftlzw.h
          index fce1c9c4bb..3d7cfd52f7 100644
          --- a/thirdparty/freetype/include/freetype/ftlzw.h
          +++ b/thirdparty/freetype/include/freetype/ftlzw.h
          @@ -4,7 +4,7 @@
            *
            *   LZW-compressed stream support.
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftmac.h b/thirdparty/freetype/include/freetype/ftmac.h
          index 607af9b589..3dd61d0fe1 100644
          --- a/thirdparty/freetype/include/freetype/ftmac.h
          +++ b/thirdparty/freetype/include/freetype/ftmac.h
          @@ -4,7 +4,7 @@
            *
            *   Additional Mac-specific API.
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftmm.h b/thirdparty/freetype/include/freetype/ftmm.h
          index 32579e997f..c74ce618cb 100644
          --- a/thirdparty/freetype/include/freetype/ftmm.h
          +++ b/thirdparty/freetype/include/freetype/ftmm.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType Multiple Master font interface (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -47,6 +47,9 @@ FT_BEGIN_HEADER
              *   MM fonts, others will work with all three types.  They are similar
              *   enough that a consistent interface makes sense.
              *
          +   *   For Adobe MM fonts, macro @FT_IS_SFNT returns false.  For GX and
          +   *   OpenType variation fonts, it returns true.
          +   *
              */
           
           
          diff --git a/thirdparty/freetype/include/freetype/ftmodapi.h b/thirdparty/freetype/include/freetype/ftmodapi.h
          index b77d356de9..b78db724c7 100644
          --- a/thirdparty/freetype/include/freetype/ftmodapi.h
          +++ b/thirdparty/freetype/include/freetype/ftmodapi.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType modules public interface (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftmoderr.h b/thirdparty/freetype/include/freetype/ftmoderr.h
          index b417cd5ab7..88d2917771 100644
          --- a/thirdparty/freetype/include/freetype/ftmoderr.h
          +++ b/thirdparty/freetype/include/freetype/ftmoderr.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType module error offsets (specification).
            *
          - * Copyright (C) 2001-2021 by
          + * Copyright (C) 2001-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftotval.h b/thirdparty/freetype/include/freetype/ftotval.h
          index 00f9727859..172fcf2402 100644
          --- a/thirdparty/freetype/include/freetype/ftotval.h
          +++ b/thirdparty/freetype/include/freetype/ftotval.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType API for validating OpenType tables (specification).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftoutln.h b/thirdparty/freetype/include/freetype/ftoutln.h
          index 6bb5f809a9..46ebf9371b 100644
          --- a/thirdparty/freetype/include/freetype/ftoutln.h
          +++ b/thirdparty/freetype/include/freetype/ftoutln.h
          @@ -5,7 +5,7 @@
            *   Support for the FT_Outline type used to store glyph shapes of
            *   most scalable font formats (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -109,11 +109,13 @@ FT_BEGIN_HEADER
              *   FreeType error code.  0~means success.
              *
              * @note:
          -   *   A contour that contains a single point only is represented by a 'move
          -   *   to' operation followed by 'line to' to the same point.  In most cases,
          -   *   it is best to filter this out before using the outline for stroking
          -   *   purposes (otherwise it would result in a visible dot when round caps
          -   *   are used).
          +   *   Degenerate contours, segments, and Bezier arcs may be reported.  In
          +   *   most cases, it is best to filter these out before using the outline
          +   *   for stroking or other path modification purposes (which may cause
          +   *   degenerate segments to become non-degenrate and visible, like when
          +   *   stroke caps are used or the path is otherwise outset).  Some glyph
          +   *   outlines may contain deliberate degenerate single points for mark
          +   *   attachement.
              *
              *   Similarly, the function returns success for an empty outline also
              *   (doing nothing, this is, not calling any emitter); if necessary, you
          diff --git a/thirdparty/freetype/include/freetype/ftparams.h b/thirdparty/freetype/include/freetype/ftparams.h
          index 04a3f44126..72080f396a 100644
          --- a/thirdparty/freetype/include/freetype/ftparams.h
          +++ b/thirdparty/freetype/include/freetype/ftparams.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType API for possible FT_Parameter tags (specification only).
            *
          - * Copyright (C) 2017-2021 by
          + * Copyright (C) 2017-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -112,6 +112,21 @@ FT_BEGIN_HEADER
                     FT_MAKE_TAG( 'i', 'n', 'c', 'r' )
           
           
          +  /**************************************************************************
          +   *
          +   * @enum:
          +   *   FT_PARAM_TAG_IGNORE_SBIX
          +   *
          +   * @description:
          +   *   A tag for @FT_Parameter to make @FT_Open_Face ignore an 'sbix' table
          +   *   while loading a font.  Use this if @FT_FACE_FLAG_SBIX is set and you
          +   *   want to access the outline glyphs in the font.
          +   *
          +   */
          +#define FT_PARAM_TAG_IGNORE_SBIX \
          +          FT_MAKE_TAG( 'i', 's', 'b', 'x' )
          +
          +
             /**************************************************************************
              *
              * @enum:
          diff --git a/thirdparty/freetype/include/freetype/ftpfr.h b/thirdparty/freetype/include/freetype/ftpfr.h
          index fbdb14c202..428e327061 100644
          --- a/thirdparty/freetype/include/freetype/ftpfr.h
          +++ b/thirdparty/freetype/include/freetype/ftpfr.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType API for accessing PFR-specific data (specification only).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftrender.h b/thirdparty/freetype/include/freetype/ftrender.h
          index 48d489d496..0fab3f8c2a 100644
          --- a/thirdparty/freetype/include/freetype/ftrender.h
          +++ b/thirdparty/freetype/include/freetype/ftrender.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType renderer modules public interface (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftsizes.h b/thirdparty/freetype/include/freetype/ftsizes.h
          index 22366393b8..e30938d862 100644
          --- a/thirdparty/freetype/include/freetype/ftsizes.h
          +++ b/thirdparty/freetype/include/freetype/ftsizes.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType size objects management (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftsnames.h b/thirdparty/freetype/include/freetype/ftsnames.h
          index c7f6581cb3..384096a585 100644
          --- a/thirdparty/freetype/include/freetype/ftsnames.h
          +++ b/thirdparty/freetype/include/freetype/ftsnames.h
          @@ -7,7 +7,7 @@
            *
            *   This is _not_ used to retrieve glyph names!
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftstroke.h b/thirdparty/freetype/include/freetype/ftstroke.h
          index 88b2a8a4ed..12c006d3fb 100644
          --- a/thirdparty/freetype/include/freetype/ftstroke.h
          +++ b/thirdparty/freetype/include/freetype/ftstroke.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType path stroker (specification).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftsynth.h b/thirdparty/freetype/include/freetype/ftsynth.h
          index 861dcb5ac5..afc40b1d84 100644
          --- a/thirdparty/freetype/include/freetype/ftsynth.h
          +++ b/thirdparty/freetype/include/freetype/ftsynth.h
          @@ -5,7 +5,7 @@
            *   FreeType synthesizing code for emboldening and slanting
            *   (specification).
            *
          - * Copyright (C) 2000-2021 by
          + * Copyright (C) 2000-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftsystem.h b/thirdparty/freetype/include/freetype/ftsystem.h
          index e5abb85a85..5f8aec7b7c 100644
          --- a/thirdparty/freetype/include/freetype/ftsystem.h
          +++ b/thirdparty/freetype/include/freetype/ftsystem.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType low-level system interface definition (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/fttrigon.h b/thirdparty/freetype/include/freetype/fttrigon.h
          index dbe7b0d388..4e8d871dec 100644
          --- a/thirdparty/freetype/include/freetype/fttrigon.h
          +++ b/thirdparty/freetype/include/freetype/fttrigon.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType trigonometric functions (specification).
            *
          - * Copyright (C) 2001-2021 by
          + * Copyright (C) 2001-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/fttypes.h b/thirdparty/freetype/include/freetype/fttypes.h
          index 699bd003c0..29f32fbb26 100644
          --- a/thirdparty/freetype/include/freetype/fttypes.h
          +++ b/thirdparty/freetype/include/freetype/fttypes.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType simple types definitions (specification only).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/ftwinfnt.h b/thirdparty/freetype/include/freetype/ftwinfnt.h
          index f30f447d84..294f85ae0d 100644
          --- a/thirdparty/freetype/include/freetype/ftwinfnt.h
          +++ b/thirdparty/freetype/include/freetype/ftwinfnt.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType API for accessing Windows fnt-specific data.
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/autohint.h b/thirdparty/freetype/include/freetype/internal/autohint.h
          index 01585f5edf..aedf48984d 100644
          --- a/thirdparty/freetype/include/freetype/internal/autohint.h
          +++ b/thirdparty/freetype/include/freetype/internal/autohint.h
          @@ -4,7 +4,7 @@
            *
            *   High-level 'autohint' module-specific interface (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/cffotypes.h b/thirdparty/freetype/include/freetype/internal/cffotypes.h
          index a91dd556ca..700f586c41 100644
          --- a/thirdparty/freetype/include/freetype/internal/cffotypes.h
          +++ b/thirdparty/freetype/include/freetype/internal/cffotypes.h
          @@ -4,7 +4,7 @@
            *
            *   Basic OpenType/CFF object type definitions (specification).
            *
          - * Copyright (C) 2017-2021 by
          + * Copyright (C) 2017-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/cfftypes.h b/thirdparty/freetype/include/freetype/internal/cfftypes.h
          index 99e8d41368..23d26c1b34 100644
          --- a/thirdparty/freetype/include/freetype/internal/cfftypes.h
          +++ b/thirdparty/freetype/include/freetype/internal/cfftypes.h
          @@ -5,7 +5,7 @@
            *   Basic OpenType/CFF type definitions and interface (specification
            *   only).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/compiler-macros.h b/thirdparty/freetype/include/freetype/internal/compiler-macros.h
          index d8b61b3dc9..66fa13c3c5 100644
          --- a/thirdparty/freetype/include/freetype/internal/compiler-macros.h
          +++ b/thirdparty/freetype/include/freetype/internal/compiler-macros.h
          @@ -4,7 +4,7 @@
            *
            *   Compiler-specific macro definitions used internally by FreeType.
            *
          - * Copyright (C) 2020-2021 by
          + * Copyright (C) 2020-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -299,10 +299,12 @@ FT_BEGIN_HEADER
           #define FT_CALLBACK_DEF( x )  static  x
           #endif
           
          -#if defined( __i386__ )
          +#if defined( __GNUC__ ) && defined( __i386__ )
           #define FT_COMPARE_DEF( x )  FT_CALLBACK_DEF( x ) __attribute__(( cdecl ))
          -#elif defined( _M_IX86 )
          +#elif defined( _MSC_VER ) && defined( _M_IX86 )
           #define FT_COMPARE_DEF( x )  FT_CALLBACK_DEF( x ) __cdecl
          +#elif defined( __WATCOMC__ ) && __WATCOMC__ >= 1240
          +#define FT_COMPARE_DEF( x )  FT_CALLBACK_DEF( x ) __watcall
           #else
           #define FT_COMPARE_DEF( x )  FT_CALLBACK_DEF( x )
           #endif
          diff --git a/thirdparty/freetype/include/freetype/internal/ftcalc.h b/thirdparty/freetype/include/freetype/internal/ftcalc.h
          index f88e055318..e6a87db94e 100644
          --- a/thirdparty/freetype/include/freetype/internal/ftcalc.h
          +++ b/thirdparty/freetype/include/freetype/internal/ftcalc.h
          @@ -4,7 +4,7 @@
            *
            *   Arithmetic computations (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -408,6 +408,19 @@ FT_BEGIN_HEADER
           
           #endif
           
          +#elif defined( __WATCOMC__ ) && defined( __386__ )
          +
          +  extern __inline FT_Int32
          +  FT_MSB_i386( FT_UInt32  x );
          +
          +#pragma aux FT_MSB_i386 =     \
          +  "bsr eax, eax"              \
          +  parm [eax] nomemory         \
          +  value [eax]                 \
          +  modify exact [eax] nomemory;
          +
          +#define FT_MSB( x )  FT_MSB_i386( x )
          +
           #elif defined( __DECC ) || defined( __DECCXX )
           
           #include 
          diff --git a/thirdparty/freetype/include/freetype/internal/ftdebug.h b/thirdparty/freetype/include/freetype/internal/ftdebug.h
          index 5e8d9294a2..f05b1395cb 100644
          --- a/thirdparty/freetype/include/freetype/internal/ftdebug.h
          +++ b/thirdparty/freetype/include/freetype/internal/ftdebug.h
          @@ -4,7 +4,7 @@
            *
            *   Debugging and logging component (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/ftdrv.h b/thirdparty/freetype/include/freetype/internal/ftdrv.h
          index 0db323d5ab..9459a9a190 100644
          --- a/thirdparty/freetype/include/freetype/internal/ftdrv.h
          +++ b/thirdparty/freetype/include/freetype/internal/ftdrv.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType internal font driver interface (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/ftgloadr.h b/thirdparty/freetype/include/freetype/internal/ftgloadr.h
          index fea931c3aa..f73b6631c8 100644
          --- a/thirdparty/freetype/include/freetype/internal/ftgloadr.h
          +++ b/thirdparty/freetype/include/freetype/internal/ftgloadr.h
          @@ -4,7 +4,7 @@
            *
            *   The FreeType glyph loader (specification).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/ftmemory.h b/thirdparty/freetype/include/freetype/internal/ftmemory.h
          index e20d949696..10d753aa5e 100644
          --- a/thirdparty/freetype/include/freetype/internal/ftmemory.h
          +++ b/thirdparty/freetype/include/freetype/internal/ftmemory.h
          @@ -4,7 +4,7 @@
            *
            *   The FreeType memory management macros (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/ftobjs.h b/thirdparty/freetype/include/freetype/internal/ftobjs.h
          index e52a26aa06..1c779ceaeb 100644
          --- a/thirdparty/freetype/include/freetype/internal/ftobjs.h
          +++ b/thirdparty/freetype/include/freetype/internal/ftobjs.h
          @@ -4,7 +4,7 @@
            *
            *   The FreeType private base classes (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -418,7 +418,8 @@ FT_BEGIN_HEADER
              *     initializing the glyph slot.
              */
           
          -#define FT_GLYPH_OWN_BITMAP  0x1U
          +#define FT_GLYPH_OWN_BITMAP    0x1U
          +#define FT_GLYPH_OWN_GZIP_SVG  0x2U
           
             typedef struct  FT_Slot_InternalRec_
             {
          diff --git a/thirdparty/freetype/include/freetype/internal/ftpsprop.h b/thirdparty/freetype/include/freetype/internal/ftpsprop.h
          index d94d0d7e4b..47373211cb 100644
          --- a/thirdparty/freetype/include/freetype/internal/ftpsprop.h
          +++ b/thirdparty/freetype/include/freetype/internal/ftpsprop.h
          @@ -4,7 +4,7 @@
            *
            *   Get and set properties of PostScript drivers (specification).
            *
          - * Copyright (C) 2017-2021 by
          + * Copyright (C) 2017-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/ftrfork.h b/thirdparty/freetype/include/freetype/internal/ftrfork.h
          index 1c56d6ceb7..165e67f245 100644
          --- a/thirdparty/freetype/include/freetype/internal/ftrfork.h
          +++ b/thirdparty/freetype/include/freetype/internal/ftrfork.h
          @@ -4,7 +4,7 @@
            *
            *   Embedded resource forks accessor (specification).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * Masatake YAMATO and Redhat K.K.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/ftserv.h b/thirdparty/freetype/include/freetype/internal/ftserv.h
          index fa82c31fcd..78996d9c85 100644
          --- a/thirdparty/freetype/include/freetype/internal/ftserv.h
          +++ b/thirdparty/freetype/include/freetype/internal/ftserv.h
          @@ -4,7 +4,7 @@
            *
            *   The FreeType services (specification only).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/ftstream.h b/thirdparty/freetype/include/freetype/internal/ftstream.h
          index 7f3af120c2..aa51fe5a87 100644
          --- a/thirdparty/freetype/include/freetype/internal/ftstream.h
          +++ b/thirdparty/freetype/include/freetype/internal/ftstream.h
          @@ -4,7 +4,7 @@
            *
            *   Stream handling (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/fttrace.h b/thirdparty/freetype/include/freetype/internal/fttrace.h
          index 3307556bff..43c6a8713b 100644
          --- a/thirdparty/freetype/include/freetype/internal/fttrace.h
          +++ b/thirdparty/freetype/include/freetype/internal/fttrace.h
          @@ -4,7 +4,7 @@
            *
            *   Tracing handling (specification only).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -49,6 +49,9 @@ FT_TRACE_DEF( synth )     /* bold/slant synthesizer  (ftsynth.c)  */
           FT_TRACE_DEF( raster )    /* monochrome rasterizer   (ftraster.c) */
           FT_TRACE_DEF( smooth )    /* anti-aliasing raster    (ftgrays.c)  */
           
          +  /* ot-svg module */
          +FT_TRACE_DEF( otsvg )     /* OT-SVG renderer         (ftsvg.c)    */
          +
             /* cache sub-system */
           FT_TRACE_DEF( cache )     /* cache sub-system   (ftcache.c, etc.) */
           
          @@ -61,6 +64,7 @@ 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)   */
           FT_TRACE_DEF( ttcpal )    /* color palette table     (ttcpal.c)   */
          +FT_TRACE_DEF( ttsvg )     /* OpenType SVG table      (ttsvg.c)    */
           FT_TRACE_DEF( ttkern )    /* kerning handler         (ttkern.c)   */
           FT_TRACE_DEF( ttload )    /* basic TrueType tables   (ttload.c)   */
           FT_TRACE_DEF( ttmtx )     /* metrics-related tables  (ttmtx.c)    */
          diff --git a/thirdparty/freetype/include/freetype/internal/ftvalid.h b/thirdparty/freetype/include/freetype/internal/ftvalid.h
          index 7bdfa62f32..171c2cb6f5 100644
          --- a/thirdparty/freetype/include/freetype/internal/ftvalid.h
          +++ b/thirdparty/freetype/include/freetype/internal/ftvalid.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType validation support (specification).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/psaux.h b/thirdparty/freetype/include/freetype/internal/psaux.h
          index 6c6399aa16..48ec1df963 100644
          --- a/thirdparty/freetype/include/freetype/internal/psaux.h
          +++ b/thirdparty/freetype/include/freetype/internal/psaux.h
          @@ -5,7 +5,7 @@
            *   Auxiliary functions and data structures related to PostScript fonts
            *   (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/pshints.h b/thirdparty/freetype/include/freetype/internal/pshints.h
          index 9dbb0776b0..5de83e4565 100644
          --- a/thirdparty/freetype/include/freetype/internal/pshints.h
          +++ b/thirdparty/freetype/include/freetype/internal/pshints.h
          @@ -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-2021 by
          + * Copyright (C) 2001-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/services/svbdf.h b/thirdparty/freetype/include/freetype/internal/services/svbdf.h
          index 879aa61383..06e3b531c8 100644
          --- a/thirdparty/freetype/include/freetype/internal/services/svbdf.h
          +++ b/thirdparty/freetype/include/freetype/internal/services/svbdf.h
          @@ -4,7 +4,7 @@
            *
            *   The FreeType BDF services (specification).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/services/svcfftl.h b/thirdparty/freetype/include/freetype/internal/services/svcfftl.h
          index f6424e424d..1dea6bcda9 100644
          --- a/thirdparty/freetype/include/freetype/internal/services/svcfftl.h
          +++ b/thirdparty/freetype/include/freetype/internal/services/svcfftl.h
          @@ -4,7 +4,7 @@
            *
            *   The FreeType CFF tables loader service (specification).
            *
          - * Copyright (C) 2017-2021 by
          + * Copyright (C) 2017-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/services/svcid.h b/thirdparty/freetype/include/freetype/internal/services/svcid.h
          index 7ef5afd0b7..acf9178d0a 100644
          --- a/thirdparty/freetype/include/freetype/internal/services/svcid.h
          +++ b/thirdparty/freetype/include/freetype/internal/services/svcid.h
          @@ -4,7 +4,7 @@
            *
            *   The FreeType CID font services (specification).
            *
          - * Copyright (C) 2007-2021 by
          + * Copyright (C) 2007-2022 by
            * Derek Clegg and Michael Toftdal.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/services/svfntfmt.h b/thirdparty/freetype/include/freetype/internal/services/svfntfmt.h
          index cc87fc122d..a7280319c5 100644
          --- a/thirdparty/freetype/include/freetype/internal/services/svfntfmt.h
          +++ b/thirdparty/freetype/include/freetype/internal/services/svfntfmt.h
          @@ -4,7 +4,7 @@
            *
            *   The FreeType font format service (specification only).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/services/svgldict.h b/thirdparty/freetype/include/freetype/internal/services/svgldict.h
          index 4256f14a04..489021d897 100644
          --- a/thirdparty/freetype/include/freetype/internal/services/svgldict.h
          +++ b/thirdparty/freetype/include/freetype/internal/services/svgldict.h
          @@ -4,7 +4,7 @@
            *
            *   The FreeType glyph dictionary services (specification).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/services/svgxval.h b/thirdparty/freetype/include/freetype/internal/services/svgxval.h
          index f36d55602a..59ae411b55 100644
          --- a/thirdparty/freetype/include/freetype/internal/services/svgxval.h
          +++ b/thirdparty/freetype/include/freetype/internal/services/svgxval.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType API for validating TrueTypeGX/AAT tables (specification).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/include/freetype/internal/services/svkern.h b/thirdparty/freetype/include/freetype/internal/services/svkern.h
          index 99dc2d97a3..c567acad46 100644
          --- a/thirdparty/freetype/include/freetype/internal/services/svkern.h
          +++ b/thirdparty/freetype/include/freetype/internal/services/svkern.h
          @@ -4,7 +4,7 @@
            *
            *   The FreeType Kerning service (specification).
            *
          - * Copyright (C) 2006-2021 by
          + * Copyright (C) 2006-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/services/svmetric.h b/thirdparty/freetype/include/freetype/internal/services/svmetric.h
          index b9c95a7c9c..7accdc46ff 100644
          --- a/thirdparty/freetype/include/freetype/internal/services/svmetric.h
          +++ b/thirdparty/freetype/include/freetype/internal/services/svmetric.h
          @@ -4,7 +4,7 @@
            *
            *   The FreeType services for metrics variations (specification).
            *
          - * Copyright (C) 2016-2021 by
          + * Copyright (C) 2016-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/services/svmm.h b/thirdparty/freetype/include/freetype/internal/services/svmm.h
          index 8eac3a3fe3..c6394890ac 100644
          --- a/thirdparty/freetype/include/freetype/internal/services/svmm.h
          +++ b/thirdparty/freetype/include/freetype/internal/services/svmm.h
          @@ -4,7 +4,7 @@
            *
            *   The FreeType Multiple Masters and GX var services (specification).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/services/svotval.h b/thirdparty/freetype/include/freetype/internal/services/svotval.h
          index 7afb49e824..3c72d1f855 100644
          --- a/thirdparty/freetype/include/freetype/internal/services/svotval.h
          +++ b/thirdparty/freetype/include/freetype/internal/services/svotval.h
          @@ -4,7 +4,7 @@
            *
            *   The FreeType OpenType validation service (specification).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/services/svpfr.h b/thirdparty/freetype/include/freetype/internal/services/svpfr.h
          index 98442bf83d..bde0ed3545 100644
          --- a/thirdparty/freetype/include/freetype/internal/services/svpfr.h
          +++ b/thirdparty/freetype/include/freetype/internal/services/svpfr.h
          @@ -4,7 +4,7 @@
            *
            *   Internal PFR service functions (specification).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/services/svpostnm.h b/thirdparty/freetype/include/freetype/internal/services/svpostnm.h
          index 5a25c5a58a..05f6291e13 100644
          --- a/thirdparty/freetype/include/freetype/internal/services/svpostnm.h
          +++ b/thirdparty/freetype/include/freetype/internal/services/svpostnm.h
          @@ -4,7 +4,7 @@
            *
            *   The FreeType PostScript name services (specification).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/services/svprop.h b/thirdparty/freetype/include/freetype/internal/services/svprop.h
          index 9b71000c52..29c568640b 100644
          --- a/thirdparty/freetype/include/freetype/internal/services/svprop.h
          +++ b/thirdparty/freetype/include/freetype/internal/services/svprop.h
          @@ -4,7 +4,7 @@
            *
            *   The FreeType property service (specification).
            *
          - * Copyright (C) 2012-2021 by
          + * Copyright (C) 2012-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/services/svpscmap.h b/thirdparty/freetype/include/freetype/internal/services/svpscmap.h
          index 346f5e2a7c..7d586587a5 100644
          --- a/thirdparty/freetype/include/freetype/internal/services/svpscmap.h
          +++ b/thirdparty/freetype/include/freetype/internal/services/svpscmap.h
          @@ -4,7 +4,7 @@
            *
            *   The FreeType PostScript charmap service (specification).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/services/svpsinfo.h b/thirdparty/freetype/include/freetype/internal/services/svpsinfo.h
          index 49aa4d565d..6e45f3272d 100644
          --- a/thirdparty/freetype/include/freetype/internal/services/svpsinfo.h
          +++ b/thirdparty/freetype/include/freetype/internal/services/svpsinfo.h
          @@ -4,7 +4,7 @@
            *
            *   The FreeType PostScript info service (specification).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/services/svsfnt.h b/thirdparty/freetype/include/freetype/internal/services/svsfnt.h
          index 4306cbc1b7..03938a562b 100644
          --- a/thirdparty/freetype/include/freetype/internal/services/svsfnt.h
          +++ b/thirdparty/freetype/include/freetype/internal/services/svsfnt.h
          @@ -4,7 +4,7 @@
            *
            *   The FreeType SFNT table loading service (specification).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/services/svttcmap.h b/thirdparty/freetype/include/freetype/internal/services/svttcmap.h
          index 775b6bcf20..a0b1bbd2f3 100644
          --- a/thirdparty/freetype/include/freetype/internal/services/svttcmap.h
          +++ b/thirdparty/freetype/include/freetype/internal/services/svttcmap.h
          @@ -4,7 +4,7 @@
            *
            *   The FreeType TrueType/sfnt cmap extra information service.
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * Masatake YAMATO, Redhat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/include/freetype/internal/services/svtteng.h b/thirdparty/freetype/include/freetype/internal/services/svtteng.h
          index 964934284d..f8396eb08c 100644
          --- a/thirdparty/freetype/include/freetype/internal/services/svtteng.h
          +++ b/thirdparty/freetype/include/freetype/internal/services/svtteng.h
          @@ -4,7 +4,7 @@
            *
            *   The FreeType TrueType engine query service (specification).
            *
          - * Copyright (C) 2006-2021 by
          + * Copyright (C) 2006-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/services/svttglyf.h b/thirdparty/freetype/include/freetype/internal/services/svttglyf.h
          index 4268467b75..982630c0aa 100644
          --- a/thirdparty/freetype/include/freetype/internal/services/svttglyf.h
          +++ b/thirdparty/freetype/include/freetype/internal/services/svttglyf.h
          @@ -4,7 +4,7 @@
            *
            *   The FreeType TrueType glyph service.
            *
          - * Copyright (C) 2007-2021 by
          + * Copyright (C) 2007-2022 by
            * David Turner.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/services/svwinfnt.h b/thirdparty/freetype/include/freetype/internal/services/svwinfnt.h
          index aa70aa44db..950f4a8824 100644
          --- a/thirdparty/freetype/include/freetype/internal/services/svwinfnt.h
          +++ b/thirdparty/freetype/include/freetype/internal/services/svwinfnt.h
          @@ -4,7 +4,7 @@
            *
            *   The FreeType Windows FNT/FONT service (specification).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/sfnt.h b/thirdparty/freetype/include/freetype/internal/sfnt.h
          index bf4c7e09fe..c67b47e860 100644
          --- a/thirdparty/freetype/include/freetype/internal/sfnt.h
          +++ b/thirdparty/freetype/include/freetype/internal/sfnt.h
          @@ -4,7 +4,7 @@
            *
            *   High-level 'sfnt' driver interface (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -311,6 +311,33 @@ FT_BEGIN_HEADER
                                         TT_SBit_MetricsRec  *ametrics );
           
           
          +  /**************************************************************************
          +   *
          +   * @functype:
          +   *   TT_Load_Svg_Doc_Func
          +   *
          +   * @description:
          +   *   Scan the SVG document list to find the document containing the glyph
          +   *   that has the ID 'glyph*XXX*', where *XXX* is the value of
          +   *   `glyph_index` as a decimal integer.
          +   *
          +   * @inout:
          +   *   glyph ::
          +   *     The glyph slot from which pointers to the SVG document list is to be
          +   *     grabbed.  The results are stored back in the slot.
          +   *
          +   * @input:
          +   *   glyph_index ::
          +   *     The index of the glyph that is to be looked up.
          +   *
          +   * @return:
          +   *   FreeType error code.  0 means success.
          +   */
          +  typedef FT_Error
          +  (*TT_Load_Svg_Doc_Func)( FT_GlyphSlot  glyph,
          +                           FT_UInt       glyph_index );
          +
          +
             /**************************************************************************
              *
              * @functype:
          @@ -946,6 +973,11 @@ FT_BEGIN_HEADER
               TT_Get_Name_Func     get_name;
               TT_Get_Name_ID_Func  get_name_id;
           
          +    /* OpenType SVG Support */
          +    TT_Load_Table_Func    load_svg;
          +    TT_Free_Table_Func    free_svg;
          +    TT_Load_Svg_Doc_Func  load_svg_doc;
          +
             } SFNT_Interface;
           
           
          @@ -997,7 +1029,10 @@ FT_BEGIN_HEADER
                     colr_blend_,                   \
                     get_metrics_,                  \
                     get_name_,                     \
          -          get_name_id_ )                 \
          +          get_name_id_,                  \
          +          load_svg_,                     \
          +          free_svg_,                     \
          +          load_svg_doc_ )                \
             static const SFNT_Interface  class_ =  \
             {                                      \
               goto_table_,                         \
          @@ -1042,7 +1077,10 @@ FT_BEGIN_HEADER
               colr_blend_,                         \
               get_metrics_,                        \
               get_name_,                           \
          -    get_name_id_                         \
          +    get_name_id_,                        \
          +    load_svg_,                           \
          +    free_svg_,                           \
          +    load_svg_doc_                        \
             };
           
           
          diff --git a/thirdparty/freetype/include/freetype/internal/svginterface.h b/thirdparty/freetype/include/freetype/internal/svginterface.h
          new file mode 100644
          index 0000000000..1b325e5e9d
          --- /dev/null
          +++ b/thirdparty/freetype/include/freetype/internal/svginterface.h
          @@ -0,0 +1,46 @@
          +/****************************************************************************
          + *
          + * svginterface.h
          + *
          + *   Interface of ot-svg module (specification only).
          + *
          + * Copyright (C) 2022 by
          + * David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti.
          + *
          + * This file is part of the FreeType project, and may only be used,
          + * modified, and distributed under the terms of the FreeType project
          + * license, LICENSE.TXT.  By continuing to use, modify, or distribute
          + * this file you indicate that you have read the license and
          + * understand and accept it fully.
          + *
          + */
          +
          +
          +#ifndef SVGINTERFACE_H_
          +#define SVGINTERFACE_H_
          +
          +#include 
          +#include 
          +
          +
          +FT_BEGIN_HEADER
          +
          +  typedef FT_Error
          +  (*Preset_Bitmap_Func)( FT_Module     module,
          +                         FT_GlyphSlot  slot,
          +                         FT_Bool       cache );
          +
          +  typedef struct  SVG_Interface_
          +  {
          +    Preset_Bitmap_Func  preset_slot;
          +
          +  } SVG_Interface;
          +
          +  typedef SVG_Interface*  SVG_Service;
          +
          +FT_END_HEADER
          +
          +#endif /* SVGINTERFACE_H_ */
          +
          +
          +/* END */
          diff --git a/thirdparty/freetype/include/freetype/internal/t1types.h b/thirdparty/freetype/include/freetype/internal/t1types.h
          index 023c5d08a2..b6a3de14d0 100644
          --- a/thirdparty/freetype/include/freetype/internal/t1types.h
          +++ b/thirdparty/freetype/include/freetype/internal/t1types.h
          @@ -5,7 +5,7 @@
            *   Basic Type1/Type2 type definitions and interface (specification
            *   only).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/internal/tttypes.h b/thirdparty/freetype/include/freetype/internal/tttypes.h
          index 651131c8d3..df719387b5 100644
          --- a/thirdparty/freetype/include/freetype/internal/tttypes.h
          +++ b/thirdparty/freetype/include/freetype/internal/tttypes.h
          @@ -5,7 +5,7 @@
            *   Basic SFNT/TrueType type definitions and interface (specification
            *   only).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -1390,8 +1390,8 @@ FT_BEGIN_HEADER
              *   hdmx_record_size ::
              *     The size of a single hdmx record.
              *
          -   *   hdmx_record_sizes ::
          -   *     An array holding the ppem sizes available in the 'hdmx' table.
          +   *   hdmx_records ::
          +   *     A array of pointers to the 'hdmx' table records sorted by ppem.
              *
              *   sbit_table ::
              *     A pointer to the font's embedded bitmap location table.
          @@ -1605,7 +1605,7 @@ FT_BEGIN_HEADER
               FT_ULong              hdmx_table_size;
               FT_UInt               hdmx_record_count;
               FT_ULong              hdmx_record_size;
          -    FT_Byte*              hdmx_record_sizes;
          +    FT_Byte**             hdmx_records;
           
               FT_Byte*              sbit_table;
               FT_ULong              sbit_table_size;
          @@ -1644,6 +1644,9 @@ FT_BEGIN_HEADER
               void*                 cpal;
               void*                 colr;
           
          +    /* since 2.12 */
          +    void*                 svg;
          +
             } TT_FaceRec;
           
           
          @@ -1769,6 +1772,9 @@ FT_BEGIN_HEADER
               /* since version 2.6.2 */
               FT_ListRec       composites;
           
          +    /* since version 2.11.2 */
          +    FT_Byte*         widthp;
          +
             } TT_LoaderRec;
           
           
          diff --git a/thirdparty/freetype/include/freetype/internal/wofftypes.h b/thirdparty/freetype/include/freetype/internal/wofftypes.h
          index c460107c4d..94804fa72f 100644
          --- a/thirdparty/freetype/include/freetype/internal/wofftypes.h
          +++ b/thirdparty/freetype/include/freetype/internal/wofftypes.h
          @@ -5,7 +5,7 @@
            *   Basic WOFF/WOFF2 type definitions and interface (specification
            *   only).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/otsvg.h b/thirdparty/freetype/include/freetype/otsvg.h
          new file mode 100644
          index 0000000000..2caadfdeeb
          --- /dev/null
          +++ b/thirdparty/freetype/include/freetype/otsvg.h
          @@ -0,0 +1,336 @@
          +/****************************************************************************
          + *
          + * otsvg.h
          + *
          + *   Interface for OT-SVG support related things (specification).
          + *
          + * Copyright (C) 2022 by
          + * David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti.
          + *
          + * This file is part of the FreeType project, and may only be used,
          + * modified, and distributed under the terms of the FreeType project
          + * license, LICENSE.TXT.  By continuing to use, modify, or distribute
          + * this file you indicate that you have read the license and
          + * understand and accept it fully.
          + *
          + */
          +
          +
          +#ifndef OTSVG_H_
          +#define OTSVG_H_
          +
          +#include 
          +
          +#ifdef FREETYPE_H
          +#error "freetype.h of FreeType 1 has been loaded!"
          +#error "Please fix the directory search order for header files"
          +#error "so that freetype.h of FreeType 2 is found first."
          +#endif
          +
          +
          +FT_BEGIN_HEADER
          +
          +
          +  /**************************************************************************
          +   *
          +   * @section:
          +   *   svg_fonts
          +   *
          +   * @title:
          +   *   OpenType SVG Fonts
          +   *
          +   * @abstract:
          +   *   OT-SVG API between FreeType and an external SVG rendering library.
          +   *
          +   * @description:
          +   *   This section describes the four hooks necessary to render SVG
          +   *   'documents' that are contained in an OpenType font's 'SVG~' table.
          +   *
          +   *   For more information on the implementation, see our standard hooks
          +   *   based on 'librsvg' in the [FreeType Demo
          +   *   Programs](https://gitlab.freedesktop.org/freetype/freetype-demos)
          +   *   repository.
          +   *
          +   */
          +
          +
          +  /**************************************************************************
          +   *
          +   * @functype:
          +   *   SVG_Lib_Init_Func
          +   *
          +   * @description:
          +   *   A callback that is called when the first OT-SVG glyph is rendered in
          +   *   the lifetime of an @FT_Library object.  In a typical implementation,
          +   *   one would want to allocate a structure and point the `data_pointer`
          +   *   to it and perform any library initializations that might be needed.
          +   *
          +   * @inout:
          +   *   data_pointer ::
          +   *     The SVG rendering module stores a pointer variable that can be used
          +   *     by clients to store any data that needs to be shared across
          +   *     different hooks.  `data_pointer` is essentially a pointer to that
          +   *     pointer such that it can be written to as well as read from.
          +   *
          +   * @return:
          +   *   FreeType error code.  0 means success.
          +   *
          +   * @since:
          +   *   2.12
          +   */
          +  typedef FT_Error
          +  (*SVG_Lib_Init_Func)( FT_Pointer  *data_pointer );
          +
          +
          +  /**************************************************************************
          +   *
          +   * @functype:
          +   *   SVG_Lib_Free_Func
          +   *
          +   * @description:
          +   *   A callback that is called when the `ot-svg` module is being freed.
          +   *   It is only called if the init hook was called earlier.  This means
          +   *   that neither the init nor the free hook is called if no OT-SVG glyph
          +   *   is rendered.
          +   *
          +   *   In a typical implementation, one would want to free any state
          +   *   structure that was allocated in the init hook and perform any
          +   *   library-related closure that might be needed.
          +   *
          +   * @inout:
          +   *   data_pointer ::
          +   *     The SVG rendering module stores a pointer variable that can be used
          +   *     by clients to store any data that needs to be shared across
          +   *     different hooks.  `data_pointer` is essentially a pointer to that
          +   *     pointer such that it can be written to as well as read from.
          +   *
          +   * @since:
          +   *   2.12
          +   */
          +  typedef void
          +  (*SVG_Lib_Free_Func)( FT_Pointer  *data_pointer );
          +
          +
          +  /**************************************************************************
          +   *
          +   * @functype:
          +   *   SVG_Lib_Render_Func
          +   *
          +   * @description:
          +   *   A callback that is called to render an OT-SVG glyph.  This callback
          +   *   hook is called right after the preset hook @SVG_Lib_Preset_Slot_Func
          +   *   has been called with `cache` set to `TRUE`.  The data necessary to
          +   *   render is available through the handle @FT_SVG_Document, which is set
          +   *   in the `other` field of @FT_GlyphSlotRec.
          +   *
          +   *   The render hook is expected to render the SVG glyph to the bitmap
          +   *   buffer that is allocated already at `slot->bitmap.buffer`.  It also
          +   *   sets the `num_grays` value as well as `slot->format`.
          +   *
          +   * @input:
          +   *   slot ::
          +   *     The slot to render.
          +   *
          +   * @inout:
          +   *   data_pointer ::
          +   *     The SVG rendering module stores a pointer variable that can be used
          +   *     by clients to store any data that needs to be shared across
          +   *     different hooks.  `data_pointer` is essentially a pointer to that
          +   *     pointer such that it can be written to as well as read from.
          +   *
          +   * @return:
          +   *   FreeType error code.  0 means success.
          +   *
          +   * @since:
          +   *   2.12
          +   */
          +  typedef FT_Error
          +  (*SVG_Lib_Render_Func)( FT_GlyphSlot  slot,
          +                          FT_Pointer   *data_pointer );
          +
          +
          +  /**************************************************************************
          +   *
          +   * @functype:
          +   *   SVG_Lib_Preset_Slot_Func
          +   *
          +   * @description:
          +   *   A callback that is called to preset the glyph slot.  It is called from
          +   *   two places.
          +   *
          +   *   1. When `FT_Load_Glyph` needs to preset the glyph slot.
          +   *
          +   *   2. Right before the `svg` module calls the render callback hook.
          +   *
          +   *   When it is the former, the argument `cache` is set to `FALSE`.  When
          +   *   it is the latter, the argument `cache` is set to `TRUE`.  This
          +   *   distinction has been made because many calculations that are necessary
          +   *   for presetting a glyph slot are the same needed later for the render
          +   *   callback hook.  Thus, if `cache` is `TRUE`, the hook can _cache_ those
          +   *   calculations in a memory block referenced by the state pointer.
          +   *
          +   *   This hook is expected to preset the slot by setting parameters such as
          +   *   `bitmap_left`, `bitmap_top`, `width`, `rows`, `pitch`, and
          +   *   `pixel_mode`.  It is also expected to set all the metrics for the slot
          +   *   including the vertical advance if it is not already set.  Typically,
          +   *   fonts have horizontal advances but not vertical ones.  If those are
          +   *   available, they had already been set, otherwise they have to be
          +   *   estimated and set manually.  The hook must take into account the
          +   *   transformations that have been set, and translate the transformation
          +   *   matrices into the SVG coordinate system, as the original matrix is
          +   *   intended for the TTF/CFF coordinate system.
          +   *
          +   * @input:
          +   *   slot ::
          +   *     The glyph slot that has the SVG document loaded.
          +   *
          +   *   cache ::
          +   *     See description.
          +   *
          +   * @inout:
          +   *   data_pointer ::
          +   *     The SVG rendering module stores a pointer variable that can be used
          +   *     by clients to store any data that needs to be shared across
          +   *     different hooks.  `data_pointer` is essentially a pointer to that
          +   *     pointer such that it can be written to as well as read from.
          +   *
          +   * @return:
          +   *   FreeType error code.  0 means success.
          +   *
          +   * @since:
          +   *   2.12
          +   */
          +  typedef FT_Error
          +  (*SVG_Lib_Preset_Slot_Func)( FT_GlyphSlot  slot,
          +                               FT_Bool       cache,
          +                               FT_Pointer   *state );
          +
          +
          +  /**************************************************************************
          +   *
          +   * @struct:
          +   *   SVG_RendererHooks
          +   *
          +   * @description:
          +   *   A structure that stores the four hooks needed to render OT-SVG glyphs
          +   *   properly.  The structure is publicly used to set the hooks via the
          +   *   @svg-hooks driver property.
          +   *
          +   *   The behavior of each hook is described in its documentation.  One
          +   *   thing to note is that the preset hook and the render hook often need
          +   *   to do the same operations; therefore, it's better to cache the
          +   *   intermediate data in a state structure to avoid calculating it twice.
          +   *   For example, in the preset hook one can draw the glyph on a recorder
          +   *   surface and later create a bitmap surface from it in the render hook.
          +   *
          +   *   All four hooks must be non-NULL.
          +   *
          +   * @fields:
          +   *   init_svg ::
          +   *     The initialization hook.
          +   *
          +   *   free_svg ::
          +   *     The cleanup hook.
          +   *
          +   *   render_hook ::
          +   *     The render hook.
          +   *
          +   *   preset_slot ::
          +   *     The preset hook.
          +   *
          +   * @since:
          +   *   2.12
          +   */
          +  typedef struct SVG_RendererHooks_
          +  {
          +    SVG_Lib_Init_Func    init_svg;
          +    SVG_Lib_Free_Func    free_svg;
          +    SVG_Lib_Render_Func  render_svg;
          +
          +    SVG_Lib_Preset_Slot_Func  preset_slot;
          +
          +  } SVG_RendererHooks;
          +
          +
          +  /**************************************************************************
          +   *
          +   * @struct:
          +   *   FT_SVG_DocumentRec
          +   *
          +   * @description:
          +   *   A structure that models one SVG document.
          +   *
          +   * @fields:
          +   *   svg_document ::
          +   *     A pointer to the SVG document.
          +   *
          +   *   svg_document_length ::
          +   *     The length of `svg_document`.
          +   *
          +   *   metrics ::
          +   *     A metrics object storing the size information.
          +   *
          +   *   units_per_EM ::
          +   *     The size of the EM square.
          +   *
          +   *   start_glyph_id ::
          +   *     The first glyph ID in the glyph range covered by this document.
          +   *
          +   *   end_glyph_id ::
          +   *     The last glyph ID in the glyph range covered by this document.
          +   *
          +   *   transform ::
          +   *     A 2x2 transformation matrix to apply to the glyph while rendering
          +   *     it.
          +   *
          +   *   delta ::
          +   *     The translation to apply to the glyph while rendering.
          +   *
          +   * @note:
          +   *   When an @FT_GlyphSlot object `slot` is passed down to a renderer, the
          +   *   renderer can only access the `metrics` and `units_per_EM` fields via
          +   *   `slot->face`.  However, when @FT_Glyph_To_Bitmap sets up a dummy
          +   *   object, it has no way to set a `face` object.  Thus, metrics
          +   *   information and `units_per_EM` (which is necessary for OT-SVG) has to
          +   *   be stored separately.
          +   *
          +   * @since:
          +   *   2.12
          +   */
          +  typedef struct  FT_SVG_DocumentRec_
          +  {
          +    FT_Byte*  svg_document;
          +    FT_ULong  svg_document_length;
          +
          +    FT_Size_Metrics  metrics;
          +    FT_UShort        units_per_EM;
          +
          +    FT_UShort  start_glyph_id;
          +    FT_UShort  end_glyph_id;
          +
          +    FT_Matrix  transform;
          +    FT_Vector  delta;
          +
          +  } FT_SVG_DocumentRec;
          +
          +
          +  /**************************************************************************
          +   *
          +   * @type:
          +   *   FT_SVG_Document
          +   *
          +   * @description:
          +   *   A handle to an @FT_SVG_DocumentRec object.
          +   *
          +   * @since:
          +   *   2.12
          +   */
          +  typedef struct FT_SVG_DocumentRec_*  FT_SVG_Document;
          +
          +
          +FT_END_HEADER
          +
          +#endif /* OTSVG_H_ */
          +
          +
          +/* END */
          diff --git a/thirdparty/freetype/include/freetype/t1tables.h b/thirdparty/freetype/include/freetype/t1tables.h
          index a5f6ae7210..4068b204a9 100644
          --- a/thirdparty/freetype/include/freetype/t1tables.h
          +++ b/thirdparty/freetype/include/freetype/t1tables.h
          @@ -5,7 +5,7 @@
            *   Basic Type 1/Type 2 tables definitions and interface (specification
            *   only).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -453,22 +453,22 @@ FT_BEGIN_HEADER
             /**************************************************************************
              *
              * @function:
          -   *    FT_Has_PS_Glyph_Names
          +   *   FT_Has_PS_Glyph_Names
              *
              * @description:
          -   *    Return true if a given face provides reliable PostScript glyph names.
          -   *    This is similar to using the @FT_HAS_GLYPH_NAMES macro, except that
          -   *    certain fonts (mostly TrueType) contain incorrect glyph name tables.
          +   *   Return true if a given face provides reliable PostScript glyph names.
          +   *   This is similar to using the @FT_HAS_GLYPH_NAMES macro, except that
          +   *   certain fonts (mostly TrueType) contain incorrect glyph name tables.
              *
          -   *    When this function returns true, the caller is sure that the glyph
          -   *    names returned by @FT_Get_Glyph_Name are reliable.
          +   *   When this function returns true, the caller is sure that the glyph
          +   *   names returned by @FT_Get_Glyph_Name are reliable.
              *
              * @input:
          -   *    face ::
          -   *      face handle
          +   *   face ::
          +   *     face handle
              *
              * @return:
          -   *    Boolean.  True if glyph names are reliable.
          +   *   Boolean.  True if glyph names are reliable.
              *
              */
             FT_EXPORT( FT_Int )
          @@ -478,30 +478,40 @@ FT_BEGIN_HEADER
             /**************************************************************************
              *
              * @function:
          -   *    FT_Get_PS_Font_Info
          +   *   FT_Get_PS_Font_Info
              *
              * @description:
          -   *    Retrieve the @PS_FontInfoRec structure corresponding to a given
          -   *    PostScript font.
          +   *   Retrieve the @PS_FontInfoRec structure corresponding to a given
          +   *   PostScript font.
              *
              * @input:
          -   *    face ::
          -   *      PostScript face handle.
          +   *   face ::
          +   *     PostScript face handle.
              *
              * @output:
          -   *    afont_info ::
          -   *      Output font info structure pointer.
          +   *   afont_info ::
          +   *     A pointer to a @PS_FontInfoRec object.
              *
              * @return:
          -   *    FreeType error code.  0~means success.
          +   *   FreeType error code.  0~means success.
              *
              * @note:
          -   *    String pointers within the @PS_FontInfoRec structure are owned by the
          -   *    face and don't need to be freed by the caller.  Missing entries in
          -   *    the font's FontInfo dictionary are represented by `NULL` pointers.
          +   *   String pointers within the @PS_FontInfoRec structure are owned by the
          +   *   face and don't need to be freed by the caller.  Missing entries in the
          +   *   font's FontInfo dictionary are represented by `NULL` pointers.
              *
          -   *    If the font's format is not PostScript-based, this function will
          -   *    return the `FT_Err_Invalid_Argument` error code.
          +   *   The following font formats support this feature: 'Type~1', 'Type~42',
          +   *   'CFF', 'CID~Type~1'.  For other font formats this function returns the
          +   *   `FT_Err_Invalid_Argument` error code.
          +   *
          +   * @example:
          +   *   ```
          +   *     PS_FontInfoRec  font_info;
          +   *
          +   *
          +   *     error = FT_Get_PS_Font_Info( face, &font_info );
          +   *     ...
          +   *   ```
              *
              */
             FT_EXPORT( FT_Error )
          @@ -512,29 +522,39 @@ FT_BEGIN_HEADER
             /**************************************************************************
              *
              * @function:
          -   *    FT_Get_PS_Font_Private
          +   *   FT_Get_PS_Font_Private
              *
              * @description:
          -   *    Retrieve the @PS_PrivateRec structure corresponding to a given
          -   *    PostScript font.
          +   *   Retrieve the @PS_PrivateRec structure corresponding to a given
          +   *   PostScript font.
              *
              * @input:
          -   *    face ::
          -   *      PostScript face handle.
          +   *   face ::
          +   *     PostScript face handle.
              *
              * @output:
          -   *    afont_private ::
          -   *      Output private dictionary structure pointer.
          +   *   afont_private ::
          +   *     A pointer to a @PS_PrivateRec object.
              *
              * @return:
          -   *    FreeType error code.  0~means success.
          +   *   FreeType error code.  0~means success.
              *
              * @note:
          -   *    The string pointers within the @PS_PrivateRec structure are owned by
          -   *    the face and don't need to be freed by the caller.
          +   *   The string pointers within the @PS_PrivateRec structure are owned by
          +   *   the face and don't need to be freed by the caller.
              *
          -   *    If the font's format is not PostScript-based, this function returns
          -   *    the `FT_Err_Invalid_Argument` error code.
          +   *   Only the 'Type~1' font format supports this feature.  For other font
          +   *   formats this function returns the `FT_Err_Invalid_Argument` error
          +   *   code.
          +   *
          +   * @example:
          +   *   ```
          +   *     PS_PrivateRec  font_private;
          +   *
          +   *
          +   *     error = FT_Get_PS_Font_Private( face, &font_private );
          +   *     ...
          +   *   ```
              *
              */
             FT_EXPORT( FT_Error )
          @@ -693,67 +713,67 @@ FT_BEGIN_HEADER
             /**************************************************************************
              *
              * @function:
          -   *    FT_Get_PS_Font_Value
          +   *   FT_Get_PS_Font_Value
              *
              * @description:
          -   *    Retrieve the value for the supplied key from a PostScript font.
          +   *   Retrieve the value for the supplied key from a PostScript font.
              *
              * @input:
          -   *    face ::
          -   *      PostScript face handle.
          +   *   face ::
          +   *     PostScript face handle.
              *
          -   *    key ::
          -   *      An enumeration value representing the dictionary key to retrieve.
          +   *   key ::
          +   *     An enumeration value representing the dictionary key to retrieve.
              *
          -   *    idx ::
          -   *      For array values, this specifies the index to be returned.
          +   *   idx ::
          +   *     For array values, this specifies the index to be returned.
              *
          -   *    value ::
          -   *      A pointer to memory into which to write the value.
          +   *   value ::
          +   *     A pointer to memory into which to write the value.
              *
          -   *    valen_len ::
          -   *      The size, in bytes, of the memory supplied for the value.
          +   *   valen_len ::
          +   *     The size, in bytes, of the memory supplied for the value.
              *
              * @output:
          -   *    value ::
          -   *      The value matching the above key, if it exists.
          +   *   value ::
          +   *     The value matching the above key, if it exists.
              *
              * @return:
          -   *    The amount of memory (in bytes) required to hold the requested value
          -   *    (if it exists, -1 otherwise).
          +   *   The amount of memory (in bytes) required to hold the requested value
          +   *   (if it exists, -1 otherwise).
              *
              * @note:
          -   *    The values returned are not pointers into the internal structures of
          -   *    the face, but are 'fresh' copies, so that the memory containing them
          -   *    belongs to the calling application.  This also enforces the
          -   *    'read-only' nature of these values, i.e., this function cannot be
          -   *    used to manipulate the face.
          +   *   The values returned are not pointers into the internal structures of
          +   *   the face, but are 'fresh' copies, so that the memory containing them
          +   *   belongs to the calling application.  This also enforces the
          +   *   'read-only' nature of these values, i.e., this function cannot be
          +   *   used to manipulate the face.
              *
          -   *    `value` is a void pointer because the values returned can be of
          -   *    various types.
          +   *   `value` is a void pointer because the values returned can be of
          +   *   various types.
              *
          -   *    If either `value` is `NULL` or `value_len` is too small, just the
          -   *    required memory size for the requested entry is returned.
          +   *   If either `value` is `NULL` or `value_len` is too small, just the
          +   *   required memory size for the requested entry is returned.
              *
          -   *    The `idx` parameter is used, not only to retrieve elements of, for
          -   *    example, the FontMatrix or FontBBox, but also to retrieve name keys
          -   *    from the CharStrings dictionary, and the charstrings themselves.  It
          -   *    is ignored for atomic values.
          +   *   The `idx` parameter is used, not only to retrieve elements of, for
          +   *   example, the FontMatrix or FontBBox, but also to retrieve name keys
          +   *   from the CharStrings dictionary, and the charstrings themselves.  It
          +   *   is ignored for atomic values.
              *
          -   *    `PS_DICT_BLUE_SCALE` returns a value that is scaled up by 1000.  To
          -   *    get the value as in the font stream, you need to divide by 65536000.0
          -   *    (to remove the FT_Fixed scale, and the x1000 scale).
          +   *   `PS_DICT_BLUE_SCALE` returns a value that is scaled up by 1000.  To
          +   *   get the value as in the font stream, you need to divide by 65536000.0
          +   *   (to remove the FT_Fixed scale, and the x1000 scale).
              *
          -   *    IMPORTANT: Only key/value pairs read by the FreeType interpreter can
          -   *    be retrieved.  So, for example, PostScript procedures such as NP, ND,
          -   *    and RD are not available.  Arbitrary keys are, obviously, not be
          -   *    available either.
          +   *   IMPORTANT: Only key/value pairs read by the FreeType interpreter can
          +   *   be retrieved.  So, for example, PostScript procedures such as NP, ND,
          +   *   and RD are not available.  Arbitrary keys are, obviously, not be
          +   *   available either.
              *
          -   *    If the font's format is not PostScript-based, this function returns
          -   *    the `FT_Err_Invalid_Argument` error code.
          +   *   If the font's format is not PostScript-based, this function returns
          +   *   the `FT_Err_Invalid_Argument` error code.
              *
              * @since:
          -   *    2.4.8
          +   *   2.4.8
              *
              */
             FT_EXPORT( FT_Long )
          diff --git a/thirdparty/freetype/include/freetype/ttnameid.h b/thirdparty/freetype/include/freetype/ttnameid.h
          index a09950f542..37b505a05b 100644
          --- a/thirdparty/freetype/include/freetype/ttnameid.h
          +++ b/thirdparty/freetype/include/freetype/ttnameid.h
          @@ -4,7 +4,7 @@
            *
            *   TrueType name ID definitions (specification only).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/tttables.h b/thirdparty/freetype/include/freetype/tttables.h
          index c33d99059d..21664df7b3 100644
          --- a/thirdparty/freetype/include/freetype/tttables.h
          +++ b/thirdparty/freetype/include/freetype/tttables.h
          @@ -5,7 +5,7 @@
            *   Basic SFNT/TrueType tables definitions and interface
            *   (specification only).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/include/freetype/tttags.h b/thirdparty/freetype/include/freetype/tttags.h
          index 47ccc6ddf4..8b807641b8 100644
          --- a/thirdparty/freetype/include/freetype/tttags.h
          +++ b/thirdparty/freetype/include/freetype/tttags.h
          @@ -4,7 +4,7 @@
            *
            *   Tags for TrueType and OpenType tables (specification only).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -95,6 +95,7 @@ FT_BEGIN_HEADER
           #define TTAG_sbix  FT_MAKE_TAG( 's', 'b', 'i', 'x' )
           #define TTAG_sfnt  FT_MAKE_TAG( 's', 'f', 'n', 't' )
           #define TTAG_SING  FT_MAKE_TAG( 'S', 'I', 'N', 'G' )
          +#define TTAG_SVG   FT_MAKE_TAG( 'S', 'V', 'G', ' ' )
           #define TTAG_trak  FT_MAKE_TAG( 't', 'r', 'a', 'k' )
           #define TTAG_true  FT_MAKE_TAG( 't', 'r', 'u', 'e' )
           #define TTAG_ttc   FT_MAKE_TAG( 't', 't', 'c', ' ' )
          diff --git a/thirdparty/freetype/include/ft2build.h b/thirdparty/freetype/include/ft2build.h
          index 62686b1b20..2543ac435a 100644
          --- a/thirdparty/freetype/include/ft2build.h
          +++ b/thirdparty/freetype/include/ft2build.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType 2 build and setup macros.
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/meson.build b/thirdparty/freetype/meson.build
          index 9998848d57..5bf94c30ca 100644
          --- a/thirdparty/freetype/meson.build
          +++ b/thirdparty/freetype/meson.build
          @@ -2,7 +2,7 @@
           # Meson project file for FreeType 2
           #
           
          -# Copyright (C) 2020-2021 by
          +# Copyright (C) 2020-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          @@ -27,7 +27,8 @@ project('freetype2', 'c',
             meson_version: '>= 0.55.0',
             default_options: ['default_library=both'],
             version: run_command('builds/meson/extract_freetype_version.py',
          -                       'include/freetype/freetype.h').stdout().strip(),
          +                       'include/freetype/freetype.h',
          +                       check: true).stdout().strip(),
           )
           
           
          @@ -35,17 +36,18 @@ project('freetype2', 'c',
           # variable; we thus use an external command to have this functionality
           # with older versions, too.
           
          -python = import('python')
          -python_exe = python.find_installation(required: true)
          +python_exe = find_program('python3')
           
           ft2_so_version = run_command(python_exe,
             files('builds/meson/extract_libtool_version.py'),
             '--soversion',
          -  files('builds/unix/configure.raw')).stdout().strip()
          +  files('builds/unix/configure.raw'),
          +  check: true).stdout().strip()
           
           ft2_pkgconfig_version = run_command(python_exe,
             files('builds/meson/extract_libtool_version.py'),
          -  files('builds/unix/configure.raw')).stdout().strip()
          +  files('builds/unix/configure.raw'),
          +  check: true).stdout().strip()
           
           ft2_includes = include_directories('include')
           
          @@ -70,7 +72,8 @@ ft2_sources = [ftmodule_h]
           ft_main_modules = run_command(python_exe,
             files('builds/meson/parse_modules_cfg.py'),
             '--format=main-modules',
          -  files('modules.cfg')).stdout().strip().split()
          +  files('modules.cfg'),
          +  check: true).stdout().strip().split()
           
           ft2_sources += files([
             'src/base/ftbase.c',
          @@ -91,7 +94,8 @@ endforeach
           ft_aux_modules = run_command(python_exe,
             files('builds/meson/parse_modules_cfg.py'),
             '--format=aux-modules',
          -  files('modules.cfg')).stdout().strip().split()
          +  files('modules.cfg'),
          +  check: true).stdout().strip().split()
           
           foreach auxmod: ft_aux_modules
             source = auxmod
          @@ -117,7 +121,8 @@ endforeach
           base_extensions = run_command(python_exe,
             files('builds/meson/parse_modules_cfg.py'),
             '--format=base-extensions-list',
          -  files('modules.cfg')).stdout().split()
          +  files('modules.cfg'),
          +  check: true).stdout().split()
           
           foreach ext: base_extensions
             ft2_sources += files('src/base/' + ext)
          @@ -167,6 +172,7 @@ ft2_public_headers = files([
             'include/freetype/fttrigon.h',
             'include/freetype/fttypes.h',
             'include/freetype/ftwinfnt.h',
          +  'include/freetype/otsvg.h',
             'include/freetype/t1tables.h',
             'include/freetype/ttnameid.h',
             'include/freetype/tttables.h',
          @@ -262,15 +268,49 @@ ftoption_command = process_header_command
           
           
           # external GZip support
          -zlib_dep = dependency('zlib',
          -  required: get_option('zlib'),
          -  fallback: 'zlib')
          +zlib_option = get_option('zlib')
           
          -if zlib_dep.found()
          -  ftoption_command += ['--enable=FT_CONFIG_OPTION_SYSTEM_ZLIB']
          +# Backwards-compatible aliases.
          +if zlib_option == 'disabled'
          +  zlib_option = 'none'
          +elif zlib_option == 'enabled'
          +  zlib_option = 'auto'
          +endif
          +
          +if zlib_option == 'auto'
          +  # First try to find a system installation, otherwise fall back to
          +  # the subproject.
          +  zlib_dep = dependency('zlib',
          +    required: false)
          +  if zlib_dep.found()
          +    zlib_option = 'system'
          +  else
          +    zlib_option = 'external'
          +  endif
          +endif
          +
          +if zlib_option == 'none'
          +  ftoption_command += [ '--disable=FT_CONFIG_OPTION_USE_ZLIB' ]
          +elif zlib_option == 'internal'
          +  ftoption_command += [ '--enable=FT_CONFIG_OPTION_USE_ZLIB' ]
          +elif zlib_option == 'external'
          +  ftoption_command += [ '--enable=FT_CONFIG_OPTION_USE_ZLIB' ]
          +  zlib_project = subproject('zlib',
          +    required: true,
          +    default_options: 'default_library=static')
          +  zlib_dep = zlib_project.get_variable('zlib_dep')
          +  ft2_deps += [zlib_dep]
          +elif zlib_option == 'system'
          +  zlib_dep = dependency('zlib',
          +    required: true)
          +  assert(zlib_dep.found(), 'Could not find system zlib installation!')
          +  ftoption_command += [
          +    '--enable=FT_CONFIG_OPTION_USE_ZLIB',
          +    '--enable=FT_CONFIG_OPTION_SYSTEM_ZLIB',
          +  ]
             ft2_deps += [zlib_dep]
           else
          -  ftoption_command += ['--disable=FT_CONFIG_OPTION_SYSTEM_ZLIB']
          +  assert(false, 'Invalid zlib option ' + zlib_option)
           endif
           
           # BZip2 support
          @@ -417,7 +457,7 @@ gen_docs = custom_target('freetype2 reference documentation',
           summary({'OS': host_machine.system(),
                   }, section: 'Operating System')
           
          -summary({'Zlib': zlib_dep.found() ? 'external' : 'internal',
          +summary({'Zlib': zlib_option,
                    'Bzip2': bzip2_dep.found() ? 'yes' : 'no',
                    'Png': libpng_dep.found() ? 'yes' : 'no',
                    'Harfbuzz': harfbuzz_dep.found() ? 'yes' : 'no',
          diff --git a/thirdparty/freetype/meson_options.txt b/thirdparty/freetype/meson_options.txt
          index 375eb714eb..8ea6251727 100644
          --- a/thirdparty/freetype/meson_options.txt
          +++ b/thirdparty/freetype/meson_options.txt
          @@ -2,7 +2,7 @@
           # meson_options.txt
           #
           
          -# Copyright (C) 2020-2021 by
          +# Copyright (C) 2020-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          @@ -46,8 +46,10 @@ option('tests',
             description: 'Enable FreeType unit and regression tests')
           
           option('zlib',
          -  type: 'feature',
          -  value: 'auto',
          +  type: 'combo',
          +  choices: [ 'auto', 'none',
          +             'internal', 'external', 'system',
          +             'disabled', 'enabled' ],
             description: 'Support reading gzip-compressed font files')
           
           # EOF
          diff --git a/thirdparty/freetype/modules.cfg b/thirdparty/freetype/modules.cfg
          index 30f7fac45a..aded92e5e9 100644
          --- a/thirdparty/freetype/modules.cfg
          +++ b/thirdparty/freetype/modules.cfg
          @@ -1,6 +1,6 @@
           # modules.cfg
           #
          -# Copyright (C) 2005-2021 by
          +# Copyright (C) 2005-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          @@ -99,6 +99,9 @@ RASTER_MODULES += smooth
           # Monochrome rasterizer.
           RASTER_MODULES += raster
           
          +# OT-SVG.
          +RASTER_MODULES += svg
          +
           # Signed distance field rasterizer.
           RASTER_MODULES += sdf
           
          diff --git a/thirdparty/freetype/src/autofit/afblue.c b/thirdparty/freetype/src/autofit/afblue.c
          index c9e8045c18..b986eb4a13 100644
          --- a/thirdparty/freetype/src/autofit/afblue.c
          +++ b/thirdparty/freetype/src/autofit/afblue.c
          @@ -7,7 +7,7 @@
            *
            *   Auto-fitter data for blue strings (body).
            *
          - * Copyright (C) 2013-2021 by
          + * Copyright (C) 2013-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/afblue.cin b/thirdparty/freetype/src/autofit/afblue.cin
          index 071e80b031..f7e27ad8e5 100644
          --- a/thirdparty/freetype/src/autofit/afblue.cin
          +++ b/thirdparty/freetype/src/autofit/afblue.cin
          @@ -4,7 +4,7 @@
            *
            *   Auto-fitter data for blue strings (body).
            *
          - * Copyright (C) 2013-2021 by
          + * Copyright (C) 2013-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/afblue.dat b/thirdparty/freetype/src/autofit/afblue.dat
          index 1aa9b26de9..201acc4f6f 100644
          --- a/thirdparty/freetype/src/autofit/afblue.dat
          +++ b/thirdparty/freetype/src/autofit/afblue.dat
          @@ -2,7 +2,7 @@
           //
           //   Auto-fitter data for blue strings.
           //
          -// Copyright (C) 2013-2021 by
          +// Copyright (C) 2013-2022 by
           // David Turner, Robert Wilhelm, and Werner Lemberg.
           //
           // This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/afblue.h b/thirdparty/freetype/src/autofit/afblue.h
          index 311c9e3afd..0e56abb94d 100644
          --- a/thirdparty/freetype/src/autofit/afblue.h
          +++ b/thirdparty/freetype/src/autofit/afblue.h
          @@ -7,7 +7,7 @@
            *
            *   Auto-fitter data for blue strings (specification).
            *
          - * Copyright (C) 2013-2021 by
          + * Copyright (C) 2013-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/afblue.hin b/thirdparty/freetype/src/autofit/afblue.hin
          index 5186914937..f9fd5aa3b4 100644
          --- a/thirdparty/freetype/src/autofit/afblue.hin
          +++ b/thirdparty/freetype/src/autofit/afblue.hin
          @@ -4,7 +4,7 @@
            *
            *   Auto-fitter data for blue strings (specification).
            *
          - * Copyright (C) 2013-2021 by
          + * Copyright (C) 2013-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/afcjk.c b/thirdparty/freetype/src/autofit/afcjk.c
          index 7e46b6b1ef..1853a17f5c 100644
          --- a/thirdparty/freetype/src/autofit/afcjk.c
          +++ b/thirdparty/freetype/src/autofit/afcjk.c
          @@ -4,7 +4,7 @@
            *
            *   Auto-fitter hinting routines for CJK writing system (body).
            *
          - * Copyright (C) 2006-2021 by
          + * Copyright (C) 2006-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -843,7 +843,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 );
               AF_Direction  major_dir     = axis->major_dir;
               AF_Segment    seg1, seg2;
               FT_Pos        len_threshold;
          @@ -1005,7 +1005,7 @@
               AF_CJKAxis    laxis  = &((AF_CJKMetrics)hints->metrics)->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 );
               AF_Segment    seg;
           
               FT_Fixed      scale;
          @@ -1153,7 +1153,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;
           
           
          @@ -1291,7 +1291,7 @@
             {
               AF_AxisHints  axis       = &hints->axis[dim];
               AF_Edge       edge       = axis->edges;
          -    AF_Edge       edge_limit = edge + axis->num_edges;
          +    AF_Edge       edge_limit = FT_OFFSET( edge, axis->num_edges );
               AF_CJKAxis    cjk        = &metrics->axis[dim];
               FT_Fixed      scale      = cjk->scale;
               FT_Pos        best_dist0;  /* initial threshold */
          @@ -1798,7 +1798,7 @@
             {
               AF_AxisHints  axis       = &hints->axis[dim];
               AF_Edge       edges      = axis->edges;
          -    AF_Edge       edge_limit = edges + axis->num_edges;
          +    AF_Edge       edge_limit = FT_OFFSET( edges, axis->num_edges );
               FT_PtrDist    n_edges;
               AF_Edge       edge;
               AF_Edge       anchor   = NULL;
          @@ -2177,7 +2177,7 @@
             {
               AF_AxisHints  axis       = & hints->axis[dim];
               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;
               FT_Bool       snapping;
           
          diff --git a/thirdparty/freetype/src/autofit/afcjk.h b/thirdparty/freetype/src/autofit/afcjk.h
          index 58aa298dad..bf948bcec0 100644
          --- a/thirdparty/freetype/src/autofit/afcjk.h
          +++ b/thirdparty/freetype/src/autofit/afcjk.h
          @@ -4,7 +4,7 @@
            *
            *   Auto-fitter hinting routines for CJK writing system (specification).
            *
          - * Copyright (C) 2006-2021 by
          + * Copyright (C) 2006-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/afcover.h b/thirdparty/freetype/src/autofit/afcover.h
          index c7ae1e9a8a..be71fe39de 100644
          --- a/thirdparty/freetype/src/autofit/afcover.h
          +++ b/thirdparty/freetype/src/autofit/afcover.h
          @@ -4,7 +4,7 @@
            *
            *   Auto-fitter coverages (specification only).
            *
          - * Copyright (C) 2013-2021 by
          + * Copyright (C) 2013-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/afdummy.c b/thirdparty/freetype/src/autofit/afdummy.c
          index a36b56f784..5fdbfcfd42 100644
          --- a/thirdparty/freetype/src/autofit/afdummy.c
          +++ b/thirdparty/freetype/src/autofit/afdummy.c
          @@ -5,7 +5,7 @@
            *   Auto-fitter dummy routines to be used if no hinting should be
            *   performed (body).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/afdummy.h b/thirdparty/freetype/src/autofit/afdummy.h
          index b58849fe50..4dddbd5215 100644
          --- a/thirdparty/freetype/src/autofit/afdummy.h
          +++ b/thirdparty/freetype/src/autofit/afdummy.h
          @@ -5,7 +5,7 @@
            *   Auto-fitter dummy routines to be used if no hinting should be
            *   performed (specification).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/aferrors.h b/thirdparty/freetype/src/autofit/aferrors.h
          index 09bed66395..d31b1a9c88 100644
          --- a/thirdparty/freetype/src/autofit/aferrors.h
          +++ b/thirdparty/freetype/src/autofit/aferrors.h
          @@ -4,7 +4,7 @@
            *
            *   Autofitter error codes (specification only).
            *
          - * Copyright (C) 2005-2021 by
          + * Copyright (C) 2005-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/afglobal.c b/thirdparty/freetype/src/autofit/afglobal.c
          index b805b3b0e5..87a3fbfb0f 100644
          --- a/thirdparty/freetype/src/autofit/afglobal.c
          +++ b/thirdparty/freetype/src/autofit/afglobal.c
          @@ -4,7 +4,7 @@
            *
            *   Auto-fitter routines to compute global hinting values (body).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -337,11 +337,13 @@
           
               /* we allocate an AF_FaceGlobals structure together */
               /* with the glyph_styles array                      */
          -    if ( FT_ALLOC( globals,
          -                   sizeof ( *globals ) +
          -                     (FT_ULong)face->num_glyphs * sizeof ( FT_UShort ) ) )
          +    if ( FT_QALLOC( globals,
          +                    sizeof ( *globals ) +
          +                      (FT_ULong)face->num_glyphs * sizeof ( FT_UShort ) ) )
                 goto Exit;
           
          +    FT_ZERO( &globals->metrics );
          +
               globals->face                      = face;
               globals->glyph_count               = face->num_glyphs;
               /* right after the globals structure come the glyph styles */
          diff --git a/thirdparty/freetype/src/autofit/afglobal.h b/thirdparty/freetype/src/autofit/afglobal.h
          index cd97e716c4..f7ebf8d57a 100644
          --- a/thirdparty/freetype/src/autofit/afglobal.h
          +++ b/thirdparty/freetype/src/autofit/afglobal.h
          @@ -5,7 +5,7 @@
            *   Auto-fitter routines to compute global hinting values
            *   (specification).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/afhints.c b/thirdparty/freetype/src/autofit/afhints.c
          index 5506afda22..ae7d10528d 100644
          --- a/thirdparty/freetype/src/autofit/afhints.c
          +++ b/thirdparty/freetype/src/autofit/afhints.c
          @@ -4,7 +4,7 @@
            *
            *   Auto-fitter hinting routines (body).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -1316,7 +1316,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 );
               AF_Segment    seg;
           
           
          @@ -1393,7 +1393,7 @@
               AF_Point      point_limit = points + hints->num_points;
               AF_AxisHints  axis        = &hints->axis[dim];
               AF_Edge       edges       = axis->edges;
          -    AF_Edge       edge_limit  = edges + axis->num_edges;
          +    AF_Edge       edge_limit  = FT_OFFSET( edges, axis->num_edges );
               FT_UInt       touch_flag;
           
           
          diff --git a/thirdparty/freetype/src/autofit/afhints.h b/thirdparty/freetype/src/autofit/afhints.h
          index 38d2847d71..96001cd80d 100644
          --- a/thirdparty/freetype/src/autofit/afhints.h
          +++ b/thirdparty/freetype/src/autofit/afhints.h
          @@ -4,7 +4,7 @@
            *
            *   Auto-fitter hinting routines (specification).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/afindic.c b/thirdparty/freetype/src/autofit/afindic.c
          index 064c300ed7..5bf0b5f945 100644
          --- a/thirdparty/freetype/src/autofit/afindic.c
          +++ b/thirdparty/freetype/src/autofit/afindic.c
          @@ -4,7 +4,7 @@
            *
            *   Auto-fitter hinting routines for Indic writing system (body).
            *
          - * Copyright (C) 2007-2021 by
          + * Copyright (C) 2007-2022 by
            * Rahul Bhalerao , .
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/afindic.h b/thirdparty/freetype/src/autofit/afindic.h
          index 3e46724112..59ae11a677 100644
          --- a/thirdparty/freetype/src/autofit/afindic.h
          +++ b/thirdparty/freetype/src/autofit/afindic.h
          @@ -5,7 +5,7 @@
            *   Auto-fitter hinting routines for Indic writing system
            *   (specification).
            *
          - * Copyright (C) 2007-2021 by
          + * Copyright (C) 2007-2022 by
            * Rahul Bhalerao , .
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/aflatin.c b/thirdparty/freetype/src/autofit/aflatin.c
          index 5e81d771a4..bed0ccee08 100644
          --- a/thirdparty/freetype/src/autofit/aflatin.c
          +++ b/thirdparty/freetype/src/autofit/aflatin.c
          @@ -4,7 +4,7 @@
            *
            *   Auto-fitter hinting routines for latin writing system (body).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -200,7 +200,7 @@
                                                 (AF_Dimension)dim );
           
                   seg   = axhints->segments;
          -        limit = seg + axhints->num_segments;
          +        limit = FT_OFFSET( seg, axhints->num_segments );
           
                   for ( ; seg < limit; seg++ )
                   {
          @@ -1989,7 +1989,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_Pos        len_threshold, len_score, dist_score, max_width;
               AF_Segment    seg1, seg2;
           
          @@ -2134,7 +2134,7 @@
               FT_Bool  top_to_bottom_hinting = 0;
           
               AF_Segment    segments      = axis->segments;
          -    AF_Segment    segment_limit = segments + axis->num_segments;
          +    AF_Segment    segment_limit = FT_OFFSET( segments, axis->num_segments );
               AF_Segment    seg;
           
           #if 0
          @@ -2500,7 +2500,7 @@
             {
               AF_AxisHints  axis       = &hints->axis[AF_DIMENSION_VERT];
               AF_Edge       edge       = axis->edges;
          -    AF_Edge       edge_limit = edge + axis->num_edges;
          +    AF_Edge       edge_limit = FT_OFFSET( edge, axis->num_edges );
               AF_LatinAxis  latin      = &metrics->axis[AF_DIMENSION_VERT];
               FT_Fixed      scale      = latin->scale;
           
          @@ -2993,7 +2993,7 @@
             {
               AF_AxisHints  axis       = &hints->axis[dim];
               AF_Edge       edges      = axis->edges;
          -    AF_Edge       edge_limit = edges + axis->num_edges;
          +    AF_Edge       edge_limit = FT_OFFSET( edges, axis->num_edges );
               FT_PtrDist    n_edges;
               AF_Edge       edge;
               AF_Edge       anchor     = NULL;
          diff --git a/thirdparty/freetype/src/autofit/aflatin.h b/thirdparty/freetype/src/autofit/aflatin.h
          index d6b919ef84..facc663450 100644
          --- a/thirdparty/freetype/src/autofit/aflatin.h
          +++ b/thirdparty/freetype/src/autofit/aflatin.h
          @@ -5,7 +5,7 @@
            *   Auto-fitter hinting routines for latin writing system
            *   (specification).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/afloader.c b/thirdparty/freetype/src/autofit/afloader.c
          index a06d49ad7e..e55183a509 100644
          --- a/thirdparty/freetype/src/autofit/afloader.c
          +++ b/thirdparty/freetype/src/autofit/afloader.c
          @@ -4,7 +4,7 @@
            *
            *   Auto-fitter glyph loading routines (body).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/afloader.h b/thirdparty/freetype/src/autofit/afloader.h
          index b4936a8722..b345e46395 100644
          --- a/thirdparty/freetype/src/autofit/afloader.h
          +++ b/thirdparty/freetype/src/autofit/afloader.h
          @@ -4,7 +4,7 @@
            *
            *   Auto-fitter glyph loading routines (specification).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/afmodule.c b/thirdparty/freetype/src/autofit/afmodule.c
          index 76f9b3733b..1b14ae682e 100644
          --- a/thirdparty/freetype/src/autofit/afmodule.c
          +++ b/thirdparty/freetype/src/autofit/afmodule.c
          @@ -4,7 +4,7 @@
            *
            *   Auto-fitter module implementation (body).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/afmodule.h b/thirdparty/freetype/src/autofit/afmodule.h
          index c5bd468201..1d1bfaf544 100644
          --- a/thirdparty/freetype/src/autofit/afmodule.h
          +++ b/thirdparty/freetype/src/autofit/afmodule.h
          @@ -4,7 +4,7 @@
            *
            *   Auto-fitter module implementation (specification).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/afranges.c b/thirdparty/freetype/src/autofit/afranges.c
          index e06f182dd0..2de1991a57 100644
          --- a/thirdparty/freetype/src/autofit/afranges.c
          +++ b/thirdparty/freetype/src/autofit/afranges.c
          @@ -4,7 +4,7 @@
            *
            *   Auto-fitter Unicode script ranges (body).
            *
          - * Copyright (C) 2013-2021 by
          + * Copyright (C) 2013-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/afranges.h b/thirdparty/freetype/src/autofit/afranges.h
          index 841d630aab..acd01faf68 100644
          --- a/thirdparty/freetype/src/autofit/afranges.h
          +++ b/thirdparty/freetype/src/autofit/afranges.h
          @@ -4,7 +4,7 @@
            *
            *   Auto-fitter Unicode script ranges (specification).
            *
          - * Copyright (C) 2013-2021 by
          + * Copyright (C) 2013-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/afscript.h b/thirdparty/freetype/src/autofit/afscript.h
          index af78d573e1..172b598069 100644
          --- a/thirdparty/freetype/src/autofit/afscript.h
          +++ b/thirdparty/freetype/src/autofit/afscript.h
          @@ -4,7 +4,7 @@
            *
            *   Auto-fitter scripts (specification only).
            *
          - * Copyright (C) 2013-2021 by
          + * Copyright (C) 2013-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/afshaper.c b/thirdparty/freetype/src/autofit/afshaper.c
          index 5d078937e1..298480d864 100644
          --- a/thirdparty/freetype/src/autofit/afshaper.c
          +++ b/thirdparty/freetype/src/autofit/afshaper.c
          @@ -4,7 +4,7 @@
            *
            *   HarfBuzz interface for accessing OpenType features (body).
            *
          - * Copyright (C) 2013-2021 by
          + * Copyright (C) 2013-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/afshaper.h b/thirdparty/freetype/src/autofit/afshaper.h
          index cf3f81342f..558f03bdef 100644
          --- a/thirdparty/freetype/src/autofit/afshaper.h
          +++ b/thirdparty/freetype/src/autofit/afshaper.h
          @@ -4,7 +4,7 @@
            *
            *   HarfBuzz interface for accessing OpenType features (specification).
            *
          - * Copyright (C) 2013-2021 by
          + * Copyright (C) 2013-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/afstyles.h b/thirdparty/freetype/src/autofit/afstyles.h
          index 64c808c581..9080b9fb65 100644
          --- a/thirdparty/freetype/src/autofit/afstyles.h
          +++ b/thirdparty/freetype/src/autofit/afstyles.h
          @@ -4,7 +4,7 @@
            *
            *   Auto-fitter styles (specification only).
            *
          - * Copyright (C) 2013-2021 by
          + * Copyright (C) 2013-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/aftypes.h b/thirdparty/freetype/src/autofit/aftypes.h
          index 1d792b9476..754aad7ba4 100644
          --- a/thirdparty/freetype/src/autofit/aftypes.h
          +++ b/thirdparty/freetype/src/autofit/aftypes.h
          @@ -4,7 +4,7 @@
            *
            *   Auto-fitter types (specification only).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/afws-decl.h b/thirdparty/freetype/src/autofit/afws-decl.h
          index c10dd57e7b..c93845ef95 100644
          --- a/thirdparty/freetype/src/autofit/afws-decl.h
          +++ b/thirdparty/freetype/src/autofit/afws-decl.h
          @@ -4,7 +4,7 @@
            *
            *   Auto-fitter writing system declarations (specification only).
            *
          - * Copyright (C) 2013-2021 by
          + * Copyright (C) 2013-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/afws-iter.h b/thirdparty/freetype/src/autofit/afws-iter.h
          index 55714203e3..9cda3509bc 100644
          --- a/thirdparty/freetype/src/autofit/afws-iter.h
          +++ b/thirdparty/freetype/src/autofit/afws-iter.h
          @@ -4,7 +4,7 @@
            *
            *   Auto-fitter writing systems iterator (specification only).
            *
          - * Copyright (C) 2013-2021 by
          + * Copyright (C) 2013-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/autofit.c b/thirdparty/freetype/src/autofit/autofit.c
          index 7e692b4de9..3d78a9b335 100644
          --- a/thirdparty/freetype/src/autofit/autofit.c
          +++ b/thirdparty/freetype/src/autofit/autofit.c
          @@ -4,7 +4,7 @@
            *
            *   Auto-fitter module (body).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/autofit/module.mk b/thirdparty/freetype/src/autofit/module.mk
          index fab3a6bd62..1d7eda3043 100644
          --- a/thirdparty/freetype/src/autofit/module.mk
          +++ b/thirdparty/freetype/src/autofit/module.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 2003-2021 by
          +# Copyright (C) 2003-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/autofit/rules.mk b/thirdparty/freetype/src/autofit/rules.mk
          index 499c0e0836..11ef607177 100644
          --- a/thirdparty/freetype/src/autofit/rules.mk
          +++ b/thirdparty/freetype/src/autofit/rules.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 2003-2021 by
          +# Copyright (C) 2003-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/base/ftadvanc.c b/thirdparty/freetype/src/base/ftadvanc.c
          index f20b9928aa..fc6b428817 100644
          --- a/thirdparty/freetype/src/base/ftadvanc.c
          +++ b/thirdparty/freetype/src/base/ftadvanc.c
          @@ -4,7 +4,7 @@
            *
            *   Quick computation of advance widths (body).
            *
          - * Copyright (C) 2008-2021 by
          + * Copyright (C) 2008-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftbase.c b/thirdparty/freetype/src/base/ftbase.c
          index 7366bc46db..cd1056890f 100644
          --- a/thirdparty/freetype/src/base/ftbase.c
          +++ b/thirdparty/freetype/src/base/ftbase.c
          @@ -4,7 +4,7 @@
            *
            *   Single object library component (body only).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftbase.h b/thirdparty/freetype/src/base/ftbase.h
          index 963ff93d68..f873566f22 100644
          --- a/thirdparty/freetype/src/base/ftbase.h
          +++ b/thirdparty/freetype/src/base/ftbase.h
          @@ -4,7 +4,7 @@
            *
            *   Private functions used in the `base' module (specification).
            *
          - * Copyright (C) 2008-2021 by
          + * Copyright (C) 2008-2022 by
            * David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -28,6 +28,7 @@ FT_BEGIN_HEADER
           
             FT_DECLARE_GLYPH( ft_bitmap_glyph_class )
             FT_DECLARE_GLYPH( ft_outline_glyph_class )
          +  FT_DECLARE_GLYPH( ft_svg_glyph_class )
           
           
           #ifdef FT_CONFIG_OPTION_MAC_FONTS
          diff --git a/thirdparty/freetype/src/base/ftbbox.c b/thirdparty/freetype/src/base/ftbbox.c
          index 4db29cbf83..30aedf780c 100644
          --- a/thirdparty/freetype/src/base/ftbbox.c
          +++ b/thirdparty/freetype/src/base/ftbbox.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType bbox computation (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used
          diff --git a/thirdparty/freetype/src/base/ftbdf.c b/thirdparty/freetype/src/base/ftbdf.c
          index f93ca8eb75..4f22113d7e 100644
          --- a/thirdparty/freetype/src/base/ftbdf.c
          +++ b/thirdparty/freetype/src/base/ftbdf.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType API for accessing BDF-specific strings (body).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftbitmap.c b/thirdparty/freetype/src/base/ftbitmap.c
          index 2146d3e364..7825895ad6 100644
          --- a/thirdparty/freetype/src/base/ftbitmap.c
          +++ b/thirdparty/freetype/src/base/ftbitmap.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType utility functions for bitmaps (body).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -480,7 +480,7 @@
                * A gamma of 2.2 is fair to assume.  And then, we need to
                * undo the premultiplication too.
                *
          -     *   https://accessibility.kde.org/hsl-adjusted.php
          +     *   http://www.brucelindbloom.com/index.html?WorkingSpaceInfo.html#SideNotes
                *
                * We do the computation with integers only, applying a gamma of 2.0.
                * We guarantee 32-bit arithmetic to avoid overflow but the resulting
          @@ -488,9 +488,9 @@
                *
                */
           
          -    l = (  4732UL /* 0.0722 * 65536 */ * bgra[0] * bgra[0] +
          -          46871UL /* 0.7152 * 65536 */ * bgra[1] * bgra[1] +
          -          13933UL /* 0.2126 * 65536 */ * bgra[2] * bgra[2] ) >> 16;
          +    l = (  4731UL /* 0.072186 * 65536 */ * bgra[0] * bgra[0] +
          +          46868UL /* 0.715158 * 65536 */ * bgra[1] * bgra[1] +
          +          13937UL /* 0.212656 * 65536 */ * bgra[2] * bgra[2] ) >> 16;
           
               /*
                * Final transparency can be determined as follows.
          diff --git a/thirdparty/freetype/src/base/ftcalc.c b/thirdparty/freetype/src/base/ftcalc.c
          index 9df8e4010d..6c1e7fbd45 100644
          --- a/thirdparty/freetype/src/base/ftcalc.c
          +++ b/thirdparty/freetype/src/base/ftcalc.c
          @@ -4,7 +4,7 @@
            *
            *   Arithmetic computations (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftcid.c b/thirdparty/freetype/src/base/ftcid.c
          index 216ee2b3e4..b882ca3de0 100644
          --- a/thirdparty/freetype/src/base/ftcid.c
          +++ b/thirdparty/freetype/src/base/ftcid.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType API for accessing CID font information.
            *
          - * Copyright (C) 2007-2021 by
          + * Copyright (C) 2007-2022 by
            * Derek Clegg and Michael Toftdal.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftcolor.c b/thirdparty/freetype/src/base/ftcolor.c
          index 3ef3256b20..0edf379b43 100644
          --- a/thirdparty/freetype/src/base/ftcolor.c
          +++ b/thirdparty/freetype/src/base/ftcolor.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType's glyph color management (body).
            *
          - * Copyright (C) 2018-2021 by
          + * Copyright (C) 2018-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftdbgmem.c b/thirdparty/freetype/src/base/ftdbgmem.c
          index 4f5c1e7697..1df83c404d 100644
          --- a/thirdparty/freetype/src/base/ftdbgmem.c
          +++ b/thirdparty/freetype/src/base/ftdbgmem.c
          @@ -4,7 +4,7 @@
            *
            *   Memory debugger (body).
            *
          - * Copyright (C) 2001-2021 by
          + * Copyright (C) 2001-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftdebug.c b/thirdparty/freetype/src/base/ftdebug.c
          index 3485791306..648fff44ed 100644
          --- a/thirdparty/freetype/src/base/ftdebug.c
          +++ b/thirdparty/freetype/src/base/ftdebug.c
          @@ -4,7 +4,7 @@
            *
            *   Debugging and logging component (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/fterrors.c b/thirdparty/freetype/src/base/fterrors.c
          index 14649268f8..5846fefc91 100644
          --- a/thirdparty/freetype/src/base/fterrors.c
          +++ b/thirdparty/freetype/src/base/fterrors.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType API for error code handling.
            *
          - * Copyright (C) 2018-2021 by
          + * Copyright (C) 2018-2022 by
            * Armin Hasitzka, David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftfntfmt.c b/thirdparty/freetype/src/base/ftfntfmt.c
          index 4e1b830190..e69c1e0684 100644
          --- a/thirdparty/freetype/src/base/ftfntfmt.c
          +++ b/thirdparty/freetype/src/base/ftfntfmt.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType utility file for font formats (body).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftfstype.c b/thirdparty/freetype/src/base/ftfstype.c
          index 57e904d6f4..009d58c57d 100644
          --- a/thirdparty/freetype/src/base/ftfstype.c
          +++ b/thirdparty/freetype/src/base/ftfstype.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType utility file to access FSType data (body).
            *
          - * Copyright (C) 2008-2021 by
          + * Copyright (C) 2008-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftgasp.c b/thirdparty/freetype/src/base/ftgasp.c
          index b744f0a465..7567e3077a 100644
          --- a/thirdparty/freetype/src/base/ftgasp.c
          +++ b/thirdparty/freetype/src/base/ftgasp.c
          @@ -4,7 +4,7 @@
            *
            *   Access of TrueType's `gasp' table (body).
            *
          - * Copyright (C) 2007-2021 by
          + * Copyright (C) 2007-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftgloadr.c b/thirdparty/freetype/src/base/ftgloadr.c
          index 83ce0660ae..f05abdee81 100644
          --- a/thirdparty/freetype/src/base/ftgloadr.c
          +++ b/thirdparty/freetype/src/base/ftgloadr.c
          @@ -4,7 +4,7 @@
            *
            *   The FreeType glyph loader (body).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftglyph.c b/thirdparty/freetype/src/base/ftglyph.c
          index e2c6f73f80..571dca1a96 100644
          --- a/thirdparty/freetype/src/base/ftglyph.c
          +++ b/thirdparty/freetype/src/base/ftglyph.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType convenience functions to handle glyphs (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -34,6 +34,7 @@
           #include 
           #include 
           #include 
          +#include 
           
           #include "ftbase.h"
           
          @@ -277,6 +278,240 @@
             )
           
           
          +#ifdef FT_CONFIG_OPTION_SVG
          +
          +  /*************************************************************************/
          +  /*************************************************************************/
          +  /****                                                                 ****/
          +  /****   FT_SvgGlyph support                                           ****/
          +  /****                                                                 ****/
          +  /*************************************************************************/
          +  /*************************************************************************/
          +
          +
          +  FT_CALLBACK_DEF( FT_Error )
          +  ft_svg_glyph_init( FT_Glyph      svg_glyph,
          +                     FT_GlyphSlot  slot )
          +  {
          +    FT_ULong         doc_length;
          +    FT_SVG_Document  document;
          +    FT_SvgGlyph      glyph = (FT_SvgGlyph)svg_glyph;
          +
          +    FT_Error   error  = FT_Err_Ok;
          +    FT_Memory  memory = FT_GLYPH( glyph )->library->memory;
          +
          +
          +    if ( slot->format != FT_GLYPH_FORMAT_SVG )
          +    {
          +      error = FT_THROW( Invalid_Glyph_Format );
          +      goto Exit;
          +    }
          +
          +    if ( slot->other == NULL )
          +    {
          +      error = FT_THROW( Invalid_Slot_Handle );
          +      goto Exit;
          +    }
          +
          +    document = (FT_SVG_Document)slot->other;
          +
          +    if ( document->svg_document_length == 0 )
          +    {
          +      error = FT_THROW( Invalid_Slot_Handle );
          +      goto Exit;
          +    }
          +
          +    /* allocate a new document */
          +    doc_length = document->svg_document_length;
          +    if ( FT_QALLOC( glyph->svg_document, doc_length ) )
          +      goto Exit;
          +    glyph->svg_document_length = doc_length;
          +
          +    glyph->glyph_index = slot->glyph_index;
          +
          +    glyph->metrics      = document->metrics;
          +    glyph->units_per_EM = document->units_per_EM;
          +
          +    glyph->start_glyph_id = document->start_glyph_id;
          +    glyph->end_glyph_id   = document->end_glyph_id;
          +
          +    glyph->transform = document->transform;
          +    glyph->delta     = document->delta;
          +
          +    /* copy the document into glyph */
          +    FT_MEM_COPY( glyph->svg_document, document->svg_document, doc_length );
          +
          +  Exit:
          +    return error;
          +  }
          +
          +
          +  FT_CALLBACK_DEF( void )
          +  ft_svg_glyph_done( FT_Glyph  svg_glyph )
          +  {
          +    FT_SvgGlyph  glyph  = (FT_SvgGlyph)svg_glyph;
          +    FT_Memory    memory = svg_glyph->library->memory;
          +
          +
          +    /* just free the memory */
          +    FT_FREE( glyph->svg_document );
          +  }
          +
          +
          +  FT_CALLBACK_DEF( FT_Error )
          +  ft_svg_glyph_copy( FT_Glyph  svg_source,
          +                     FT_Glyph  svg_target )
          +  {
          +    FT_SvgGlyph  source = (FT_SvgGlyph)svg_source;
          +    FT_SvgGlyph  target = (FT_SvgGlyph)svg_target;
          +
          +    FT_Error   error  = FT_Err_Ok;
          +    FT_Memory  memory = FT_GLYPH( source )->library->memory;
          +
          +
          +    if ( svg_source->format != FT_GLYPH_FORMAT_SVG )
          +    {
          +      error = FT_THROW( Invalid_Glyph_Format );
          +      goto Exit;
          +    }
          +
          +    if ( source->svg_document_length == 0 )
          +    {
          +      error = FT_THROW( Invalid_Slot_Handle );
          +      goto Exit;
          +    }
          +
          +    target->glyph_index = source->glyph_index;
          +
          +    target->svg_document_length = source->svg_document_length;
          +
          +    target->metrics      = source->metrics;
          +    target->units_per_EM = source->units_per_EM;
          +
          +    target->start_glyph_id = source->start_glyph_id;
          +    target->end_glyph_id   = source->end_glyph_id;
          +
          +    target->transform = source->transform;
          +    target->delta     = source->delta;
          +
          +    /* allocate space for the SVG document */
          +    if ( FT_QALLOC( target->svg_document, target->svg_document_length ) )
          +      goto Exit;
          +
          +    /* copy the document */
          +    FT_MEM_COPY( target->svg_document,
          +                 source->svg_document,
          +                 target->svg_document_length );
          +
          +  Exit:
          +    return error;
          +  }
          +
          +
          +  FT_CALLBACK_DEF( void )
          +  ft_svg_glyph_transform( FT_Glyph          svg_glyph,
          +                          const FT_Matrix*  _matrix,
          +                          const FT_Vector*  _delta )
          +  {
          +    FT_SvgGlyph  glyph  = (FT_SvgGlyph)svg_glyph;
          +    FT_Matrix*   matrix = (FT_Matrix*)_matrix;
          +    FT_Vector*   delta  = (FT_Vector*)_delta;
          +
          +    FT_Matrix  tmp_matrix;
          +    FT_Vector  tmp_delta;
          +
          +    FT_Matrix  a, b;
          +    FT_Pos     x, y;
          +
          +
          +    if ( !matrix )
          +    {
          +      tmp_matrix.xx = 0x10000;
          +      tmp_matrix.xy = 0;
          +      tmp_matrix.yx = 0;
          +      tmp_matrix.yy = 0x10000;
          +
          +      matrix = &tmp_matrix;
          +    }
          +
          +    if ( !delta )
          +    {
          +      tmp_delta.x = 0;
          +      tmp_delta.y = 0;
          +
          +      delta = &tmp_delta;
          +    }
          +
          +    a = glyph->transform;
          +    b = *matrix;
          +    FT_Matrix_Multiply( &b, &a );
          +
          +    x = ADD_LONG( ADD_LONG( FT_MulFix( matrix->xx, glyph->delta.x ),
          +                            FT_MulFix( matrix->xy, glyph->delta.y ) ),
          +                  delta->x );
          +    y = ADD_LONG( ADD_LONG( FT_MulFix( matrix->yx, glyph->delta.x ),
          +                            FT_MulFix( matrix->yy, glyph->delta.y ) ),
          +                  delta->y );
          +
          +    glyph->delta.x = x;
          +    glyph->delta.y = y;
          +
          +    glyph->transform = a;
          +  }
          +
          +
          +  FT_CALLBACK_DEF( FT_Error )
          +  ft_svg_glyph_prepare( FT_Glyph      svg_glyph,
          +                        FT_GlyphSlot  slot )
          +  {
          +    FT_SvgGlyph  glyph = (FT_SvgGlyph)svg_glyph;
          +
          +    FT_Error   error  = FT_Err_Ok;
          +    FT_Memory  memory = svg_glyph->library->memory;
          +
          +    FT_SVG_Document  document = NULL;
          +
          +
          +    if ( FT_NEW( document ) )
          +      return error;
          +
          +    document->svg_document        = glyph->svg_document;
          +    document->svg_document_length = glyph->svg_document_length;
          +
          +    document->metrics      = glyph->metrics;
          +    document->units_per_EM = glyph->units_per_EM;
          +
          +    document->start_glyph_id = glyph->start_glyph_id;
          +    document->end_glyph_id   = glyph->end_glyph_id;
          +
          +    document->transform = glyph->transform;
          +    document->delta     = glyph->delta;
          +
          +    slot->format      = FT_GLYPH_FORMAT_SVG;
          +    slot->glyph_index = glyph->glyph_index;
          +    slot->other       = document;
          +
          +    return error;
          +  }
          +
          +
          +  FT_DEFINE_GLYPH(
          +    ft_svg_glyph_class,
          +
          +    sizeof ( FT_SvgGlyphRec ),
          +    FT_GLYPH_FORMAT_SVG,
          +
          +    ft_svg_glyph_init,      /* FT_Glyph_InitFunc       glyph_init      */
          +    ft_svg_glyph_done,      /* FT_Glyph_DoneFunc       glyph_done      */
          +    ft_svg_glyph_copy,      /* FT_Glyph_CopyFunc       glyph_copy      */
          +    ft_svg_glyph_transform, /* FT_Glyph_TransformFunc  glyph_transform */
          +    NULL,                   /* FT_Glyph_GetBBoxFunc    glyph_bbox      */
          +    ft_svg_glyph_prepare    /* FT_Glyph_PrepareFunc    glyph_prepare   */
          +  )
          +
          +#endif /* FT_CONFIG_OPTION_SVG */
          +
          +
             /*************************************************************************/
             /*************************************************************************/
             /****                                                                 ****/
          @@ -377,6 +612,12 @@
               else if ( format == FT_GLYPH_FORMAT_OUTLINE )
                 clazz = &ft_outline_glyph_class;
           
          +#ifdef FT_CONFIG_OPTION_SVG
          +    /* if it is an SVG glyph */
          +    else if ( format == FT_GLYPH_FORMAT_SVG )
          +      clazz = &ft_svg_glyph_class;
          +#endif
          +
               else
               {
                 /* try to find a renderer that supports the glyph image format */
          @@ -595,6 +836,16 @@
               if ( !error )
                 error = FT_Render_Glyph_Internal( glyph->library, &dummy, render_mode );
           
          +#ifdef FT_CONFIG_OPTION_SVG
          +    if ( clazz == &ft_svg_glyph_class )
          +    {
          +      FT_Memory  memory = library->memory;
          +
          +
          +      FT_FREE( dummy.other );
          +    }
          +#endif
          +
           #if 1
               if ( !destroy && origin )
               {
          diff --git a/thirdparty/freetype/src/base/ftgxval.c b/thirdparty/freetype/src/base/ftgxval.c
          index e9567f77f3..5598a11c6d 100644
          --- a/thirdparty/freetype/src/base/ftgxval.c
          +++ b/thirdparty/freetype/src/base/ftgxval.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType API for validating TrueTypeGX/AAT tables (body).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * Masatake YAMATO, Redhat K.K,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/base/fthash.c b/thirdparty/freetype/src/base/fthash.c
          index 449b03a5c1..313bbbb4b2 100644
          --- a/thirdparty/freetype/src/base/fthash.c
          +++ b/thirdparty/freetype/src/base/fthash.c
          @@ -243,7 +243,7 @@
               nn = *bp;
               if ( !nn )
               {
          -      if ( FT_NEW( nn ) )
          +      if ( FT_QNEW( nn ) )
                   goto Exit;
                 *bp = nn;
           
          diff --git a/thirdparty/freetype/src/base/ftinit.c b/thirdparty/freetype/src/base/ftinit.c
          index a2d2b933c0..0f29a6017e 100644
          --- a/thirdparty/freetype/src/base/ftinit.c
          +++ b/thirdparty/freetype/src/base/ftinit.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType initialization layer (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftlcdfil.c b/thirdparty/freetype/src/base/ftlcdfil.c
          index 488b913e63..e72f6d668d 100644
          --- a/thirdparty/freetype/src/base/ftlcdfil.c
          +++ b/thirdparty/freetype/src/base/ftlcdfil.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType API for color filtering of subpixel bitmap glyphs (body).
            *
          - * Copyright (C) 2006-2021 by
          + * Copyright (C) 2006-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftmac.c b/thirdparty/freetype/src/base/ftmac.c
          index 36a860979e..8f0cf701af 100644
          --- a/thirdparty/freetype/src/base/ftmac.c
          +++ b/thirdparty/freetype/src/base/ftmac.c
          @@ -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-2021 by
          + * Copyright (C) 1996-2022 by
            * Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -105,7 +105,7 @@
             /* Don't want warnings about our own use of deprecated functions. */
           #define FT_DEPRECATED_ATTRIBUTE
           
          -#include FT_MAC_H
          +#include 
           
           #ifndef kATSOptionFlagsUnRestrictedScope /* since Mac OS X 10.1 */
           #define kATSOptionFlagsUnRestrictedScope kATSOptionFlagsDefault
          diff --git a/thirdparty/freetype/src/base/ftmm.c b/thirdparty/freetype/src/base/ftmm.c
          index fc5d4ecc8d..dbbd87c9b9 100644
          --- a/thirdparty/freetype/src/base/ftmm.c
          +++ b/thirdparty/freetype/src/base/ftmm.c
          @@ -4,7 +4,7 @@
            *
            *   Multiple Master font support (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftobjs.c b/thirdparty/freetype/src/base/ftobjs.c
          index 883f1a8970..eeda69c3ed 100644
          --- a/thirdparty/freetype/src/base/ftobjs.c
          +++ b/thirdparty/freetype/src/base/ftobjs.c
          @@ -4,7 +4,7 @@
            *
            *   The FreeType private base classes (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -19,6 +19,7 @@
           #include 
           #include 
           #include 
          +#include 
           
           #include 
           #include 
          @@ -27,6 +28,7 @@
           #include 
           #include           /* for SFNT_Load_Table_Func */
           #include          /* for PS_Driver            */
          +#include 
           
           #include 
           #include 
          @@ -328,6 +330,19 @@
               if ( !error && clazz->init_slot )
                 error = clazz->init_slot( slot );
           
          +#ifdef FT_CONFIG_OPTION_SVG
          +    /* if SVG table exists, allocate the space in `slot->other` */
          +    if ( slot->face->face_flags & FT_FACE_FLAG_SVG )
          +    {
          +      FT_SVG_Document  document = NULL;
          +
          +
          +      if ( FT_NEW( document ) )
          +        goto Exit;
          +      slot->other = document;
          +    }
          +#endif
          +
             Exit:
               return error;
             }
          @@ -372,7 +387,18 @@
               FT_Pos   width, height, pitch;
           
           
          -    if ( slot->format != FT_GLYPH_FORMAT_OUTLINE )
          +    if ( slot->format == FT_GLYPH_FORMAT_SVG )
          +    {
          +      FT_Module    module;
          +      SVG_Service  svg_service;
          +
          +
          +      module      = FT_Get_Module( slot->library, "ot-svg" );
          +      svg_service = (SVG_Service)module->clazz->module_interface;
          +
          +      return (FT_Bool)svg_service->preset_slot( module, slot, FALSE );
          +    }
          +    else if ( slot->format != FT_GLYPH_FORMAT_OUTLINE )
                 return 1;
           
               if ( origin )
          @@ -564,8 +590,27 @@
               slot->subglyphs     = NULL;
               slot->control_data  = NULL;
               slot->control_len   = 0;
          -    slot->other         = NULL;
          -    slot->format        = FT_GLYPH_FORMAT_NONE;
          +
          +#ifndef FT_CONFIG_OPTION_SVG
          +    slot->other = NULL;
          +#else
          +    if ( !( slot->face->face_flags & FT_FACE_FLAG_SVG ) )
          +      slot->other = NULL;
          +    else
          +    {
          +      if ( slot->internal->flags & FT_GLYPH_OWN_GZIP_SVG )
          +      {
          +        FT_Memory        memory = slot->face->memory;
          +        FT_SVG_Document  doc    = (FT_SVG_Document)slot->other;
          +
          +
          +        FT_FREE( doc->svg_document );
          +        slot->internal->load_flags &= ~FT_GLYPH_OWN_GZIP_SVG;
          +      }
          +    }
          +#endif
          +
          +    slot->format = FT_GLYPH_FORMAT_NONE;
           
               slot->linearHoriAdvance = 0;
               slot->linearVertAdvance = 0;
          @@ -583,6 +628,23 @@
               FT_Driver_Class  clazz  = driver->clazz;
               FT_Memory        memory = driver->root.memory;
           
          +#ifdef FT_CONFIG_OPTION_SVG
          +    if ( slot->face->face_flags & FT_FACE_FLAG_SVG )
          +    {
          +      /* free memory in case SVG was there */
          +      if ( slot->internal->flags & FT_GLYPH_OWN_GZIP_SVG )
          +      {
          +        FT_SVG_Document  doc = (FT_SVG_Document)slot->other;
          +
          +
          +        FT_FREE( doc->svg_document );
          +
          +        slot->internal->flags &= ~FT_GLYPH_OWN_GZIP_SVG;
          +      }
          +
          +      FT_FREE( slot->other );
          +    }
          +#endif
           
               if ( clazz->done_slot )
                 clazz->done_slot( slot );
          @@ -858,6 +920,11 @@
               library = driver->root.library;
               hinter  = library->auto_hinter;
           
          +    /* undefined scale means no scale */
          +    if ( face->size->metrics.x_ppem == 0 ||
          +         face->size->metrics.y_ppem == 0 )
          +      load_flags |= FT_LOAD_NO_SCALE;
          +
               /* resolve load flags dependencies */
           
               if ( load_flags & FT_LOAD_NO_RECURSE )
          @@ -947,11 +1014,21 @@
                 FT_AutoHinter_Interface  hinting;
           
           
          -      /* try to load embedded bitmaps first if available            */
          -      /*                                                            */
          -      /* XXX: This is really a temporary hack that should disappear */
          -      /*      promptly with FreeType 2.1!                           */
          -      /*                                                            */
          +      /* XXX: The use of the `FT_LOAD_XXX_ONLY` flags is not very */
          +      /*      elegant.                                            */
          +
          +      /* try to load SVG documents if available */
          +      if ( FT_HAS_SVG( face ) )
          +      {
          +        error = driver->clazz->load_glyph( slot, face->size,
          +                                           glyph_index,
          +                                           load_flags | FT_LOAD_SVG_ONLY );
          +
          +        if ( !error && slot->format == FT_GLYPH_FORMAT_SVG )
          +          goto Load_Ok;
          +      }
          +
          +      /* try to load embedded bitmaps if available */
                 if ( FT_HAS_FIXED_SIZES( face )              &&
                      ( load_flags & FT_LOAD_NO_BITMAP ) == 0 )
                 {
          @@ -1597,7 +1674,6 @@
               FT_FREE( stream->base );
           
               stream->size  = 0;
          -    stream->base  = NULL;
               stream->close = NULL;
             }
           
          @@ -2451,6 +2527,16 @@
           #endif
           
           
          +    /* only use lower 31 bits together with sign bit */
          +    if ( face_index > 0 )
          +      face_index &= 0x7FFFFFFFL;
          +    else
          +    {
          +      face_index  = -face_index;
          +      face_index &= 0x7FFFFFFFL;
          +      face_index  = -face_index;
          +    }
          +
           #ifdef FT_DEBUG_LEVEL_TRACE
               FT_TRACE3(( "FT_Open_Face: " ));
               if ( face_index < 0 )
          @@ -3323,6 +3409,9 @@
               if ( !face )
                 return FT_THROW( Invalid_Face_Handle );
           
          +    if ( !face->size )
          +      return FT_THROW( Invalid_Size_Handle );
          +
               if ( !req || req->width < 0 || req->height < 0 ||
                    req->type >= FT_SIZE_REQUEST_TYPE_MAX )
                 return FT_THROW( Invalid_Argument );
          @@ -4474,7 +4563,7 @@
                 render->glyph_format = clazz->glyph_format;
           
                 /* allocate raster object if needed */
          -      if ( clazz->raster_class->raster_new )
          +      if ( clazz->raster_class && clazz->raster_class->raster_new )
                 {
                   error = clazz->raster_class->raster_new( memory, &render->raster );
                   if ( error )
          @@ -4484,6 +4573,11 @@
                   render->render        = clazz->render_glyph;
                 }
           
          +#ifdef FT_CONFIG_OPTION_SVG
          +      if ( clazz->glyph_format == FT_GLYPH_FORMAT_SVG )
          +        render->render = clazz->render_glyph;
          +#endif
          +
                 /* add to list */
                 node->data = module;
                 FT_List_Add( &library->renderers, node );
          @@ -5729,7 +5823,7 @@
               SFNT_Service  sfnt;
           
           
          -    if ( !face || !paint || !paint )
          +    if ( !face || !paint )
                 return 0;
           
               if ( !FT_IS_SFNT( face ) )
          diff --git a/thirdparty/freetype/src/base/ftotval.c b/thirdparty/freetype/src/base/ftotval.c
          index 0f748d006c..f336e96227 100644
          --- a/thirdparty/freetype/src/base/ftotval.c
          +++ b/thirdparty/freetype/src/base/ftotval.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType API for validating OpenType tables (body).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftoutln.c b/thirdparty/freetype/src/base/ftoutln.c
          index 98c6ca16e6..624df03ad8 100644
          --- a/thirdparty/freetype/src/base/ftoutln.c
          +++ b/thirdparty/freetype/src/base/ftoutln.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType outline management (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftpatent.c b/thirdparty/freetype/src/base/ftpatent.c
          index cd192d33bd..353ed2b531 100644
          --- a/thirdparty/freetype/src/base/ftpatent.c
          +++ b/thirdparty/freetype/src/base/ftpatent.c
          @@ -5,7 +5,7 @@
            *   FreeType API for checking patented TrueType bytecode instructions
            *   (body).  Obsolete, retained for backward compatibility.
            *
          - * Copyright (C) 2007-2021 by
          + * Copyright (C) 2007-2022 by
            * David Turner.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftpfr.c b/thirdparty/freetype/src/base/ftpfr.c
          index 5afd5a183f..9e748f06e6 100644
          --- a/thirdparty/freetype/src/base/ftpfr.c
          +++ b/thirdparty/freetype/src/base/ftpfr.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType API for accessing PFR-specific data (body).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftpsprop.c b/thirdparty/freetype/src/base/ftpsprop.c
          index 3655ae97ec..81fcee08f6 100644
          --- a/thirdparty/freetype/src/base/ftpsprop.c
          +++ b/thirdparty/freetype/src/base/ftpsprop.c
          @@ -5,7 +5,7 @@
            *   Get and set properties of PostScript drivers (body).
            *   See `ftdriver.h' for available properties.
            *
          - * Copyright (C) 2017-2021 by
          + * Copyright (C) 2017-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftrfork.c b/thirdparty/freetype/src/base/ftrfork.c
          index cb7e94ddb0..7fe4146fd0 100644
          --- a/thirdparty/freetype/src/base/ftrfork.c
          +++ b/thirdparty/freetype/src/base/ftrfork.c
          @@ -4,7 +4,7 @@
            *
            *   Embedded resource forks accessor (body).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * Masatake YAMATO and Redhat K.K.
            *
            * FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are
          @@ -868,9 +868,7 @@
               const char*  tmp;
               const char*  slash;
               size_t       new_length;
          -    FT_Error     error = FT_Err_Ok;
          -
          -    FT_UNUSED( error );
          +    FT_Error     error;
           
           
               new_length = ft_strlen( original_name ) + ft_strlen( insertion );
          diff --git a/thirdparty/freetype/src/base/ftsnames.c b/thirdparty/freetype/src/base/ftsnames.c
          index 44dba66638..3bf20c389b 100644
          --- a/thirdparty/freetype/src/base/ftsnames.c
          +++ b/thirdparty/freetype/src/base/ftsnames.c
          @@ -7,7 +7,7 @@
            *
            *   This is _not_ used to retrieve glyph names!
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftstream.c b/thirdparty/freetype/src/base/ftstream.c
          index 5992998ba3..cc926565c3 100644
          --- a/thirdparty/freetype/src/base/ftstream.c
          +++ b/thirdparty/freetype/src/base/ftstream.c
          @@ -4,7 +4,7 @@
            *
            *   I/O stream support (body).
            *
          - * Copyright (C) 2000-2021 by
          + * Copyright (C) 2000-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftstroke.c b/thirdparty/freetype/src/base/ftstroke.c
          index 37e9649411..aa983f940f 100644
          --- a/thirdparty/freetype/src/base/ftstroke.c
          +++ b/thirdparty/freetype/src/base/ftstroke.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType path stroker (body).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftsynth.c b/thirdparty/freetype/src/base/ftsynth.c
          index 73565b1307..10bbe0dfda 100644
          --- a/thirdparty/freetype/src/base/ftsynth.c
          +++ b/thirdparty/freetype/src/base/ftsynth.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType synthesizing code for emboldening and slanting (body).
            *
          - * Copyright (C) 2000-2021 by
          + * Copyright (C) 2000-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftsystem.c b/thirdparty/freetype/src/base/ftsystem.c
          index 9beb7e245d..d8826b2367 100644
          --- a/thirdparty/freetype/src/base/ftsystem.c
          +++ b/thirdparty/freetype/src/base/ftsystem.c
          @@ -4,7 +4,7 @@
            *
            *   ANSI-specific FreeType low-level system interface (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/fttrigon.c b/thirdparty/freetype/src/base/fttrigon.c
          index 0ca6d7810a..6964edb0f5 100644
          --- a/thirdparty/freetype/src/base/fttrigon.c
          +++ b/thirdparty/freetype/src/base/fttrigon.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType trigonometric functions (body).
            *
          - * Copyright (C) 2001-2021 by
          + * Copyright (C) 2001-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/fttype1.c b/thirdparty/freetype/src/base/fttype1.c
          index 0d0afbcef0..de3d5a48bd 100644
          --- a/thirdparty/freetype/src/base/fttype1.c
          +++ b/thirdparty/freetype/src/base/fttype1.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType utility file for PS names support (body).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftutil.c b/thirdparty/freetype/src/base/ftutil.c
          index 3142faee98..5a91382580 100644
          --- a/thirdparty/freetype/src/base/ftutil.c
          +++ b/thirdparty/freetype/src/base/ftutil.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType utility file for memory and list management (body).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/ftver.rc b/thirdparty/freetype/src/base/ftver.rc
          index a3d05b3780..2d0cb416b7 100644
          --- a/thirdparty/freetype/src/base/ftver.rc
          +++ b/thirdparty/freetype/src/base/ftver.rc
          @@ -4,7 +4,7 @@
           /*                                                                         */
           /*    FreeType VERSIONINFO resource for Windows DLLs.                      */
           /*                                                                         */
          -/*  Copyright (C) 2018-2021 by                                             */
          +/*  Copyright (C) 2018-2022 by                                             */
           /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
           /*                                                                         */
           /*  This file is part of the FreeType project, and may only be used,       */
          @@ -18,8 +18,8 @@
           
           #include
           
          -#define FT_VERSION      2,11,1,0
          -#define FT_VERSION_STR  "2.11.1"
          +#define FT_VERSION      2,12,0,0
          +#define FT_VERSION_STR  "2.12.0"
           
           VS_VERSION_INFO      VERSIONINFO
           FILEVERSION          FT_VERSION
          @@ -45,7 +45,7 @@ BEGIN
                 VALUE "FileVersion",      FT_VERSION_STR
                 VALUE "ProductName",      "FreeType"
                 VALUE "ProductVersion",   FT_VERSION_STR
          -      VALUE "LegalCopyright",   "\251 2000-2021 The FreeType Project www.freetype.org. All rights reserved."
          +      VALUE "LegalCopyright",   "\251 2000-2022 The FreeType Project www.freetype.org. All rights reserved."
                 VALUE "InternalName",     "freetype"
                 VALUE "OriginalFilename", FT_FILENAME
               END
          diff --git a/thirdparty/freetype/src/base/ftwinfnt.c b/thirdparty/freetype/src/base/ftwinfnt.c
          index 98f197afdc..193f7fa048 100644
          --- a/thirdparty/freetype/src/base/ftwinfnt.c
          +++ b/thirdparty/freetype/src/base/ftwinfnt.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType API for accessing Windows FNT specific info (body).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/base/rules.mk b/thirdparty/freetype/src/base/rules.mk
          index 53289aee6d..9a224b14ed 100644
          --- a/thirdparty/freetype/src/base/rules.mk
          +++ b/thirdparty/freetype/src/base/rules.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/bdf/README b/thirdparty/freetype/src/bdf/README
          index 996ac2d2aa..d7cb8c14ef 100644
          --- a/thirdparty/freetype/src/bdf/README
          +++ b/thirdparty/freetype/src/bdf/README
          @@ -13,7 +13,7 @@ This code implements a BDF driver for the FreeType library, following the
           Adobe Specification V 2.2.  The specification of the BDF font format is
           available from Adobe's web site:
           
          -  https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5005.BDF_Spec.pdf
          +  https://adobe-type-tools.github.io/font-tech-notes/pdfs/5005.BDF_Spec.pdf
           
           Many good bitmap fonts in bdf format come with XFree86 (www.XFree86.org).
           They do not define vertical metrics, because the X Consortium BDF
          @@ -23,6 +23,10 @@ specification has removed them.
           Encodings
           *********
           
          +[This section is out of date, retained for historical reasons.  BDF
          + properties can be retrieved with `FT_Get_BDF_Property`, character set ID
          + values with `FT_Get_BDF_Charset_ID`.]
          +
           The variety of encodings that accompanies bdf fonts appears to encompass the
           small set defined in freetype.h.  On the other hand, two properties that
           specify encoding and registry are usually defined in bdf fonts.
          diff --git a/thirdparty/freetype/src/bdf/bdflib.c b/thirdparty/freetype/src/bdf/bdflib.c
          index b65c8a2f3e..6603148a02 100644
          --- a/thirdparty/freetype/src/bdf/bdflib.c
          +++ b/thirdparty/freetype/src/bdf/bdflib.c
          @@ -613,7 +613,7 @@
                     if ( FT_QREALLOC( buf, buf_size, new_size ) )
                       goto Exit;
           
          -          cursor   = (ptrdiff_t)buf_size;
          +          cursor   = avail;
                     buf_size = new_size;
                   }
                   else
          @@ -623,7 +623,6 @@
                     FT_MEM_MOVE( buf, buf + start, bytes );
           
                     cursor = bytes;
          -          avail -= bytes;
                     start  = 0;
                   }
                   refill = 1;
          @@ -1175,7 +1174,6 @@
                                       font->props_size + 1 ) )
                   goto Exit;
           
          -      fp = font->props + font->props_size;
                 font->props_size++;
               }
           
          @@ -1537,8 +1535,6 @@
                     /* kept.                                                */
                     FT_FREE( p->glyph_name );
                   }
          -
          -        p->glyph_name = NULL;
                 }
           
                 /* Clear the flags that might be added when width and height are */
          @@ -1953,7 +1949,7 @@
                   }
                 }
           
          -      if ( FT_ALLOC( p->font->internal, sizeof ( FT_HashRec ) ) )
          +      if ( FT_QALLOC( p->font->internal, sizeof ( FT_HashRec ) ) )
                   goto Exit;
                 error = ft_hash_str_init( (FT_Hash)p->font->internal, memory );
                 if ( error )
          diff --git a/thirdparty/freetype/src/bzip2/ftbzip2.c b/thirdparty/freetype/src/bzip2/ftbzip2.c
          index 296cea088b..6f34a8bb79 100644
          --- a/thirdparty/freetype/src/bzip2/ftbzip2.c
          +++ b/thirdparty/freetype/src/bzip2/ftbzip2.c
          @@ -8,7 +8,7 @@
            * parse compressed PCF fonts, as found with many X11 server
            * distributions.
            *
          - * Copyright (C) 2010-2021 by
          + * Copyright (C) 2010-2022 by
            * Joel Klinghed.
            *
            * based on `src/gzip/ftgzip.c'
          @@ -102,10 +102,11 @@
           
               FT_Byte    input[FT_BZIP2_BUFFER_SIZE];  /* input read buffer  */
           
          -    FT_Byte    buffer[FT_BZIP2_BUFFER_SIZE]; /* output buffer      */
          -    FT_ULong   pos;                          /* position in output */
          +    FT_Byte    buffer[FT_BZIP2_BUFFER_SIZE]; /* output buffer          */
          +    FT_ULong   pos;                          /* position in output     */
               FT_Byte*   cursor;
               FT_Byte*   limit;
          +    FT_Bool    reset;                        /* reset before next read */
           
             } FT_BZip2FileRec, *FT_BZip2File;
           
          @@ -153,6 +154,7 @@
               zip->limit  = zip->buffer + FT_BZIP2_BUFFER_SIZE;
               zip->cursor = zip->limit;
               zip->pos    = 0;
          +    zip->reset  = 0;
           
               /* check .bz2 header */
               {
          @@ -228,6 +230,7 @@
                 zip->limit  = zip->buffer + FT_BZIP2_BUFFER_SIZE;
                 zip->cursor = zip->limit;
                 zip->pos    = 0;
          +      zip->reset  = 0;
           
                 BZ2_bzDecompressInit( bzstream, 0, 0 );
               }
          @@ -302,18 +305,23 @@
           
                 err = BZ2_bzDecompress( bzstream );
           
          -      if ( err == BZ_STREAM_END )
          +      if ( err != BZ_OK )
                 {
          -        zip->limit = (FT_Byte*)bzstream->next_out;
          -        if ( zip->limit == zip->cursor )
          -          error = FT_THROW( Invalid_Stream_Operation );
          -        break;
          -      }
          -      else if ( err != BZ_OK )
          -      {
          -        zip->limit = zip->cursor;
          -        error      = FT_THROW( Invalid_Stream_Operation );
          -        break;
          +        zip->reset = 1;
          +
          +        if ( err == BZ_STREAM_END )
          +        {
          +          zip->limit = (FT_Byte*)bzstream->next_out;
          +          if ( zip->limit == zip->cursor )
          +            error = FT_THROW( Invalid_Stream_Operation );
          +          break;
          +        }
          +        else
          +        {
          +          zip->limit = zip->cursor;
          +          error      = FT_THROW( Invalid_Stream_Operation );
          +          break;
          +        }
                 }
               }
           
          @@ -363,9 +371,9 @@
               FT_Error  error;
           
           
          -    /* Reset inflate stream if we're seeking backwards.        */
          -    /* Yes, that is not too efficient, but it saves memory :-) */
          -    if ( pos < zip->pos )
          +    /* Reset inflate stream if seeking backwards or bzip reported an error. */
          +    /* Yes, that is not too efficient, but it saves memory :-)              */
          +    if ( pos < zip->pos || zip->reset )
               {
                 error = ft_bzip2_file_reset( zip );
                 if ( error )
          diff --git a/thirdparty/freetype/src/bzip2/rules.mk b/thirdparty/freetype/src/bzip2/rules.mk
          index e584277b06..93a820c853 100644
          --- a/thirdparty/freetype/src/bzip2/rules.mk
          +++ b/thirdparty/freetype/src/bzip2/rules.mk
          @@ -2,7 +2,7 @@
           # FreeType 2 BZIP2 support configuration rules
           #
           
          -# Copyright (C) 2010-2021 by
          +# Copyright (C) 2010-2022 by
           # Joel Klinghed.
           #
           # based on `src/lzw/rules.mk'
          diff --git a/thirdparty/freetype/src/cache/ftcache.c b/thirdparty/freetype/src/cache/ftcache.c
          index ddd3e43c02..e26b44a700 100644
          --- a/thirdparty/freetype/src/cache/ftcache.c
          +++ b/thirdparty/freetype/src/cache/ftcache.c
          @@ -4,7 +4,7 @@
            *
            *   The FreeType Caching sub-system (body only).
            *
          - * Copyright (C) 2000-2021 by
          + * Copyright (C) 2000-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cache/ftcbasic.c b/thirdparty/freetype/src/cache/ftcbasic.c
          index 1760c5fbd4..635b17d074 100644
          --- a/thirdparty/freetype/src/cache/ftcbasic.c
          +++ b/thirdparty/freetype/src/cache/ftcbasic.c
          @@ -4,7 +4,7 @@
            *
            *   The FreeType basic cache interface (body).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -26,6 +26,7 @@
           #include "ftccback.h"
           #include "ftcerror.h"
           
          +#undef  FT_COMPONENT
           #define FT_COMPONENT  cache
           
           
          @@ -182,7 +183,8 @@
                 if ( !error )
                 {
                   if ( face->glyph->format == FT_GLYPH_FORMAT_BITMAP  ||
          -             face->glyph->format == FT_GLYPH_FORMAT_OUTLINE )
          +             face->glyph->format == FT_GLYPH_FORMAT_OUTLINE ||
          +             face->glyph->format == FT_GLYPH_FORMAT_SVG     )
                   {
                     /* ok, copy it */
                     FT_Glyph  glyph;
          diff --git a/thirdparty/freetype/src/cache/ftccache.c b/thirdparty/freetype/src/cache/ftccache.c
          index 5bbf329298..ab4ad2faa2 100644
          --- a/thirdparty/freetype/src/cache/ftccache.c
          +++ b/thirdparty/freetype/src/cache/ftccache.c
          @@ -4,7 +4,7 @@
            *
            *   The FreeType internal cache interface (body).
            *
          - * Copyright (C) 2000-2021 by
          + * Copyright (C) 2000-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cache/ftccache.h b/thirdparty/freetype/src/cache/ftccache.h
          index 4849b92352..a0e7dcaa23 100644
          --- a/thirdparty/freetype/src/cache/ftccache.h
          +++ b/thirdparty/freetype/src/cache/ftccache.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType internal cache interface (specification).
            *
          - * Copyright (C) 2000-2021 by
          + * Copyright (C) 2000-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cache/ftccback.h b/thirdparty/freetype/src/cache/ftccback.h
          index 8185fe3738..ba01af2e78 100644
          --- a/thirdparty/freetype/src/cache/ftccback.h
          +++ b/thirdparty/freetype/src/cache/ftccback.h
          @@ -4,7 +4,7 @@
            *
            *   Callback functions of the caching sub-system (specification only).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cache/ftccmap.c b/thirdparty/freetype/src/cache/ftccmap.c
          index 40b449b9cc..0ee1834e27 100644
          --- a/thirdparty/freetype/src/cache/ftccmap.c
          +++ b/thirdparty/freetype/src/cache/ftccmap.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType CharMap cache (body)
            *
          - * Copyright (C) 2000-2021 by
          + * Copyright (C) 2000-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -116,7 +116,7 @@
               FT_UInt        nn;
           
           
          -    if ( !FT_NEW( node ) )
          +    if ( !FT_QNEW( node ) )
               {
                 node->face_id    = query->face_id;
                 node->cmap_index = query->cmap_index;
          diff --git a/thirdparty/freetype/src/cache/ftcerror.h b/thirdparty/freetype/src/cache/ftcerror.h
          index 2c6faf65e2..44e74d36b4 100644
          --- a/thirdparty/freetype/src/cache/ftcerror.h
          +++ b/thirdparty/freetype/src/cache/ftcerror.h
          @@ -4,7 +4,7 @@
            *
            *   Caching sub-system error codes (specification only).
            *
          - * Copyright (C) 2001-2021 by
          + * Copyright (C) 2001-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cache/ftcglyph.c b/thirdparty/freetype/src/cache/ftcglyph.c
          index 52771c7a8a..f826c8dd8e 100644
          --- a/thirdparty/freetype/src/cache/ftcglyph.c
          +++ b/thirdparty/freetype/src/cache/ftcglyph.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType Glyph Image (FT_Glyph) cache (body).
            *
          - * Copyright (C) 2000-2021 by
          + * Copyright (C) 2000-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cache/ftcglyph.h b/thirdparty/freetype/src/cache/ftcglyph.h
          index cf00cdc7b8..11292f825c 100644
          --- a/thirdparty/freetype/src/cache/ftcglyph.h
          +++ b/thirdparty/freetype/src/cache/ftcglyph.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType abstract glyph cache (specification).
            *
          - * Copyright (C) 2000-2021 by
          + * Copyright (C) 2000-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cache/ftcimage.c b/thirdparty/freetype/src/cache/ftcimage.c
          index 3f12a654b2..39ce61a511 100644
          --- a/thirdparty/freetype/src/cache/ftcimage.c
          +++ b/thirdparty/freetype/src/cache/ftcimage.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType Image cache (body).
            *
          - * Copyright (C) 2000-2021 by
          + * Copyright (C) 2000-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -64,7 +64,7 @@
               FTC_INode  inode  = NULL;
           
           
          -    if ( !FT_NEW( inode ) )
          +    if ( !FT_QNEW( inode ) )
               {
                 FTC_GNode         gnode  = FTC_GNODE( inode );
                 FTC_Family        family = gquery->family;
          @@ -74,6 +74,7 @@
           
                 /* initialize its inner fields */
                 FTC_GNode_Init( gnode, gindex, family );
          +      inode->glyph = NULL;
           
                 /* we will now load the glyph image */
                 error = clazz->family_load_glyph( family, gindex, cache,
          diff --git a/thirdparty/freetype/src/cache/ftcimage.h b/thirdparty/freetype/src/cache/ftcimage.h
          index 8b28d6f00b..a273053c20 100644
          --- a/thirdparty/freetype/src/cache/ftcimage.h
          +++ b/thirdparty/freetype/src/cache/ftcimage.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType Generic Image cache (specification)
            *
          - * Copyright (C) 2000-2021 by
          + * Copyright (C) 2000-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cache/ftcmanag.c b/thirdparty/freetype/src/cache/ftcmanag.c
          index 512de8a3fc..49f037aa73 100644
          --- a/thirdparty/freetype/src/cache/ftcmanag.c
          +++ b/thirdparty/freetype/src/cache/ftcmanag.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType Cache Manager (body).
            *
          - * Copyright (C) 2000-2021 by
          + * Copyright (C) 2000-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cache/ftcmanag.h b/thirdparty/freetype/src/cache/ftcmanag.h
          index 99aa926369..5c67af30bc 100644
          --- a/thirdparty/freetype/src/cache/ftcmanag.h
          +++ b/thirdparty/freetype/src/cache/ftcmanag.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType Cache Manager (specification).
            *
          - * Copyright (C) 2000-2021 by
          + * Copyright (C) 2000-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cache/ftcmru.c b/thirdparty/freetype/src/cache/ftcmru.c
          index 2cac6f9d3a..6a14ae36e9 100644
          --- a/thirdparty/freetype/src/cache/ftcmru.c
          +++ b/thirdparty/freetype/src/cache/ftcmru.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType MRU support (body).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -262,7 +262,9 @@
                 if ( list->clazz.node_done )
                   list->clazz.node_done( node, list->data );
               }
          -    else if ( FT_QALLOC( node, list->clazz.node_size ) )
          +
          +    /* zero new node in case of node_init failure */
          +    else if ( FT_ALLOC( node, list->clazz.node_size ) )
                 goto Exit;
           
               error = list->clazz.node_init( node, key, list->data );
          diff --git a/thirdparty/freetype/src/cache/ftcmru.h b/thirdparty/freetype/src/cache/ftcmru.h
          index 6befde307f..4fcadef477 100644
          --- a/thirdparty/freetype/src/cache/ftcmru.h
          +++ b/thirdparty/freetype/src/cache/ftcmru.h
          @@ -4,7 +4,7 @@
            *
            *   Simple MRU list-cache (specification).
            *
          - * Copyright (C) 2000-2021 by
          + * Copyright (C) 2000-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cache/ftcsbits.c b/thirdparty/freetype/src/cache/ftcsbits.c
          index 362999fce0..9f5cc23909 100644
          --- a/thirdparty/freetype/src/cache/ftcsbits.c
          +++ b/thirdparty/freetype/src/cache/ftcsbits.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType sbits manager (body).
            *
          - * Copyright (C) 2000-2021 by
          + * Copyright (C) 2000-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -233,7 +233,7 @@
                 goto Exit;
               }
           
          -    if ( !FT_NEW( snode ) )
          +    if ( !FT_QNEW( snode ) )
               {
                 FT_UInt  count, start;
           
          @@ -248,7 +248,9 @@
                 snode->count = count;
                 for ( node_count = 0; node_count < count; node_count++ )
                 {
          -        snode->sbits[node_count].width = 255;
          +        snode->sbits[node_count].width  = 255;
          +        snode->sbits[node_count].height = 0;
          +        snode->sbits[node_count].buffer = NULL;
                 }
           
                 error = ftc_snode_load( snode,
          diff --git a/thirdparty/freetype/src/cache/ftcsbits.h b/thirdparty/freetype/src/cache/ftcsbits.h
          index 9f2d5fb33c..03a5ec47ff 100644
          --- a/thirdparty/freetype/src/cache/ftcsbits.h
          +++ b/thirdparty/freetype/src/cache/ftcsbits.h
          @@ -4,7 +4,7 @@
            *
            *   A small-bitmap cache (specification).
            *
          - * Copyright (C) 2000-2021 by
          + * Copyright (C) 2000-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cache/rules.mk b/thirdparty/freetype/src/cache/rules.mk
          index 0abd216a84..778e19e580 100644
          --- a/thirdparty/freetype/src/cache/rules.mk
          +++ b/thirdparty/freetype/src/cache/rules.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 2000-2021 by
          +# Copyright (C) 2000-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/cff/cff.c b/thirdparty/freetype/src/cff/cff.c
          index c2ffea3d0d..1ac0beb06a 100644
          --- a/thirdparty/freetype/src/cff/cff.c
          +++ b/thirdparty/freetype/src/cff/cff.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType OpenType driver component (body only).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cff/cffcmap.c b/thirdparty/freetype/src/cff/cffcmap.c
          index ff1aae69ef..1625225b55 100644
          --- a/thirdparty/freetype/src/cff/cffcmap.c
          +++ b/thirdparty/freetype/src/cff/cffcmap.c
          @@ -4,7 +4,7 @@
            *
            *   CFF character mapping table (cmap) support (body).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cff/cffcmap.h b/thirdparty/freetype/src/cff/cffcmap.h
          index 221e255afb..2818d3c6fe 100644
          --- a/thirdparty/freetype/src/cff/cffcmap.h
          +++ b/thirdparty/freetype/src/cff/cffcmap.h
          @@ -4,7 +4,7 @@
            *
            *   CFF character mapping table (cmap) support (specification).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cff/cffdrivr.c b/thirdparty/freetype/src/cff/cffdrivr.c
          index 59210f37c5..d945afdfe8 100644
          --- a/thirdparty/freetype/src/cff/cffdrivr.c
          +++ b/thirdparty/freetype/src/cff/cffdrivr.c
          @@ -4,7 +4,7 @@
            *
            *   OpenType font driver implementation (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cff/cffdrivr.h b/thirdparty/freetype/src/cff/cffdrivr.h
          index fce92bbb00..a312003be7 100644
          --- a/thirdparty/freetype/src/cff/cffdrivr.h
          +++ b/thirdparty/freetype/src/cff/cffdrivr.h
          @@ -4,7 +4,7 @@
            *
            *   High-level OpenType driver interface (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cff/cfferrs.h b/thirdparty/freetype/src/cff/cfferrs.h
          index b507ec8bb7..90d32897c7 100644
          --- a/thirdparty/freetype/src/cff/cfferrs.h
          +++ b/thirdparty/freetype/src/cff/cfferrs.h
          @@ -4,7 +4,7 @@
            *
            *   CFF error codes (specification only).
            *
          - * Copyright (C) 2001-2021 by
          + * Copyright (C) 2001-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cff/cffgload.c b/thirdparty/freetype/src/cff/cffgload.c
          index 97e8f9c1c6..ff0d9cf136 100644
          --- a/thirdparty/freetype/src/cff/cffgload.c
          +++ b/thirdparty/freetype/src/cff/cffgload.c
          @@ -4,7 +4,7 @@
            *
            *   OpenType Glyph Loader (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -29,6 +29,14 @@
           
           #include "cfferrs.h"
           
          +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
          +#define IS_DEFAULT_INSTANCE( _face )             \
          +          ( !( FT_IS_NAMED_INSTANCE( _face ) ||  \
          +               FT_IS_VARIATION( _face )      ) )
          +#else
          +#define IS_DEFAULT_INSTANCE( _face )  1
          +#endif
          +
           
             /**************************************************************************
              *
          @@ -255,8 +263,8 @@
           
           
                 if ( size->strike_index != 0xFFFFFFFFUL      &&
          -           sfnt->load_eblc                         &&
          -           ( load_flags & FT_LOAD_NO_BITMAP ) == 0 )
          +           ( load_flags & FT_LOAD_NO_BITMAP ) == 0 &&
          +           IS_DEFAULT_INSTANCE( size->root.face )  )
                 {
                   TT_SBit_MetricsRec  metrics;
           
          @@ -346,6 +354,76 @@
               if ( load_flags & FT_LOAD_SBITS_ONLY )
                 return FT_THROW( Invalid_Argument );
           
          +#ifdef FT_CONFIG_OPTION_SVG
          +    /* check for OT-SVG */
          +    if ( ( load_flags & FT_LOAD_COLOR )     &&
          +         ( (TT_Face)glyph->root.face )->svg )
          +    {
          +      /*
          +       * We load the SVG document and try to grab the advances from the
          +       * table.  For the bearings we rely on the presetting hook to do that.
          +       */
          +
          +      FT_Short      dummy;
          +      FT_UShort     advanceX;
          +      FT_UShort     advanceY;
          +      SFNT_Service  sfnt;
          +
          +
          +      if ( size->root.metrics.x_ppem < 1 ||
          +           size->root.metrics.y_ppem < 1 )
          +      {
          +        error = FT_THROW( Invalid_Size_Handle );
          +        return error;
          +      }
          +
          +      FT_TRACE3(( "Trying to load SVG glyph\n" ));
          +
          +      sfnt  = (SFNT_Service)((TT_Face)glyph->root.face)->sfnt;
          +      error = sfnt->load_svg_doc( (FT_GlyphSlot)glyph, glyph_index );
          +      if ( !error )
          +      {
          +        FT_TRACE3(( "Successfully loaded SVG glyph\n" ));
          +
          +        glyph->root.format = FT_GLYPH_FORMAT_SVG;
          +
          +        /*
          +         * If horizontal or vertical advances are not present in the table,
          +         * this is a problem with the font since the standard requires them.
          +         * However, we are graceful and calculate the values by ourselves
          +         * for the vertical case.
          +         */
          +        sfnt->get_metrics( face,
          +                           FALSE,
          +                           glyph_index,
          +                           &dummy,
          +                           &advanceX );
          +        sfnt->get_metrics( face,
          +                           TRUE,
          +                           glyph_index,
          +                           &dummy,
          +                           &advanceY );
          +
          +        advanceX =
          +          (FT_UShort)FT_MulDiv( advanceX,
          +                                glyph->root.face->size->metrics.x_ppem,
          +                                glyph->root.face->units_per_EM );
          +        advanceY =
          +          (FT_UShort)FT_MulDiv( advanceY,
          +                                glyph->root.face->size->metrics.y_ppem,
          +                                glyph->root.face->units_per_EM );
          +
          +        glyph->root.metrics.horiAdvance = advanceX << 6;
          +        glyph->root.metrics.vertAdvance = advanceY << 6;
          +
          +        return error;
          +      }
          +
          +      FT_TRACE3(( "Failed to load SVG glyph\n" ));
          +    }
          +
          +#endif /* FT_CONFIG_OPTION_SVG */
          +
               /* if we have a CID subfont, use its matrix (which has already */
               /* been multiplied with the root matrix)                       */
           
          diff --git a/thirdparty/freetype/src/cff/cffgload.h b/thirdparty/freetype/src/cff/cffgload.h
          index d0d6a6fa08..33616b9684 100644
          --- a/thirdparty/freetype/src/cff/cffgload.h
          +++ b/thirdparty/freetype/src/cff/cffgload.h
          @@ -4,7 +4,7 @@
            *
            *   OpenType Glyph Loader (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cff/cffload.c b/thirdparty/freetype/src/cff/cffload.c
          index 3c3f6fe502..d6f8a1013d 100644
          --- a/thirdparty/freetype/src/cff/cffload.c
          +++ b/thirdparty/freetype/src/cff/cffload.c
          @@ -4,7 +4,7 @@
            *
            *   OpenType and CFF data/program tables loader (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cff/cffload.h b/thirdparty/freetype/src/cff/cffload.h
          index 20f9296c4f..a3cc642b77 100644
          --- a/thirdparty/freetype/src/cff/cffload.h
          +++ b/thirdparty/freetype/src/cff/cffload.h
          @@ -4,7 +4,7 @@
            *
            *   OpenType & CFF data/program tables loader (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cff/cffobjs.c b/thirdparty/freetype/src/cff/cffobjs.c
          index 3a4d47dbdd..fa42accb65 100644
          --- a/thirdparty/freetype/src/cff/cffobjs.c
          +++ b/thirdparty/freetype/src/cff/cffobjs.c
          @@ -4,7 +4,7 @@
            *
            *   OpenType objects manager (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -411,9 +411,7 @@
               FT_String*  result;
           
           
          -    (void)FT_STRDUP( result, source );
          -
          -    FT_UNUSED( error );
          +    FT_MEM_STRDUP( result, source );
           
               return result;
             }
          diff --git a/thirdparty/freetype/src/cff/cffobjs.h b/thirdparty/freetype/src/cff/cffobjs.h
          index 149a8a2f0a..d48c1cded9 100644
          --- a/thirdparty/freetype/src/cff/cffobjs.h
          +++ b/thirdparty/freetype/src/cff/cffobjs.h
          @@ -4,7 +4,7 @@
            *
            *   OpenType objects manager (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cff/cffparse.c b/thirdparty/freetype/src/cff/cffparse.c
          index dde55e95c2..2536a21866 100644
          --- a/thirdparty/freetype/src/cff/cffparse.c
          +++ b/thirdparty/freetype/src/cff/cffparse.c
          @@ -4,7 +4,7 @@
            *
            *   CFF token stream parser (body)
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cff/cffparse.h b/thirdparty/freetype/src/cff/cffparse.h
          index a28ab52200..55b6fe6e7c 100644
          --- a/thirdparty/freetype/src/cff/cffparse.h
          +++ b/thirdparty/freetype/src/cff/cffparse.h
          @@ -4,7 +4,7 @@
            *
            *   CFF token stream parser (specification)
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cff/cfftoken.h b/thirdparty/freetype/src/cff/cfftoken.h
          index eef30690c4..15237de9e5 100644
          --- a/thirdparty/freetype/src/cff/cfftoken.h
          +++ b/thirdparty/freetype/src/cff/cfftoken.h
          @@ -4,7 +4,7 @@
            *
            *   CFF token definitions (specification only).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cff/module.mk b/thirdparty/freetype/src/cff/module.mk
          index cfa444d8f3..eb1227175e 100644
          --- a/thirdparty/freetype/src/cff/module.mk
          +++ b/thirdparty/freetype/src/cff/module.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/cff/rules.mk b/thirdparty/freetype/src/cff/rules.mk
          index e54614ffe5..569a84c7cc 100644
          --- a/thirdparty/freetype/src/cff/rules.mk
          +++ b/thirdparty/freetype/src/cff/rules.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/cid/ciderrs.h b/thirdparty/freetype/src/cid/ciderrs.h
          index 2d762d9e1d..d07da5a01d 100644
          --- a/thirdparty/freetype/src/cid/ciderrs.h
          +++ b/thirdparty/freetype/src/cid/ciderrs.h
          @@ -4,7 +4,7 @@
            *
            *   CID error codes (specification only).
            *
          - * Copyright (C) 2001-2021 by
          + * Copyright (C) 2001-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cid/cidgload.c b/thirdparty/freetype/src/cid/cidgload.c
          index a46d063dfe..24d37d3295 100644
          --- a/thirdparty/freetype/src/cid/cidgload.c
          +++ b/thirdparty/freetype/src/cid/cidgload.c
          @@ -4,7 +4,7 @@
            *
            *   CID-keyed Type1 Glyph Loader (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cid/cidgload.h b/thirdparty/freetype/src/cid/cidgload.h
          index 8b515efa01..c06bb29d3d 100644
          --- a/thirdparty/freetype/src/cid/cidgload.h
          +++ b/thirdparty/freetype/src/cid/cidgload.h
          @@ -4,7 +4,7 @@
            *
            *   OpenType Glyph Loader (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cid/cidload.c b/thirdparty/freetype/src/cid/cidload.c
          index 496219de80..fe8fa1abff 100644
          --- a/thirdparty/freetype/src/cid/cidload.c
          +++ b/thirdparty/freetype/src/cid/cidload.c
          @@ -4,7 +4,7 @@
            *
            *   CID-keyed Type1 font loader (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cid/cidload.h b/thirdparty/freetype/src/cid/cidload.h
          index ee1d486505..90ced9280b 100644
          --- a/thirdparty/freetype/src/cid/cidload.h
          +++ b/thirdparty/freetype/src/cid/cidload.h
          @@ -4,7 +4,7 @@
            *
            *   CID-keyed Type1 font loader (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cid/cidobjs.c b/thirdparty/freetype/src/cid/cidobjs.c
          index e3c29c22f6..c39de6369c 100644
          --- a/thirdparty/freetype/src/cid/cidobjs.c
          +++ b/thirdparty/freetype/src/cid/cidobjs.c
          @@ -4,7 +4,7 @@
            *
            *   CID objects manager (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cid/cidobjs.h b/thirdparty/freetype/src/cid/cidobjs.h
          index 32f59cbcce..fd76a1cba5 100644
          --- a/thirdparty/freetype/src/cid/cidobjs.h
          +++ b/thirdparty/freetype/src/cid/cidobjs.h
          @@ -4,7 +4,7 @@
            *
            *   CID objects manager (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cid/cidparse.c b/thirdparty/freetype/src/cid/cidparse.c
          index 852c9b6b96..cfc820561f 100644
          --- a/thirdparty/freetype/src/cid/cidparse.c
          +++ b/thirdparty/freetype/src/cid/cidparse.c
          @@ -4,7 +4,7 @@
            *
            *   CID-keyed Type1 parser (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cid/cidparse.h b/thirdparty/freetype/src/cid/cidparse.h
          index fbc437bc38..ba363f7803 100644
          --- a/thirdparty/freetype/src/cid/cidparse.h
          +++ b/thirdparty/freetype/src/cid/cidparse.h
          @@ -4,7 +4,7 @@
            *
            *   CID-keyed Type1 parser (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cid/cidriver.c b/thirdparty/freetype/src/cid/cidriver.c
          index a0898dfa2f..a63c01064a 100644
          --- a/thirdparty/freetype/src/cid/cidriver.c
          +++ b/thirdparty/freetype/src/cid/cidriver.c
          @@ -4,7 +4,7 @@
            *
            *   CID driver interface (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cid/cidriver.h b/thirdparty/freetype/src/cid/cidriver.h
          index 3ff5f78e11..5073b7a8eb 100644
          --- a/thirdparty/freetype/src/cid/cidriver.h
          +++ b/thirdparty/freetype/src/cid/cidriver.h
          @@ -4,7 +4,7 @@
            *
            *   High-level CID driver interface (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cid/cidtoken.h b/thirdparty/freetype/src/cid/cidtoken.h
          index 84c8258014..7640137eac 100644
          --- a/thirdparty/freetype/src/cid/cidtoken.h
          +++ b/thirdparty/freetype/src/cid/cidtoken.h
          @@ -4,7 +4,7 @@
            *
            *   CID token definitions (specification only).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/cid/module.mk b/thirdparty/freetype/src/cid/module.mk
          index 2e16262b3a..d4beef80eb 100644
          --- a/thirdparty/freetype/src/cid/module.mk
          +++ b/thirdparty/freetype/src/cid/module.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/cid/rules.mk b/thirdparty/freetype/src/cid/rules.mk
          index 933b2daf78..7ed85291f8 100644
          --- a/thirdparty/freetype/src/cid/rules.mk
          +++ b/thirdparty/freetype/src/cid/rules.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/cid/type1cid.c b/thirdparty/freetype/src/cid/type1cid.c
          index 5405ecffc8..b32c261376 100644
          --- a/thirdparty/freetype/src/cid/type1cid.c
          +++ b/thirdparty/freetype/src/cid/type1cid.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType OpenType driver component (body only).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/dlg/dlgwrap.c b/thirdparty/freetype/src/dlg/dlgwrap.c
          index e0b9a8d29d..b149b79483 100644
          --- a/thirdparty/freetype/src/dlg/dlgwrap.c
          +++ b/thirdparty/freetype/src/dlg/dlgwrap.c
          @@ -4,7 +4,7 @@
            *
            *   Wrapper file for the 'dlg' library (body only)
            *
          - * Copyright (C) 2020-2021 by
          + * Copyright (C) 2020-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/dlg/rules.mk b/thirdparty/freetype/src/dlg/rules.mk
          index a56dee6c2a..0afa5d7a09 100644
          --- a/thirdparty/freetype/src/dlg/rules.mk
          +++ b/thirdparty/freetype/src/dlg/rules.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 2020-2021 by
          +# Copyright (C) 2020-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/gxvalid/README b/thirdparty/freetype/src/gxvalid/README
          index 7fb0296282..921b3ac92e 100644
          --- a/thirdparty/freetype/src/gxvalid/README
          +++ b/thirdparty/freetype/src/gxvalid/README
          @@ -518,7 +518,7 @@ gxvalid: TrueType GX validator
           
           ------------------------------------------------------------------------
           
          -Copyright (C) 2004-2021 by
          +Copyright (C) 2004-2022 by
           suzuki toshiya, Masatake YAMATO, Red hat K.K.,
           David Turner, Robert Wilhelm, and Werner Lemberg.
           
          diff --git a/thirdparty/freetype/src/gxvalid/gxvalid.c b/thirdparty/freetype/src/gxvalid/gxvalid.c
          index 309d517443..9f380337c9 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvalid.c
          +++ b/thirdparty/freetype/src/gxvalid/gxvalid.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType validator for TrueTypeGX/AAT tables (body only).
            *
          - * Copyright (C) 2005-2021 by
          + * Copyright (C) 2005-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvalid.h b/thirdparty/freetype/src/gxvalid/gxvalid.h
          index 2c41c28668..170fde3406 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvalid.h
          +++ b/thirdparty/freetype/src/gxvalid/gxvalid.h
          @@ -4,7 +4,7 @@
            *
            *   TrueTypeGX/AAT table validation (specification only).
            *
          - * Copyright (C) 2005-2021 by
          + * Copyright (C) 2005-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvbsln.c b/thirdparty/freetype/src/gxvalid/gxvbsln.c
          index af69cb51df..9784d18c5d 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvbsln.c
          +++ b/thirdparty/freetype/src/gxvalid/gxvbsln.c
          @@ -4,7 +4,7 @@
            *
            *   TrueTypeGX/AAT bsln table validation (body).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvcommn.c b/thirdparty/freetype/src/gxvalid/gxvcommn.c
          index 18e42b0cd8..16ce05b990 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvcommn.c
          +++ b/thirdparty/freetype/src/gxvalid/gxvcommn.c
          @@ -4,7 +4,7 @@
            *
            *   TrueTypeGX/AAT common tables validation (body).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvcommn.h b/thirdparty/freetype/src/gxvalid/gxvcommn.h
          index b79b641142..794cf0a447 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvcommn.h
          +++ b/thirdparty/freetype/src/gxvalid/gxvcommn.h
          @@ -4,7 +4,7 @@
            *
            *   TrueTypeGX/AAT common tables validation (specification).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxverror.h b/thirdparty/freetype/src/gxvalid/gxverror.h
          index d20d395680..8d2faac808 100644
          --- a/thirdparty/freetype/src/gxvalid/gxverror.h
          +++ b/thirdparty/freetype/src/gxvalid/gxverror.h
          @@ -4,7 +4,7 @@
            *
            *   TrueTypeGX/AAT validation module error codes (specification only).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvfeat.c b/thirdparty/freetype/src/gxvalid/gxvfeat.c
          index 0a8e2f201a..77200564ee 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvfeat.c
          +++ b/thirdparty/freetype/src/gxvalid/gxvfeat.c
          @@ -4,7 +4,7 @@
            *
            *   TrueTypeGX/AAT feat table validation (body).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvfeat.h b/thirdparty/freetype/src/gxvalid/gxvfeat.h
          index f6d28fa71c..3deeb521dd 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvfeat.h
          +++ b/thirdparty/freetype/src/gxvalid/gxvfeat.h
          @@ -4,7 +4,7 @@
            *
            *   TrueTypeGX/AAT feat table validation (specification).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvfgen.c b/thirdparty/freetype/src/gxvalid/gxvfgen.c
          index b47cd0f7ba..57f11a8412 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvfgen.c
          +++ b/thirdparty/freetype/src/gxvalid/gxvfgen.c
          @@ -5,7 +5,7 @@
            *   Generate feature registry data for gxv `feat' validator.
            *   This program is derived from gxfeatreg.c in gxlayout.
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * Masatake YAMATO and Redhat K.K.
            *
            * This file may only be used,
          diff --git a/thirdparty/freetype/src/gxvalid/gxvjust.c b/thirdparty/freetype/src/gxvalid/gxvjust.c
          index ec289b8ebf..6af2c79c84 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvjust.c
          +++ b/thirdparty/freetype/src/gxvalid/gxvjust.c
          @@ -4,7 +4,7 @@
            *
            *   TrueTypeGX/AAT just table validation (body).
            *
          - * Copyright (C) 2005-2021 by
          + * Copyright (C) 2005-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvkern.c b/thirdparty/freetype/src/gxvalid/gxvkern.c
          index 542e8bc095..f0804e37b9 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvkern.c
          +++ b/thirdparty/freetype/src/gxvalid/gxvkern.c
          @@ -4,7 +4,7 @@
            *
            *   TrueTypeGX/AAT kern table validation (body).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvlcar.c b/thirdparty/freetype/src/gxvalid/gxvlcar.c
          index 9db839ba8a..be6e491f9f 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvlcar.c
          +++ b/thirdparty/freetype/src/gxvalid/gxvlcar.c
          @@ -4,7 +4,7 @@
            *
            *   TrueTypeGX/AAT lcar table validation (body).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvmod.c b/thirdparty/freetype/src/gxvalid/gxvmod.c
          index 1a11426ccb..8c505dd23f 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvmod.c
          +++ b/thirdparty/freetype/src/gxvalid/gxvmod.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType's TrueTypeGX/AAT validation module implementation (body).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvmod.h b/thirdparty/freetype/src/gxvalid/gxvmod.h
          index 90e0c10a28..1758d4c86e 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvmod.h
          +++ b/thirdparty/freetype/src/gxvalid/gxvmod.h
          @@ -5,7 +5,7 @@
            *   FreeType's TrueTypeGX/AAT validation module implementation
            *   (specification).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvmort.c b/thirdparty/freetype/src/gxvalid/gxvmort.c
          index d0db7f4d2d..01a77d6a5d 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvmort.c
          +++ b/thirdparty/freetype/src/gxvalid/gxvmort.c
          @@ -4,7 +4,7 @@
            *
            *   TrueTypeGX/AAT mort table validation (body).
            *
          - * Copyright (C) 2005-2021 by
          + * Copyright (C) 2005-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvmort.h b/thirdparty/freetype/src/gxvalid/gxvmort.h
          index de5ab4ef02..1a1d8961b5 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvmort.h
          +++ b/thirdparty/freetype/src/gxvalid/gxvmort.h
          @@ -4,7 +4,7 @@
            *
            *   TrueTypeGX/AAT common definition for mort table (specification).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvmort0.c b/thirdparty/freetype/src/gxvalid/gxvmort0.c
          index 0c695aa4c7..fa6c7368f7 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvmort0.c
          +++ b/thirdparty/freetype/src/gxvalid/gxvmort0.c
          @@ -5,7 +5,7 @@
            *   TrueTypeGX/AAT mort table validation
            *   body for type0 (Indic Script Rearrangement) subtable.
            *
          - * Copyright (C) 2005-2021 by
          + * Copyright (C) 2005-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvmort1.c b/thirdparty/freetype/src/gxvalid/gxvmort1.c
          index 0af22362f1..170acee2c7 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvmort1.c
          +++ b/thirdparty/freetype/src/gxvalid/gxvmort1.c
          @@ -5,7 +5,7 @@
            *   TrueTypeGX/AAT mort table validation
            *   body for type1 (Contextual Substitution) subtable.
            *
          - * Copyright (C) 2005-2021 by
          + * Copyright (C) 2005-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvmort2.c b/thirdparty/freetype/src/gxvalid/gxvmort2.c
          index 73f418ea1e..faf446741b 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvmort2.c
          +++ b/thirdparty/freetype/src/gxvalid/gxvmort2.c
          @@ -5,7 +5,7 @@
            *   TrueTypeGX/AAT mort table validation
            *   body for type2 (Ligature Substitution) subtable.
            *
          - * Copyright (C) 2005-2021 by
          + * Copyright (C) 2005-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvmort4.c b/thirdparty/freetype/src/gxvalid/gxvmort4.c
          index 1b0dd3edab..12555da82a 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvmort4.c
          +++ b/thirdparty/freetype/src/gxvalid/gxvmort4.c
          @@ -5,7 +5,7 @@
            *   TrueTypeGX/AAT mort table validation
            *   body for type4 (Non-Contextual Glyph Substitution) subtable.
            *
          - * Copyright (C) 2005-2021 by
          + * Copyright (C) 2005-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvmort5.c b/thirdparty/freetype/src/gxvalid/gxvmort5.c
          index cfbf31208c..48caac4347 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvmort5.c
          +++ b/thirdparty/freetype/src/gxvalid/gxvmort5.c
          @@ -5,7 +5,7 @@
            *   TrueTypeGX/AAT mort table validation
            *   body for type5 (Contextual Glyph Insertion) subtable.
            *
          - * Copyright (C) 2005-2021 by
          + * Copyright (C) 2005-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvmorx.c b/thirdparty/freetype/src/gxvalid/gxvmorx.c
          index babff51866..4b848b1e10 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvmorx.c
          +++ b/thirdparty/freetype/src/gxvalid/gxvmorx.c
          @@ -4,7 +4,7 @@
            *
            *   TrueTypeGX/AAT morx table validation (body).
            *
          - * Copyright (C) 2005-2021 by
          + * Copyright (C) 2005-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvmorx.h b/thirdparty/freetype/src/gxvalid/gxvmorx.h
          index f155f18460..a849d573b3 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvmorx.h
          +++ b/thirdparty/freetype/src/gxvalid/gxvmorx.h
          @@ -4,7 +4,7 @@
            *
            *   TrueTypeGX/AAT common definition for morx table (specification).
            *
          - * Copyright (C) 2005-2021 by
          + * Copyright (C) 2005-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvmorx0.c b/thirdparty/freetype/src/gxvalid/gxvmorx0.c
          index e93cea9cca..7eb27d143e 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvmorx0.c
          +++ b/thirdparty/freetype/src/gxvalid/gxvmorx0.c
          @@ -5,7 +5,7 @@
            *   TrueTypeGX/AAT morx table validation
            *   body for type0 (Indic Script Rearrangement) subtable.
            *
          - * Copyright (C) 2005-2021 by
          + * Copyright (C) 2005-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvmorx1.c b/thirdparty/freetype/src/gxvalid/gxvmorx1.c
          index d380f8d1ad..6ffbf151bb 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvmorx1.c
          +++ b/thirdparty/freetype/src/gxvalid/gxvmorx1.c
          @@ -5,7 +5,7 @@
            *   TrueTypeGX/AAT morx table validation
            *   body for type1 (Contextual Substitution) subtable.
            *
          - * Copyright (C) 2005-2021 by
          + * Copyright (C) 2005-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvmorx2.c b/thirdparty/freetype/src/gxvalid/gxvmorx2.c
          index e7e008f069..eb79e9b408 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvmorx2.c
          +++ b/thirdparty/freetype/src/gxvalid/gxvmorx2.c
          @@ -5,7 +5,7 @@
            *   TrueTypeGX/AAT morx table validation
            *   body for type2 (Ligature Substitution) subtable.
            *
          - * Copyright (C) 2005-2021 by
          + * Copyright (C) 2005-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvmorx4.c b/thirdparty/freetype/src/gxvalid/gxvmorx4.c
          index e632e8d42a..30c602cb8a 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvmorx4.c
          +++ b/thirdparty/freetype/src/gxvalid/gxvmorx4.c
          @@ -5,7 +5,7 @@
            *   TrueTypeGX/AAT morx table validation
            *   body for "morx" type4 (Non-Contextual Glyph Substitution) subtable.
            *
          - * Copyright (C) 2005-2021 by
          + * Copyright (C) 2005-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvmorx5.c b/thirdparty/freetype/src/gxvalid/gxvmorx5.c
          index 5ad33976d7..afdef05a89 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvmorx5.c
          +++ b/thirdparty/freetype/src/gxvalid/gxvmorx5.c
          @@ -5,7 +5,7 @@
            *   TrueTypeGX/AAT morx table validation
            *   body for type5 (Contextual Glyph Insertion) subtable.
            *
          - * Copyright (C) 2005-2021 by
          + * Copyright (C) 2005-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvopbd.c b/thirdparty/freetype/src/gxvalid/gxvopbd.c
          index 7a2feab468..a6b04a4b17 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvopbd.c
          +++ b/thirdparty/freetype/src/gxvalid/gxvopbd.c
          @@ -4,7 +4,7 @@
            *
            *   TrueTypeGX/AAT opbd table validation (body).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvprop.c b/thirdparty/freetype/src/gxvalid/gxvprop.c
          index 98cd368845..bf1ed112fd 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvprop.c
          +++ b/thirdparty/freetype/src/gxvalid/gxvprop.c
          @@ -4,7 +4,7 @@
            *
            *   TrueTypeGX/AAT prop table validation (body).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/gxvtrak.c b/thirdparty/freetype/src/gxvalid/gxvtrak.c
          index c1ed92872d..93ac3e76a9 100644
          --- a/thirdparty/freetype/src/gxvalid/gxvtrak.c
          +++ b/thirdparty/freetype/src/gxvalid/gxvtrak.c
          @@ -4,7 +4,7 @@
            *
            *   TrueTypeGX/AAT trak table validation (body).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
          diff --git a/thirdparty/freetype/src/gxvalid/module.mk b/thirdparty/freetype/src/gxvalid/module.mk
          index efb9c9295f..7635587c39 100644
          --- a/thirdparty/freetype/src/gxvalid/module.mk
          +++ b/thirdparty/freetype/src/gxvalid/module.mk
          @@ -2,7 +2,7 @@
           # FreeType 2 gxvalid module definition
           #
           
          -# Copyright (C) 2004-2021 by
          +# Copyright (C) 2004-2022 by
           # suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
          diff --git a/thirdparty/freetype/src/gxvalid/rules.mk b/thirdparty/freetype/src/gxvalid/rules.mk
          index 8e0b453423..cc103b2704 100644
          --- a/thirdparty/freetype/src/gxvalid/rules.mk
          +++ b/thirdparty/freetype/src/gxvalid/rules.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 2004-2021 by
          +# Copyright (C) 2004-2022 by
           # suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
          diff --git a/thirdparty/freetype/src/gzip/README.freetype b/thirdparty/freetype/src/gzip/README.freetype
          new file mode 100644
          index 0000000000..646ac2eb18
          --- /dev/null
          +++ b/thirdparty/freetype/src/gzip/README.freetype
          @@ -0,0 +1,22 @@
          +Name: zlib
          +Short Name: zlib
          +URL: http://zlib.net/
          +Version: 1.2.11
          +License: see `zlib.h`
          +
          +Description:
          +"A massively spiffy yet delicately unobtrusive compression library."
          +
          +'zlib' is a free, general-purpose, legally unencumbered lossless
          +data-compression library.  'zlib' implements the "deflate" compression
          +algorithm described by RFC 1951, which combines the LZ77 (Lempel-Ziv)
          +algorithm with Huffman coding.  zlib also implements the zlib (RFC 1950) and
          +gzip (RFC 1952) wrapper formats.
          +
          +Local Modifications:
          +The files in this directory have been prepared as follows.
          +
          + - Take the unmodified source code files from the zlib distribution that are
          +   included by `ftgzip.c`.
          + - Run zlib's `zlib2ansi` script on all `.c` files.
          + - Apply the diff file(s) in the `patches` folder.
          diff --git a/thirdparty/freetype/src/gzip/adler32.c b/thirdparty/freetype/src/gzip/adler32.c
          index c53f9dd125..aa032e1ddf 100644
          --- a/thirdparty/freetype/src/gzip/adler32.c
          +++ b/thirdparty/freetype/src/gzip/adler32.c
          @@ -1,48 +1,192 @@
           /* adler32.c -- compute the Adler-32 checksum of a data stream
          - * Copyright (C) 1995-2002 Mark Adler
          + * Copyright (C) 1995-2011, 2016 Mark Adler
            * For conditions of distribution and use, see copyright notice in zlib.h
            */
           
           /* @(#) $Id$ */
           
          -#include "zlib.h"
          +#include "zutil.h"
           
          -#define BASE 65521L /* largest prime smaller than 65536 */
          +#ifndef Z_FREETYPE
          +local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
          +#endif
          +
          +#define BASE 65521U     /* largest prime smaller than 65536 */
           #define NMAX 5552
           /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
           
          -#define DO1(buf,i)  {s1 += buf[i]; s2 += s1;}
          +#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
           #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
           #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
           #define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
           #define DO16(buf)   DO8(buf,0); DO8(buf,8);
           
          +/* use NO_DIVIDE if your processor does not do division in hardware --
          +   try it both ways to see which is faster */
          +#ifdef NO_DIVIDE
          +/* note that this assumes BASE is 65521, where 65536 % 65521 == 15
          +   (thank you to John Reiser for pointing this out) */
          +#  define CHOP(a) \
          +    do { \
          +        unsigned long tmp = a >> 16; \
          +        a &= 0xffffUL; \
          +        a += (tmp << 4) - tmp; \
          +    } while (0)
          +#  define MOD28(a) \
          +    do { \
          +        CHOP(a); \
          +        if (a >= BASE) a -= BASE; \
          +    } while (0)
          +#  define MOD(a) \
          +    do { \
          +        CHOP(a); \
          +        MOD28(a); \
          +    } while (0)
          +#  define MOD63(a) \
          +    do { /* this assumes a is not negative */ \
          +        z_off64_t tmp = a >> 32; \
          +        a &= 0xffffffffL; \
          +        a += (tmp << 8) - (tmp << 5) + tmp; \
          +        tmp = a >> 16; \
          +        a &= 0xffffL; \
          +        a += (tmp << 4) - tmp; \
          +        tmp = a >> 16; \
          +        a &= 0xffffL; \
          +        a += (tmp << 4) - tmp; \
          +        if (a >= BASE) a -= BASE; \
          +    } while (0)
          +#else
          +#  define MOD(a) a %= BASE
          +#  define MOD28(a) a %= BASE
          +#  define MOD63(a) a %= BASE
          +#endif
          +
           /* ========================================================================= */
          -ZEXPORT(uLong) adler32( /* adler, buf, len) */
          +uLong ZEXPORT adler32_z(
               uLong adler,
               const Bytef *buf,
          -    uInt len )
          +    z_size_t len)
           {
          -    unsigned long s1 = adler & 0xffff;
          -    unsigned long s2 = (adler >> 16) & 0xffff;
          -    int k;
          +    unsigned long sum2;
          +    unsigned n;
           
          -    if (buf == Z_NULL) return 1L;
          +    /* split Adler-32 into component sums */
          +    sum2 = (adler >> 16) & 0xffff;
          +    adler &= 0xffff;
           
          -    while (len > 0) {
          -        k = len < NMAX ? len : NMAX;
          -        len -= k;
          -        while (k >= 16) {
          +    /* in case user likes doing a byte at a time, keep it fast */
          +    if (len == 1) {
          +        adler += buf[0];
          +        if (adler >= BASE)
          +            adler -= BASE;
          +        sum2 += adler;
          +        if (sum2 >= BASE)
          +            sum2 -= BASE;
          +        return adler | (sum2 << 16);
          +    }
          +
          +    /* initial Adler-32 value (deferred check for len == 1 speed) */
          +    if (buf == Z_NULL)
          +        return 1L;
          +
          +    /* in case short lengths are provided, keep it somewhat fast */
          +    if (len < 16) {
          +        while (len--) {
          +            adler += *buf++;
          +            sum2 += adler;
          +        }
          +        if (adler >= BASE)
          +            adler -= BASE;
          +        MOD28(sum2);            /* only added so many BASE's */
          +        return adler | (sum2 << 16);
          +    }
          +
          +    /* do length NMAX blocks -- requires just one modulo operation */
          +    while (len >= NMAX) {
          +        len -= NMAX;
          +        n = NMAX / 16;          /* NMAX is divisible by 16 */
          +        do {
          +            DO16(buf);          /* 16 sums unrolled */
          +            buf += 16;
          +        } while (--n);
          +        MOD(adler);
          +        MOD(sum2);
          +    }
          +
          +    /* do remaining bytes (less than NMAX, still just one modulo) */
          +    if (len) {                  /* avoid modulos if none remaining */
          +        while (len >= 16) {
          +            len -= 16;
                       DO16(buf);
                       buf += 16;
          -            k -= 16;
                   }
          -        if (k != 0) do {
          -            s1 += *buf++;
          -            s2 += s1;
          -        } while (--k);
          -        s1 %= BASE;
          -        s2 %= BASE;
          +        while (len--) {
          +            adler += *buf++;
          +            sum2 += adler;
          +        }
          +        MOD(adler);
          +        MOD(sum2);
               }
          -    return (s2 << 16) | s1;
          +
          +    /* return recombined sums */
          +    return adler | (sum2 << 16);
           }
          +
          +/* ========================================================================= */
          +uLong ZEXPORT adler32(
          +    uLong adler,
          +    const Bytef *buf,
          +    uInt len)
          +{
          +    return adler32_z(adler, buf, len);
          +}
          +
          +#ifndef Z_FREETYPE
          +
          +/* ========================================================================= */
          +local uLong adler32_combine_(
          +    uLong adler1,
          +    uLong adler2,
          +    z_off64_t len2)
          +{
          +    unsigned long sum1;
          +    unsigned long sum2;
          +    unsigned rem;
          +
          +    /* for negative len, return invalid adler32 as a clue for debugging */
          +    if (len2 < 0)
          +        return 0xffffffffUL;
          +
          +    /* the derivation of this formula is left as an exercise for the reader */
          +    MOD63(len2);                /* assumes len2 >= 0 */
          +    rem = (unsigned)len2;
          +    sum1 = adler1 & 0xffff;
          +    sum2 = rem * sum1;
          +    MOD(sum2);
          +    sum1 += (adler2 & 0xffff) + BASE - 1;
          +    sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
          +    if (sum1 >= BASE) sum1 -= BASE;
          +    if (sum1 >= BASE) sum1 -= BASE;
          +    if (sum2 >= ((unsigned long)BASE << 1)) sum2 -= ((unsigned long)BASE << 1);
          +    if (sum2 >= BASE) sum2 -= BASE;
          +    return sum1 | (sum2 << 16);
          +}
          +
          +/* ========================================================================= */
          +uLong ZEXPORT adler32_combine(
          +    uLong adler1,
          +    uLong adler2,
          +    z_off_t len2)
          +{
          +    return adler32_combine_(adler1, adler2, len2);
          +}
          +
          +uLong ZEXPORT adler32_combine64(
          +    uLong adler1,
          +    uLong adler2,
          +    z_off64_t len2)
          +{
          +    return adler32_combine_(adler1, adler2, len2);
          +}
          +
          +#endif  /* !Z_FREETYPE */
          diff --git a/thirdparty/freetype/src/gzip/crc32.c b/thirdparty/freetype/src/gzip/crc32.c
          new file mode 100644
          index 0000000000..ffced1ea7d
          --- /dev/null
          +++ b/thirdparty/freetype/src/gzip/crc32.c
          @@ -0,0 +1,444 @@
          +/* crc32.c -- compute the CRC-32 of a data stream
          + * Copyright (C) 1995-2006, 2010, 2011, 2012, 2016 Mark Adler
          + * For conditions of distribution and use, see copyright notice in zlib.h
          + *
          + * Thanks to Rodney Brown  for his contribution of faster
          + * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing
          + * tables for updating the shift register in one step with three exclusive-ors
          + * instead of four steps with four exclusive-ors.  This results in about a
          + * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3.
          + */
          +
          +/* @(#) $Id$ */
          +
          +/*
          +  Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore
          +  protection on the static variables used to control the first-use generation
          +  of the crc tables.  Therefore, if you #define DYNAMIC_CRC_TABLE, you should
          +  first call get_crc_table() to initialize the tables before allowing more than
          +  one thread to use crc32().
          +
          +  DYNAMIC_CRC_TABLE and MAKECRCH can be #defined to write out crc32.h.
          + */
          +
          +#ifdef MAKECRCH
          +#  include 
          +#  ifndef DYNAMIC_CRC_TABLE
          +#    define DYNAMIC_CRC_TABLE
          +#  endif /* !DYNAMIC_CRC_TABLE */
          +#endif /* MAKECRCH */
          +
          +#include "zutil.h"      /* for STDC and FAR definitions */
          +
          +/* Definitions for doing the crc four data bytes at a time. */
          +#if !defined(NOBYFOUR) && defined(Z_U4)
          +#  define BYFOUR
          +#endif
          +#ifdef BYFOUR
          +   local unsigned long crc32_little OF((unsigned long,
          +                        const unsigned char FAR *, z_size_t));
          +   local unsigned long crc32_big OF((unsigned long,
          +                        const unsigned char FAR *, z_size_t));
          +#  define TBLS 8
          +#else
          +#  define TBLS 1
          +#endif /* BYFOUR */
          +
          +/* Local functions for crc concatenation */
          +local unsigned long gf2_matrix_times OF((unsigned long *mat,
          +                                         unsigned long vec));
          +local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat));
          +local uLong crc32_combine_ OF((uLong crc1, uLong crc2, z_off64_t len2));
          +
          +
          +#ifdef DYNAMIC_CRC_TABLE
          +
          +local volatile int crc_table_empty = 1;
          +local z_crc_t FAR crc_table[TBLS][256];
          +local void make_crc_table OF((void));
          +#ifdef MAKECRCH
          +   local void write_table OF((FILE *, const z_crc_t FAR *));
          +#endif /* MAKECRCH */
          +/*
          +  Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
          +  x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
          +
          +  Polynomials over GF(2) are represented in binary, one bit per coefficient,
          +  with the lowest powers in the most significant bit.  Then adding polynomials
          +  is just exclusive-or, and multiplying a polynomial by x is a right shift by
          +  one.  If we call the above polynomial p, and represent a byte as the
          +  polynomial q, also with the lowest power in the most significant bit (so the
          +  byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,
          +  where a mod b means the remainder after dividing a by b.
          +
          +  This calculation is done using the shift-register method of multiplying and
          +  taking the remainder.  The register is initialized to zero, and for each
          +  incoming bit, x^32 is added mod p to the register if the bit is a one (where
          +  x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by
          +  x (which is shifting right by one and adding x^32 mod p if the bit shifted
          +  out is a one).  We start with the highest power (least significant bit) of
          +  q and repeat for all eight bits of q.
          +
          +  The first table is simply the CRC of all possible eight bit values.  This is
          +  all the information needed to generate CRCs on data a byte at a time for all
          +  combinations of CRC register values and incoming bytes.  The remaining tables
          +  allow for word-at-a-time CRC calculation for both big-endian and little-
          +  endian machines, where a word is four bytes.
          +*/
          +local void make_crc_table()
          +{
          +    z_crc_t c;
          +    int n, k;
          +    z_crc_t poly;                       /* polynomial exclusive-or pattern */
          +    /* terms of polynomial defining this crc (except x^32): */
          +    static volatile int first = 1;      /* flag to limit concurrent making */
          +    static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
          +
          +    /* See if another task is already doing this (not thread-safe, but better
          +       than nothing -- significantly reduces duration of vulnerability in
          +       case the advice about DYNAMIC_CRC_TABLE is ignored) */
          +    if (first) {
          +        first = 0;
          +
          +        /* make exclusive-or pattern from polynomial (0xedb88320UL) */
          +        poly = 0;
          +        for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++)
          +            poly |= (z_crc_t)1 << (31 - p[n]);
          +
          +        /* generate a crc for every 8-bit value */
          +        for (n = 0; n < 256; n++) {
          +            c = (z_crc_t)n;
          +            for (k = 0; k < 8; k++)
          +                c = c & 1 ? poly ^ (c >> 1) : c >> 1;
          +            crc_table[0][n] = c;
          +        }
          +
          +#ifdef BYFOUR
          +        /* generate crc for each value followed by one, two, and three zeros,
          +           and then the byte reversal of those as well as the first table */
          +        for (n = 0; n < 256; n++) {
          +            c = crc_table[0][n];
          +            crc_table[4][n] = ZSWAP32(c);
          +            for (k = 1; k < 4; k++) {
          +                c = crc_table[0][c & 0xff] ^ (c >> 8);
          +                crc_table[k][n] = c;
          +                crc_table[k + 4][n] = ZSWAP32(c);
          +            }
          +        }
          +#endif /* BYFOUR */
          +
          +        crc_table_empty = 0;
          +    }
          +    else {      /* not first */
          +        /* wait for the other guy to finish (not efficient, but rare) */
          +        while (crc_table_empty)
          +            ;
          +    }
          +
          +#ifdef MAKECRCH
          +    /* write out CRC tables to crc32.h */
          +    {
          +        FILE *out;
          +
          +        out = fopen("crc32.h", "w");
          +        if (out == NULL) return;
          +        fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n");
          +        fprintf(out, " * Generated automatically by crc32.c\n */\n\n");
          +        fprintf(out, "local const z_crc_t FAR ");
          +        fprintf(out, "crc_table[TBLS][256] =\n{\n  {\n");
          +        write_table(out, crc_table[0]);
          +#  ifdef BYFOUR
          +        fprintf(out, "#ifdef BYFOUR\n");
          +        for (k = 1; k < 8; k++) {
          +            fprintf(out, "  },\n  {\n");
          +            write_table(out, crc_table[k]);
          +        }
          +        fprintf(out, "#endif\n");
          +#  endif /* BYFOUR */
          +        fprintf(out, "  }\n};\n");
          +        fclose(out);
          +    }
          +#endif /* MAKECRCH */
          +}
          +
          +#ifdef MAKECRCH
          +local void write_table(
          +    FILE *out,
          +    const z_crc_t FAR *table)
          +{
          +    int n;
          +
          +    for (n = 0; n < 256; n++)
          +        fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : "    ",
          +                (unsigned long)(table[n]),
          +                n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", "));
          +}
          +#endif /* MAKECRCH */
          +
          +#else /* !DYNAMIC_CRC_TABLE */
          +/* ========================================================================
          + * Tables of CRC-32s of all single-byte values, made by make_crc_table().
          + */
          +#include "crc32.h"
          +#endif /* DYNAMIC_CRC_TABLE */
          +
          +/* =========================================================================
          + * This function can be used by asm versions of crc32()
          + */
          +const z_crc_t FAR * ZEXPORT get_crc_table()
          +{
          +#ifdef DYNAMIC_CRC_TABLE
          +    if (crc_table_empty)
          +        make_crc_table();
          +#endif /* DYNAMIC_CRC_TABLE */
          +    return (const z_crc_t FAR *)crc_table;
          +}
          +
          +/* ========================================================================= */
          +#undef DO1
          +#undef DO8
          +#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8)
          +#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
          +
          +/* ========================================================================= */
          +unsigned long ZEXPORT crc32_z(
          +    unsigned long crc,
          +    const unsigned char FAR *buf,
          +    z_size_t len)
          +{
          +    if (buf == Z_NULL) return 0UL;
          +
          +#ifdef DYNAMIC_CRC_TABLE
          +    if (crc_table_empty)
          +        make_crc_table();
          +#endif /* DYNAMIC_CRC_TABLE */
          +
          +#ifdef BYFOUR
          +    if (sizeof(void *) == sizeof(ptrdiff_t)) {
          +        z_crc_t endian;
          +
          +        endian = 1;
          +        if (*((unsigned char *)(&endian)))
          +            return crc32_little(crc, buf, len);
          +        else
          +            return crc32_big(crc, buf, len);
          +    }
          +#endif /* BYFOUR */
          +    crc = crc ^ 0xffffffffUL;
          +    while (len >= 8) {
          +        DO8;
          +        len -= 8;
          +    }
          +    if (len) do {
          +        DO1;
          +    } while (--len);
          +    return crc ^ 0xffffffffUL;
          +}
          +
          +/* ========================================================================= */
          +unsigned long ZEXPORT crc32(
          +    unsigned long crc,
          +    const unsigned char FAR *buf,
          +    uInt len)
          +{
          +    return crc32_z(crc, buf, len);
          +}
          +
          +#ifdef BYFOUR
          +
          +/*
          +   This BYFOUR code accesses the passed unsigned char * buffer with a 32-bit
          +   integer pointer type. This violates the strict aliasing rule, where a
          +   compiler can assume, for optimization purposes, that two pointers to
          +   fundamentally different types won't ever point to the same memory. This can
          +   manifest as a problem only if one of the pointers is written to. This code
          +   only reads from those pointers. So long as this code remains isolated in
          +   this compilation unit, there won't be a problem. For this reason, this code
          +   should not be copied and pasted into a compilation unit in which other code
          +   writes to the buffer that is passed to these routines.
          + */
          +
          +/* ========================================================================= */
          +#define DOLIT4 c ^= *buf4++; \
          +        c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \
          +            crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24]
          +#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4
          +
          +/* ========================================================================= */
          +local unsigned long crc32_little(
          +    unsigned long crc,
          +    const unsigned char FAR *buf,
          +    z_size_t len)
          +{
          +    register z_crc_t c;
          +    register const z_crc_t FAR *buf4;
          +
          +    c = (z_crc_t)crc;
          +    c = ~c;
          +    while (len && ((ptrdiff_t)buf & 3)) {
          +        c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
          +        len--;
          +    }
          +
          +    buf4 = (const z_crc_t FAR *)(const void FAR *)buf;
          +    while (len >= 32) {
          +        DOLIT32;
          +        len -= 32;
          +    }
          +    while (len >= 4) {
          +        DOLIT4;
          +        len -= 4;
          +    }
          +    buf = (const unsigned char FAR *)buf4;
          +
          +    if (len) do {
          +        c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
          +    } while (--len);
          +    c = ~c;
          +    return (unsigned long)c;
          +}
          +
          +/* ========================================================================= */
          +#define DOBIG4 c ^= *buf4++; \
          +        c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \
          +            crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24]
          +#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4
          +
          +/* ========================================================================= */
          +local unsigned long crc32_big(
          +    unsigned long crc,
          +    const unsigned char FAR *buf,
          +    z_size_t len)
          +{
          +    register z_crc_t c;
          +    register const z_crc_t FAR *buf4;
          +
          +    c = ZSWAP32((z_crc_t)crc);
          +    c = ~c;
          +    while (len && ((ptrdiff_t)buf & 3)) {
          +        c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
          +        len--;
          +    }
          +
          +    buf4 = (const z_crc_t FAR *)(const void FAR *)buf;
          +    while (len >= 32) {
          +        DOBIG32;
          +        len -= 32;
          +    }
          +    while (len >= 4) {
          +        DOBIG4;
          +        len -= 4;
          +    }
          +    buf = (const unsigned char FAR *)buf4;
          +
          +    if (len) do {
          +        c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
          +    } while (--len);
          +    c = ~c;
          +    return (unsigned long)(ZSWAP32(c));
          +}
          +
          +#endif /* BYFOUR */
          +
          +#define GF2_DIM 32      /* dimension of GF(2) vectors (length of CRC) */
          +
          +/* ========================================================================= */
          +local unsigned long gf2_matrix_times(
          +    unsigned long *mat,
          +    unsigned long vec)
          +{
          +    unsigned long sum;
          +
          +    sum = 0;
          +    while (vec) {
          +        if (vec & 1)
          +            sum ^= *mat;
          +        vec >>= 1;
          +        mat++;
          +    }
          +    return sum;
          +}
          +
          +/* ========================================================================= */
          +local void gf2_matrix_square(
          +    unsigned long *square,
          +    unsigned long *mat)
          +{
          +    int n;
          +
          +    for (n = 0; n < GF2_DIM; n++)
          +        square[n] = gf2_matrix_times(mat, mat[n]);
          +}
          +
          +/* ========================================================================= */
          +local uLong crc32_combine_(
          +    uLong crc1,
          +    uLong crc2,
          +    z_off64_t len2)
          +{
          +    int n;
          +    unsigned long row;
          +    unsigned long even[GF2_DIM];    /* even-power-of-two zeros operator */
          +    unsigned long odd[GF2_DIM];     /* odd-power-of-two zeros operator */
          +
          +    /* degenerate case (also disallow negative lengths) */
          +    if (len2 <= 0)
          +        return crc1;
          +
          +    /* put operator for one zero bit in odd */
          +    odd[0] = 0xedb88320UL;          /* CRC-32 polynomial */
          +    row = 1;
          +    for (n = 1; n < GF2_DIM; n++) {
          +        odd[n] = row;
          +        row <<= 1;
          +    }
          +
          +    /* put operator for two zero bits in even */
          +    gf2_matrix_square(even, odd);
          +
          +    /* put operator for four zero bits in odd */
          +    gf2_matrix_square(odd, even);
          +
          +    /* apply len2 zeros to crc1 (first square will put the operator for one
          +       zero byte, eight zero bits, in even) */
          +    do {
          +        /* apply zeros operator for this bit of len2 */
          +        gf2_matrix_square(even, odd);
          +        if (len2 & 1)
          +            crc1 = gf2_matrix_times(even, crc1);
          +        len2 >>= 1;
          +
          +        /* if no more bits set, then done */
          +        if (len2 == 0)
          +            break;
          +
          +        /* another iteration of the loop with odd and even swapped */
          +        gf2_matrix_square(odd, even);
          +        if (len2 & 1)
          +            crc1 = gf2_matrix_times(odd, crc1);
          +        len2 >>= 1;
          +
          +        /* if no more bits set, then done */
          +    } while (len2 != 0);
          +
          +    /* return combined crc */
          +    crc1 ^= crc2;
          +    return crc1;
          +}
          +
          +/* ========================================================================= */
          +uLong ZEXPORT crc32_combine(
          +    uLong crc1,
          +    uLong crc2,
          +    z_off_t len2)
          +{
          +    return crc32_combine_(crc1, crc2, len2);
          +}
          +
          +uLong ZEXPORT crc32_combine64(
          +    uLong crc1,
          +    uLong crc2,
          +    z_off64_t len2)
          +{
          +    return crc32_combine_(crc1, crc2, len2);
          +}
          diff --git a/thirdparty/freetype/src/gzip/crc32.h b/thirdparty/freetype/src/gzip/crc32.h
          new file mode 100644
          index 0000000000..9e0c778102
          --- /dev/null
          +++ b/thirdparty/freetype/src/gzip/crc32.h
          @@ -0,0 +1,441 @@
          +/* crc32.h -- tables for rapid CRC calculation
          + * Generated automatically by crc32.c
          + */
          +
          +local const z_crc_t FAR crc_table[TBLS][256] =
          +{
          +  {
          +    0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
          +    0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL,
          +    0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL,
          +    0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL,
          +    0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL,
          +    0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL,
          +    0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL,
          +    0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL,
          +    0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL,
          +    0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL,
          +    0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL,
          +    0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL,
          +    0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL,
          +    0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL,
          +    0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL,
          +    0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL,
          +    0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL,
          +    0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL,
          +    0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL,
          +    0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL,
          +    0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL,
          +    0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL,
          +    0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL,
          +    0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL,
          +    0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL,
          +    0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL,
          +    0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL,
          +    0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL,
          +    0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL,
          +    0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL,
          +    0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL,
          +    0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL,
          +    0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL,
          +    0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL,
          +    0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL,
          +    0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL,
          +    0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL,
          +    0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL,
          +    0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL,
          +    0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL,
          +    0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL,
          +    0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL,
          +    0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL,
          +    0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL,
          +    0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL,
          +    0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL,
          +    0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL,
          +    0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL,
          +    0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL,
          +    0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL,
          +    0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL,
          +    0x2d02ef8dUL
          +#ifdef BYFOUR
          +  },
          +  {
          +    0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL,
          +    0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL,
          +    0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL,
          +    0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL,
          +    0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL,
          +    0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL,
          +    0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL,
          +    0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL,
          +    0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL,
          +    0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL,
          +    0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL,
          +    0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL,
          +    0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL,
          +    0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL,
          +    0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL,
          +    0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL,
          +    0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL,
          +    0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL,
          +    0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL,
          +    0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL,
          +    0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL,
          +    0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL,
          +    0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL,
          +    0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL,
          +    0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL,
          +    0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL,
          +    0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL,
          +    0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL,
          +    0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL,
          +    0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL,
          +    0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL,
          +    0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL,
          +    0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL,
          +    0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL,
          +    0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL,
          +    0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL,
          +    0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL,
          +    0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL,
          +    0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL,
          +    0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL,
          +    0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL,
          +    0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL,
          +    0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL,
          +    0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL,
          +    0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL,
          +    0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL,
          +    0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL,
          +    0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL,
          +    0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL,
          +    0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL,
          +    0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL,
          +    0x9324fd72UL
          +  },
          +  {
          +    0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL,
          +    0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL,
          +    0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL,
          +    0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL,
          +    0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL,
          +    0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL,
          +    0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL,
          +    0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL,
          +    0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL,
          +    0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL,
          +    0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL,
          +    0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL,
          +    0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL,
          +    0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL,
          +    0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL,
          +    0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL,
          +    0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL,
          +    0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL,
          +    0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL,
          +    0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL,
          +    0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL,
          +    0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL,
          +    0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL,
          +    0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL,
          +    0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL,
          +    0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL,
          +    0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL,
          +    0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL,
          +    0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL,
          +    0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL,
          +    0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL,
          +    0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL,
          +    0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL,
          +    0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL,
          +    0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL,
          +    0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL,
          +    0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL,
          +    0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL,
          +    0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL,
          +    0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL,
          +    0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL,
          +    0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL,
          +    0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL,
          +    0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL,
          +    0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL,
          +    0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL,
          +    0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL,
          +    0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL,
          +    0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL,
          +    0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL,
          +    0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL,
          +    0xbe9834edUL
          +  },
          +  {
          +    0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL,
          +    0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL,
          +    0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL,
          +    0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL,
          +    0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL,
          +    0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL,
          +    0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL,
          +    0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL,
          +    0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL,
          +    0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL,
          +    0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL,
          +    0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL,
          +    0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL,
          +    0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL,
          +    0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL,
          +    0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL,
          +    0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL,
          +    0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL,
          +    0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL,
          +    0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL,
          +    0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL,
          +    0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL,
          +    0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL,
          +    0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL,
          +    0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL,
          +    0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL,
          +    0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL,
          +    0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL,
          +    0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL,
          +    0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL,
          +    0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL,
          +    0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL,
          +    0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL,
          +    0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL,
          +    0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL,
          +    0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL,
          +    0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL,
          +    0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL,
          +    0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL,
          +    0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL,
          +    0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL,
          +    0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL,
          +    0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL,
          +    0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL,
          +    0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL,
          +    0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL,
          +    0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL,
          +    0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL,
          +    0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL,
          +    0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL,
          +    0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL,
          +    0xde0506f1UL
          +  },
          +  {
          +    0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL,
          +    0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL,
          +    0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL,
          +    0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL,
          +    0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL,
          +    0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL,
          +    0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL,
          +    0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL,
          +    0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL,
          +    0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL,
          +    0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL,
          +    0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL,
          +    0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL,
          +    0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL,
          +    0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL,
          +    0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL,
          +    0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL,
          +    0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL,
          +    0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL,
          +    0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL,
          +    0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL,
          +    0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL,
          +    0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL,
          +    0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL,
          +    0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL,
          +    0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL,
          +    0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL,
          +    0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL,
          +    0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL,
          +    0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL,
          +    0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL,
          +    0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL,
          +    0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL,
          +    0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL,
          +    0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL,
          +    0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL,
          +    0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL,
          +    0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL,
          +    0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL,
          +    0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL,
          +    0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL,
          +    0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL,
          +    0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL,
          +    0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL,
          +    0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL,
          +    0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL,
          +    0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL,
          +    0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL,
          +    0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL,
          +    0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL,
          +    0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL,
          +    0x8def022dUL
          +  },
          +  {
          +    0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL,
          +    0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL,
          +    0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL,
          +    0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL,
          +    0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL,
          +    0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL,
          +    0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL,
          +    0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL,
          +    0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL,
          +    0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL,
          +    0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL,
          +    0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL,
          +    0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL,
          +    0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL,
          +    0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL,
          +    0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL,
          +    0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL,
          +    0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL,
          +    0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL,
          +    0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL,
          +    0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL,
          +    0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL,
          +    0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL,
          +    0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL,
          +    0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL,
          +    0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL,
          +    0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL,
          +    0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL,
          +    0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL,
          +    0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL,
          +    0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL,
          +    0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL,
          +    0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL,
          +    0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL,
          +    0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL,
          +    0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL,
          +    0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL,
          +    0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL,
          +    0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL,
          +    0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL,
          +    0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL,
          +    0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL,
          +    0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL,
          +    0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL,
          +    0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL,
          +    0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL,
          +    0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL,
          +    0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL,
          +    0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL,
          +    0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL,
          +    0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL,
          +    0x72fd2493UL
          +  },
          +  {
          +    0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL,
          +    0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL,
          +    0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL,
          +    0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL,
          +    0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL,
          +    0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL,
          +    0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL,
          +    0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL,
          +    0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL,
          +    0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL,
          +    0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL,
          +    0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL,
          +    0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL,
          +    0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL,
          +    0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL,
          +    0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL,
          +    0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL,
          +    0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL,
          +    0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL,
          +    0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL,
          +    0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL,
          +    0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL,
          +    0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL,
          +    0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL,
          +    0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL,
          +    0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL,
          +    0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL,
          +    0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL,
          +    0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL,
          +    0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL,
          +    0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL,
          +    0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL,
          +    0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL,
          +    0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL,
          +    0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL,
          +    0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL,
          +    0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL,
          +    0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL,
          +    0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL,
          +    0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL,
          +    0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL,
          +    0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL,
          +    0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL,
          +    0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL,
          +    0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL,
          +    0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL,
          +    0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL,
          +    0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL,
          +    0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL,
          +    0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL,
          +    0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL,
          +    0xed3498beUL
          +  },
          +  {
          +    0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL,
          +    0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL,
          +    0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL,
          +    0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL,
          +    0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL,
          +    0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL,
          +    0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL,
          +    0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL,
          +    0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL,
          +    0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL,
          +    0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL,
          +    0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL,
          +    0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL,
          +    0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL,
          +    0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL,
          +    0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL,
          +    0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL,
          +    0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL,
          +    0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL,
          +    0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL,
          +    0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL,
          +    0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL,
          +    0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL,
          +    0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL,
          +    0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL,
          +    0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL,
          +    0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL,
          +    0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL,
          +    0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL,
          +    0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL,
          +    0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL,
          +    0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL,
          +    0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL,
          +    0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL,
          +    0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL,
          +    0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL,
          +    0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL,
          +    0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL,
          +    0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL,
          +    0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL,
          +    0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL,
          +    0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL,
          +    0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL,
          +    0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL,
          +    0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL,
          +    0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL,
          +    0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL,
          +    0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL,
          +    0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL,
          +    0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL,
          +    0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL,
          +    0xf10605deUL
          +#endif
          +  }
          +};
          diff --git a/thirdparty/freetype/src/gzip/ftgzip.c b/thirdparty/freetype/src/gzip/ftgzip.c
          index 8f98a7d17b..34bbe4dafa 100644
          --- a/thirdparty/freetype/src/gzip/ftgzip.c
          +++ b/thirdparty/freetype/src/gzip/ftgzip.c
          @@ -8,7 +8,7 @@
            * parse compressed PCF fonts, as found with many X11 server
            * distributions.
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -69,10 +69,21 @@
             /*                                                                   */
             /* so that configuration with `FT_CONFIG_OPTION_SYSTEM_ZLIB' might   */
             /* include the wrong `zconf.h' file, leading to errors.              */
          -#include "zlib.h"
           
          -#undef  SLOW
          -#define SLOW  1  /* we can't use asm-optimized sources here! */
          +  /* `HAVE_HIDDEN` should be defined if                                 */
          +  /*                                                                    */
          +  /*   __attribute__((visibility("hidden")))                            */
          +  /*                                                                    */
          +  /* is supported by the compiler, which prevents internal symbols from */
          +  /* being exported by the library.                                     */
          +#if defined( __GNUC__ ) ||  defined( __clang__ )
          +#define HAVE_HIDDEN  1
          +#define ZEXPORT
          +#define ZEXTERN      static
          +#endif
          +
          +#define Z_SOLO      1
          +#define Z_FREETYPE  1
           
           #if defined( _MSC_VER )      /* Visual C++ (and Intel C++)   */
             /* We disable the warning `conversion from XXX to YYY,     */
          @@ -83,24 +94,23 @@
           #pragma warning( disable : 4244 )
           #endif /* _MSC_VER */
           
          -  /* Urgh.  `inflate_mask' must not be declared twice -- C++ doesn't like
          -     this.  We temporarily disable it and load all necessary header files. */
          -#define NO_INFLATE_MASK
          -#include "zutil.h"
          -#include "inftrees.h"
          -#include "infblock.h"
          -#include "infcodes.h"
          -#include "infutil.h"
          -#undef  NO_INFLATE_MASK
          +#if defined( __GNUC__ )
          +#pragma GCC diagnostic push
          +#pragma GCC diagnostic ignored "-Wstrict-prototypes"
          +#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
          +#pragma GCC diagnostic ignored "-Wredundant-decls"
          +#endif
           
          -  /* infutil.c must be included before infcodes.c */
           #include "zutil.c"
          -#include "inftrees.c"
          -#include "infutil.c"
          -#include "infcodes.c"
          -#include "infblock.c"
          +#include "inffast.c"
           #include "inflate.c"
          +#include "inftrees.c"
           #include "adler32.c"
          +#include "crc32.c"
          +
          +#if defined( __GNUC__ )
          +#pragma GCC diagnostic pop
          +#endif
           
           #if defined( _MSC_VER )
           #pragma warning( pop )
          @@ -150,7 +160,7 @@
           
           #if !defined( FT_CONFIG_OPTION_SYSTEM_ZLIB ) && !defined( USE_ZLIB_ZCALLOC )
           
          -  local voidpf
          +  voidpf ZLIB_INTERNAL
             zcalloc ( voidpf    opaque,
                       unsigned  items,
                       unsigned  size )
          @@ -158,7 +168,8 @@
               return ft_gzip_alloc( opaque, items, size );
             }
           
          -  local void
          +
          +  void ZLIB_INTERNAL
             zcfree( voidpf  opaque,
                     voidpf  ptr )
             {
          @@ -751,16 +762,7 @@
               stream.zfree  = ft_gzip_free;
               stream.opaque = memory;
           
          -    /* This is a temporary fix and will be removed once the internal
          -     * copy of zlib is updated to the newest version. The `|32' flag
          -     * is only supported in the new versions of zlib to enable gzip
          -     * encoded header.
          -     */
          -#ifdef FT_CONFIG_OPTION_SYSTEM_ZLIB
               err = inflateInit2( &stream, MAX_WBITS|32 );
          -#else
          -    err = inflateInit2( &stream, MAX_WBITS );
          -#endif
           
               if ( err != Z_OK )
                 return FT_THROW( Invalid_Argument );
          diff --git a/thirdparty/freetype/src/gzip/ftzconf.h b/thirdparty/freetype/src/gzip/ftzconf.h
          index 3abf0ba03b..5e1d68a004 100644
          --- a/thirdparty/freetype/src/gzip/ftzconf.h
          +++ b/thirdparty/freetype/src/gzip/ftzconf.h
          @@ -1,109 +1,255 @@
           /* zconf.h -- configuration of the zlib compression library
          - * Copyright (C) 1995-2002 Jean-loup Gailly.
          + * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
            * For conditions of distribution and use, see copyright notice in zlib.h
            */
           
           /* @(#) $Id$ */
           
          -#ifndef _ZCONF_H
          -#define _ZCONF_H
          +#ifndef ZCONF_H
          +#define ZCONF_H
           
           /*
            * If you *really* need a unique prefix for all types and library functions,
            * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
          + * Even better than compiling with -DZ_PREFIX would be to use configure to set
          + * this permanently in zconf.h using "./configure --zprefix".
            */
          -#ifdef Z_PREFIX
          -#  define deflateInit_         z_deflateInit_
          -#  define deflate              z_deflate
          -#  define deflateEnd           z_deflateEnd
          -#  define inflateInit_         z_inflateInit_
          -#  define inflate              z_inflate
          -#  define inflateEnd           z_inflateEnd
          -#  define deflateInit2_        z_deflateInit2_
          -#  define deflateSetDictionary z_deflateSetDictionary
          -#  define deflateCopy          z_deflateCopy
          -#  define deflateReset         z_deflateReset
          -#  define deflateParams        z_deflateParams
          -#  define inflateInit2_        z_inflateInit2_
          -#  define inflateSetDictionary z_inflateSetDictionary
          -#  define inflateSync          z_inflateSync
          -#  define inflateSyncPoint     z_inflateSyncPoint
          -#  define inflateReset         z_inflateReset
          -#  define compress             z_compress
          -#  define compress2            z_compress2
          -#  define uncompress           z_uncompress
          -#  define adler32              z_adler32
          -#  define crc32                z_crc32
          -#  define get_crc_table        z_get_crc_table
          +#ifdef Z_PREFIX     /* may be set to #if 1 by ./configure */
          +#  define Z_PREFIX_SET
           
          -#  define Byte   z_Byte
          -#  define uInt   z_uInt
          -#  define uLong  z_uLong
          -#  define Bytef  z_Bytef
          -#  define charf  z_charf
          -#  define intf   z_intf
          -#  define uIntf  z_uIntf
          -#  define uLongf z_uLongf
          -#  define voidpf z_voidpf
          -#  define voidp  z_voidp
          -#endif
          -
          -#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
          -#  define WIN32
          -#endif
          -#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386)
          -#  ifndef __32BIT__
          -#    define __32BIT__
          +/* all linked symbols and init macros */
          +#  define _dist_code            z__dist_code
          +#  define _length_code          z__length_code
          +#  define _tr_align             z__tr_align
          +#  define _tr_flush_bits        z__tr_flush_bits
          +#  define _tr_flush_block       z__tr_flush_block
          +#  define _tr_init              z__tr_init
          +#  define _tr_stored_block      z__tr_stored_block
          +#  define _tr_tally             z__tr_tally
          +#  define adler32               z_adler32
          +#  define adler32_combine       z_adler32_combine
          +#  define adler32_combine64     z_adler32_combine64
          +#  define adler32_z             z_adler32_z
          +#  ifndef Z_SOLO
          +#    define compress              z_compress
          +#    define compress2             z_compress2
          +#    define compressBound         z_compressBound
           #  endif
          +#  define crc32                 z_crc32
          +#  define crc32_combine         z_crc32_combine
          +#  define crc32_combine64       z_crc32_combine64
          +#  define crc32_z               z_crc32_z
          +#  define deflate               z_deflate
          +#  define deflateBound          z_deflateBound
          +#  define deflateCopy           z_deflateCopy
          +#  define deflateEnd            z_deflateEnd
          +#  define deflateGetDictionary  z_deflateGetDictionary
          +#  define deflateInit           z_deflateInit
          +#  define deflateInit2          z_deflateInit2
          +#  define deflateInit2_         z_deflateInit2_
          +#  define deflateInit_          z_deflateInit_
          +#  define deflateParams         z_deflateParams
          +#  define deflatePending        z_deflatePending
          +#  define deflatePrime          z_deflatePrime
          +#  define deflateReset          z_deflateReset
          +#  define deflateResetKeep      z_deflateResetKeep
          +#  define deflateSetDictionary  z_deflateSetDictionary
          +#  define deflateSetHeader      z_deflateSetHeader
          +#  define deflateTune           z_deflateTune
          +#  define deflate_copyright     z_deflate_copyright
          +#  define get_crc_table         z_get_crc_table
          +#  ifndef Z_SOLO
          +#    define gz_error              z_gz_error
          +#    define gz_intmax             z_gz_intmax
          +#    define gz_strwinerror        z_gz_strwinerror
          +#    define gzbuffer              z_gzbuffer
          +#    define gzclearerr            z_gzclearerr
          +#    define gzclose               z_gzclose
          +#    define gzclose_r             z_gzclose_r
          +#    define gzclose_w             z_gzclose_w
          +#    define gzdirect              z_gzdirect
          +#    define gzdopen               z_gzdopen
          +#    define gzeof                 z_gzeof
          +#    define gzerror               z_gzerror
          +#    define gzflush               z_gzflush
          +#    define gzfread               z_gzfread
          +#    define gzfwrite              z_gzfwrite
          +#    define gzgetc                z_gzgetc
          +#    define gzgetc_               z_gzgetc_
          +#    define gzgets                z_gzgets
          +#    define gzoffset              z_gzoffset
          +#    define gzoffset64            z_gzoffset64
          +#    define gzopen                z_gzopen
          +#    define gzopen64              z_gzopen64
          +#    ifdef _WIN32
          +#      define gzopen_w              z_gzopen_w
          +#    endif
          +#    define gzprintf              z_gzprintf
          +#    define gzputc                z_gzputc
          +#    define gzputs                z_gzputs
          +#    define gzread                z_gzread
          +#    define gzrewind              z_gzrewind
          +#    define gzseek                z_gzseek
          +#    define gzseek64              z_gzseek64
          +#    define gzsetparams           z_gzsetparams
          +#    define gztell                z_gztell
          +#    define gztell64              z_gztell64
          +#    define gzungetc              z_gzungetc
          +#    define gzvprintf             z_gzvprintf
          +#    define gzwrite               z_gzwrite
          +#  endif
          +#  define inflate               z_inflate
          +#  define inflateBack           z_inflateBack
          +#  define inflateBackEnd        z_inflateBackEnd
          +#  define inflateBackInit       z_inflateBackInit
          +#  define inflateBackInit_      z_inflateBackInit_
          +#  define inflateCodesUsed      z_inflateCodesUsed
          +#  define inflateCopy           z_inflateCopy
          +#  define inflateEnd            z_inflateEnd
          +#  define inflateGetDictionary  z_inflateGetDictionary
          +#  define inflateGetHeader      z_inflateGetHeader
          +#  define inflateInit           z_inflateInit
          +#  define inflateInit2          z_inflateInit2
          +#  define inflateInit2_         z_inflateInit2_
          +#  define inflateInit_          z_inflateInit_
          +#  define inflateMark           z_inflateMark
          +#  define inflatePrime          z_inflatePrime
          +#  define inflateReset          z_inflateReset
          +#  define inflateReset2         z_inflateReset2
          +#  define inflateResetKeep      z_inflateResetKeep
          +#  define inflateSetDictionary  z_inflateSetDictionary
          +#  define inflateSync           z_inflateSync
          +#  define inflateSyncPoint      z_inflateSyncPoint
          +#  define inflateUndermine      z_inflateUndermine
          +#  define inflateValidate       z_inflateValidate
          +#  define inflate_copyright     z_inflate_copyright
          +#  define inflate_fast          z_inflate_fast
          +#  define inflate_table         z_inflate_table
          +#  ifndef Z_SOLO
          +#    define uncompress            z_uncompress
          +#    define uncompress2           z_uncompress2
          +#  endif
          +#  define zError                z_zError
          +#  ifndef Z_SOLO
          +#    define zcalloc               z_zcalloc
          +#    define zcfree                z_zcfree
          +#  endif
          +#  define zlibCompileFlags      z_zlibCompileFlags
          +#  define zlibVersion           z_zlibVersion
          +
          +/* all zlib typedefs in zlib.h and zconf.h */
          +#  define Byte                  z_Byte
          +#  define Bytef                 z_Bytef
          +#  define alloc_func            z_alloc_func
          +#  define charf                 z_charf
          +#  define free_func             z_free_func
          +#  ifndef Z_SOLO
          +#    define gzFile                z_gzFile
          +#  endif
          +#  define gz_header             z_gz_header
          +#  define gz_headerp            z_gz_headerp
          +#  define in_func               z_in_func
          +#  define intf                  z_intf
          +#  define out_func              z_out_func
          +#  define uInt                  z_uInt
          +#  define uIntf                 z_uIntf
          +#  define uLong                 z_uLong
          +#  define uLongf                z_uLongf
          +#  define voidp                 z_voidp
          +#  define voidpc                z_voidpc
          +#  define voidpf                z_voidpf
          +
          +/* all zlib structs in zlib.h and zconf.h */
          +#  define gz_header_s           z_gz_header_s
          +#  define internal_state        z_internal_state
          +
           #endif
          +
           #if defined(__MSDOS__) && !defined(MSDOS)
           #  define MSDOS
           #endif
          -
          -/* WinCE doesn't have errno.h */
          -#ifdef _WIN32_WCE
          -#  define NO_ERRNO_H
          +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
          +#  define OS2
          +#endif
          +#if defined(_WINDOWS) && !defined(WINDOWS)
          +#  define WINDOWS
          +#endif
          +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
          +#  ifndef WIN32
          +#    define WIN32
          +#  endif
          +#endif
          +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
          +#  if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
          +#    ifndef SYS16BIT
          +#      define SYS16BIT
          +#    endif
          +#  endif
           #endif
          -
           
           /*
            * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
            * than 64k bytes at a time (needed on systems with 16-bit int).
            */
          -#if defined(MSDOS) && !defined(__32BIT__)
          +#ifdef SYS16BIT
           #  define MAXSEG_64K
           #endif
           #ifdef MSDOS
           #  define UNALIGNED_OK
           #endif
           
          -#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32))  && !defined(STDC)
          -#  define STDC
          -#endif
          -#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__)
          +#ifdef __STDC_VERSION__
           #  ifndef STDC
           #    define STDC
           #  endif
          +#  if __STDC_VERSION__ >= 199901L
          +#    ifndef STDC99
          +#      define STDC99
          +#    endif
          +#  endif
          +#endif
          +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
          +#  define STDC
          +#endif
          +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
          +#  define STDC
          +#endif
          +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
          +#  define STDC
          +#endif
          +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
          +#  define STDC
          +#endif
          +
          +#if defined(__OS400__) && !defined(STDC)    /* iSeries (formerly AS/400). */
          +#  define STDC
           #endif
           
           #ifndef STDC
           #  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
          -#    define const
          +#    define const       /* note: need a more gentle solution here */
           #  endif
           #endif
           
          -/* Some Mac compilers merge all .h files incorrectly: */
          -#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__)
          -#  define NO_DUMMY_DECL
          +#if defined(ZLIB_CONST) && !defined(z_const)
          +#  define z_const const
          +#else
          +#  define z_const
           #endif
           
          -/* Old Borland C and LCC incorrectly complains about missing returns: */
          -#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
          -#  define NEED_DUMMY_RETURN
          -#endif
          -
          -#if defined(__LCC__)
          -#  define  NEED_DUMMY_RETURN
          +#ifdef Z_SOLO
          +   typedef unsigned long z_size_t;
          +#else
          +#  define z_longlong long long
          +#  if defined(NO_SIZE_T)
          +     typedef unsigned NO_SIZE_T z_size_t;
          +#  elif defined(STDC)
          +#    include 
          +     typedef size_t z_size_t;
          +#  else
          +     typedef unsigned long z_size_t;
          +#  endif
          +#  undef z_longlong
           #endif
           
           /* Maximum value for memLevel in deflateInit2 */
          @@ -133,7 +279,7 @@
            Of course this will generally degrade compression (there's no free lunch).
           
              The memory requirements for inflate are (in bytes) 1 << windowBits
          - that is, 32K for windowBits=15 (default value) plus a few kilobytes
          + that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
            for small objects.
           */
           
          @@ -147,75 +293,101 @@
           #  endif
           #endif
           
          +#ifndef Z_ARG /* function prototypes for stdarg */
          +#  if defined(STDC) || defined(Z_HAVE_STDARG_H)
          +#    define Z_ARG(args)  args
          +#  else
          +#    define Z_ARG(args)  ()
          +#  endif
          +#endif
          +
           /* The following definitions for FAR are needed only for MSDOS mixed
            * model programming (small or medium model with some far allocations).
            * This was tested only with MSC; for other MSDOS compilers you may have
            * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
            * just define FAR to be empty.
            */
          -#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__)
          -   /* MSC small or medium model */
          -#  define SMALL_MEDIUM
          -#  ifdef _MSC_VER
          -#    define FAR _far
          -#  else
          -#    define FAR far
          -#  endif
          -#endif
          -#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__))
          -#  ifndef __32BIT__
          +#ifdef SYS16BIT
          +#  if defined(M_I86SM) || defined(M_I86MM)
          +     /* MSC small or medium model */
           #    define SMALL_MEDIUM
          -#    define FAR _far
          +#    ifdef _MSC_VER
          +#      define FAR _far
          +#    else
          +#      define FAR far
          +#    endif
          +#  endif
          +#  if (defined(__SMALL__) || defined(__MEDIUM__))
          +     /* Turbo C small or medium model */
          +#    define SMALL_MEDIUM
          +#    ifdef __BORLANDC__
          +#      define FAR _far
          +#    else
          +#      define FAR far
          +#    endif
           #  endif
           #endif
           
          -/* Compile with -DZLIB_DLL for Windows DLL support */
          -#if defined(ZLIB_DLL)
          -#  if defined(_WINDOWS) || defined(WINDOWS)
          +#if defined(WINDOWS) || defined(WIN32)
          +   /* If building or using zlib as a DLL, define ZLIB_DLL.
          +    * This is not mandatory, but it offers a little performance increase.
          +    */
          +#  ifdef ZLIB_DLL
          +#    if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
          +#      ifdef ZLIB_INTERNAL
          +#        define ZEXTERN extern __declspec(dllexport)
          +#      else
          +#        define ZEXTERN extern __declspec(dllimport)
          +#      endif
          +#    endif
          +#  endif  /* ZLIB_DLL */
          +   /* If building or using zlib with the WINAPI/WINAPIV calling convention,
          +    * define ZLIB_WINAPI.
          +    * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
          +    */
          +#  ifdef ZLIB_WINAPI
           #    ifdef FAR
           #      undef FAR
           #    endif
           #    include 
          -#    define ZEXPORT(x)  x WINAPI
          +     /* No need for _export, use ZLIB.DEF instead. */
          +     /* For complete Windows compatibility, use WINAPI, not __stdcall. */
          +#    define ZEXPORT WINAPI
           #    ifdef WIN32
          -#      define ZEXPORTVA(x)  x WINAPIV
          +#      define ZEXPORTVA WINAPIV
           #    else
          -#      define ZEXPORTVA(x)  x FAR _cdecl _export
          -#    endif
          -#  endif
          -#  if defined (__BORLANDC__)
          -#    if (__BORLANDC__ >= 0x0500) && defined (WIN32)
          -#      include 
          -#      define ZEXPORT(x) x __declspec(dllexport) WINAPI
          -#      define ZEXPORTRVA(x)  x __declspec(dllexport) WINAPIV
          -#    else
          -#      if defined (_Windows) && defined (__DLL__)
          -#        define ZEXPORT(x) x _export
          -#        define ZEXPORTVA(x) x _export
          -#      endif
          +#      define ZEXPORTVA FAR CDECL
           #    endif
           #  endif
           #endif
           
          +#if defined (__BEOS__)
          +#  ifdef ZLIB_DLL
          +#    ifdef ZLIB_INTERNAL
          +#      define ZEXPORT   __declspec(dllexport)
          +#      define ZEXPORTVA __declspec(dllexport)
          +#    else
          +#      define ZEXPORT   __declspec(dllimport)
          +#      define ZEXPORTVA __declspec(dllimport)
          +#    endif
          +#  endif
          +#endif
           
          +#ifndef ZEXTERN
          +#  define ZEXTERN extern
          +#endif
           #ifndef ZEXPORT
          -#  define ZEXPORT(x)   static x
          +#  define ZEXPORT
           #endif
           #ifndef ZEXPORTVA
          -#  define ZEXPORTVA(x)   static x
          -#endif
          -#ifndef ZEXTERN
          -#  define ZEXTERN(x) static x
          -#endif
          -#ifndef ZEXTERNDEF
          -#  define ZEXTERNDEF(x)  static x
          +#  define ZEXPORTVA
           #endif
           
           #ifndef FAR
          -#   define FAR
          +#  define FAR
           #endif
           
          -#if !defined(MACOS) && !defined(TARGET_OS_MAC)
          +#if !defined(__MACTYPES__)
           typedef unsigned char  Byte;  /* 8 bits */
           #endif
           typedef unsigned int   uInt;  /* 16 bits or more */
          @@ -233,52 +405,130 @@ typedef uInt  FAR uIntf;
           typedef uLong FAR uLongf;
           
           #ifdef STDC
          -   typedef void FAR *voidpf;
          -   typedef void     *voidp;
          +   typedef void const *voidpc;
          +   typedef void FAR   *voidpf;
          +   typedef void       *voidp;
           #else
          -   typedef Byte FAR *voidpf;
          -   typedef Byte     *voidp;
          +   typedef Byte const *voidpc;
          +   typedef Byte FAR   *voidpf;
          +   typedef Byte       *voidp;
           #endif
           
          -#ifdef HAVE_UNISTD_H
          -#  include  /* for off_t */
          -#  include     /* for SEEK_* and off_t */
          -#  define z_off_t  off_t
          +#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
          +#  include 
          +#  if (UINT_MAX == 0xffffffffUL)
          +#    define Z_U4 unsigned
          +#  elif (ULONG_MAX == 0xffffffffUL)
          +#    define Z_U4 unsigned long
          +#  elif (USHRT_MAX == 0xffffffffUL)
          +#    define Z_U4 unsigned short
          +#  endif
           #endif
          -#ifndef SEEK_SET
          +
          +#ifdef Z_U4
          +   typedef Z_U4 z_crc_t;
          +#else
          +   typedef unsigned long z_crc_t;
          +#endif
          +
          +#ifdef HAVE_UNISTD_H    /* may be set to #if 1 by ./configure */
          +#  define Z_HAVE_UNISTD_H
          +#endif
          +
          +#ifdef HAVE_STDARG_H    /* may be set to #if 1 by ./configure */
          +#  define Z_HAVE_STDARG_H
          +#endif
          +
          +#ifdef STDC
          +#  ifndef Z_SOLO
          +#    include       /* for off_t */
          +#  endif
          +#endif
          +
          +#if defined(STDC) || defined(Z_HAVE_STDARG_H)
          +#  ifndef Z_SOLO
          +#    include          /* for va_list */
          +#  endif
          +#endif
          +
          +#ifdef _WIN32
          +#  ifndef Z_SOLO
          +#    include          /* for wchar_t */
          +#  endif
          +#endif
          +
          +/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
          + * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
          + * though the former does not conform to the LFS document), but considering
          + * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
          + * equivalently requesting no 64-bit operations
          + */
          +#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
          +#  undef _LARGEFILE64_SOURCE
          +#endif
          +
          +#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
          +#  define Z_HAVE_UNISTD_H
          +#endif
          +#ifndef Z_SOLO
          +#  if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
          +#    include          /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
          +#    ifdef VMS
          +#      include        /* for off_t */
          +#    endif
          +#    ifndef z_off_t
          +#      define z_off_t off_t
          +#    endif
          +#  endif
          +#endif
          +
          +#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
          +#  define Z_LFS64
          +#endif
          +
          +#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
          +#  define Z_LARGE64
          +#endif
          +
          +#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
          +#  define Z_WANT64
          +#endif
          +
          +#if !defined(SEEK_SET) && !defined(Z_SOLO)
           #  define SEEK_SET        0       /* Seek from beginning of file.  */
           #  define SEEK_CUR        1       /* Seek from current position.  */
           #  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
           #endif
          +
           #ifndef z_off_t
          -#  define  z_off_t long
          +#  define z_off_t long
          +#endif
          +
          +#if !defined(_WIN32) && defined(Z_LARGE64)
          +#  define z_off64_t off64_t
          +#else
          +#  if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
          +#    define z_off64_t __int64
          +#  else
          +#    define z_off64_t z_off_t
          +#  endif
           #endif
           
           /* MVS linker does not support external names larger than 8 bytes */
           #if defined(__MVS__)
          -#   pragma map(deflateInit_,"DEIN")
          -#   pragma map(deflateInit2_,"DEIN2")
          -#   pragma map(deflateEnd,"DEEND")
          -#   pragma map(inflateInit_,"ININ")
          -#   pragma map(inflateInit2_,"ININ2")
          -#   pragma map(inflateEnd,"INEND")
          -#   pragma map(inflateSync,"INSY")
          -#   pragma map(inflateSetDictionary,"INSEDI")
          -#   pragma map(inflate_blocks,"INBL")
          -#   pragma map(inflate_blocks_new,"INBLNE")
          -#   pragma map(inflate_blocks_free,"INBLFR")
          -#   pragma map(inflate_blocks_reset,"INBLRE")
          -#   pragma map(inflate_codes_free,"INCOFR")
          -#   pragma map(inflate_codes,"INCO")
          -#   pragma map(inflate_fast,"INFA")
          -#   pragma map(inflate_flush,"INFLU")
          -#   pragma map(inflate_mask,"INMA")
          -#   pragma map(inflate_set_dictionary,"INSEDI2")
          -#   pragma map(inflate_copyright,"INCOPY")
          -#   pragma map(inflate_trees_bits,"INTRBI")
          -#   pragma map(inflate_trees_dynamic,"INTRDY")
          -#   pragma map(inflate_trees_fixed,"INTRFI")
          -#   pragma map(inflate_trees_free,"INTRFR")
          +  #pragma map(deflateInit_,"DEIN")
          +  #pragma map(deflateInit2_,"DEIN2")
          +  #pragma map(deflateEnd,"DEEND")
          +  #pragma map(deflateBound,"DEBND")
          +  #pragma map(inflateInit_,"ININ")
          +  #pragma map(inflateInit2_,"ININ2")
          +  #pragma map(inflateEnd,"INEND")
          +  #pragma map(inflateSync,"INSY")
          +  #pragma map(inflateSetDictionary,"INSEDI")
          +  #pragma map(compressBound,"CMBND")
          +  #pragma map(inflate_table,"INTABL")
          +  #pragma map(inflate_fast,"INFA")
          +  #pragma map(inflate_copyright,"INCOPY")
           #endif
           
          -#endif /* _ZCONF_H */
          +#endif /* ZCONF_H */
          diff --git a/thirdparty/freetype/src/gzip/gzguts.h b/thirdparty/freetype/src/gzip/gzguts.h
          new file mode 100644
          index 0000000000..c81f8f392a
          --- /dev/null
          +++ b/thirdparty/freetype/src/gzip/gzguts.h
          @@ -0,0 +1,218 @@
          +/* gzguts.h -- zlib internal header definitions for gz* operations
          + * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler
          + * For conditions of distribution and use, see copyright notice in zlib.h
          + */
          +
          +#ifdef _LARGEFILE64_SOURCE
          +#  ifndef _LARGEFILE_SOURCE
          +#    define _LARGEFILE_SOURCE 1
          +#  endif
          +#  ifdef _FILE_OFFSET_BITS
          +#    undef _FILE_OFFSET_BITS
          +#  endif
          +#endif
          +
          +#ifdef HAVE_HIDDEN
          +#  define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
          +#else
          +#  define ZLIB_INTERNAL
          +#endif
          +
          +#include 
          +#include "zlib.h"
          +#ifdef STDC
          +#  include 
          +#  include 
          +#  include 
          +#endif
          +
          +#ifndef _POSIX_SOURCE
          +#  define _POSIX_SOURCE
          +#endif
          +#include 
          +
          +#ifdef _WIN32
          +#  include 
          +#endif
          +
          +#if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32)
          +#  include 
          +#endif
          +
          +#if defined(_WIN32) || defined(__CYGWIN__)
          +#  define WIDECHAR
          +#endif
          +
          +#ifdef WINAPI_FAMILY
          +#  define open _open
          +#  define read _read
          +#  define write _write
          +#  define close _close
          +#endif
          +
          +#ifdef NO_DEFLATE       /* for compatibility with old definition */
          +#  define NO_GZCOMPRESS
          +#endif
          +
          +#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
          +#  ifndef HAVE_VSNPRINTF
          +#    define HAVE_VSNPRINTF
          +#  endif
          +#endif
          +
          +#if defined(__CYGWIN__)
          +#  ifndef HAVE_VSNPRINTF
          +#    define HAVE_VSNPRINTF
          +#  endif
          +#endif
          +
          +#if defined(MSDOS) && defined(__BORLANDC__) && (BORLANDC > 0x410)
          +#  ifndef HAVE_VSNPRINTF
          +#    define HAVE_VSNPRINTF
          +#  endif
          +#endif
          +
          +#ifndef HAVE_VSNPRINTF
          +#  ifdef MSDOS
          +/* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
          +   but for now we just assume it doesn't. */
          +#    define NO_vsnprintf
          +#  endif
          +#  ifdef __TURBOC__
          +#    define NO_vsnprintf
          +#  endif
          +#  ifdef WIN32
          +/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
          +#    if !defined(vsnprintf) && !defined(NO_vsnprintf)
          +#      if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
          +#         define vsnprintf _vsnprintf
          +#      endif
          +#    endif
          +#  endif
          +#  ifdef __SASC
          +#    define NO_vsnprintf
          +#  endif
          +#  ifdef VMS
          +#    define NO_vsnprintf
          +#  endif
          +#  ifdef __OS400__
          +#    define NO_vsnprintf
          +#  endif
          +#  ifdef __MVS__
          +#    define NO_vsnprintf
          +#  endif
          +#endif
          +
          +/* unlike snprintf (which is required in C99), _snprintf does not guarantee
          +   null termination of the result -- however this is only used in gzlib.c where
          +   the result is assured to fit in the space provided */
          +#if defined(_MSC_VER) && _MSC_VER < 1900
          +#  define snprintf _snprintf
          +#endif
          +
          +#ifndef local
          +#  define local static
          +#endif
          +/* since "static" is used to mean two completely different things in C, we
          +   define "local" for the non-static meaning of "static", for readability
          +   (compile with -Dlocal if your debugger can't find static symbols) */
          +
          +/* gz* functions always use library allocation functions */
          +#ifndef STDC
          +  extern voidp  malloc OF((uInt size));
          +  extern void   free   OF((voidpf ptr));
          +#endif
          +
          +/* get errno and strerror definition */
          +#if defined UNDER_CE
          +#  include 
          +#  define zstrerror() gz_strwinerror((DWORD)GetLastError())
          +#else
          +#  ifndef NO_STRERROR
          +#    include 
          +#    define zstrerror() strerror(errno)
          +#  else
          +#    define zstrerror() "stdio error (consult errno)"
          +#  endif
          +#endif
          +
          +/* provide prototypes for these when building zlib without LFS */
          +#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
          +    ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
          +    ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
          +    ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
          +    ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
          +#endif
          +
          +/* default memLevel */
          +#if MAX_MEM_LEVEL >= 8
          +#  define DEF_MEM_LEVEL 8
          +#else
          +#  define DEF_MEM_LEVEL  MAX_MEM_LEVEL
          +#endif
          +
          +/* default i/o buffer size -- double this for output when reading (this and
          +   twice this must be able to fit in an unsigned type) */
          +#define GZBUFSIZE 8192
          +
          +/* gzip modes, also provide a little integrity check on the passed structure */
          +#define GZ_NONE 0
          +#define GZ_READ 7247
          +#define GZ_WRITE 31153
          +#define GZ_APPEND 1     /* mode set to GZ_WRITE after the file is opened */
          +
          +/* values for gz_state how */
          +#define LOOK 0      /* look for a gzip header */
          +#define COPY__ 1    /* copy input directly */
          +#define GZIP 2      /* decompress a gzip stream */
          +
          +/* internal gzip file state data structure */
          +typedef struct {
          +        /* exposed contents for gzgetc() macro */
          +    struct gzFile_s x;      /* "x" for exposed */
          +                            /* x.have: number of bytes available at x.next */
          +                            /* x.next: next output data to deliver or write */
          +                            /* x.pos: current position in uncompressed data */
          +        /* used for both reading and writing */
          +    int mode;               /* see gzip modes above */
          +    int fd;                 /* file descriptor */
          +    char *path;             /* path or fd for error messages */
          +    unsigned size;          /* buffer size, zero if not allocated yet */
          +    unsigned want;          /* requested buffer size, default is GZBUFSIZE */
          +    unsigned char *in;      /* input buffer (double-sized when writing) */
          +    unsigned char *out;     /* output buffer (double-sized when reading) */
          +    int direct;             /* 0 if processing gzip, 1 if transparent */
          +        /* just for reading */
          +    int how;                /* 0: get header, 1: copy, 2: decompress */
          +    z_off64_t start;        /* where the gzip data started, for rewinding */
          +    int eof;                /* true if end of input file reached */
          +    int past;               /* true if read requested past end */
          +        /* just for writing */
          +    int level;              /* compression level */
          +    int strategy;           /* compression strategy */
          +        /* seek request */
          +    z_off64_t skip;         /* amount to skip (already rewound if backwards) */
          +    int seek;               /* true if seek request pending */
          +        /* error information */
          +    int err;                /* error code */
          +    char *msg;              /* error message */
          +        /* zlib inflate or deflate stream */
          +    z_stream strm;          /* stream structure in-place (not a pointer) */
          +} gz_state;
          +typedef gz_state FAR *gz_statep;
          +
          +/* shared functions */
          +void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *));
          +#if defined UNDER_CE
          +char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error));
          +#endif
          +
          +/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
          +   value -- needed when comparing unsigned to z_off64_t, which is signed
          +   (possible z_off64_t types off_t, off64_t, and long are all signed) */
          +#ifdef INT_MAX
          +#  define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
          +#else
          +unsigned ZLIB_INTERNAL gz_intmax OF((void));
          +#  define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
          +#endif
          diff --git a/thirdparty/freetype/src/gzip/infback.c b/thirdparty/freetype/src/gzip/infback.c
          new file mode 100644
          index 0000000000..e3470aab66
          --- /dev/null
          +++ b/thirdparty/freetype/src/gzip/infback.c
          @@ -0,0 +1,640 @@
          +/* infback.c -- inflate using a call-back interface
          + * Copyright (C) 1995-2016 Mark Adler
          + * For conditions of distribution and use, see copyright notice in zlib.h
          + */
          +
          +/*
          +   This code is largely copied from inflate.c.  Normally either infback.o or
          +   inflate.o would be linked into an application--not both.  The interface
          +   with inffast.c is retained so that optimized assembler-coded versions of
          +   inflate_fast() can be used with either inflate.c or infback.c.
          + */
          +
          +#include "zutil.h"
          +#include "inftrees.h"
          +#include "inflate.h"
          +#include "inffast.h"
          +
          +/* function prototypes */
          +local void fixedtables OF((struct inflate_state FAR *state));
          +
          +/*
          +   strm provides memory allocation functions in zalloc and zfree, or
          +   Z_NULL to use the library memory allocation functions.
          +
          +   windowBits is in the range 8..15, and window is a user-supplied
          +   window and output buffer that is 2**windowBits bytes.
          + */
          +int ZEXPORT inflateBackInit_(
          +    z_streamp strm,
          +    int windowBits,
          +    unsigned char FAR *window,
          +    const char *version,
          +    int stream_size)
          +{
          +    struct inflate_state FAR *state;
          +
          +    if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
          +        stream_size != (int)(sizeof(z_stream)))
          +        return Z_VERSION_ERROR;
          +    if (strm == Z_NULL || window == Z_NULL ||
          +        windowBits < 8 || windowBits > 15)
          +        return Z_STREAM_ERROR;
          +    strm->msg = Z_NULL;                 /* in case we return an error */
          +    if (strm->zalloc == (alloc_func)0) {
          +#ifdef Z_SOLO
          +        return Z_STREAM_ERROR;
          +#else
          +        strm->zalloc = zcalloc;
          +        strm->opaque = (voidpf)0;
          +#endif
          +    }
          +    if (strm->zfree == (free_func)0)
          +#ifdef Z_SOLO
          +        return Z_STREAM_ERROR;
          +#else
          +    strm->zfree = zcfree;
          +#endif
          +    state = (struct inflate_state FAR *)ZALLOC(strm, 1,
          +                                               sizeof(struct inflate_state));
          +    if (state == Z_NULL) return Z_MEM_ERROR;
          +    Tracev((stderr, "inflate: allocated\n"));
          +    strm->state = (struct internal_state FAR *)state;
          +    state->dmax = 32768U;
          +    state->wbits = (uInt)windowBits;
          +    state->wsize = 1U << windowBits;
          +    state->window = window;
          +    state->wnext = 0;
          +    state->whave = 0;
          +    return Z_OK;
          +}
          +
          +/*
          +   Return state with length and distance decoding tables and index sizes set to
          +   fixed code decoding.  Normally this returns fixed tables from inffixed.h.
          +   If BUILDFIXED is defined, then instead this routine builds the tables the
          +   first time it's called, and returns those tables the first time and
          +   thereafter.  This reduces the size of the code by about 2K bytes, in
          +   exchange for a little execution time.  However, BUILDFIXED should not be
          +   used for threaded applications, since the rewriting of the tables and virgin
          +   may not be thread-safe.
          + */
          +local void fixedtables(
          +    struct inflate_state FAR *state)
          +{
          +#ifdef BUILDFIXED
          +    static int virgin = 1;
          +    static code *lenfix, *distfix;
          +    static code fixed[544];
          +
          +    /* build fixed huffman tables if first call (may not be thread safe) */
          +    if (virgin) {
          +        unsigned sym, bits;
          +        static code *next;
          +
          +        /* literal/length table */
          +        sym = 0;
          +        while (sym < 144) state->lens[sym++] = 8;
          +        while (sym < 256) state->lens[sym++] = 9;
          +        while (sym < 280) state->lens[sym++] = 7;
          +        while (sym < 288) state->lens[sym++] = 8;
          +        next = fixed;
          +        lenfix = next;
          +        bits = 9;
          +        inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
          +
          +        /* distance table */
          +        sym = 0;
          +        while (sym < 32) state->lens[sym++] = 5;
          +        distfix = next;
          +        bits = 5;
          +        inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
          +
          +        /* do this just once */
          +        virgin = 0;
          +    }
          +#else /* !BUILDFIXED */
          +#   include "inffixed.h"
          +#endif /* BUILDFIXED */
          +    state->lencode = lenfix;
          +    state->lenbits = 9;
          +    state->distcode = distfix;
          +    state->distbits = 5;
          +}
          +
          +/* Macros for inflateBack(): */
          +
          +/* Load returned state from inflate_fast() */
          +#define LOAD() \
          +    do { \
          +        put = strm->next_out; \
          +        left = strm->avail_out; \
          +        next = strm->next_in; \
          +        have = strm->avail_in; \
          +        hold = state->hold; \
          +        bits = state->bits; \
          +    } while (0)
          +
          +/* Set state from registers for inflate_fast() */
          +#define RESTORE() \
          +    do { \
          +        strm->next_out = put; \
          +        strm->avail_out = left; \
          +        strm->next_in = next; \
          +        strm->avail_in = have; \
          +        state->hold = hold; \
          +        state->bits = bits; \
          +    } while (0)
          +
          +/* Clear the input bit accumulator */
          +#define INITBITS() \
          +    do { \
          +        hold = 0; \
          +        bits = 0; \
          +    } while (0)
          +
          +/* Assure that some input is available.  If input is requested, but denied,
          +   then return a Z_BUF_ERROR from inflateBack(). */
          +#define PULL() \
          +    do { \
          +        if (have == 0) { \
          +            have = in(in_desc, &next); \
          +            if (have == 0) { \
          +                next = Z_NULL; \
          +                ret = Z_BUF_ERROR; \
          +                goto inf_leave; \
          +            } \
          +        } \
          +    } while (0)
          +
          +/* Get a byte of input into the bit accumulator, or return from inflateBack()
          +   with an error if there is no input available. */
          +#define PULLBYTE() \
          +    do { \
          +        PULL(); \
          +        have--; \
          +        hold += (unsigned long)(*next++) << bits; \
          +        bits += 8; \
          +    } while (0)
          +
          +/* Assure that there are at least n bits in the bit accumulator.  If there is
          +   not enough available input to do that, then return from inflateBack() with
          +   an error. */
          +#define NEEDBITS(n) \
          +    do { \
          +        while (bits < (unsigned)(n)) \
          +            PULLBYTE(); \
          +    } while (0)
          +
          +/* Return the low n bits of the bit accumulator (n < 16) */
          +#define BITS(n) \
          +    ((unsigned)hold & ((1U << (n)) - 1))
          +
          +/* Remove n bits from the bit accumulator */
          +#define DROPBITS(n) \
          +    do { \
          +        hold >>= (n); \
          +        bits -= (unsigned)(n); \
          +    } while (0)
          +
          +/* Remove zero to seven bits as needed to go to a byte boundary */
          +#define BYTEBITS() \
          +    do { \
          +        hold >>= bits & 7; \
          +        bits -= bits & 7; \
          +    } while (0)
          +
          +/* Assure that some output space is available, by writing out the window
          +   if it's full.  If the write fails, return from inflateBack() with a
          +   Z_BUF_ERROR. */
          +#define ROOM() \
          +    do { \
          +        if (left == 0) { \
          +            put = state->window; \
          +            left = state->wsize; \
          +            state->whave = left; \
          +            if (out(out_desc, put, left)) { \
          +                ret = Z_BUF_ERROR; \
          +                goto inf_leave; \
          +            } \
          +        } \
          +    } while (0)
          +
          +/*
          +   strm provides the memory allocation functions and window buffer on input,
          +   and provides information on the unused input on return.  For Z_DATA_ERROR
          +   returns, strm will also provide an error message.
          +
          +   in() and out() are the call-back input and output functions.  When
          +   inflateBack() needs more input, it calls in().  When inflateBack() has
          +   filled the window with output, or when it completes with data in the
          +   window, it calls out() to write out the data.  The application must not
          +   change the provided input until in() is called again or inflateBack()
          +   returns.  The application must not change the window/output buffer until
          +   inflateBack() returns.
          +
          +   in() and out() are called with a descriptor parameter provided in the
          +   inflateBack() call.  This parameter can be a structure that provides the
          +   information required to do the read or write, as well as accumulated
          +   information on the input and output such as totals and check values.
          +
          +   in() should return zero on failure.  out() should return non-zero on
          +   failure.  If either in() or out() fails, than inflateBack() returns a
          +   Z_BUF_ERROR.  strm->next_in can be checked for Z_NULL to see whether it
          +   was in() or out() that caused in the error.  Otherwise,  inflateBack()
          +   returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format
          +   error, or Z_MEM_ERROR if it could not allocate memory for the state.
          +   inflateBack() can also return Z_STREAM_ERROR if the input parameters
          +   are not correct, i.e. strm is Z_NULL or the state was not initialized.
          + */
          +int ZEXPORT inflateBack(
          +    z_streamp strm,
          +    in_func in,
          +    void FAR *in_desc,
          +    out_func out,
          +    void FAR *out_desc)
          +{
          +    struct inflate_state FAR *state;
          +    z_const unsigned char FAR *next;    /* next input */
          +    unsigned char FAR *put;     /* next output */
          +    unsigned have, left;        /* available input and output */
          +    unsigned long hold;         /* bit buffer */
          +    unsigned bits;              /* bits in bit buffer */
          +    unsigned copy;              /* number of stored or match bytes to copy */
          +    unsigned char FAR *from;    /* where to copy match bytes from */
          +    code here;                  /* current decoding table entry */
          +    code last;                  /* parent table entry */
          +    unsigned len;               /* length to copy for repeats, bits to drop */
          +    int ret;                    /* return code */
          +    static const unsigned short order[19] = /* permutation of code lengths */
          +        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
          +
          +    /* Check that the strm exists and that the state was initialized */
          +    if (strm == Z_NULL || strm->state == Z_NULL)
          +        return Z_STREAM_ERROR;
          +    state = (struct inflate_state FAR *)strm->state;
          +
          +    /* Reset the state */
          +    strm->msg = Z_NULL;
          +    state->mode = TYPE;
          +    state->last = 0;
          +    state->whave = 0;
          +    next = strm->next_in;
          +    have = next != Z_NULL ? strm->avail_in : 0;
          +    hold = 0;
          +    bits = 0;
          +    put = state->window;
          +    left = state->wsize;
          +
          +    /* Inflate until end of block marked as last */
          +    for (;;)
          +        switch (state->mode) {
          +        case TYPE:
          +            /* determine and dispatch block type */
          +            if (state->last) {
          +                BYTEBITS();
          +                state->mode = DONE;
          +                break;
          +            }
          +            NEEDBITS(3);
          +            state->last = BITS(1);
          +            DROPBITS(1);
          +            switch (BITS(2)) {
          +            case 0:                             /* stored block */
          +                Tracev((stderr, "inflate:     stored block%s\n",
          +                        state->last ? " (last)" : ""));
          +                state->mode = STORED;
          +                break;
          +            case 1:                             /* fixed block */
          +                fixedtables(state);
          +                Tracev((stderr, "inflate:     fixed codes block%s\n",
          +                        state->last ? " (last)" : ""));
          +                state->mode = LEN;              /* decode codes */
          +                break;
          +            case 2:                             /* dynamic block */
          +                Tracev((stderr, "inflate:     dynamic codes block%s\n",
          +                        state->last ? " (last)" : ""));
          +                state->mode = TABLE;
          +                break;
          +            case 3:
          +                strm->msg = (char *)"invalid block type";
          +                state->mode = BAD;
          +            }
          +            DROPBITS(2);
          +            break;
          +
          +        case STORED:
          +            /* get and verify stored block length */
          +            BYTEBITS();                         /* go to byte boundary */
          +            NEEDBITS(32);
          +            if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
          +                strm->msg = (char *)"invalid stored block lengths";
          +                state->mode = BAD;
          +                break;
          +            }
          +            state->length = (unsigned)hold & 0xffff;
          +            Tracev((stderr, "inflate:       stored length %u\n",
          +                    state->length));
          +            INITBITS();
          +
          +            /* copy stored block from input to output */
          +            while (state->length != 0) {
          +                copy = state->length;
          +                PULL();
          +                ROOM();
          +                if (copy > have) copy = have;
          +                if (copy > left) copy = left;
          +                zmemcpy(put, next, copy);
          +                have -= copy;
          +                next += copy;
          +                left -= copy;
          +                put += copy;
          +                state->length -= copy;
          +            }
          +            Tracev((stderr, "inflate:       stored end\n"));
          +            state->mode = TYPE;
          +            break;
          +
          +        case TABLE:
          +            /* get dynamic table entries descriptor */
          +            NEEDBITS(14);
          +            state->nlen = BITS(5) + 257;
          +            DROPBITS(5);
          +            state->ndist = BITS(5) + 1;
          +            DROPBITS(5);
          +            state->ncode = BITS(4) + 4;
          +            DROPBITS(4);
          +#ifndef PKZIP_BUG_WORKAROUND
          +            if (state->nlen > 286 || state->ndist > 30) {
          +                strm->msg = (char *)"too many length or distance symbols";
          +                state->mode = BAD;
          +                break;
          +            }
          +#endif
          +            Tracev((stderr, "inflate:       table sizes ok\n"));
          +
          +            /* get code length code lengths (not a typo) */
          +            state->have = 0;
          +            while (state->have < state->ncode) {
          +                NEEDBITS(3);
          +                state->lens[order[state->have++]] = (unsigned short)BITS(3);
          +                DROPBITS(3);
          +            }
          +            while (state->have < 19)
          +                state->lens[order[state->have++]] = 0;
          +            state->next = state->codes;
          +            state->lencode = (code const FAR *)(state->next);
          +            state->lenbits = 7;
          +            ret = inflate_table(CODES, state->lens, 19, &(state->next),
          +                                &(state->lenbits), state->work);
          +            if (ret) {
          +                strm->msg = (char *)"invalid code lengths set";
          +                state->mode = BAD;
          +                break;
          +            }
          +            Tracev((stderr, "inflate:       code lengths ok\n"));
          +
          +            /* get length and distance code code lengths */
          +            state->have = 0;
          +            while (state->have < state->nlen + state->ndist) {
          +                for (;;) {
          +                    here = state->lencode[BITS(state->lenbits)];
          +                    if ((unsigned)(here.bits) <= bits) break;
          +                    PULLBYTE();
          +                }
          +                if (here.val < 16) {
          +                    DROPBITS(here.bits);
          +                    state->lens[state->have++] = here.val;
          +                }
          +                else {
          +                    if (here.val == 16) {
          +                        NEEDBITS(here.bits + 2);
          +                        DROPBITS(here.bits);
          +                        if (state->have == 0) {
          +                            strm->msg = (char *)"invalid bit length repeat";
          +                            state->mode = BAD;
          +                            break;
          +                        }
          +                        len = (unsigned)(state->lens[state->have - 1]);
          +                        copy = 3 + BITS(2);
          +                        DROPBITS(2);
          +                    }
          +                    else if (here.val == 17) {
          +                        NEEDBITS(here.bits + 3);
          +                        DROPBITS(here.bits);
          +                        len = 0;
          +                        copy = 3 + BITS(3);
          +                        DROPBITS(3);
          +                    }
          +                    else {
          +                        NEEDBITS(here.bits + 7);
          +                        DROPBITS(here.bits);
          +                        len = 0;
          +                        copy = 11 + BITS(7);
          +                        DROPBITS(7);
          +                    }
          +                    if (state->have + copy > state->nlen + state->ndist) {
          +                        strm->msg = (char *)"invalid bit length repeat";
          +                        state->mode = BAD;
          +                        break;
          +                    }
          +                    while (copy--)
          +                        state->lens[state->have++] = (unsigned short)len;
          +                }
          +            }
          +
          +            /* handle error breaks in while */
          +            if (state->mode == BAD) break;
          +
          +            /* check for end-of-block code (better have one) */
          +            if (state->lens[256] == 0) {
          +                strm->msg = (char *)"invalid code -- missing end-of-block";
          +                state->mode = BAD;
          +                break;
          +            }
          +
          +            /* build code tables -- note: do not change the lenbits or distbits
          +               values here (9 and 6) without reading the comments in inftrees.h
          +               concerning the ENOUGH constants, which depend on those values */
          +            state->next = state->codes;
          +            state->lencode = (code const FAR *)(state->next);
          +            state->lenbits = 9;
          +            ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
          +                                &(state->lenbits), state->work);
          +            if (ret) {
          +                strm->msg = (char *)"invalid literal/lengths set";
          +                state->mode = BAD;
          +                break;
          +            }
          +            state->distcode = (code const FAR *)(state->next);
          +            state->distbits = 6;
          +            ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
          +                            &(state->next), &(state->distbits), state->work);
          +            if (ret) {
          +                strm->msg = (char *)"invalid distances set";
          +                state->mode = BAD;
          +                break;
          +            }
          +            Tracev((stderr, "inflate:       codes ok\n"));
          +            state->mode = LEN;
          +
          +        case LEN:
          +            /* use inflate_fast() if we have enough input and output */
          +            if (have >= 6 && left >= 258) {
          +                RESTORE();
          +                if (state->whave < state->wsize)
          +                    state->whave = state->wsize - left;
          +                inflate_fast(strm, state->wsize);
          +                LOAD();
          +                break;
          +            }
          +
          +            /* get a literal, length, or end-of-block code */
          +            for (;;) {
          +                here = state->lencode[BITS(state->lenbits)];
          +                if ((unsigned)(here.bits) <= bits) break;
          +                PULLBYTE();
          +            }
          +            if (here.op && (here.op & 0xf0) == 0) {
          +                last = here;
          +                for (;;) {
          +                    here = state->lencode[last.val +
          +                            (BITS(last.bits + last.op) >> last.bits)];
          +                    if ((unsigned)(last.bits + here.bits) <= bits) break;
          +                    PULLBYTE();
          +                }
          +                DROPBITS(last.bits);
          +            }
          +            DROPBITS(here.bits);
          +            state->length = (unsigned)here.val;
          +
          +            /* process literal */
          +            if (here.op == 0) {
          +                Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
          +                        "inflate:         literal '%c'\n" :
          +                        "inflate:         literal 0x%02x\n", here.val));
          +                ROOM();
          +                *put++ = (unsigned char)(state->length);
          +                left--;
          +                state->mode = LEN;
          +                break;
          +            }
          +
          +            /* process end of block */
          +            if (here.op & 32) {
          +                Tracevv((stderr, "inflate:         end of block\n"));
          +                state->mode = TYPE;
          +                break;
          +            }
          +
          +            /* invalid code */
          +            if (here.op & 64) {
          +                strm->msg = (char *)"invalid literal/length code";
          +                state->mode = BAD;
          +                break;
          +            }
          +
          +            /* length code -- get extra bits, if any */
          +            state->extra = (unsigned)(here.op) & 15;
          +            if (state->extra != 0) {
          +                NEEDBITS(state->extra);
          +                state->length += BITS(state->extra);
          +                DROPBITS(state->extra);
          +            }
          +            Tracevv((stderr, "inflate:         length %u\n", state->length));
          +
          +            /* get distance code */
          +            for (;;) {
          +                here = state->distcode[BITS(state->distbits)];
          +                if ((unsigned)(here.bits) <= bits) break;
          +                PULLBYTE();
          +            }
          +            if ((here.op & 0xf0) == 0) {
          +                last = here;
          +                for (;;) {
          +                    here = state->distcode[last.val +
          +                            (BITS(last.bits + last.op) >> last.bits)];
          +                    if ((unsigned)(last.bits + here.bits) <= bits) break;
          +                    PULLBYTE();
          +                }
          +                DROPBITS(last.bits);
          +            }
          +            DROPBITS(here.bits);
          +            if (here.op & 64) {
          +                strm->msg = (char *)"invalid distance code";
          +                state->mode = BAD;
          +                break;
          +            }
          +            state->offset = (unsigned)here.val;
          +
          +            /* get distance extra bits, if any */
          +            state->extra = (unsigned)(here.op) & 15;
          +            if (state->extra != 0) {
          +                NEEDBITS(state->extra);
          +                state->offset += BITS(state->extra);
          +                DROPBITS(state->extra);
          +            }
          +            if (state->offset > state->wsize - (state->whave < state->wsize ?
          +                                                left : 0)) {
          +                strm->msg = (char *)"invalid distance too far back";
          +                state->mode = BAD;
          +                break;
          +            }
          +            Tracevv((stderr, "inflate:         distance %u\n", state->offset));
          +
          +            /* copy match from window to output */
          +            do {
          +                ROOM();
          +                copy = state->wsize - state->offset;
          +                if (copy < left) {
          +                    from = put + copy;
          +                    copy = left - copy;
          +                }
          +                else {
          +                    from = put - state->offset;
          +                    copy = left;
          +                }
          +                if (copy > state->length) copy = state->length;
          +                state->length -= copy;
          +                left -= copy;
          +                do {
          +                    *put++ = *from++;
          +                } while (--copy);
          +            } while (state->length != 0);
          +            break;
          +
          +        case DONE:
          +            /* inflate stream terminated properly -- write leftover output */
          +            ret = Z_STREAM_END;
          +            if (left < state->wsize) {
          +                if (out(out_desc, state->window, state->wsize - left))
          +                    ret = Z_BUF_ERROR;
          +            }
          +            goto inf_leave;
          +
          +        case BAD:
          +            ret = Z_DATA_ERROR;
          +            goto inf_leave;
          +
          +        default:                /* can't happen, but makes compilers happy */
          +            ret = Z_STREAM_ERROR;
          +            goto inf_leave;
          +        }
          +
          +    /* Return unused input */
          +  inf_leave:
          +    strm->next_in = next;
          +    strm->avail_in = have;
          +    return ret;
          +}
          +
          +int ZEXPORT inflateBackEnd(
          +    z_streamp strm)
          +{
          +    if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
          +        return Z_STREAM_ERROR;
          +    ZFREE(strm, strm->state);
          +    strm->state = Z_NULL;
          +    Tracev((stderr, "inflate: end\n"));
          +    return Z_OK;
          +}
          diff --git a/thirdparty/freetype/src/gzip/infblock.c b/thirdparty/freetype/src/gzip/infblock.c
          deleted file mode 100644
          index 2b4f0c2b53..0000000000
          --- a/thirdparty/freetype/src/gzip/infblock.c
          +++ /dev/null
          @@ -1,392 +0,0 @@
          -/* infblock.c -- interpret and process block types to last block
          - * Copyright (C) 1995-2002 Mark Adler
          - * For conditions of distribution and use, see copyright notice in zlib.h
          - */
          -
          -#include "zutil.h"
          -#include "infblock.h"
          -#include "inftrees.h"
          -#include "infcodes.h"
          -#include "infutil.h"
          -
          -
          -/* simplify the use of the inflate_huft type with some defines */
          -#define exop word.what.Exop
          -#define bits word.what.Bits
          -
          -/* Table for deflate from PKZIP's appnote.txt. */
          -local const uInt border[] = { /* Order of the bit length code lengths */
          -        16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
          -
          -/*
          -   Notes beyond the 1.93a appnote.txt:
          -
          -   1. Distance pointers never point before the beginning of the output
          -      stream.
          -   2. Distance pointers can point back across blocks, up to 32k away.
          -   3. There is an implied maximum of 7 bits for the bit length table and
          -      15 bits for the actual data.
          -   4. If only one code exists, then it is encoded using one bit.  (Zero
          -      would be more efficient, but perhaps a little confusing.)  If two
          -      codes exist, they are coded using one bit each (0 and 1).
          -   5. There is no way of sending zero distance codes--a dummy must be
          -      sent if there are none.  (History: a pre 2.0 version of PKZIP would
          -      store blocks with no distance codes, but this was discovered to be
          -      too harsh a criterion.)  Valid only for 1.93a.  2.04c does allow
          -      zero distance codes, which is sent as one code of zero bits in
          -      length.
          -   6. There are up to 286 literal/length codes.  Code 256 represents the
          -      end-of-block.  Note however that the static length tree defines
          -      288 codes just to fill out the Huffman codes.  Codes 286 and 287
          -      cannot be used though, since there is no length base or extra bits
          -      defined for them.  Similarily, there are up to 30 distance codes.
          -      However, static trees define 32 codes (all 5 bits) to fill out the
          -      Huffman codes, but the last two had better not show up in the data.
          -   7. Unzip can check dynamic Huffman blocks for complete code sets.
          -      The exception is that a single code would not be complete (see #4).
          -   8. The five bits following the block type is really the number of
          -      literal codes sent minus 257.
          -   9. Length codes 8,16,16 are interpreted as 13 length codes of 8 bits
          -      (1+6+6).  Therefore, to output three times the length, you output
          -      three codes (1+1+1), whereas to output four times the same length,
          -      you only need two codes (1+3).  Hmm.
          -  10. In the tree reconstruction algorithm, Code = Code + Increment
          -      only if BitLength(i) is not zero.  (Pretty obvious.)
          -  11. Correction: 4 Bits: # of Bit Length codes - 4     (4 - 19)
          -  12. Note: length code 284 can represent 227-258, but length code 285
          -      really is 258.  The last length deserves its own, short code
          -      since it gets used a lot in very redundant files.  The length
          -      258 is special since 258 - 3 (the min match length) is 255.
          -  13. The literal/length and distance code bit lengths are read as a
          -      single stream of lengths.  It is possible (and advantageous) for
          -      a repeat code (16, 17, or 18) to go across the boundary between
          -      the two sets of lengths.
          - */
          -
          -
          -local void inflate_blocks_reset( /* s, z, c) */
          -inflate_blocks_statef *s,
          -z_streamp z,
          -uLongf *c )
          -{
          -  if (c != Z_NULL)
          -    *c = s->check;
          -  if (s->mode == BTREE || s->mode == DTREE)
          -    ZFREE(z, s->sub.trees.blens);
          -  if (s->mode == CODES)
          -    inflate_codes_free(s->sub.decode.codes, z);
          -  s->mode = TYPE;
          -  s->bitk = 0;
          -  s->bitb = 0;
          -  s->read = s->write = s->window;
          -  if (s->checkfn != Z_NULL)
          -    z->adler = s->check = (*s->checkfn)(0L, (const Bytef *)Z_NULL, 0);
          -  Tracev((stderr, "inflate:   blocks reset\n"));
          -}
          -
          -
          -local inflate_blocks_statef *inflate_blocks_new( /* z, c, w) */
          -z_streamp z,
          -check_func c,
          -uInt w )
          -{
          -  inflate_blocks_statef *s;
          -
          -  if ((s = (inflate_blocks_statef *)ZALLOC
          -       (z,1,sizeof(struct inflate_blocks_state))) == Z_NULL)
          -    return s;
          -  if ((s->hufts =
          -       (inflate_huft *)ZALLOC(z, sizeof(inflate_huft), MANY)) == Z_NULL)
          -  {
          -    ZFREE(z, s);
          -    return Z_NULL;
          -  }
          -  if ((s->window = (Bytef *)ZALLOC(z, 1, w)) == Z_NULL)
          -  {
          -    ZFREE(z, s->hufts);
          -    ZFREE(z, s);
          -    return Z_NULL;
          -  }
          -  s->end = s->window + w;
          -  s->checkfn = c;
          -  s->mode = TYPE;
          -  Tracev((stderr, "inflate:   blocks allocated\n"));
          -  inflate_blocks_reset(s, z, Z_NULL);
          -  return s;
          -}
          -
          -
          -local int inflate_blocks( /* s, z, r) */
          -inflate_blocks_statef *s,
          -z_streamp z,
          -int r )
          -{
          -  uInt t;               /* temporary storage */
          -  uLong b;              /* bit buffer */
          -  uInt k;               /* bits in bit buffer */
          -  Bytef *p;             /* input data pointer */
          -  uInt n;               /* bytes available there */
          -  Bytef *q;             /* output window write pointer */
          -  uInt m;               /* bytes to end of window or read pointer */
          -
          -  /* copy input/output information to locals (UPDATE macro restores) */
          -  LOAD
          -
          -  /* process input based on current state */
          -  while (1) switch (s->mode)
          -  {
          -    case TYPE:
          -      NEEDBITS(3)
          -      t = (uInt)b & 7;
          -      s->last = t & 1;
          -      switch (t >> 1)
          -      {
          -        case 0:                         /* stored */
          -          Tracev((stderr, "inflate:     stored block%s\n",
          -                 s->last ? " (last)" : ""));
          -          DUMPBITS(3)
          -          t = k & 7;                    /* go to byte boundary */
          -          DUMPBITS(t)
          -          s->mode = LENS;               /* get length of stored block */
          -          break;
          -        case 1:                         /* fixed */
          -          Tracev((stderr, "inflate:     fixed codes block%s\n",
          -                 s->last ? " (last)" : ""));
          -          {
          -            uInt bl, bd;
          -            inflate_huft *tl, *td;
          -
          -            inflate_trees_fixed(&bl, &bd, (const inflate_huft**)&tl,
          -                                          (const inflate_huft**)&td, z);
          -            s->sub.decode.codes = inflate_codes_new(bl, bd, tl, td, z);
          -            if (s->sub.decode.codes == Z_NULL)
          -            {
          -              r = Z_MEM_ERROR;
          -              LEAVE
          -            }
          -          }
          -          DUMPBITS(3)
          -          s->mode = CODES;
          -          break;
          -        case 2:                         /* dynamic */
          -          Tracev((stderr, "inflate:     dynamic codes block%s\n",
          -                 s->last ? " (last)" : ""));
          -          DUMPBITS(3)
          -          s->mode = TABLE;
          -          break;
          -        case 3:                         /* illegal */
          -          DUMPBITS(3)
          -          s->mode = BAD;
          -          z->msg = (char*)"invalid block type";
          -          r = Z_DATA_ERROR;
          -          LEAVE
          -      }
          -      break;
          -    case LENS:
          -      NEEDBITS(32)
          -      if ((((~b) >> 16) & 0xffff) != (b & 0xffff))
          -      {
          -        s->mode = BAD;
          -        z->msg = (char*)"invalid stored block lengths";
          -        r = Z_DATA_ERROR;
          -        LEAVE
          -      }
          -      s->sub.left = (uInt)b & 0xffff;
          -      b = k = 0;                      /* dump bits */
          -      Tracev((stderr, "inflate:       stored length %u\n", s->sub.left));
          -      s->mode = s->sub.left ? STORED : (s->last ? DRY : TYPE);
          -      break;
          -    case STORED:
          -      if (n == 0)
          -        LEAVE
          -      NEEDOUT
          -      t = s->sub.left;
          -      if (t > n) t = n;
          -      if (t > m) t = m;
          -      zmemcpy(q, p, t);
          -      p += t;  n -= t;
          -      q += t;  m -= t;
          -      if ((s->sub.left -= t) != 0)
          -        break;
          -      Tracev((stderr, "inflate:       stored end, %lu total out\n",
          -              z->total_out + (q >= s->read ? q - s->read :
          -              (s->end - s->read) + (q - s->window))));
          -      s->mode = s->last ? DRY : TYPE;
          -      break;
          -    case TABLE:
          -      NEEDBITS(14)
          -      s->sub.trees.table = t = (uInt)b & 0x3fff;
          -#ifndef PKZIP_BUG_WORKAROUND
          -      if ((t & 0x1f) > 29 || ((t >> 5) & 0x1f) > 29)
          -      {
          -        s->mode = BAD;
          -        z->msg = (char*)"too many length or distance symbols";
          -        r = Z_DATA_ERROR;
          -        LEAVE
          -      }
          -#endif
          -      t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f);
          -      if ((s->sub.trees.blens = (uIntf*)ZALLOC(z, t, sizeof(uInt))) == Z_NULL)
          -      {
          -        r = Z_MEM_ERROR;
          -        LEAVE
          -      }
          -      DUMPBITS(14)
          -      s->sub.trees.index = 0;
          -      Tracev((stderr, "inflate:       table sizes ok\n"));
          -      s->mode = BTREE;
          -      /* fall through */
          -    case BTREE:
          -      while (s->sub.trees.index < 4 + (s->sub.trees.table >> 10))
          -      {
          -        NEEDBITS(3)
          -        s->sub.trees.blens[border[s->sub.trees.index++]] = (uInt)b & 7;
          -        DUMPBITS(3)
          -      }
          -      while (s->sub.trees.index < 19)
          -        s->sub.trees.blens[border[s->sub.trees.index++]] = 0;
          -      s->sub.trees.bb = 7;
          -      t = inflate_trees_bits(s->sub.trees.blens, &s->sub.trees.bb,
          -                             &s->sub.trees.tb, s->hufts, z);
          -      if (t != Z_OK)
          -      {
          -        r = t;
          -        if (r == Z_DATA_ERROR)
          -        {
          -          ZFREE(z, s->sub.trees.blens);
          -          s->mode = BAD;
          -        }
          -        LEAVE
          -      }
          -      s->sub.trees.index = 0;
          -      Tracev((stderr, "inflate:       bits tree ok\n"));
          -      s->mode = DTREE;
          -      /* fall through */
          -    case DTREE:
          -      while (t = s->sub.trees.table,
          -             s->sub.trees.index < 258 + (t & 0x1f) + ((t >> 5) & 0x1f))
          -      {
          -        inflate_huft *h;
          -        uInt i, j, c;
          -
          -        t = s->sub.trees.bb;
          -        NEEDBITS(t)
          -        h = s->sub.trees.tb + ((uInt)b & inflate_mask[t]);
          -        t = h->bits;
          -        c = h->base;
          -        if (c < 16)
          -        {
          -          DUMPBITS(t)
          -          s->sub.trees.blens[s->sub.trees.index++] = c;
          -        }
          -        else /* c == 16..18 */
          -        {
          -          i = c == 18 ? 7 : c - 14;
          -          j = c == 18 ? 11 : 3;
          -          NEEDBITS(t + i)
          -          DUMPBITS(t)
          -          j += (uInt)b & inflate_mask[i];
          -          DUMPBITS(i)
          -          i = s->sub.trees.index;
          -          t = s->sub.trees.table;
          -          if (i + j > 258 + (t & 0x1f) + ((t >> 5) & 0x1f) ||
          -              (c == 16 && i < 1))
          -          {
          -            ZFREE(z, s->sub.trees.blens);
          -            s->mode = BAD;
          -            z->msg = (char*)"invalid bit length repeat";
          -            r = Z_DATA_ERROR;
          -            LEAVE
          -          }
          -          c = c == 16 ? s->sub.trees.blens[i - 1] : 0;
          -          do {
          -            s->sub.trees.blens[i++] = c;
          -          } while (--j);
          -          s->sub.trees.index = i;
          -        }
          -      }
          -      s->sub.trees.tb = Z_NULL;
          -      {
          -        uInt bl, bd;
          -        inflate_huft *tl, *td;
          -        inflate_codes_statef *c;
          -
          -        bl = 9;         /* must be <= 9 for lookahead assumptions */
          -        bd = 6;         /* must be <= 9 for lookahead assumptions */
          -        t = s->sub.trees.table;
          -        t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f),
          -                                  s->sub.trees.blens, &bl, &bd, &tl, &td,
          -                                  s->hufts, z);
          -        if (t != Z_OK)
          -        {
          -          if (t == (uInt)Z_DATA_ERROR)
          -          {
          -            ZFREE(z, s->sub.trees.blens);
          -            s->mode = BAD;
          -          }
          -          r = t;
          -          LEAVE
          -        }
          -        Tracev((stderr, "inflate:       trees ok\n"));
          -        if ((c = inflate_codes_new(bl, bd, tl, td, z)) == Z_NULL)
          -        {
          -          r = Z_MEM_ERROR;
          -          LEAVE
          -        }
          -        s->sub.decode.codes = c;
          -      }
          -      ZFREE(z, s->sub.trees.blens);
          -      s->mode = CODES;
          -      /* fall through */
          -    case CODES:
          -      UPDATE
          -      if ((r = inflate_codes(s, z, r)) != Z_STREAM_END)
          -        return inflate_flush(s, z, r);
          -      r = Z_OK;
          -      inflate_codes_free(s->sub.decode.codes, z);
          -      LOAD
          -      Tracev((stderr, "inflate:       codes end, %lu total out\n",
          -              z->total_out + (q >= s->read ? q - s->read :
          -              (s->end - s->read) + (q - s->window))));
          -      if (!s->last)
          -      {
          -        s->mode = TYPE;
          -        break;
          -      }
          -      s->mode = DRY;
          -      /* fall through */
          -    case DRY:
          -      FLUSH
          -      if (s->read != s->write)
          -        LEAVE
          -      s->mode = DONE;
          -      /* fall through */
          -    case DONE:
          -      r = Z_STREAM_END;
          -      LEAVE
          -    case BAD:
          -      r = Z_DATA_ERROR;
          -      LEAVE
          -    default:
          -      r = Z_STREAM_ERROR;
          -      LEAVE
          -  }
          -#ifdef NEED_DUMMY_RETURN
          -  return 0;
          -#endif
          -}
          -
          -
          -local int inflate_blocks_free( /* s, z) */
          -inflate_blocks_statef *s,
          -z_streamp z )
          -{
          -  inflate_blocks_reset(s, z, Z_NULL);
          -  ZFREE(z, s->window);
          -  ZFREE(z, s->hufts);
          -  ZFREE(z, s);
          -  Tracev((stderr, "inflate:   blocks freed\n"));
          -  return Z_OK;
          -}
          -
          -
          diff --git a/thirdparty/freetype/src/gzip/infblock.h b/thirdparty/freetype/src/gzip/infblock.h
          deleted file mode 100644
          index c2535a1e45..0000000000
          --- a/thirdparty/freetype/src/gzip/infblock.h
          +++ /dev/null
          @@ -1,36 +0,0 @@
          -/* infblock.h -- header to use infblock.c
          - * Copyright (C) 1995-2002 Mark Adler
          - * For conditions of distribution and use, see copyright notice in zlib.h
          - */
          -
          -/* WARNING: this file should *not* be used by applications. It is
          -   part of the implementation of the compression library and is
          -   subject to change. Applications should only use zlib.h.
          - */
          -
          -#ifndef _INFBLOCK_H
          -#define _INFBLOCK_H
          -
          -struct inflate_blocks_state;
          -typedef struct inflate_blocks_state FAR inflate_blocks_statef;
          -
          -local  inflate_blocks_statef * inflate_blocks_new OF((
          -    z_streamp z,
          -    check_func c,               /* check function */
          -    uInt w));                   /* window size */
          -
          -local  int inflate_blocks OF((
          -    inflate_blocks_statef *,
          -    z_streamp ,
          -    int));                      /* initial return code */
          -
          -local  void inflate_blocks_reset OF((
          -    inflate_blocks_statef *,
          -    z_streamp ,
          -    uLongf *));                  /* check value on output */
          -
          -local  int inflate_blocks_free OF((
          -    inflate_blocks_statef *,
          -    z_streamp));
          -
          -#endif /* _INFBLOCK_H */
          diff --git a/thirdparty/freetype/src/gzip/infcodes.c b/thirdparty/freetype/src/gzip/infcodes.c
          deleted file mode 100644
          index ba30654990..0000000000
          --- a/thirdparty/freetype/src/gzip/infcodes.c
          +++ /dev/null
          @@ -1,254 +0,0 @@
          -/* infcodes.c -- process literals and length/distance pairs
          - * Copyright (C) 1995-2002 Mark Adler
          - * For conditions of distribution and use, see copyright notice in zlib.h
          - */
          -
          -#include "zutil.h"
          -#include "inftrees.h"
          -#include "infblock.h"
          -#include "infcodes.h"
          -#include "infutil.h"
          -
          -/* simplify the use of the inflate_huft type with some defines */
          -#define exop word.what.Exop
          -#define bits word.what.Bits
          -
          -typedef enum {        /* waiting for "i:"=input, "o:"=output, "x:"=nothing */
          -      START,    /* x: set up for LEN */
          -      LEN,      /* i: get length/literal/eob next */
          -      LENEXT,   /* i: getting length extra (have base) */
          -      DIST,     /* i: get distance next */
          -      DISTEXT,  /* i: getting distance extra */
          -      COPY,     /* o: copying bytes in window, waiting for space */
          -      LIT,      /* o: got literal, waiting for output space */
          -      WASH,     /* o: got eob, possibly still output waiting */
          -      END,      /* x: got eob and all data flushed */
          -      BADCODE}  /* x: got error */
          -inflate_codes_mode;
          -
          -/* inflate codes private state */
          -struct inflate_codes_state {
          -
          -  /* mode */
          -  inflate_codes_mode mode;      /* current inflate_codes mode */
          -
          -  /* mode dependent information */
          -  uInt len;
          -  union {
          -    struct {
          -      inflate_huft *tree;       /* pointer into tree */
          -      uInt need;                /* bits needed */
          -    } code;             /* if LEN or DIST, where in tree */
          -    uInt lit;           /* if LIT, literal */
          -    struct {
          -      uInt get;                 /* bits to get for extra */
          -      uInt dist;                /* distance back to copy from */
          -    } copy;             /* if EXT or COPY, where and how much */
          -  } sub;                /* submode */
          -
          -  /* mode independent information */
          -  Byte lbits;           /* ltree bits decoded per branch */
          -  Byte dbits;           /* dtree bits decoder per branch */
          -  inflate_huft *ltree;          /* literal/length/eob tree */
          -  inflate_huft *dtree;          /* distance tree */
          -
          -};
          -
          -
          -local inflate_codes_statef *inflate_codes_new( /* bl, bd, tl, td, z) */
          -uInt bl, uInt bd,
          -inflate_huft *tl,
          -inflate_huft *td, /* need separate declaration for Borland C++ */
          -z_streamp z )
          -{
          -  inflate_codes_statef *c;
          -
          -  if ((c = (inflate_codes_statef *)
          -       ZALLOC(z,1,sizeof(struct inflate_codes_state))) != Z_NULL)
          -  {
          -    c->mode = START;
          -    c->lbits = (Byte)bl;
          -    c->dbits = (Byte)bd;
          -    c->ltree = tl;
          -    c->dtree = td;
          -    Tracev((stderr, "inflate:       codes new\n"));
          -  }
          -  return c;
          -}
          -
          -
          -local int inflate_codes( /* s, z, r) */
          -inflate_blocks_statef *s,
          -z_streamp z,
          -int r )
          -{
          -  uInt j;               /* temporary storage */
          -  inflate_huft *t;      /* temporary pointer */
          -  uInt e;               /* extra bits or operation */
          -  uLong b;              /* bit buffer */
          -  uInt k;               /* bits in bit buffer */
          -  Bytef *p;             /* input data pointer */
          -  uInt n;               /* bytes available there */
          -  Bytef *q;             /* output window write pointer */
          -  uInt m;               /* bytes to end of window or read pointer */
          -  Bytef *f;             /* pointer to copy strings from */
          -  inflate_codes_statef *c = s->sub.decode.codes;  /* codes state */
          -
          -  /* copy input/output information to locals (UPDATE macro restores) */
          -  LOAD
          -
          -  /* process input and output based on current state */
          -  while (1) switch (c->mode)
          -  {             /* waiting for "i:"=input, "o:"=output, "x:"=nothing */
          -    case START:         /* x: set up for LEN */
          -#ifndef SLOW
          -      if (m >= 258 && n >= 10)
          -      {
          -        UPDATE
          -        r = inflate_fast(c->lbits, c->dbits, c->ltree, c->dtree, s, z);
          -        LOAD
          -        if (r != Z_OK)
          -        {
          -          c->mode = r == Z_STREAM_END ? WASH : BADCODE;
          -          break;
          -        }
          -      }
          -#endif /* !SLOW */
          -      c->sub.code.need = c->lbits;
          -      c->sub.code.tree = c->ltree;
          -      c->mode = LEN;
          -      /* fall through */
          -    case LEN:           /* i: get length/literal/eob next */
          -      j = c->sub.code.need;
          -      NEEDBITS(j)
          -      t = c->sub.code.tree + ((uInt)b & inflate_mask[j]);
          -      DUMPBITS(t->bits)
          -      e = (uInt)(t->exop);
          -      if (e == 0)               /* literal */
          -      {
          -        c->sub.lit = t->base;
          -        Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
          -                 "inflate:         literal '%c'\n" :
          -                 "inflate:         literal 0x%02x\n", t->base));
          -        c->mode = LIT;
          -        break;
          -      }
          -      if (e & 16)               /* length */
          -      {
          -        c->sub.copy.get = e & 15;
          -        c->len = t->base;
          -        c->mode = LENEXT;
          -        break;
          -      }
          -      if ((e & 64) == 0)        /* next table */
          -      {
          -        c->sub.code.need = e;
          -        c->sub.code.tree = t + t->base;
          -        break;
          -      }
          -      if (e & 32)               /* end of block */
          -      {
          -        Tracevv((stderr, "inflate:         end of block\n"));
          -        c->mode = WASH;
          -        break;
          -      }
          -      c->mode = BADCODE;        /* invalid code */
          -      z->msg = (char*)"invalid literal/length code";
          -      r = Z_DATA_ERROR;
          -      LEAVE
          -    case LENEXT:        /* i: getting length extra (have base) */
          -      j = c->sub.copy.get;
          -      NEEDBITS(j)
          -      c->len += (uInt)b & inflate_mask[j];
          -      DUMPBITS(j)
          -      c->sub.code.need = c->dbits;
          -      c->sub.code.tree = c->dtree;
          -      Tracevv((stderr, "inflate:         length %u\n", c->len));
          -      c->mode = DIST;
          -      /* fall through */
          -    case DIST:          /* i: get distance next */
          -      j = c->sub.code.need;
          -      NEEDBITS(j)
          -      t = c->sub.code.tree + ((uInt)b & inflate_mask[j]);
          -      DUMPBITS(t->bits)
          -      e = (uInt)(t->exop);
          -      if (e & 16)               /* distance */
          -      {
          -        c->sub.copy.get = e & 15;
          -        c->sub.copy.dist = t->base;
          -        c->mode = DISTEXT;
          -        break;
          -      }
          -      if ((e & 64) == 0)        /* next table */
          -      {
          -        c->sub.code.need = e;
          -        c->sub.code.tree = t + t->base;
          -        break;
          -      }
          -      c->mode = BADCODE;        /* invalid code */
          -      z->msg = (char*)"invalid distance code";
          -      r = Z_DATA_ERROR;
          -      LEAVE
          -    case DISTEXT:       /* i: getting distance extra */
          -      j = c->sub.copy.get;
          -      NEEDBITS(j)
          -      c->sub.copy.dist += (uInt)b & inflate_mask[j];
          -      DUMPBITS(j)
          -      Tracevv((stderr, "inflate:         distance %u\n", c->sub.copy.dist));
          -      c->mode = COPY;
          -      /* fall through */
          -    case COPY:          /* o: copying bytes in window, waiting for space */
          -      f = q - c->sub.copy.dist;
          -      while (f < s->window)             /* modulo window size-"while" instead */
          -        f += s->end - s->window;        /* of "if" handles invalid distances */
          -      while (c->len)
          -      {
          -        NEEDOUT
          -        OUTBYTE(*f++)
          -        if (f == s->end)
          -          f = s->window;
          -        c->len--;
          -      }
          -      c->mode = START;
          -      break;
          -    case LIT:           /* o: got literal, waiting for output space */
          -      NEEDOUT
          -      OUTBYTE(c->sub.lit)
          -      c->mode = START;
          -      break;
          -    case WASH:          /* o: got eob, possibly more output */
          -      if (k > 7)        /* return unused byte, if any */
          -      {
          -        Assert(k < 16, "inflate_codes grabbed too many bytes")
          -        k -= 8;
          -        n++;
          -        p--;            /* can always return one */
          -      }
          -      FLUSH
          -      if (s->read != s->write)
          -        LEAVE
          -      c->mode = END;
          -      /* fall through */
          -    case END:
          -      r = Z_STREAM_END;
          -      LEAVE
          -    case BADCODE:       /* x: got error */
          -      r = Z_DATA_ERROR;
          -      LEAVE
          -    default:
          -      r = Z_STREAM_ERROR;
          -      LEAVE
          -  }
          -#ifdef NEED_DUMMY_RETURN
          -  return Z_STREAM_ERROR;  /* Some dumb compilers complain without this */
          -#endif
          -}
          -
          -
          -local void inflate_codes_free( /* c, z) */
          -inflate_codes_statef *c,
          -z_streamp z )
          -{
          -  ZFREE(z, c);
          -  Tracev((stderr, "inflate:       codes free\n"));
          -}
          diff --git a/thirdparty/freetype/src/gzip/infcodes.h b/thirdparty/freetype/src/gzip/infcodes.h
          deleted file mode 100644
          index 154d7f896c..0000000000
          --- a/thirdparty/freetype/src/gzip/infcodes.h
          +++ /dev/null
          @@ -1,31 +0,0 @@
          -/* infcodes.h -- header to use infcodes.c
          - * Copyright (C) 1995-2002 Mark Adler
          - * For conditions of distribution and use, see copyright notice in zlib.h
          - */
          -
          -/* WARNING: this file should *not* be used by applications. It is
          -   part of the implementation of the compression library and is
          -   subject to change. Applications should only use zlib.h.
          - */
          -
          -#ifndef _INFCODES_H
          -#define _INFCODES_H
          -
          -struct inflate_codes_state;
          -typedef struct inflate_codes_state FAR inflate_codes_statef;
          -
          -local inflate_codes_statef *inflate_codes_new OF((
          -    uInt, uInt,
          -    inflate_huft *, inflate_huft *,
          -    z_streamp ));
          -
          -local int inflate_codes OF((
          -    inflate_blocks_statef *,
          -    z_streamp ,
          -    int));
          -
          -local void inflate_codes_free OF((
          -    inflate_codes_statef *,
          -    z_streamp ));
          -
          -#endif /* _INFCODES_H */
          diff --git a/thirdparty/freetype/src/gzip/inffast.c b/thirdparty/freetype/src/gzip/inffast.c
          new file mode 100644
          index 0000000000..1583181cda
          --- /dev/null
          +++ b/thirdparty/freetype/src/gzip/inffast.c
          @@ -0,0 +1,323 @@
          +/* inffast.c -- fast decoding
          + * Copyright (C) 1995-2017 Mark Adler
          + * For conditions of distribution and use, see copyright notice in zlib.h
          + */
          +
          +#include "zutil.h"
          +#include "inftrees.h"
          +#include "inflate.h"
          +#include "inffast.h"
          +
          +#ifdef ASMINF
          +#  pragma message("Assembler code may have bugs -- use at your own risk")
          +#else
          +
          +/*
          +   Decode literal, length, and distance codes and write out the resulting
          +   literal and match bytes until either not enough input or output is
          +   available, an end-of-block is encountered, or a data error is encountered.
          +   When large enough input and output buffers are supplied to inflate(), for
          +   example, a 16K input buffer and a 64K output buffer, more than 95% of the
          +   inflate execution time is spent in this routine.
          +
          +   Entry assumptions:
          +
          +        state->mode == LEN
          +        strm->avail_in >= 6
          +        strm->avail_out >= 258
          +        start >= strm->avail_out
          +        state->bits < 8
          +
          +   On return, state->mode is one of:
          +
          +        LEN -- ran out of enough output space or enough available input
          +        TYPE -- reached end of block code, inflate() to interpret next block
          +        BAD -- error in block data
          +
          +   Notes:
          +
          +    - The maximum input bits used by a length/distance pair is 15 bits for the
          +      length code, 5 bits for the length extra, 15 bits for the distance code,
          +      and 13 bits for the distance extra.  This totals 48 bits, or six bytes.
          +      Therefore if strm->avail_in >= 6, then there is enough input to avoid
          +      checking for available input while decoding.
          +
          +    - The maximum bytes that a single length/distance pair can output is 258
          +      bytes, which is the maximum length that can be coded.  inflate_fast()
          +      requires strm->avail_out >= 258 for each loop to avoid checking for
          +      output space.
          + */
          +void ZLIB_INTERNAL inflate_fast(
          +    z_streamp strm,
          +    unsigned start)
          +{
          +    struct inflate_state FAR *state;
          +    z_const unsigned char FAR *in;      /* local strm->next_in */
          +    z_const unsigned char FAR *last;    /* have enough input while in < last */
          +    unsigned char FAR *out;     /* local strm->next_out */
          +    unsigned char FAR *beg;     /* inflate()'s initial strm->next_out */
          +    unsigned char FAR *end;     /* while out < end, enough space available */
          +#ifdef INFLATE_STRICT
          +    unsigned dmax;              /* maximum distance from zlib header */
          +#endif
          +    unsigned wsize;             /* window size or zero if not using window */
          +    unsigned whave;             /* valid bytes in the window */
          +    unsigned wnext;             /* window write index */
          +    unsigned char FAR *window;  /* allocated sliding window, if wsize != 0 */
          +    unsigned long hold;         /* local strm->hold */
          +    unsigned bits;              /* local strm->bits */
          +    code const FAR *lcode;      /* local strm->lencode */
          +    code const FAR *dcode;      /* local strm->distcode */
          +    unsigned lmask;             /* mask for first level of length codes */
          +    unsigned dmask;             /* mask for first level of distance codes */
          +    code here;                  /* retrieved table entry */
          +    unsigned op;                /* code bits, operation, extra bits, or */
          +                                /*  window position, window bytes to copy */
          +    unsigned len;               /* match length, unused bytes */
          +    unsigned dist;              /* match distance */
          +    unsigned char FAR *from;    /* where to copy match from */
          +
          +    /* copy state to local variables */
          +    state = (struct inflate_state FAR *)strm->state;
          +    in = strm->next_in;
          +    last = in + (strm->avail_in - 5);
          +    out = strm->next_out;
          +    beg = out - (start - strm->avail_out);
          +    end = out + (strm->avail_out - 257);
          +#ifdef INFLATE_STRICT
          +    dmax = state->dmax;
          +#endif
          +    wsize = state->wsize;
          +    whave = state->whave;
          +    wnext = state->wnext;
          +    window = state->window;
          +    hold = state->hold;
          +    bits = state->bits;
          +    lcode = state->lencode;
          +    dcode = state->distcode;
          +    lmask = (1U << state->lenbits) - 1;
          +    dmask = (1U << state->distbits) - 1;
          +
          +    /* decode literals and length/distances until end-of-block or not enough
          +       input data or output space */
          +    do {
          +        if (bits < 15) {
          +            hold += (unsigned long)(*in++) << bits;
          +            bits += 8;
          +            hold += (unsigned long)(*in++) << bits;
          +            bits += 8;
          +        }
          +        here = lcode[hold & lmask];
          +      dolen:
          +        op = (unsigned)(here.bits);
          +        hold >>= op;
          +        bits -= op;
          +        op = (unsigned)(here.op);
          +        if (op == 0) {                          /* literal */
          +            Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
          +                    "inflate:         literal '%c'\n" :
          +                    "inflate:         literal 0x%02x\n", here.val));
          +            *out++ = (unsigned char)(here.val);
          +        }
          +        else if (op & 16) {                     /* length base */
          +            len = (unsigned)(here.val);
          +            op &= 15;                           /* number of extra bits */
          +            if (op) {
          +                if (bits < op) {
          +                    hold += (unsigned long)(*in++) << bits;
          +                    bits += 8;
          +                }
          +                len += (unsigned)hold & ((1U << op) - 1);
          +                hold >>= op;
          +                bits -= op;
          +            }
          +            Tracevv((stderr, "inflate:         length %u\n", len));
          +            if (bits < 15) {
          +                hold += (unsigned long)(*in++) << bits;
          +                bits += 8;
          +                hold += (unsigned long)(*in++) << bits;
          +                bits += 8;
          +            }
          +            here = dcode[hold & dmask];
          +          dodist:
          +            op = (unsigned)(here.bits);
          +            hold >>= op;
          +            bits -= op;
          +            op = (unsigned)(here.op);
          +            if (op & 16) {                      /* distance base */
          +                dist = (unsigned)(here.val);
          +                op &= 15;                       /* number of extra bits */
          +                if (bits < op) {
          +                    hold += (unsigned long)(*in++) << bits;
          +                    bits += 8;
          +                    if (bits < op) {
          +                        hold += (unsigned long)(*in++) << bits;
          +                        bits += 8;
          +                    }
          +                }
          +                dist += (unsigned)hold & ((1U << op) - 1);
          +#ifdef INFLATE_STRICT
          +                if (dist > dmax) {
          +                    strm->msg = (char *)"invalid distance too far back";
          +                    state->mode = BAD;
          +                    break;
          +                }
          +#endif
          +                hold >>= op;
          +                bits -= op;
          +                Tracevv((stderr, "inflate:         distance %u\n", dist));
          +                op = (unsigned)(out - beg);     /* max distance in output */
          +                if (dist > op) {                /* see if copy from window */
          +                    op = dist - op;             /* distance back in window */
          +                    if (op > whave) {
          +                        if (state->sane) {
          +                            strm->msg =
          +                                (char *)"invalid distance too far back";
          +                            state->mode = BAD;
          +                            break;
          +                        }
          +#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
          +                        if (len <= op - whave) {
          +                            do {
          +                                *out++ = 0;
          +                            } while (--len);
          +                            continue;
          +                        }
          +                        len -= op - whave;
          +                        do {
          +                            *out++ = 0;
          +                        } while (--op > whave);
          +                        if (op == 0) {
          +                            from = out - dist;
          +                            do {
          +                                *out++ = *from++;
          +                            } while (--len);
          +                            continue;
          +                        }
          +#endif
          +                    }
          +                    from = window;
          +                    if (wnext == 0) {           /* very common case */
          +                        from += wsize - op;
          +                        if (op < len) {         /* some from window */
          +                            len -= op;
          +                            do {
          +                                *out++ = *from++;
          +                            } while (--op);
          +                            from = out - dist;  /* rest from output */
          +                        }
          +                    }
          +                    else if (wnext < op) {      /* wrap around window */
          +                        from += wsize + wnext - op;
          +                        op -= wnext;
          +                        if (op < len) {         /* some from end of window */
          +                            len -= op;
          +                            do {
          +                                *out++ = *from++;
          +                            } while (--op);
          +                            from = window;
          +                            if (wnext < len) {  /* some from start of window */
          +                                op = wnext;
          +                                len -= op;
          +                                do {
          +                                    *out++ = *from++;
          +                                } while (--op);
          +                                from = out - dist;      /* rest from output */
          +                            }
          +                        }
          +                    }
          +                    else {                      /* contiguous in window */
          +                        from += wnext - op;
          +                        if (op < len) {         /* some from window */
          +                            len -= op;
          +                            do {
          +                                *out++ = *from++;
          +                            } while (--op);
          +                            from = out - dist;  /* rest from output */
          +                        }
          +                    }
          +                    while (len > 2) {
          +                        *out++ = *from++;
          +                        *out++ = *from++;
          +                        *out++ = *from++;
          +                        len -= 3;
          +                    }
          +                    if (len) {
          +                        *out++ = *from++;
          +                        if (len > 1)
          +                            *out++ = *from++;
          +                    }
          +                }
          +                else {
          +                    from = out - dist;          /* copy direct from output */
          +                    do {                        /* minimum length is three */
          +                        *out++ = *from++;
          +                        *out++ = *from++;
          +                        *out++ = *from++;
          +                        len -= 3;
          +                    } while (len > 2);
          +                    if (len) {
          +                        *out++ = *from++;
          +                        if (len > 1)
          +                            *out++ = *from++;
          +                    }
          +                }
          +            }
          +            else if ((op & 64) == 0) {          /* 2nd level distance code */
          +                here = dcode[here.val + (hold & ((1U << op) - 1))];
          +                goto dodist;
          +            }
          +            else {
          +                strm->msg = (char *)"invalid distance code";
          +                state->mode = BAD;
          +                break;
          +            }
          +        }
          +        else if ((op & 64) == 0) {              /* 2nd level length code */
          +            here = lcode[here.val + (hold & ((1U << op) - 1))];
          +            goto dolen;
          +        }
          +        else if (op & 32) {                     /* end-of-block */
          +            Tracevv((stderr, "inflate:         end of block\n"));
          +            state->mode = TYPE;
          +            break;
          +        }
          +        else {
          +            strm->msg = (char *)"invalid literal/length code";
          +            state->mode = BAD;
          +            break;
          +        }
          +    } while (in < last && out < end);
          +
          +    /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
          +    len = bits >> 3;
          +    in -= len;
          +    bits -= len << 3;
          +    hold &= (1U << bits) - 1;
          +
          +    /* update state and return */
          +    strm->next_in = in;
          +    strm->next_out = out;
          +    strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
          +    strm->avail_out = (unsigned)(out < end ?
          +                                 257 + (end - out) : 257 - (out - end));
          +    state->hold = hold;
          +    state->bits = bits;
          +    return;
          +}
          +
          +/*
          +   inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe):
          +   - Using bit fields for code structure
          +   - Different op definition to avoid & for extra bits (do & for table bits)
          +   - Three separate decoding do-loops for direct, window, and wnext == 0
          +   - Special case for distance > 1 copies to do overlapped load and store copy
          +   - Explicit branch predictions (based on measured branch probabilities)
          +   - Deferring match copy and interspersed it with decoding subsequent codes
          +   - Swapping literal/length else
          +   - Swapping window/direct else
          +   - Larger unrolled copy loops (three is about right)
          +   - Moving len -= 3 statement into middle of loop
          + */
          +
          +#endif /* !ASMINF */
          diff --git a/thirdparty/freetype/src/gzip/inffast.h b/thirdparty/freetype/src/gzip/inffast.h
          new file mode 100644
          index 0000000000..e5c1aa4ca8
          --- /dev/null
          +++ b/thirdparty/freetype/src/gzip/inffast.h
          @@ -0,0 +1,11 @@
          +/* inffast.h -- header to use inffast.c
          + * Copyright (C) 1995-2003, 2010 Mark Adler
          + * For conditions of distribution and use, see copyright notice in zlib.h
          + */
          +
          +/* WARNING: this file should *not* be used by applications. It is
          +   part of the implementation of the compression library and is
          +   subject to change. Applications should only use zlib.h.
          + */
          +
          +void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
          diff --git a/thirdparty/freetype/src/gzip/inffixed.h b/thirdparty/freetype/src/gzip/inffixed.h
          index 4d4760ea00..d628327769 100644
          --- a/thirdparty/freetype/src/gzip/inffixed.h
          +++ b/thirdparty/freetype/src/gzip/inffixed.h
          @@ -1,151 +1,94 @@
          -/* inffixed.h -- table for decoding fixed codes
          - * Generated automatically by the maketree.c program
          - */
          +    /* inffixed.h -- table for decoding fixed codes
          +     * Generated automatically by makefixed().
          +     */
           
          -/* WARNING: this file should *not* be used by applications. It is
          -   part of the implementation of the compression library and is
          -   subject to change. Applications should only use zlib.h.
          - */
          +    /* WARNING: this file should *not* be used by applications.
          +       It is part of the implementation of this library and is
          +       subject to change. Applications should only use zlib.h.
          +     */
           
          -local const uInt fixed_bl = 9;
          -local const uInt fixed_bd = 5;
          -local const inflate_huft fixed_tl[] = {
          -    {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115},
          -    {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},192},
          -    {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},160},
          -    {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},224},
          -    {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},144},
          -    {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},208},
          -    {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},176},
          -    {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},240},
          -    {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227},
          -    {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},200},
          -    {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},168},
          -    {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},232},
          -    {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},152},
          -    {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},216},
          -    {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},184},
          -    {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},248},
          -    {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163},
          -    {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},196},
          -    {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},164},
          -    {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},228},
          -    {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},148},
          -    {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},212},
          -    {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},180},
          -    {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},244},
          -    {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0},
          -    {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},204},
          -    {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},172},
          -    {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},236},
          -    {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},156},
          -    {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},220},
          -    {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},188},
          -    {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},252},
          -    {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131},
          -    {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},194},
          -    {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},162},
          -    {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},226},
          -    {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},146},
          -    {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},210},
          -    {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},178},
          -    {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},242},
          -    {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258},
          -    {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},202},
          -    {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},170},
          -    {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},234},
          -    {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},154},
          -    {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},218},
          -    {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},186},
          -    {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},250},
          -    {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195},
          -    {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},198},
          -    {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},166},
          -    {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},230},
          -    {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},150},
          -    {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},214},
          -    {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},182},
          -    {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},246},
          -    {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0},
          -    {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},206},
          -    {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},174},
          -    {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},238},
          -    {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},158},
          -    {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},222},
          -    {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},190},
          -    {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},254},
          -    {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115},
          -    {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},193},
          -    {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},161},
          -    {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},225},
          -    {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},145},
          -    {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},209},
          -    {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},177},
          -    {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},241},
          -    {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227},
          -    {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},201},
          -    {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},169},
          -    {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},233},
          -    {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},153},
          -    {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},217},
          -    {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},185},
          -    {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},249},
          -    {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163},
          -    {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},197},
          -    {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},165},
          -    {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},229},
          -    {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},149},
          -    {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},213},
          -    {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},181},
          -    {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},245},
          -    {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0},
          -    {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},205},
          -    {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},173},
          -    {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},237},
          -    {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},157},
          -    {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},221},
          -    {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},189},
          -    {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},253},
          -    {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131},
          -    {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},195},
          -    {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},163},
          -    {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},227},
          -    {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},147},
          -    {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},211},
          -    {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},179},
          -    {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},243},
          -    {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258},
          -    {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},203},
          -    {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},171},
          -    {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},235},
          -    {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},155},
          -    {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},219},
          -    {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},187},
          -    {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},251},
          -    {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195},
          -    {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},199},
          -    {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},167},
          -    {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},231},
          -    {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},151},
          -    {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},215},
          -    {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},183},
          -    {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},247},
          -    {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0},
          -    {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},207},
          -    {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},175},
          -    {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},239},
          -    {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},159},
          -    {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},223},
          -    {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},191},
          -    {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},255}
          -  };
          -local const inflate_huft fixed_td[] = {
          -    {{{80,5}},1}, {{{87,5}},257}, {{{83,5}},17}, {{{91,5}},4097},
          -    {{{81,5}},5}, {{{89,5}},1025}, {{{85,5}},65}, {{{93,5}},16385},
          -    {{{80,5}},3}, {{{88,5}},513}, {{{84,5}},33}, {{{92,5}},8193},
          -    {{{82,5}},9}, {{{90,5}},2049}, {{{86,5}},129}, {{{192,5}},24577},
          -    {{{80,5}},2}, {{{87,5}},385}, {{{83,5}},25}, {{{91,5}},6145},
          -    {{{81,5}},7}, {{{89,5}},1537}, {{{85,5}},97}, {{{93,5}},24577},
          -    {{{80,5}},4}, {{{88,5}},769}, {{{84,5}},49}, {{{92,5}},12289},
          -    {{{82,5}},13}, {{{90,5}},3073}, {{{86,5}},193}, {{{192,5}},24577}
          -  };
          +    static const code lenfix[512] = {
          +        {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
          +        {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
          +        {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
          +        {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},
          +        {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
          +        {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},
          +        {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
          +        {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},
          +        {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},
          +        {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},
          +        {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},
          +        {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},
          +        {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},
          +        {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},
          +        {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},
          +        {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},
          +        {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},
          +        {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
          +        {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},
          +        {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},
          +        {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},
          +        {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},
          +        {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},
          +        {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202},
          +        {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},
          +        {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},
          +        {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},
          +        {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},
          +        {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},
          +        {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},
          +        {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},
          +        {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},
          +        {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55},
          +        {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},
          +        {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},
          +        {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},
          +        {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},
          +        {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},
          +        {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},
          +        {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},
          +        {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},
          +        {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},
          +        {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},
          +        {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},
          +        {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},
          +        {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},
          +        {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},
          +        {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
          +        {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},
          +        {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},
          +        {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51},
          +        {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},
          +        {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},
          +        {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},
          +        {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},
          +        {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},
          +        {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},
          +        {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},
          +        {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},
          +        {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258},
          +        {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},
          +        {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},
          +        {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},
          +        {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},
          +        {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},
          +        {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
          +        {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},
          +        {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},
          +        {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},
          +        {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},
          +        {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},
          +        {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},
          +        {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},
          +        {0,9,255}
          +    };
          +
          +    static const code distfix[32] = {
          +        {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},
          +        {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},
          +        {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385},
          +        {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},
          +        {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},
          +        {22,5,193},{64,5,0}
          +    };
          diff --git a/thirdparty/freetype/src/gzip/inflate.c b/thirdparty/freetype/src/gzip/inflate.c
          index 95e2653662..7387e6f574 100644
          --- a/thirdparty/freetype/src/gzip/inflate.c
          +++ b/thirdparty/freetype/src/gzip/inflate.c
          @@ -1,283 +1,1579 @@
          -/* inflate.c -- zlib interface to inflate modules
          - * Copyright (C) 1995-2002 Mark Adler
          +/* inflate.c -- zlib decompression
          + * Copyright (C) 1995-2016 Mark Adler
            * For conditions of distribution and use, see copyright notice in zlib.h
            */
           
          +/*
          + * Change history:
          + *
          + * 1.2.beta0    24 Nov 2002
          + * - First version -- complete rewrite of inflate to simplify code, avoid
          + *   creation of window when not needed, minimize use of window when it is
          + *   needed, make inffast.c even faster, implement gzip decoding, and to
          + *   improve code readability and style over the previous zlib inflate code
          + *
          + * 1.2.beta1    25 Nov 2002
          + * - Use pointers for available input and output checking in inffast.c
          + * - Remove input and output counters in inffast.c
          + * - Change inffast.c entry and loop from avail_in >= 7 to >= 6
          + * - Remove unnecessary second byte pull from length extra in inffast.c
          + * - Unroll direct copy to three copies per loop in inffast.c
          + *
          + * 1.2.beta2    4 Dec 2002
          + * - Change external routine names to reduce potential conflicts
          + * - Correct filename to inffixed.h for fixed tables in inflate.c
          + * - Make hbuf[] unsigned char to match parameter type in inflate.c
          + * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset)
          + *   to avoid negation problem on Alphas (64 bit) in inflate.c
          + *
          + * 1.2.beta3    22 Dec 2002
          + * - Add comments on state->bits assertion in inffast.c
          + * - Add comments on op field in inftrees.h
          + * - Fix bug in reuse of allocated window after inflateReset()
          + * - Remove bit fields--back to byte structure for speed
          + * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths
          + * - Change post-increments to pre-increments in inflate_fast(), PPC biased?
          + * - Add compile time option, POSTINC, to use post-increments instead (Intel?)
          + * - Make MATCH copy in inflate() much faster for when inflate_fast() not used
          + * - Use local copies of stream next and avail values, as well as local bit
          + *   buffer and bit count in inflate()--for speed when inflate_fast() not used
          + *
          + * 1.2.beta4    1 Jan 2003
          + * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings
          + * - Move a comment on output buffer sizes from inffast.c to inflate.c
          + * - Add comments in inffast.c to introduce the inflate_fast() routine
          + * - Rearrange window copies in inflate_fast() for speed and simplification
          + * - Unroll last copy for window match in inflate_fast()
          + * - Use local copies of window variables in inflate_fast() for speed
          + * - Pull out common wnext == 0 case for speed in inflate_fast()
          + * - Make op and len in inflate_fast() unsigned for consistency
          + * - Add FAR to lcode and dcode declarations in inflate_fast()
          + * - Simplified bad distance check in inflate_fast()
          + * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new
          + *   source file infback.c to provide a call-back interface to inflate for
          + *   programs like gzip and unzip -- uses window as output buffer to avoid
          + *   window copying
          + *
          + * 1.2.beta5    1 Jan 2003
          + * - Improved inflateBack() interface to allow the caller to provide initial
          + *   input in strm.
          + * - Fixed stored blocks bug in inflateBack()
          + *
          + * 1.2.beta6    4 Jan 2003
          + * - Added comments in inffast.c on effectiveness of POSTINC
          + * - Typecasting all around to reduce compiler warnings
          + * - Changed loops from while (1) or do {} while (1) to for (;;), again to
          + *   make compilers happy
          + * - Changed type of window in inflateBackInit() to unsigned char *
          + *
          + * 1.2.beta7    27 Jan 2003
          + * - Changed many types to unsigned or unsigned short to avoid warnings
          + * - Added inflateCopy() function
          + *
          + * 1.2.0        9 Mar 2003
          + * - Changed inflateBack() interface to provide separate opaque descriptors
          + *   for the in() and out() functions
          + * - Changed inflateBack() argument and in_func typedef to swap the length
          + *   and buffer address return values for the input function
          + * - Check next_in and next_out for Z_NULL on entry to inflate()
          + *
          + * The history for versions after 1.2.0 are in ChangeLog in zlib distribution.
          + */
          +
           #include "zutil.h"
          -#include "infblock.h"
          +#include "inftrees.h"
          +#include "inflate.h"
          +#include "inffast.h"
           
          -#define  DONE  INFLATE_DONE
          -#define  BAD   INFLATE_BAD
          +#ifdef MAKEFIXED
          +#  ifndef BUILDFIXED
          +#    define BUILDFIXED
          +#  endif
          +#endif
           
          -typedef enum {
          -      METHOD,   /* waiting for method byte */
          -      FLAG,     /* waiting for flag byte */
          -      DICT4,    /* four dictionary check bytes to go */
          -      DICT3,    /* three dictionary check bytes to go */
          -      DICT2,    /* two dictionary check bytes to go */
          -      DICT1,    /* one dictionary check byte to go */
          -      DICT0,    /* waiting for inflateSetDictionary */
          -      BLOCKS,   /* decompressing blocks */
          -      CHECK4,   /* four check bytes to go */
          -      CHECK3,   /* three check bytes to go */
          -      CHECK2,   /* two check bytes to go */
          -      CHECK1,   /* one check byte to go */
          -      DONE,     /* finished check, done */
          -      BAD}      /* got an error--stay here */
          -inflate_mode;
          +/* function prototypes */
          +local int inflateStateCheck OF((z_streamp strm));
          +local void fixedtables OF((struct inflate_state FAR *state));
          +local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
          +                           unsigned copy));
          +#ifdef BUILDFIXED
          +   void makefixed OF((void));
          +#endif
          +#ifndef Z_FREETYPE
          +local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf,
          +                              unsigned len));
          +#endif
           
          -/* inflate private state */
          -struct internal_state {
          -
          -  /* mode */
          -  inflate_mode  mode;   /* current inflate mode */
          -
          -  /* mode dependent information */
          -  union {
          -    uInt method;        /* if FLAGS, method byte */
          -    struct {
          -      uLong was;                /* computed check value */
          -      uLong need;               /* stream check value */
          -    } check;            /* if CHECK, check values to compare */
          -    uInt marker;        /* if BAD, inflateSync's marker bytes count */
          -  } sub;        /* submode */
          -
          -  /* mode independent information */
          -  int  nowrap;          /* flag for no wrapper */
          -  uInt wbits;           /* log2(window size)  (8..15, defaults to 15) */
          -  inflate_blocks_statef
          -    *blocks;            /* current inflate_blocks state */
          -
          -};
          -
          -
          -ZEXPORT(int) inflateReset( /* z) */
          -z_streamp z )
          +local int inflateStateCheck(
          +    z_streamp strm)
           {
          -  if (z == Z_NULL || z->state == Z_NULL)
          -    return Z_STREAM_ERROR;
          -  z->total_in = z->total_out = 0;
          -  z->msg = Z_NULL;
          -  z->state->mode = z->state->nowrap ? BLOCKS : METHOD;
          -  inflate_blocks_reset(z->state->blocks, z, Z_NULL);
          -  Tracev((stderr, "inflate: reset\n"));
          -  return Z_OK;
          +    struct inflate_state FAR *state;
          +    if (strm == Z_NULL ||
          +        strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
          +        return 1;
          +    state = (struct inflate_state FAR *)strm->state;
          +    if (state == Z_NULL || state->strm != strm ||
          +        state->mode < HEAD || state->mode > SYNC)
          +        return 1;
          +    return 0;
           }
           
          -
          -ZEXPORT(int) inflateEnd( /* z) */
          -z_streamp z )
          +int ZEXPORT inflateResetKeep(
          +    z_streamp strm)
           {
          -  if (z == Z_NULL || z->state == Z_NULL || z->zfree == Z_NULL)
          -    return Z_STREAM_ERROR;
          -  if (z->state->blocks != Z_NULL)
          -    inflate_blocks_free(z->state->blocks, z);
          -  ZFREE(z, z->state);
          -  z->state = Z_NULL;
          -  Tracev((stderr, "inflate: end\n"));
          -  return Z_OK;
          +    struct inflate_state FAR *state;
          +
          +    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
          +    state = (struct inflate_state FAR *)strm->state;
          +    strm->total_in = strm->total_out = state->total = 0;
          +    strm->msg = Z_NULL;
          +    if (state->wrap)        /* to support ill-conceived Java test suite */
          +        strm->adler = state->wrap & 1;
          +    state->mode = HEAD;
          +    state->last = 0;
          +    state->havedict = 0;
          +    state->dmax = 32768U;
          +    state->head = Z_NULL;
          +    state->hold = 0;
          +    state->bits = 0;
          +    state->lencode = state->distcode = state->next = state->codes;
          +    state->sane = 1;
          +    state->back = -1;
          +    Tracev((stderr, "inflate: reset\n"));
          +    return Z_OK;
           }
           
          -
          -ZEXPORT(int) inflateInit2_( /* z, w, version, stream_size) */
          -z_streamp z,
          -int w,
          -const char *version,
          -int stream_size )
          +int ZEXPORT inflateReset(
          +    z_streamp strm)
           {
          -  if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
          -      stream_size != sizeof(z_stream))
          -      return Z_VERSION_ERROR;
          +    struct inflate_state FAR *state;
           
          -  /* initialize state */
          -  if (z == Z_NULL)
          -    return Z_STREAM_ERROR;
          -  z->msg = Z_NULL;
          -  if (z->zalloc == Z_NULL)
          -  {
          -    z->zalloc = zcalloc;
          -    z->opaque = (voidpf)0;
          -  }
          -  if (z->zfree == Z_NULL) z->zfree = zcfree;
          -  if ((z->state = (struct internal_state FAR *)
          -       ZALLOC(z,1,sizeof(struct internal_state))) == Z_NULL)
          -    return Z_MEM_ERROR;
          -  z->state->blocks = Z_NULL;
          -
          -  /* handle undocumented nowrap option (no zlib header or check) */
          -  z->state->nowrap = 0;
          -  if (w < 0)
          -  {
          -    w = - w;
          -    z->state->nowrap = 1;
          -  }
          -
          -  /* set window size */
          -  if (w < 8 || w > 15)
          -  {
          -    inflateEnd(z);
          -    return Z_STREAM_ERROR;
          -  }
          -  z->state->wbits = (uInt)w;
          -
          -  /* create inflate_blocks state */
          -  if ((z->state->blocks =
          -      inflate_blocks_new(z, z->state->nowrap ? Z_NULL : adler32, (uInt)1 << w))
          -      == Z_NULL)
          -  {
          -    inflateEnd(z);
          -    return Z_MEM_ERROR;
          -  }
          -  Tracev((stderr, "inflate: allocated\n"));
          -
          -  /* reset state */
          -  inflateReset(z);
          -  return Z_OK;
          +    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
          +    state = (struct inflate_state FAR *)strm->state;
          +    state->wsize = 0;
          +    state->whave = 0;
          +    state->wnext = 0;
          +    return inflateResetKeep(strm);
           }
           
          -
          -
          -#undef  NEEDBYTE
          -#define NEEDBYTE {if(z->avail_in==0)return r;r=f;}
          -
          -#undef  NEXTBYTE
          -#define NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++)
          -
          -
          -ZEXPORT(int) inflate( /* z, f) */
          -z_streamp z,
          -int f )
          +int ZEXPORT inflateReset2(
          +    z_streamp strm,
          +    int windowBits)
           {
          -  int r;
          -  uInt b;
          +    int wrap;
          +    struct inflate_state FAR *state;
           
          -  if (z == Z_NULL || z->state == Z_NULL || z->next_in == Z_NULL)
          -    return Z_STREAM_ERROR;
          -  f = f == Z_FINISH ? Z_BUF_ERROR : Z_OK;
          -  r = Z_BUF_ERROR;
          -  while (1) switch (z->state->mode)
          -  {
          -    case METHOD:
          -      NEEDBYTE
          -      if (((z->state->sub.method = NEXTBYTE) & 0xf) != Z_DEFLATED)
          -      {
          -        z->state->mode = BAD;
          -        z->msg = (char*)"unknown compression method";
          -        z->state->sub.marker = 5;       /* can't try inflateSync */
          -        break;
          -      }
          -      if ((z->state->sub.method >> 4) + 8 > z->state->wbits)
          -      {
          -        z->state->mode = BAD;
          -        z->msg = (char*)"invalid window size";
          -        z->state->sub.marker = 5;       /* can't try inflateSync */
          -        break;
          -      }
          -      z->state->mode = FLAG;
          -      /* fall through */
          -    case FLAG:
          -      NEEDBYTE
          -      b = NEXTBYTE;
          -      if (((z->state->sub.method << 8) + b) % 31)
          -      {
          -        z->state->mode = BAD;
          -        z->msg = (char*)"incorrect header check";
          -        z->state->sub.marker = 5;       /* can't try inflateSync */
          -        break;
          -      }
          -      Tracev((stderr, "inflate: zlib header ok\n"));
          -      if (!(b & PRESET_DICT))
          -      {
          -        z->state->mode = BLOCKS;
          -        break;
          -      }
          -      z->state->mode = DICT4;
          -      /* fall through */
          -    case DICT4:
          -      NEEDBYTE
          -      z->state->sub.check.need = (uLong)NEXTBYTE << 24;
          -      z->state->mode = DICT3;
          -      /* fall through */
          -    case DICT3:
          -      NEEDBYTE
          -      z->state->sub.check.need += (uLong)NEXTBYTE << 16;
          -      z->state->mode = DICT2;
          -      /* fall through */
          -    case DICT2:
          -      NEEDBYTE
          -      z->state->sub.check.need += (uLong)NEXTBYTE << 8;
          -      z->state->mode = DICT1;
          -      /* fall through */
          -    case DICT1:
          -      NEEDBYTE
          -      z->state->sub.check.need += (uLong)NEXTBYTE;
          -      z->adler = z->state->sub.check.need;
          -      z->state->mode = DICT0;
          -      return Z_NEED_DICT;
          -    case DICT0:
          -      z->state->mode = BAD;
          -      z->msg = (char*)"need dictionary";
          -      z->state->sub.marker = 0;       /* can try inflateSync */
          -      return Z_STREAM_ERROR;
          -    case BLOCKS:
          -      r = inflate_blocks(z->state->blocks, z, r);
          -      if (r == Z_DATA_ERROR)
          -      {
          -        z->state->mode = BAD;
          -        z->state->sub.marker = 0;       /* can try inflateSync */
          -        break;
          -      }
          -      if (r == Z_OK)
          -        r = f;
          -      if (r != Z_STREAM_END)
          -        return r;
          -      r = f;
          -      inflate_blocks_reset(z->state->blocks, z, &z->state->sub.check.was);
          -      if (z->state->nowrap)
          -      {
          -        z->state->mode = DONE;
          -        break;
          -      }
          -      z->state->mode = CHECK4;
          -      /* fall through */
          -    case CHECK4:
          -      NEEDBYTE
          -      z->state->sub.check.need = (uLong)NEXTBYTE << 24;
          -      z->state->mode = CHECK3;
          -      /* fall through */
          -    case CHECK3:
          -      NEEDBYTE
          -      z->state->sub.check.need += (uLong)NEXTBYTE << 16;
          -      z->state->mode = CHECK2;
          -      /* fall through */
          -    case CHECK2:
          -      NEEDBYTE
          -      z->state->sub.check.need += (uLong)NEXTBYTE << 8;
          -      z->state->mode = CHECK1;
          -      /* fall through */
          -    case CHECK1:
          -      NEEDBYTE
          -      z->state->sub.check.need += (uLong)NEXTBYTE;
          +    /* get the state */
          +    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
          +    state = (struct inflate_state FAR *)strm->state;
           
          -      if (z->state->sub.check.was != z->state->sub.check.need)
          -      {
          -        z->state->mode = BAD;
          -        z->msg = (char*)"incorrect data check";
          -        z->state->sub.marker = 5;       /* can't try inflateSync */
          +    /* extract wrap request from windowBits parameter */
          +    if (windowBits < 0) {
          +        wrap = 0;
          +        windowBits = -windowBits;
          +    }
          +    else {
          +        wrap = (windowBits >> 4) + 5;
          +#ifdef GUNZIP
          +        if (windowBits < 48)
          +            windowBits &= 15;
          +#endif
          +    }
          +
          +    /* set number of window bits, free window if different */
          +    if (windowBits && (windowBits < 8 || windowBits > 15))
          +        return Z_STREAM_ERROR;
          +    if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
          +        ZFREE(strm, state->window);
          +        state->window = Z_NULL;
          +    }
          +
          +    /* update state and reset the rest of it */
          +    state->wrap = wrap;
          +    state->wbits = (unsigned)windowBits;
          +    return inflateReset(strm);
          +}
          +
          +int ZEXPORT inflateInit2_(
          +    z_streamp strm,
          +    int windowBits,
          +    const char *version,
          +    int stream_size)
          +{
          +    int ret;
          +    struct inflate_state FAR *state;
          +
          +    if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
          +        stream_size != (int)(sizeof(z_stream)))
          +        return Z_VERSION_ERROR;
          +    if (strm == Z_NULL) return Z_STREAM_ERROR;
          +    strm->msg = Z_NULL;                 /* in case we return an error */
          +    if (strm->zalloc == (alloc_func)0) {
          +#ifdef Z_SOLO
          +        return Z_STREAM_ERROR;
          +#else
          +        strm->zalloc = zcalloc;
          +        strm->opaque = (voidpf)0;
          +#endif
          +    }
          +    if (strm->zfree == (free_func)0)
          +#ifdef Z_SOLO
          +        return Z_STREAM_ERROR;
          +#else
          +        strm->zfree = zcfree;
          +#endif
          +    state = (struct inflate_state FAR *)
          +            ZALLOC(strm, 1, sizeof(struct inflate_state));
          +    if (state == Z_NULL) return Z_MEM_ERROR;
          +    Tracev((stderr, "inflate: allocated\n"));
          +    strm->state = (struct internal_state FAR *)state;
          +    state->strm = strm;
          +    state->window = Z_NULL;
          +    state->mode = HEAD;     /* to pass state test in inflateReset2() */
          +    ret = inflateReset2(strm, windowBits);
          +    if (ret != Z_OK) {
          +        ZFREE(strm, state);
          +        strm->state = Z_NULL;
          +    }
          +    return ret;
          +}
          +
          +int ZEXPORT inflateInit_(
          +    z_streamp strm,
          +    const char *version,
          +    int stream_size)
          +{
          +    return inflateInit2_(strm, DEF_WBITS, version, stream_size);
          +}
          +
          +#ifndef Z_FREETYPE
          +
          +int ZEXPORT inflatePrime(
          +    z_streamp strm,
          +    int bits,
          +    int value)
          +{
          +    struct inflate_state FAR *state;
          +
          +    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
          +    state = (struct inflate_state FAR *)strm->state;
          +    if (bits < 0) {
          +        state->hold = 0;
          +        state->bits = 0;
          +        return Z_OK;
          +    }
          +    if (bits > 16 || state->bits + (uInt)bits > 32) return Z_STREAM_ERROR;
          +    value &= (1L << bits) - 1;
          +    state->hold += (unsigned)value << state->bits;
          +    state->bits += (uInt)bits;
          +    return Z_OK;
          +}
          +
          +#endif  /* Z_FREETYPE */
          +
          +/*
          +   Return state with length and distance decoding tables and index sizes set to
          +   fixed code decoding.  Normally this returns fixed tables from inffixed.h.
          +   If BUILDFIXED is defined, then instead this routine builds the tables the
          +   first time it's called, and returns those tables the first time and
          +   thereafter.  This reduces the size of the code by about 2K bytes, in
          +   exchange for a little execution time.  However, BUILDFIXED should not be
          +   used for threaded applications, since the rewriting of the tables and virgin
          +   may not be thread-safe.
          + */
          +local void fixedtables(
          +    struct inflate_state FAR *state)
          +{
          +#ifdef BUILDFIXED
          +    static int virgin = 1;
          +    static code *lenfix, *distfix;
          +    static code fixed[544];
          +
          +    /* build fixed huffman tables if first call (may not be thread safe) */
          +    if (virgin) {
          +        unsigned sym, bits;
          +        static code *next;
          +
          +        /* literal/length table */
          +        sym = 0;
          +        while (sym < 144) state->lens[sym++] = 8;
          +        while (sym < 256) state->lens[sym++] = 9;
          +        while (sym < 280) state->lens[sym++] = 7;
          +        while (sym < 288) state->lens[sym++] = 8;
          +        next = fixed;
          +        lenfix = next;
          +        bits = 9;
          +        inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
          +
          +        /* distance table */
          +        sym = 0;
          +        while (sym < 32) state->lens[sym++] = 5;
          +        distfix = next;
          +        bits = 5;
          +        inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
          +
          +        /* do this just once */
          +        virgin = 0;
          +    }
          +#else /* !BUILDFIXED */
          +#   include "inffixed.h"
          +#endif /* BUILDFIXED */
          +    state->lencode = lenfix;
          +    state->lenbits = 9;
          +    state->distcode = distfix;
          +    state->distbits = 5;
          +}
          +
          +#ifdef MAKEFIXED
          +#include 
          +
          +/*
          +   Write out the inffixed.h that is #include'd above.  Defining MAKEFIXED also
          +   defines BUILDFIXED, so the tables are built on the fly.  makefixed() writes
          +   those tables to stdout, which would be piped to inffixed.h.  A small program
          +   can simply call makefixed to do this:
          +
          +    void makefixed(void);
          +
          +    int main(void)
          +    {
          +        makefixed();
          +        return 0;
          +    }
          +
          +   Then that can be linked with zlib built with MAKEFIXED defined and run:
          +
          +    a.out > inffixed.h
          + */
          +void makefixed()
          +{
          +    unsigned low, size;
          +    struct inflate_state state;
          +
          +    fixedtables(&state);
          +    puts("    /* inffixed.h -- table for decoding fixed codes");
          +    puts("     * Generated automatically by makefixed().");
          +    puts("     */");
          +    puts("");
          +    puts("    /* WARNING: this file should *not* be used by applications.");
          +    puts("       It is part of the implementation of this library and is");
          +    puts("       subject to change. Applications should only use zlib.h.");
          +    puts("     */");
          +    puts("");
          +    size = 1U << 9;
          +    printf("    static const code lenfix[%u] = {", size);
          +    low = 0;
          +    for (;;) {
          +        if ((low % 7) == 0) printf("\n        ");
          +        printf("{%u,%u,%d}", (low & 127) == 99 ? 64 : state.lencode[low].op,
          +               state.lencode[low].bits, state.lencode[low].val);
          +        if (++low == size) break;
          +        putchar(',');
          +    }
          +    puts("\n    };");
          +    size = 1U << 5;
          +    printf("\n    static const code distfix[%u] = {", size);
          +    low = 0;
          +    for (;;) {
          +        if ((low % 6) == 0) printf("\n        ");
          +        printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits,
          +               state.distcode[low].val);
          +        if (++low == size) break;
          +        putchar(',');
          +    }
          +    puts("\n    };");
          +}
          +#endif /* MAKEFIXED */
          +
          +/*
          +   Update the window with the last wsize (normally 32K) bytes written before
          +   returning.  If window does not exist yet, create it.  This is only called
          +   when a window is already in use, or when output has been written during this
          +   inflate call, but the end of the deflate stream has not been reached yet.
          +   It is also called to create a window for dictionary data when a dictionary
          +   is loaded.
          +
          +   Providing output buffers larger than 32K to inflate() should provide a speed
          +   advantage, since only the last 32K of output is copied to the sliding window
          +   upon return from inflate(), and since all distances after the first 32K of
          +   output will fall in the output data, making match copies simpler and faster.
          +   The advantage may be dependent on the size of the processor's data caches.
          + */
          +local int updatewindow(
          +    z_streamp strm,
          +    const Bytef *end,
          +    unsigned copy)
          +{
          +    struct inflate_state FAR *state;
          +    unsigned dist;
          +
          +    state = (struct inflate_state FAR *)strm->state;
          +
          +    /* if it hasn't been done already, allocate space for the window */
          +    if (state->window == Z_NULL) {
          +        state->window = (unsigned char FAR *)
          +                        ZALLOC(strm, 1U << state->wbits,
          +                               sizeof(unsigned char));
          +        if (state->window == Z_NULL) return 1;
          +    }
          +
          +    /* if window not in use yet, initialize */
          +    if (state->wsize == 0) {
          +        state->wsize = 1U << state->wbits;
          +        state->wnext = 0;
          +        state->whave = 0;
          +    }
          +
          +    /* copy state->wsize or less output bytes into the circular window */
          +    if (copy >= state->wsize) {
          +        zmemcpy(state->window, end - state->wsize, state->wsize);
          +        state->wnext = 0;
          +        state->whave = state->wsize;
          +    }
          +    else {
          +        dist = state->wsize - state->wnext;
          +        if (dist > copy) dist = copy;
          +        zmemcpy(state->window + state->wnext, end - copy, dist);
          +        copy -= dist;
          +        if (copy) {
          +            zmemcpy(state->window, end - copy, copy);
          +            state->wnext = copy;
          +            state->whave = state->wsize;
          +        }
          +        else {
          +            state->wnext += dist;
          +            if (state->wnext == state->wsize) state->wnext = 0;
          +            if (state->whave < state->wsize) state->whave += dist;
          +        }
          +    }
          +    return 0;
          +}
          +
          +/* Macros for inflate(): */
          +
          +/* check function to use adler32() for zlib or crc32() for gzip */
          +#ifdef GUNZIP
          +#  define UPDATE(check, buf, len) \
          +    (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
          +#else
          +#  define UPDATE(check, buf, len) adler32(check, buf, len)
          +#endif
          +
          +/* check macros for header crc */
          +#ifdef GUNZIP
          +#  define CRC2(check, word) \
          +    do { \
          +        hbuf[0] = (unsigned char)(word); \
          +        hbuf[1] = (unsigned char)((word) >> 8); \
          +        check = crc32(check, hbuf, 2); \
          +    } while (0)
          +
          +#  define CRC4(check, word) \
          +    do { \
          +        hbuf[0] = (unsigned char)(word); \
          +        hbuf[1] = (unsigned char)((word) >> 8); \
          +        hbuf[2] = (unsigned char)((word) >> 16); \
          +        hbuf[3] = (unsigned char)((word) >> 24); \
          +        check = crc32(check, hbuf, 4); \
          +    } while (0)
          +#endif
          +
          +/* Load registers with state in inflate() for speed */
          +#define LOAD() \
          +    do { \
          +        put = strm->next_out; \
          +        left = strm->avail_out; \
          +        next = strm->next_in; \
          +        have = strm->avail_in; \
          +        hold = state->hold; \
          +        bits = state->bits; \
          +    } while (0)
          +
          +/* Restore state from registers in inflate() */
          +#define RESTORE() \
          +    do { \
          +        strm->next_out = put; \
          +        strm->avail_out = left; \
          +        strm->next_in = next; \
          +        strm->avail_in = have; \
          +        state->hold = hold; \
          +        state->bits = bits; \
          +    } while (0)
          +
          +/* Clear the input bit accumulator */
          +#define INITBITS() \
          +    do { \
          +        hold = 0; \
          +        bits = 0; \
          +    } while (0)
          +
          +/* Get a byte of input into the bit accumulator, or return from inflate()
          +   if there is no input available. */
          +#define PULLBYTE() \
          +    do { \
          +        if (have == 0) goto inf_leave; \
          +        have--; \
          +        hold += (unsigned long)(*next++) << bits; \
          +        bits += 8; \
          +    } while (0)
          +
          +/* Assure that there are at least n bits in the bit accumulator.  If there is
          +   not enough available input to do that, then return from inflate(). */
          +#define NEEDBITS(n) \
          +    do { \
          +        while (bits < (unsigned)(n)) \
          +            PULLBYTE(); \
          +    } while (0)
          +
          +/* Return the low n bits of the bit accumulator (n < 16) */
          +#define BITS(n) \
          +    ((unsigned)hold & ((1U << (n)) - 1))
          +
          +/* Remove n bits from the bit accumulator */
          +#define DROPBITS(n) \
          +    do { \
          +        hold >>= (n); \
          +        bits -= (unsigned)(n); \
          +    } while (0)
          +
          +/* Remove zero to seven bits as needed to go to a byte boundary */
          +#define BYTEBITS() \
          +    do { \
          +        hold >>= bits & 7; \
          +        bits -= bits & 7; \
          +    } while (0)
          +
          +/*
          +   inflate() uses a state machine to process as much input data and generate as
          +   much output data as possible before returning.  The state machine is
          +   structured roughly as follows:
          +
          +    for (;;) switch (state) {
          +    ...
          +    case STATEn:
          +        if (not enough input data or output space to make progress)
          +            return;
          +        ... make progress ...
          +        state = STATEm;
                   break;
          -      }
          -      Tracev((stderr, "inflate: zlib check ok\n"));
          -      z->state->mode = DONE;
          -      /* fall through */
          -    case DONE:
          -      return Z_STREAM_END;
          -    case BAD:
          -      return Z_DATA_ERROR;
          -    default:
          -      return Z_STREAM_ERROR;
          -  }
          -#ifdef NEED_DUMMY_RETURN
          -  return Z_STREAM_ERROR;  /* Some dumb compilers complain without this */
          +    ...
          +    }
          +
          +   so when inflate() is called again, the same case is attempted again, and
          +   if the appropriate resources are provided, the machine proceeds to the
          +   next state.  The NEEDBITS() macro is usually the way the state evaluates
          +   whether it can proceed or should return.  NEEDBITS() does the return if
          +   the requested bits are not available.  The typical use of the BITS macros
          +   is:
          +
          +        NEEDBITS(n);
          +        ... do something with BITS(n) ...
          +        DROPBITS(n);
          +
          +   where NEEDBITS(n) either returns from inflate() if there isn't enough
          +   input left to load n bits into the accumulator, or it continues.  BITS(n)
          +   gives the low n bits in the accumulator.  When done, DROPBITS(n) drops
          +   the low n bits off the accumulator.  INITBITS() clears the accumulator
          +   and sets the number of available bits to zero.  BYTEBITS() discards just
          +   enough bits to put the accumulator on a byte boundary.  After BYTEBITS()
          +   and a NEEDBITS(8), then BITS(8) would return the next byte in the stream.
          +
          +   NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return
          +   if there is no input available.  The decoding of variable length codes uses
          +   PULLBYTE() directly in order to pull just enough bytes to decode the next
          +   code, and no more.
          +
          +   Some states loop until they get enough input, making sure that enough
          +   state information is maintained to continue the loop where it left off
          +   if NEEDBITS() returns in the loop.  For example, want, need, and keep
          +   would all have to actually be part of the saved state in case NEEDBITS()
          +   returns:
          +
          +    case STATEw:
          +        while (want < need) {
          +            NEEDBITS(n);
          +            keep[want++] = BITS(n);
          +            DROPBITS(n);
          +        }
          +        state = STATEx;
          +    case STATEx:
          +
          +   As shown above, if the next state is also the next case, then the break
          +   is omitted.
          +
          +   A state may also return if there is not enough output space available to
          +   complete that state.  Those states are copying stored data, writing a
          +   literal byte, and copying a matching string.
          +
          +   When returning, a "goto inf_leave" is used to update the total counters,
          +   update the check value, and determine whether any progress has been made
          +   during that inflate() call in order to return the proper return code.
          +   Progress is defined as a change in either strm->avail_in or strm->avail_out.
          +   When there is a window, goto inf_leave will update the window with the last
          +   output written.  If a goto inf_leave occurs in the middle of decompression
          +   and there is no window currently, goto inf_leave will create one and copy
          +   output to the window for the next call of inflate().
          +
          +   In this implementation, the flush parameter of inflate() only affects the
          +   return code (per zlib.h).  inflate() always writes as much as possible to
          +   strm->next_out, given the space available and the provided input--the effect
          +   documented in zlib.h of Z_SYNC_FLUSH.  Furthermore, inflate() always defers
          +   the allocation of and copying into a sliding window until necessary, which
          +   provides the effect documented in zlib.h for Z_FINISH when the entire input
          +   stream available.  So the only thing the flush parameter actually does is:
          +   when flush is set to Z_FINISH, inflate() cannot return Z_OK.  Instead it
          +   will return Z_BUF_ERROR if it has not reached the end of the stream.
          + */
          +
          +int ZEXPORT inflate(
          +    z_streamp strm,
          +    int flush)
          +{
          +    struct inflate_state FAR *state;
          +    z_const unsigned char FAR *next;    /* next input */
          +    unsigned char FAR *put;     /* next output */
          +    unsigned have, left;        /* available input and output */
          +    unsigned long hold;         /* bit buffer */
          +    unsigned bits;              /* bits in bit buffer */
          +    unsigned in, out;           /* save starting available input and output */
          +    unsigned copy;              /* number of stored or match bytes to copy */
          +    unsigned char FAR *from;    /* where to copy match bytes from */
          +    code here;                  /* current decoding table entry */
          +    code last;                  /* parent table entry */
          +    unsigned len;               /* length to copy for repeats, bits to drop */
          +    int ret;                    /* return code */
          +#ifdef GUNZIP
          +    unsigned char hbuf[4];      /* buffer for gzip header crc calculation */
          +#endif
          +    static const unsigned short order[19] = /* permutation of code lengths */
          +        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
          +
          +    if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
          +        (strm->next_in == Z_NULL && strm->avail_in != 0))
          +        return Z_STREAM_ERROR;
          +
          +    state = (struct inflate_state FAR *)strm->state;
          +    if (state->mode == TYPE) state->mode = TYPEDO;      /* skip check */
          +    LOAD();
          +    in = have;
          +    out = left;
          +    ret = Z_OK;
          +    for (;;)
          +        switch (state->mode) {
          +        case HEAD:
          +            if (state->wrap == 0) {
          +                state->mode = TYPEDO;
          +                break;
          +            }
          +            NEEDBITS(16);
          +#ifdef GUNZIP
          +            if ((state->wrap & 2) && hold == 0x8b1f) {  /* gzip header */
          +                if (state->wbits == 0)
          +                    state->wbits = 15;
          +                state->check = crc32(0L, Z_NULL, 0);
          +                CRC2(state->check, hold);
          +                INITBITS();
          +                state->mode = FLAGS;
          +                break;
          +            }
          +            state->flags = 0;           /* expect zlib header */
          +            if (state->head != Z_NULL)
          +                state->head->done = -1;
          +            if (!(state->wrap & 1) ||   /* check if zlib header allowed */
          +#else
          +            if (
          +#endif
          +                ((BITS(8) << 8) + (hold >> 8)) % 31) {
          +                strm->msg = (char *)"incorrect header check";
          +                state->mode = BAD;
          +                break;
          +            }
          +            if (BITS(4) != Z_DEFLATED) {
          +                strm->msg = (char *)"unknown compression method";
          +                state->mode = BAD;
          +                break;
          +            }
          +            DROPBITS(4);
          +            len = BITS(4) + 8;
          +            if (state->wbits == 0)
          +                state->wbits = len;
          +            if (len > 15 || len > state->wbits) {
          +                strm->msg = (char *)"invalid window size";
          +                state->mode = BAD;
          +                break;
          +            }
          +            state->dmax = 1U << len;
          +            Tracev((stderr, "inflate:   zlib header ok\n"));
          +            strm->adler = state->check = adler32(0L, Z_NULL, 0);
          +            state->mode = hold & 0x200 ? DICTID : TYPE;
          +            INITBITS();
          +            break;
          +#ifdef GUNZIP
          +        case FLAGS:
          +            NEEDBITS(16);
          +            state->flags = (int)(hold);
          +            if ((state->flags & 0xff) != Z_DEFLATED) {
          +                strm->msg = (char *)"unknown compression method";
          +                state->mode = BAD;
          +                break;
          +            }
          +            if (state->flags & 0xe000) {
          +                strm->msg = (char *)"unknown header flags set";
          +                state->mode = BAD;
          +                break;
          +            }
          +            if (state->head != Z_NULL)
          +                state->head->text = (int)((hold >> 8) & 1);
          +            if ((state->flags & 0x0200) && (state->wrap & 4))
          +                CRC2(state->check, hold);
          +            INITBITS();
          +            state->mode = TIME;
          +        case TIME:
          +            NEEDBITS(32);
          +            if (state->head != Z_NULL)
          +                state->head->time = hold;
          +            if ((state->flags & 0x0200) && (state->wrap & 4))
          +                CRC4(state->check, hold);
          +            INITBITS();
          +            state->mode = OS;
          +        case OS:
          +            NEEDBITS(16);
          +            if (state->head != Z_NULL) {
          +                state->head->xflags = (int)(hold & 0xff);
          +                state->head->os = (int)(hold >> 8);
          +            }
          +            if ((state->flags & 0x0200) && (state->wrap & 4))
          +                CRC2(state->check, hold);
          +            INITBITS();
          +            state->mode = EXLEN;
          +        case EXLEN:
          +            if (state->flags & 0x0400) {
          +                NEEDBITS(16);
          +                state->length = (unsigned)(hold);
          +                if (state->head != Z_NULL)
          +                    state->head->extra_len = (unsigned)hold;
          +                if ((state->flags & 0x0200) && (state->wrap & 4))
          +                    CRC2(state->check, hold);
          +                INITBITS();
          +            }
          +            else if (state->head != Z_NULL)
          +                state->head->extra = Z_NULL;
          +            state->mode = EXTRA;
          +        case EXTRA:
          +            if (state->flags & 0x0400) {
          +                copy = state->length;
          +                if (copy > have) copy = have;
          +                if (copy) {
          +                    if (state->head != Z_NULL &&
          +                        state->head->extra != Z_NULL) {
          +                        len = state->head->extra_len - state->length;
          +                        zmemcpy(state->head->extra + len, next,
          +                                len + copy > state->head->extra_max ?
          +                                state->head->extra_max - len : copy);
          +                    }
          +                    if ((state->flags & 0x0200) && (state->wrap & 4))
          +                        state->check = crc32(state->check, next, copy);
          +                    have -= copy;
          +                    next += copy;
          +                    state->length -= copy;
          +                }
          +                if (state->length) goto inf_leave;
          +            }
          +            state->length = 0;
          +            state->mode = NAME;
          +        case NAME:
          +            if (state->flags & 0x0800) {
          +                if (have == 0) goto inf_leave;
          +                copy = 0;
          +                do {
          +                    len = (unsigned)(next[copy++]);
          +                    if (state->head != Z_NULL &&
          +                            state->head->name != Z_NULL &&
          +                            state->length < state->head->name_max)
          +                        state->head->name[state->length++] = (Bytef)len;
          +                } while (len && copy < have);
          +                if ((state->flags & 0x0200) && (state->wrap & 4))
          +                    state->check = crc32(state->check, next, copy);
          +                have -= copy;
          +                next += copy;
          +                if (len) goto inf_leave;
          +            }
          +            else if (state->head != Z_NULL)
          +                state->head->name = Z_NULL;
          +            state->length = 0;
          +            state->mode = COMMENT;
          +        case COMMENT:
          +            if (state->flags & 0x1000) {
          +                if (have == 0) goto inf_leave;
          +                copy = 0;
          +                do {
          +                    len = (unsigned)(next[copy++]);
          +                    if (state->head != Z_NULL &&
          +                            state->head->comment != Z_NULL &&
          +                            state->length < state->head->comm_max)
          +                        state->head->comment[state->length++] = (Bytef)len;
          +                } while (len && copy < have);
          +                if ((state->flags & 0x0200) && (state->wrap & 4))
          +                    state->check = crc32(state->check, next, copy);
          +                have -= copy;
          +                next += copy;
          +                if (len) goto inf_leave;
          +            }
          +            else if (state->head != Z_NULL)
          +                state->head->comment = Z_NULL;
          +            state->mode = HCRC;
          +        case HCRC:
          +            if (state->flags & 0x0200) {
          +                NEEDBITS(16);
          +                if ((state->wrap & 4) && hold != (state->check & 0xffff)) {
          +                    strm->msg = (char *)"header crc mismatch";
          +                    state->mode = BAD;
          +                    break;
          +                }
          +                INITBITS();
          +            }
          +            if (state->head != Z_NULL) {
          +                state->head->hcrc = (int)((state->flags >> 9) & 1);
          +                state->head->done = 1;
          +            }
          +            strm->adler = state->check = crc32(0L, Z_NULL, 0);
          +            state->mode = TYPE;
          +            break;
          +#endif
          +        case DICTID:
          +            NEEDBITS(32);
          +            strm->adler = state->check = ZSWAP32(hold);
          +            INITBITS();
          +            state->mode = DICT;
          +        case DICT:
          +            if (state->havedict == 0) {
          +                RESTORE();
          +                return Z_NEED_DICT;
          +            }
          +            strm->adler = state->check = adler32(0L, Z_NULL, 0);
          +            state->mode = TYPE;
          +        case TYPE:
          +            if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
          +        case TYPEDO:
          +            if (state->last) {
          +                BYTEBITS();
          +                state->mode = CHECK;
          +                break;
          +            }
          +            NEEDBITS(3);
          +            state->last = BITS(1);
          +            DROPBITS(1);
          +            switch (BITS(2)) {
          +            case 0:                             /* stored block */
          +                Tracev((stderr, "inflate:     stored block%s\n",
          +                        state->last ? " (last)" : ""));
          +                state->mode = STORED;
          +                break;
          +            case 1:                             /* fixed block */
          +                fixedtables(state);
          +                Tracev((stderr, "inflate:     fixed codes block%s\n",
          +                        state->last ? " (last)" : ""));
          +                state->mode = LEN_;             /* decode codes */
          +                if (flush == Z_TREES) {
          +                    DROPBITS(2);
          +                    goto inf_leave;
          +                }
          +                break;
          +            case 2:                             /* dynamic block */
          +                Tracev((stderr, "inflate:     dynamic codes block%s\n",
          +                        state->last ? " (last)" : ""));
          +                state->mode = TABLE;
          +                break;
          +            case 3:
          +                strm->msg = (char *)"invalid block type";
          +                state->mode = BAD;
          +            }
          +            DROPBITS(2);
          +            break;
          +        case STORED:
          +            BYTEBITS();                         /* go to byte boundary */
          +            NEEDBITS(32);
          +            if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
          +                strm->msg = (char *)"invalid stored block lengths";
          +                state->mode = BAD;
          +                break;
          +            }
          +            state->length = (unsigned)hold & 0xffff;
          +            Tracev((stderr, "inflate:       stored length %u\n",
          +                    state->length));
          +            INITBITS();
          +            state->mode = COPY_;
          +            if (flush == Z_TREES) goto inf_leave;
          +        case COPY_:
          +            state->mode = COPY;
          +        case COPY:
          +            copy = state->length;
          +            if (copy) {
          +                if (copy > have) copy = have;
          +                if (copy > left) copy = left;
          +                if (copy == 0) goto inf_leave;
          +                zmemcpy(put, next, copy);
          +                have -= copy;
          +                next += copy;
          +                left -= copy;
          +                put += copy;
          +                state->length -= copy;
          +                break;
          +            }
          +            Tracev((stderr, "inflate:       stored end\n"));
          +            state->mode = TYPE;
          +            break;
          +        case TABLE:
          +            NEEDBITS(14);
          +            state->nlen = BITS(5) + 257;
          +            DROPBITS(5);
          +            state->ndist = BITS(5) + 1;
          +            DROPBITS(5);
          +            state->ncode = BITS(4) + 4;
          +            DROPBITS(4);
          +#ifndef PKZIP_BUG_WORKAROUND
          +            if (state->nlen > 286 || state->ndist > 30) {
          +                strm->msg = (char *)"too many length or distance symbols";
          +                state->mode = BAD;
          +                break;
          +            }
          +#endif
          +            Tracev((stderr, "inflate:       table sizes ok\n"));
          +            state->have = 0;
          +            state->mode = LENLENS;
          +        case LENLENS:
          +            while (state->have < state->ncode) {
          +                NEEDBITS(3);
          +                state->lens[order[state->have++]] = (unsigned short)BITS(3);
          +                DROPBITS(3);
          +            }
          +            while (state->have < 19)
          +                state->lens[order[state->have++]] = 0;
          +            state->next = state->codes;
          +            state->lencode = (const code FAR *)(state->next);
          +            state->lenbits = 7;
          +            ret = inflate_table(CODES, state->lens, 19, &(state->next),
          +                                &(state->lenbits), state->work);
          +            if (ret) {
          +                strm->msg = (char *)"invalid code lengths set";
          +                state->mode = BAD;
          +                break;
          +            }
          +            Tracev((stderr, "inflate:       code lengths ok\n"));
          +            state->have = 0;
          +            state->mode = CODELENS;
          +        case CODELENS:
          +            while (state->have < state->nlen + state->ndist) {
          +                for (;;) {
          +                    here = state->lencode[BITS(state->lenbits)];
          +                    if ((unsigned)(here.bits) <= bits) break;
          +                    PULLBYTE();
          +                }
          +                if (here.val < 16) {
          +                    DROPBITS(here.bits);
          +                    state->lens[state->have++] = here.val;
          +                }
          +                else {
          +                    if (here.val == 16) {
          +                        NEEDBITS(here.bits + 2);
          +                        DROPBITS(here.bits);
          +                        if (state->have == 0) {
          +                            strm->msg = (char *)"invalid bit length repeat";
          +                            state->mode = BAD;
          +                            break;
          +                        }
          +                        len = state->lens[state->have - 1];
          +                        copy = 3 + BITS(2);
          +                        DROPBITS(2);
          +                    }
          +                    else if (here.val == 17) {
          +                        NEEDBITS(here.bits + 3);
          +                        DROPBITS(here.bits);
          +                        len = 0;
          +                        copy = 3 + BITS(3);
          +                        DROPBITS(3);
          +                    }
          +                    else {
          +                        NEEDBITS(here.bits + 7);
          +                        DROPBITS(here.bits);
          +                        len = 0;
          +                        copy = 11 + BITS(7);
          +                        DROPBITS(7);
          +                    }
          +                    if (state->have + copy > state->nlen + state->ndist) {
          +                        strm->msg = (char *)"invalid bit length repeat";
          +                        state->mode = BAD;
          +                        break;
          +                    }
          +                    while (copy--)
          +                        state->lens[state->have++] = (unsigned short)len;
          +                }
          +            }
          +
          +            /* handle error breaks in while */
          +            if (state->mode == BAD) break;
          +
          +            /* check for end-of-block code (better have one) */
          +            if (state->lens[256] == 0) {
          +                strm->msg = (char *)"invalid code -- missing end-of-block";
          +                state->mode = BAD;
          +                break;
          +            }
          +
          +            /* build code tables -- note: do not change the lenbits or distbits
          +               values here (9 and 6) without reading the comments in inftrees.h
          +               concerning the ENOUGH constants, which depend on those values */
          +            state->next = state->codes;
          +            state->lencode = (const code FAR *)(state->next);
          +            state->lenbits = 9;
          +            ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
          +                                &(state->lenbits), state->work);
          +            if (ret) {
          +                strm->msg = (char *)"invalid literal/lengths set";
          +                state->mode = BAD;
          +                break;
          +            }
          +            state->distcode = (const code FAR *)(state->next);
          +            state->distbits = 6;
          +            ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
          +                            &(state->next), &(state->distbits), state->work);
          +            if (ret) {
          +                strm->msg = (char *)"invalid distances set";
          +                state->mode = BAD;
          +                break;
          +            }
          +            Tracev((stderr, "inflate:       codes ok\n"));
          +            state->mode = LEN_;
          +            if (flush == Z_TREES) goto inf_leave;
          +        case LEN_:
          +            state->mode = LEN;
          +        case LEN:
          +            if (have >= 6 && left >= 258) {
          +                RESTORE();
          +                inflate_fast(strm, out);
          +                LOAD();
          +                if (state->mode == TYPE)
          +                    state->back = -1;
          +                break;
          +            }
          +            state->back = 0;
          +            for (;;) {
          +                here = state->lencode[BITS(state->lenbits)];
          +                if ((unsigned)(here.bits) <= bits) break;
          +                PULLBYTE();
          +            }
          +            if (here.op && (here.op & 0xf0) == 0) {
          +                last = here;
          +                for (;;) {
          +                    here = state->lencode[last.val +
          +                            (BITS(last.bits + last.op) >> last.bits)];
          +                    if ((unsigned)(last.bits + here.bits) <= bits) break;
          +                    PULLBYTE();
          +                }
          +                DROPBITS(last.bits);
          +                state->back += last.bits;
          +            }
          +            DROPBITS(here.bits);
          +            state->back += here.bits;
          +            state->length = (unsigned)here.val;
          +            if ((int)(here.op) == 0) {
          +                Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
          +                        "inflate:         literal '%c'\n" :
          +                        "inflate:         literal 0x%02x\n", here.val));
          +                state->mode = LIT;
          +                break;
          +            }
          +            if (here.op & 32) {
          +                Tracevv((stderr, "inflate:         end of block\n"));
          +                state->back = -1;
          +                state->mode = TYPE;
          +                break;
          +            }
          +            if (here.op & 64) {
          +                strm->msg = (char *)"invalid literal/length code";
          +                state->mode = BAD;
          +                break;
          +            }
          +            state->extra = (unsigned)(here.op) & 15;
          +            state->mode = LENEXT;
          +        case LENEXT:
          +            if (state->extra) {
          +                NEEDBITS(state->extra);
          +                state->length += BITS(state->extra);
          +                DROPBITS(state->extra);
          +                state->back += state->extra;
          +            }
          +            Tracevv((stderr, "inflate:         length %u\n", state->length));
          +            state->was = state->length;
          +            state->mode = DIST;
          +        case DIST:
          +            for (;;) {
          +                here = state->distcode[BITS(state->distbits)];
          +                if ((unsigned)(here.bits) <= bits) break;
          +                PULLBYTE();
          +            }
          +            if ((here.op & 0xf0) == 0) {
          +                last = here;
          +                for (;;) {
          +                    here = state->distcode[last.val +
          +                            (BITS(last.bits + last.op) >> last.bits)];
          +                    if ((unsigned)(last.bits + here.bits) <= bits) break;
          +                    PULLBYTE();
          +                }
          +                DROPBITS(last.bits);
          +                state->back += last.bits;
          +            }
          +            DROPBITS(here.bits);
          +            state->back += here.bits;
          +            if (here.op & 64) {
          +                strm->msg = (char *)"invalid distance code";
          +                state->mode = BAD;
          +                break;
          +            }
          +            state->offset = (unsigned)here.val;
          +            state->extra = (unsigned)(here.op) & 15;
          +            state->mode = DISTEXT;
          +        case DISTEXT:
          +            if (state->extra) {
          +                NEEDBITS(state->extra);
          +                state->offset += BITS(state->extra);
          +                DROPBITS(state->extra);
          +                state->back += state->extra;
          +            }
          +#ifdef INFLATE_STRICT
          +            if (state->offset > state->dmax) {
          +                strm->msg = (char *)"invalid distance too far back";
          +                state->mode = BAD;
          +                break;
          +            }
          +#endif
          +            Tracevv((stderr, "inflate:         distance %u\n", state->offset));
          +            state->mode = MATCH;
          +        case MATCH:
          +            if (left == 0) goto inf_leave;
          +            copy = out - left;
          +            if (state->offset > copy) {         /* copy from window */
          +                copy = state->offset - copy;
          +                if (copy > state->whave) {
          +                    if (state->sane) {
          +                        strm->msg = (char *)"invalid distance too far back";
          +                        state->mode = BAD;
          +                        break;
          +                    }
          +#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
          +                    Trace((stderr, "inflate.c too far\n"));
          +                    copy -= state->whave;
          +                    if (copy > state->length) copy = state->length;
          +                    if (copy > left) copy = left;
          +                    left -= copy;
          +                    state->length -= copy;
          +                    do {
          +                        *put++ = 0;
          +                    } while (--copy);
          +                    if (state->length == 0) state->mode = LEN;
          +                    break;
          +#endif
          +                }
          +                if (copy > state->wnext) {
          +                    copy -= state->wnext;
          +                    from = state->window + (state->wsize - copy);
          +                }
          +                else
          +                    from = state->window + (state->wnext - copy);
          +                if (copy > state->length) copy = state->length;
          +            }
          +            else {                              /* copy from output */
          +                from = put - state->offset;
          +                copy = state->length;
          +            }
          +            if (copy > left) copy = left;
          +            left -= copy;
          +            state->length -= copy;
          +            do {
          +                *put++ = *from++;
          +            } while (--copy);
          +            if (state->length == 0) state->mode = LEN;
          +            break;
          +        case LIT:
          +            if (left == 0) goto inf_leave;
          +            *put++ = (unsigned char)(state->length);
          +            left--;
          +            state->mode = LEN;
          +            break;
          +        case CHECK:
          +            if (state->wrap) {
          +                NEEDBITS(32);
          +                out -= left;
          +                strm->total_out += out;
          +                state->total += out;
          +                if ((state->wrap & 4) && out)
          +                    strm->adler = state->check =
          +                        UPDATE(state->check, put - out, out);
          +                out = left;
          +                if ((state->wrap & 4) && (
          +#ifdef GUNZIP
          +                     state->flags ? hold :
          +#endif
          +                     ZSWAP32(hold)) != state->check) {
          +                    strm->msg = (char *)"incorrect data check";
          +                    state->mode = BAD;
          +                    break;
          +                }
          +                INITBITS();
          +                Tracev((stderr, "inflate:   check matches trailer\n"));
          +            }
          +#ifdef GUNZIP
          +            state->mode = LENGTH;
          +        case LENGTH:
          +            if (state->wrap && state->flags) {
          +                NEEDBITS(32);
          +                if (hold != (state->total & 0xffffffffUL)) {
          +                    strm->msg = (char *)"incorrect length check";
          +                    state->mode = BAD;
          +                    break;
          +                }
          +                INITBITS();
          +                Tracev((stderr, "inflate:   length matches trailer\n"));
          +            }
          +#endif
          +            state->mode = DONE;
          +        case DONE:
          +            ret = Z_STREAM_END;
          +            goto inf_leave;
          +        case BAD:
          +            ret = Z_DATA_ERROR;
          +            goto inf_leave;
          +        case MEM:
          +            return Z_MEM_ERROR;
          +        case SYNC:
          +        default:
          +            return Z_STREAM_ERROR;
          +        }
          +
          +    /*
          +       Return from inflate(), updating the total counts and the check value.
          +       If there was no progress during the inflate() call, return a buffer
          +       error.  Call updatewindow() to create and/or update the window state.
          +       Note: a memory error from inflate() is non-recoverable.
          +     */
          +  inf_leave:
          +    RESTORE();
          +    if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
          +            (state->mode < CHECK || flush != Z_FINISH)))
          +        if (updatewindow(strm, strm->next_out, out - strm->avail_out)) {
          +            state->mode = MEM;
          +            return Z_MEM_ERROR;
          +        }
          +    in -= strm->avail_in;
          +    out -= strm->avail_out;
          +    strm->total_in += in;
          +    strm->total_out += out;
          +    state->total += out;
          +    if ((state->wrap & 4) && out)
          +        strm->adler = state->check =
          +            UPDATE(state->check, strm->next_out - out, out);
          +    strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
          +                      (state->mode == TYPE ? 128 : 0) +
          +                      (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
          +    if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
          +        ret = Z_BUF_ERROR;
          +    return ret;
          +}
          +
          +int ZEXPORT inflateEnd(
          +    z_streamp strm)
          +{
          +    struct inflate_state FAR *state;
          +    if (inflateStateCheck(strm))
          +        return Z_STREAM_ERROR;
          +    state = (struct inflate_state FAR *)strm->state;
          +    if (state->window != Z_NULL) ZFREE(strm, state->window);
          +    ZFREE(strm, strm->state);
          +    strm->state = Z_NULL;
          +    Tracev((stderr, "inflate: end\n"));
          +    return Z_OK;
          +}
          +
          +#ifndef Z_FREETYPE
          +
          +int ZEXPORT inflateGetDictionary(
          +    z_streamp strm,
          +    Bytef *dictionary,
          +    uInt *dictLength)
          +{
          +    struct inflate_state FAR *state;
          +
          +    /* check state */
          +    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
          +    state = (struct inflate_state FAR *)strm->state;
          +
          +    /* copy dictionary */
          +    if (state->whave && dictionary != Z_NULL) {
          +        zmemcpy(dictionary, state->window + state->wnext,
          +                state->whave - state->wnext);
          +        zmemcpy(dictionary + state->whave - state->wnext,
          +                state->window, state->wnext);
          +    }
          +    if (dictLength != Z_NULL)
          +        *dictLength = state->whave;
          +    return Z_OK;
          +}
          +
          +int ZEXPORT inflateSetDictionary(
          +    z_streamp strm,
          +    const Bytef *dictionary,
          +    uInt dictLength)
          +{
          +    struct inflate_state FAR *state;
          +    unsigned long dictid;
          +    int ret;
          +
          +    /* check state */
          +    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
          +    state = (struct inflate_state FAR *)strm->state;
          +    if (state->wrap != 0 && state->mode != DICT)
          +        return Z_STREAM_ERROR;
          +
          +    /* check for correct dictionary identifier */
          +    if (state->mode == DICT) {
          +        dictid = adler32(0L, Z_NULL, 0);
          +        dictid = adler32(dictid, dictionary, dictLength);
          +        if (dictid != state->check)
          +            return Z_DATA_ERROR;
          +    }
          +
          +    /* copy dictionary to window using updatewindow(), which will amend the
          +       existing dictionary if appropriate */
          +    ret = updatewindow(strm, dictionary + dictLength, dictLength);
          +    if (ret) {
          +        state->mode = MEM;
          +        return Z_MEM_ERROR;
          +    }
          +    state->havedict = 1;
          +    Tracev((stderr, "inflate:   dictionary set\n"));
          +    return Z_OK;
          +}
          +
          +int ZEXPORT inflateGetHeader(
          +    z_streamp strm,
          +    gz_headerp head)
          +{
          +    struct inflate_state FAR *state;
          +
          +    /* check state */
          +    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
          +    state = (struct inflate_state FAR *)strm->state;
          +    if ((state->wrap & 2) == 0) return Z_STREAM_ERROR;
          +
          +    /* save header structure */
          +    state->head = head;
          +    head->done = 0;
          +    return Z_OK;
          +}
          +
          +/*
          +   Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff.  Return when found
          +   or when out of input.  When called, *have is the number of pattern bytes
          +   found in order so far, in 0..3.  On return *have is updated to the new
          +   state.  If on return *have equals four, then the pattern was found and the
          +   return value is how many bytes were read including the last byte of the
          +   pattern.  If *have is less than four, then the pattern has not been found
          +   yet and the return value is len.  In the latter case, syncsearch() can be
          +   called again with more data and the *have state.  *have is initialized to
          +   zero for the first call.
          + */
          +local unsigned syncsearch(
          +    unsigned FAR *have,
          +    const unsigned char FAR *buf,
          +    unsigned len)
          +{
          +    unsigned got;
          +    unsigned next;
          +
          +    got = *have;
          +    next = 0;
          +    while (next < len && got < 4) {
          +        if ((int)(buf[next]) == (got < 2 ? 0 : 0xff))
          +            got++;
          +        else if (buf[next])
          +            got = 0;
          +        else
          +            got = 4 - got;
          +        next++;
          +    }
          +    *have = got;
          +    return next;
          +}
          +
          +int ZEXPORT inflateSync(
          +    z_streamp strm)
          +{
          +    unsigned len;               /* number of bytes to look at or looked at */
          +    unsigned long in, out;      /* temporary to save total_in and total_out */
          +    unsigned char buf[4];       /* to restore bit buffer to byte string */
          +    struct inflate_state FAR *state;
          +
          +    /* check parameters */
          +    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
          +    state = (struct inflate_state FAR *)strm->state;
          +    if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR;
          +
          +    /* if first time, start search in bit buffer */
          +    if (state->mode != SYNC) {
          +        state->mode = SYNC;
          +        state->hold <<= state->bits & 7;
          +        state->bits -= state->bits & 7;
          +        len = 0;
          +        while (state->bits >= 8) {
          +            buf[len++] = (unsigned char)(state->hold);
          +            state->hold >>= 8;
          +            state->bits -= 8;
          +        }
          +        state->have = 0;
          +        syncsearch(&(state->have), buf, len);
          +    }
          +
          +    /* search available input */
          +    len = syncsearch(&(state->have), strm->next_in, strm->avail_in);
          +    strm->avail_in -= len;
          +    strm->next_in += len;
          +    strm->total_in += len;
          +
          +    /* return no joy or set up to restart inflate() on a new block */
          +    if (state->have != 4) return Z_DATA_ERROR;
          +    in = strm->total_in;  out = strm->total_out;
          +    inflateReset(strm);
          +    strm->total_in = in;  strm->total_out = out;
          +    state->mode = TYPE;
          +    return Z_OK;
          +}
          +
          +#endif  /* !Z_FREETYPE */
          +
          +/*
          +   Returns true if inflate is currently at the end of a block generated by
          +   Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP
          +   implementation to provide an additional safety check. PPP uses
          +   Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored
          +   block. When decompressing, PPP checks that at the end of input packet,
          +   inflate is waiting for these length bytes.
          + */
          +int ZEXPORT inflateSyncPoint(
          +    z_streamp strm)
          +{
          +    struct inflate_state FAR *state;
          +
          +    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
          +    state = (struct inflate_state FAR *)strm->state;
          +    return state->mode == STORED && state->bits == 0;
          +}
          +
          +#if !Z_FREETYPE
          +
          +int ZEXPORT inflateCopy(
          +    z_streamp dest,
          +    z_streamp source)
          +{
          +    struct inflate_state FAR *state;
          +    struct inflate_state FAR *copy;
          +    unsigned char FAR *window;
          +    unsigned wsize;
          +
          +    /* check input */
          +    if (inflateStateCheck(source) || dest == Z_NULL)
          +        return Z_STREAM_ERROR;
          +    state = (struct inflate_state FAR *)source->state;
          +
          +    /* allocate space */
          +    copy = (struct inflate_state FAR *)
          +           ZALLOC(source, 1, sizeof(struct inflate_state));
          +    if (copy == Z_NULL) return Z_MEM_ERROR;
          +    window = Z_NULL;
          +    if (state->window != Z_NULL) {
          +        window = (unsigned char FAR *)
          +                 ZALLOC(source, 1U << state->wbits, sizeof(unsigned char));
          +        if (window == Z_NULL) {
          +            ZFREE(source, copy);
          +            return Z_MEM_ERROR;
          +        }
          +    }
          +
          +    /* copy state */
          +    zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream));
          +    zmemcpy((voidpf)copy, (voidpf)state, sizeof(struct inflate_state));
          +    copy->strm = dest;
          +    if (state->lencode >= state->codes &&
          +        state->lencode <= state->codes + ENOUGH - 1) {
          +        copy->lencode = copy->codes + (state->lencode - state->codes);
          +        copy->distcode = copy->codes + (state->distcode - state->codes);
          +    }
          +    copy->next = copy->codes + (state->next - state->codes);
          +    if (window != Z_NULL) {
          +        wsize = 1U << state->wbits;
          +        zmemcpy(window, state->window, wsize);
          +    }
          +    copy->window = window;
          +    dest->state = (struct internal_state FAR *)copy;
          +    return Z_OK;
          +}
          +
          +#endif  /* !Z_FREETYPE */
          +
          +int ZEXPORT inflateUndermine(
          +    z_streamp strm,
          +    int subvert)
          +{
          +    struct inflate_state FAR *state;
          +
          +    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
          +    state = (struct inflate_state FAR *)strm->state;
          +#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
          +    state->sane = !subvert;
          +    return Z_OK;
          +#else
          +    (void)subvert;
          +    state->sane = 1;
          +    return Z_DATA_ERROR;
           #endif
           }
           
          +int ZEXPORT inflateValidate(
          +    z_streamp strm,
          +    int check)
          +{
          +    struct inflate_state FAR *state;
          +
          +    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
          +    state = (struct inflate_state FAR *)strm->state;
          +    if (check)
          +        state->wrap |= 4;
          +    else
          +        state->wrap &= ~4;
          +    return Z_OK;
          +}
          +
          +#ifndef Z_FREETYPE
          +
          +long ZEXPORT inflateMark(
          +    z_streamp strm)
          +{
          +    struct inflate_state FAR *state;
          +
          +    if (inflateStateCheck(strm))
          +        return -(1L << 16);
          +    state = (struct inflate_state FAR *)strm->state;
          +    return (long)(((unsigned long)((long)state->back)) << 16) +
          +        (state->mode == COPY ? state->length :
          +            (state->mode == MATCH ? state->was - state->length : 0));
          +}
          +
          +unsigned long ZEXPORT inflateCodesUsed(
          +    z_streamp strm)
          +{
          +    struct inflate_state FAR *state;
          +    if (inflateStateCheck(strm)) return (unsigned long)-1;
          +    state = (struct inflate_state FAR *)strm->state;
          +    return (unsigned long)(state->next - state->codes);
          +}
          +
          +#endif  /* !Z_FREETYPE */
          diff --git a/thirdparty/freetype/src/gzip/inflate.h b/thirdparty/freetype/src/gzip/inflate.h
          new file mode 100644
          index 0000000000..92ea758e2d
          --- /dev/null
          +++ b/thirdparty/freetype/src/gzip/inflate.h
          @@ -0,0 +1,130 @@
          +/* inflate.h -- internal inflate state definition
          + * Copyright (C) 1995-2016 Mark Adler
          + * For conditions of distribution and use, see copyright notice in zlib.h
          + */
          +
          +#ifndef INFLATE_H
          +#define INFLATE_H
          +
          +/* WARNING: this file should *not* be used by applications. It is
          +   part of the implementation of the compression library and is
          +   subject to change. Applications should only use zlib.h.
          + */
          +
          +/* define NO_GZIP when compiling if you want to disable gzip header and
          +   trailer decoding by inflate().  NO_GZIP would be used to avoid linking in
          +   the crc code when it is not needed.  For shared libraries, gzip decoding
          +   should be left enabled. */
          +#ifndef NO_GZIP
          +#  define GUNZIP
          +#endif
          +
          +/* Possible inflate modes between inflate() calls */
          +typedef enum {
          +    HEAD = 16180,   /* i: waiting for magic header */
          +    FLAGS,      /* i: waiting for method and flags (gzip) */
          +    TIME,       /* i: waiting for modification time (gzip) */
          +    OS,         /* i: waiting for extra flags and operating system (gzip) */
          +    EXLEN,      /* i: waiting for extra length (gzip) */
          +    EXTRA,      /* i: waiting for extra bytes (gzip) */
          +    NAME,       /* i: waiting for end of file name (gzip) */
          +    COMMENT,    /* i: waiting for end of comment (gzip) */
          +    HCRC,       /* i: waiting for header crc (gzip) */
          +    DICTID,     /* i: waiting for dictionary check value */
          +    DICT,       /* waiting for inflateSetDictionary() call */
          +        TYPE,       /* i: waiting for type bits, including last-flag bit */
          +        TYPEDO,     /* i: same, but skip check to exit inflate on new block */
          +        STORED,     /* i: waiting for stored size (length and complement) */
          +        COPY_,      /* i/o: same as COPY below, but only first time in */
          +        COPY,       /* i/o: waiting for input or output to copy stored block */
          +        TABLE,      /* i: waiting for dynamic block table lengths */
          +        LENLENS,    /* i: waiting for code length code lengths */
          +        CODELENS,   /* i: waiting for length/lit and distance code lengths */
          +            LEN_,       /* i: same as LEN below, but only first time in */
          +            LEN,        /* i: waiting for length/lit/eob code */
          +            LENEXT,     /* i: waiting for length extra bits */
          +            DIST,       /* i: waiting for distance code */
          +            DISTEXT,    /* i: waiting for distance extra bits */
          +            MATCH,      /* o: waiting for output space to copy string */
          +            LIT,        /* o: waiting for output space to write literal */
          +    CHECK,      /* i: waiting for 32-bit check value */
          +    LENGTH,     /* i: waiting for 32-bit length (gzip) */
          +    DONE,       /* finished check, done -- remain here until reset */
          +    BAD,        /* got a data error -- remain here until reset */
          +    MEM,        /* got an inflate() memory error -- remain here until reset */
          +    SYNC        /* looking for synchronization bytes to restart inflate() */
          +} inflate_mode;
          +
          +/*
          +    State transitions between above modes -
          +
          +    (most modes can go to BAD or MEM on error -- not shown for clarity)
          +
          +    Process header:
          +        HEAD -> (gzip) or (zlib) or (raw)
          +        (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT ->
          +                  HCRC -> TYPE
          +        (zlib) -> DICTID or TYPE
          +        DICTID -> DICT -> TYPE
          +        (raw) -> TYPEDO
          +    Read deflate blocks:
          +            TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK
          +            STORED -> COPY_ -> COPY -> TYPE
          +            TABLE -> LENLENS -> CODELENS -> LEN_
          +            LEN_ -> LEN
          +    Read deflate codes in fixed or dynamic block:
          +                LEN -> LENEXT or LIT or TYPE
          +                LENEXT -> DIST -> DISTEXT -> MATCH -> LEN
          +                LIT -> LEN
          +    Process trailer:
          +        CHECK -> LENGTH -> DONE
          + */
          +
          +/* State maintained between inflate() calls -- approximately 7K bytes, not
          +   including the allocated sliding window, which is up to 32K bytes. */
          +struct inflate_state {
          +    z_streamp strm;             /* pointer back to this zlib stream */
          +    inflate_mode mode;          /* current inflate mode */
          +    int last;                   /* true if processing last block */
          +    int wrap;                   /* bit 0 true for zlib, bit 1 true for gzip,
          +                                   bit 2 true to validate check value */
          +    int havedict;               /* true if dictionary provided */
          +    int flags;                  /* gzip header method and flags (0 if zlib) */
          +    unsigned dmax;              /* zlib header max distance (INFLATE_STRICT) */
          +    unsigned long check;        /* protected copy of check value */
          +    unsigned long total;        /* protected copy of output count */
          +    gz_headerp head;            /* where to save gzip header information */
          +        /* sliding window */
          +    unsigned wbits;             /* log base 2 of requested window size */
          +    unsigned wsize;             /* window size or zero if not using window */
          +    unsigned whave;             /* valid bytes in the window */
          +    unsigned wnext;             /* window write index */
          +    unsigned char FAR *window;  /* allocated sliding window, if needed */
          +        /* bit accumulator */
          +    unsigned long hold;         /* input bit accumulator */
          +    unsigned bits;              /* number of bits in "in" */
          +        /* for string and stored block copying */
          +    unsigned length;            /* literal or length of data to copy */
          +    unsigned offset;            /* distance back to copy string from */
          +        /* for table and code decoding */
          +    unsigned extra;             /* extra bits needed */
          +        /* fixed and dynamic code tables */
          +    code const FAR *lencode;    /* starting table for length/literal codes */
          +    code const FAR *distcode;   /* starting table for distance codes */
          +    unsigned lenbits;           /* index bits for lencode */
          +    unsigned distbits;          /* index bits for distcode */
          +        /* dynamic table building */
          +    unsigned ncode;             /* number of code length code lengths */
          +    unsigned nlen;              /* number of length code lengths */
          +    unsigned ndist;             /* number of distance code lengths */
          +    unsigned have;              /* number of code lengths in lens[] */
          +    code FAR *next;             /* next available space in codes[] */
          +    unsigned short lens[320];   /* temporary storage for code lengths */
          +    unsigned short work[288];   /* work area for code table building */
          +    code codes[ENOUGH];         /* space for code tables */
          +    int sane;                   /* if false, allow invalid distance too far */
          +    int back;                   /* bits back of last unprocessed length/lit */
          +    unsigned was;               /* initial length of match */
          +};
          +
          +#endif  /* INFLATE_H */
          diff --git a/thirdparty/freetype/src/gzip/inftrees.c b/thirdparty/freetype/src/gzip/inftrees.c
          index 56f52b1701..c917e3de75 100644
          --- a/thirdparty/freetype/src/gzip/inftrees.c
          +++ b/thirdparty/freetype/src/gzip/inftrees.c
          @@ -1,20 +1,15 @@
           /* inftrees.c -- generate Huffman trees for efficient decoding
          - * Copyright (C) 1995-2002 Mark Adler
          + * Copyright (C) 1995-2017 Mark Adler
            * For conditions of distribution and use, see copyright notice in zlib.h
            */
           
           #include "zutil.h"
           #include "inftrees.h"
           
          -#if !defined(BUILDFIXED) && !defined(STDC)
          -#  define BUILDFIXED   /* non ANSI compilers may not accept inffixed.h */
          -#endif
          +#define MAXBITS 15
           
          -
          -#if 0
          -local const char inflate_copyright[] =
          -   " inflate 1.1.4 Copyright 1995-2002 Mark Adler ";
          -#endif
          +const char inflate_copyright[] =
          +   " inflate 1.2.11 Copyright 1995-2017 Mark Adler ";
           /*
             If you use the zlib library in a product, an acknowledgment is welcome
             in the documentation of your product. If for some reason you cannot
          @@ -22,447 +17,288 @@ local const char inflate_copyright[] =
             copyright string in the executable of your product.
            */
           
          -/* simplify the use of the inflate_huft type with some defines */
          -#define exop word.what.Exop
          -#define bits word.what.Bits
          -
          -
          -local int huft_build OF((
          -    uIntf *,            /* code lengths in bits */
          -    uInt,               /* number of codes */
          -    uInt,               /* number of "simple" codes */
          -    const uIntf *,      /* list of base values for non-simple codes */
          -    const uIntf *,      /* list of extra bits for non-simple codes */
          -    inflate_huft * FAR*,/* result: starting table */
          -    uIntf *,            /* maximum lookup bits (returns actual) */
          -    inflate_huft *,     /* space for trees */
          -    uInt *,             /* hufts used in space */
          -    uIntf * ));         /* space for values */
          -
          -/* Tables for deflate from PKZIP's appnote.txt. */
          -local const uInt cplens[31] = { /* Copy lengths for literal codes 257..285 */
          +/*
          +   Build a set of tables to decode the provided canonical Huffman code.
          +   The code lengths are lens[0..codes-1].  The result starts at *table,
          +   whose indices are 0..2^bits-1.  work is a writable array of at least
          +   lens shorts, which is used as a work area.  type is the type of code
          +   to be generated, CODES, LENS, or DISTS.  On return, zero is success,
          +   -1 is an invalid code, and +1 means that ENOUGH isn't enough.  table
          +   on return points to the next available entry's address.  bits is the
          +   requested root table index bits, and on return it is the actual root
          +   table index bits.  It will differ if the request is greater than the
          +   longest code or if it is less than the shortest code.
          + */
          +int ZLIB_INTERNAL inflate_table(
          +    codetype type,
          +    unsigned short FAR *lens,
          +    unsigned codes,
          +    code FAR * FAR *table,
          +    unsigned FAR *bits,
          +    unsigned short FAR *work)
          +{
          +    unsigned len;               /* a code's length in bits */
          +    unsigned sym;               /* index of code symbols */
          +    unsigned min, max;          /* minimum and maximum code lengths */
          +    unsigned root;              /* number of index bits for root table */
          +    unsigned curr;              /* number of index bits for current table */
          +    unsigned drop;              /* code bits to drop for sub-table */
          +    int left;                   /* number of prefix codes available */
          +    unsigned used;              /* code entries in table used */
          +    unsigned huff;              /* Huffman code */
          +    unsigned incr;              /* for incrementing code, index */
          +    unsigned fill;              /* index for replicating entries */
          +    unsigned low;               /* low bits for current root entry */
          +    unsigned mask;              /* mask for low root bits */
          +    code here;                  /* table entry for duplication */
          +    code FAR *next;             /* next available space in table */
          +    const unsigned short FAR *base;     /* base value table to use */
          +    const unsigned short FAR *extra;    /* extra bits table to use */
          +    unsigned match;             /* use base and extra for symbol >= match */
          +    unsigned short count[MAXBITS+1];    /* number of codes of each length */
          +    unsigned short offs[MAXBITS+1];     /* offsets in table for each length */
          +    static const unsigned short lbase[31] = { /* Length codes 257..285 base */
                   3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
                   35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
          -        /* see note #13 above about 258 */
          -local const uInt cplext[31] = { /* Extra bits for literal codes 257..285 */
          -        0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
          -        3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 112, 112}; /* 112==invalid */
          -local const uInt cpdist[30] = { /* Copy offsets for distance codes 0..29 */
          +    static const unsigned short lext[31] = { /* Length codes 257..285 extra */
          +        16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
          +        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 77, 202};
          +    static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
                   1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
                   257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
          -        8193, 12289, 16385, 24577};
          -local const uInt cpdext[30] = { /* Extra bits for distance codes */
          -        0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
          -        7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
          -        12, 12, 13, 13};
          +        8193, 12289, 16385, 24577, 0, 0};
          +    static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
          +        16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
          +        23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
          +        28, 28, 29, 29, 64, 64};
           
          -/*
          -   Huffman code decoding is performed using a multi-level table lookup.
          -   The fastest way to decode is to simply build a lookup table whose
          -   size is determined by the longest code.  However, the time it takes
          -   to build this table can also be a factor if the data being decoded
          -   is not very long.  The most common codes are necessarily the
          -   shortest codes, so those codes dominate the decoding time, and hence
          -   the speed.  The idea is you can have a shorter table that decodes the
          -   shorter, more probable codes, and then point to subsidiary tables for
          -   the longer codes.  The time it costs to decode the longer codes is
          -   then traded against the time it takes to make longer tables.
          +    /*
          +       Process a set of code lengths to create a canonical Huffman code.  The
          +       code lengths are lens[0..codes-1].  Each length corresponds to the
          +       symbols 0..codes-1.  The Huffman code is generated by first sorting the
          +       symbols by length from short to long, and retaining the symbol order
          +       for codes with equal lengths.  Then the code starts with all zero bits
          +       for the first code of the shortest length, and the codes are integer
          +       increments for the same length, and zeros are appended as the length
          +       increases.  For the deflate format, these bits are stored backwards
          +       from their more natural integer increment ordering, and so when the
          +       decoding tables are built in the large loop below, the integer codes
          +       are incremented backwards.
           
          -   This results of this trade are in the variables lbits and dbits
          -   below.  lbits is the number of bits the first level table for literal/
          -   length codes can decode in one step, and dbits is the same thing for
          -   the distance codes.  Subsequent tables are also less than or equal to
          -   those sizes.  These values may be adjusted either when all of the
          -   codes are shorter than that, in which case the longest code length in
          -   bits is used, or when the shortest code is *longer* than the requested
          -   table size, in which case the length of the shortest code in bits is
          -   used.
          +       This routine assumes, but does not check, that all of the entries in
          +       lens[] are in the range 0..MAXBITS.  The caller must assure this.
          +       1..MAXBITS is interpreted as that code length.  zero means that that
          +       symbol does not occur in this code.
           
          -   There are two different values for the two tables, since they code a
          -   different number of possibilities each.  The literal/length table
          -   codes 286 possible values, or in a flat code, a little over eight
          -   bits.  The distance table codes 30 possible values, or a little less
          -   than five bits, flat.  The optimum values for speed end up being
          -   about one bit more than those, so lbits is 8+1 and dbits is 5+1.
          -   The optimum values may differ though from machine to machine, and
          -   possibly even between compilers.  Your mileage may vary.
          - */
          +       The codes are sorted by computing a count of codes for each length,
          +       creating from that a table of starting indices for each length in the
          +       sorted table, and then entering the symbols in order in the sorted
          +       table.  The sorted table is work[], with that space being provided by
          +       the caller.
           
          +       The length counts are used for other purposes as well, i.e. finding
          +       the minimum and maximum length codes, determining if there are any
          +       codes at all, checking for a valid set of lengths, and looking ahead
          +       at length counts to determine sub-table sizes when building the
          +       decoding tables.
          +     */
           
          -/* If BMAX needs to be larger than 16, then h and x[] should be uLong. */
          -#define BMAX 15         /* maximum bit length of any code */
          +    /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
          +    for (len = 0; len <= MAXBITS; len++)
          +        count[len] = 0;
          +    for (sym = 0; sym < codes; sym++)
          +        count[lens[sym]]++;
           
          -local int huft_build( /* b, n, s, d, e, t, m, hp, hn, v) */
          -uIntf *b,               /* code lengths in bits (all assumed <= BMAX) */
          -uInt n,                 /* number of codes (assumed <= 288) */
          -uInt s,                 /* number of simple-valued codes (0..s-1) */
          -const uIntf *d,         /* list of base values for non-simple codes */
          -const uIntf *e,         /* list of extra bits for non-simple codes */
          -inflate_huft * FAR *t,  /* result: starting table */
          -uIntf *m,               /* maximum lookup bits, returns actual */
          -inflate_huft *hp,       /* space for trees */
          -uInt *hn,               /* hufts used in space */
          -uIntf *v                /* working area: values in order of bit length */
          -/* Given a list of code lengths and a maximum table size, make a set of
          -   tables to decode that set of codes.  Return Z_OK on success, Z_BUF_ERROR
          -   if the given code set is incomplete (the tables are still built in this
          -   case), or Z_DATA_ERROR if the input is invalid. */
          -)
          -{
          +    /* bound code lengths, force root to be within code lengths */
          +    root = *bits;
          +    for (max = MAXBITS; max >= 1; max--)
          +        if (count[max] != 0) break;
          +    if (root > max) root = max;
          +    if (max == 0) {                     /* no symbols to code at all */
          +        here.op = (unsigned char)64;    /* invalid code marker */
          +        here.bits = (unsigned char)1;
          +        here.val = (unsigned short)0;
          +        *(*table)++ = here;             /* make a table to force an error */
          +        *(*table)++ = here;
          +        *bits = 1;
          +        return 0;     /* no symbols, but wait for decoding to report error */
          +    }
          +    for (min = 1; min < max; min++)
          +        if (count[min] != 0) break;
          +    if (root < min) root = min;
           
          -  uInt a;                       /* counter for codes of length k */
          -  uInt c[BMAX+1];               /* bit length count table */
          -  uInt f;                       /* i repeats in table every f entries */
          -  int g;                        /* maximum code length */
          -  int h;                        /* table level */
          -  uInt i;                       /* counter, current code */
          -  uInt j;                       /* counter */
          -  int k;                        /* number of bits in current code */
          -  int l;                        /* bits per table (returned in m) */
          -  uInt mask;                    /* (1 << w) - 1, to avoid cc -O bug on HP */
          -  uIntf *p;                     /* pointer into c[], b[], or v[] */
          -  inflate_huft *q;              /* points to current table */
          -  struct inflate_huft_s r;      /* table entry for structure assignment */
          -  inflate_huft *u[BMAX];        /* table stack */
          -  int w;                        /* bits before this table == (l * h) */
          -  uInt x[BMAX+1];               /* bit offsets, then code stack */
          -  uIntf *xp;                    /* pointer into x */
          -  int y;                        /* number of dummy codes added */
          -  uInt z;                       /* number of entries in current table */
          +    /* check for an over-subscribed or incomplete set of lengths */
          +    left = 1;
          +    for (len = 1; len <= MAXBITS; len++) {
          +        left <<= 1;
          +        left -= count[len];
          +        if (left < 0) return -1;        /* over-subscribed */
          +    }
          +    if (left > 0 && (type == CODES || max != 1))
          +        return -1;                      /* incomplete set */
           
          +    /* generate offsets into symbol table for each length for sorting */
          +    offs[1] = 0;
          +    for (len = 1; len < MAXBITS; len++)
          +        offs[len + 1] = offs[len] + count[len];
           
          -  /* Make compiler happy */
          -  r.base = 0;
          +    /* sort symbols by length, by symbol order within each length */
          +    for (sym = 0; sym < codes; sym++)
          +        if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
           
          -  /* Generate counts for each bit length */
          -  p = c;
          -#define C0 *p++ = 0;
          -#define C2 C0 C0 C0 C0
          -#define C4 C2 C2 C2 C2
          -  C4                            /* clear c[]--assume BMAX+1 is 16 */
          -  p = b;  i = n;
          -  do {
          -    c[*p++]++;                  /* assume all entries <= BMAX */
          -  } while (--i);
          -  if (c[0] == n)                /* null input--all zero length codes */
          -  {
          -    *t = (inflate_huft *)Z_NULL;
          -    *m = 0;
          -    return Z_OK;
          -  }
          +    /*
          +       Create and fill in decoding tables.  In this loop, the table being
          +       filled is at next and has curr index bits.  The code being used is huff
          +       with length len.  That code is converted to an index by dropping drop
          +       bits off of the bottom.  For codes where len is less than drop + curr,
          +       those top drop + curr - len bits are incremented through all values to
          +       fill the table with replicated entries.
           
          +       root is the number of index bits for the root table.  When len exceeds
          +       root, sub-tables are created pointed to by the root entry with an index
          +       of the low root bits of huff.  This is saved in low to check for when a
          +       new sub-table should be started.  drop is zero when the root table is
          +       being filled, and drop is root when sub-tables are being filled.
           
          -  /* Find minimum and maximum length, bound *m by those */
          -  l = *m;
          -  for (j = 1; j <= BMAX; j++)
          -    if (c[j])
          -      break;
          -  k = j;                        /* minimum code length */
          -  if ((uInt)l < j)
          -    l = j;
          -  for (i = BMAX; i; i--)
          -    if (c[i])
          -      break;
          -  g = i;                        /* maximum code length */
          -  if ((uInt)l > i)
          -    l = i;
          -  *m = l;
          +       When a new sub-table is needed, it is necessary to look ahead in the
          +       code lengths to determine what size sub-table is needed.  The length
          +       counts are used for this, and so count[] is decremented as codes are
          +       entered in the tables.
           
          +       used keeps track of how many table entries have been allocated from the
          +       provided *table space.  It is checked for LENS and DIST tables against
          +       the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
          +       the initial root table size constants.  See the comments in inftrees.h
          +       for more information.
           
          -  /* Adjust last length count to fill out codes, if needed */
          -  for (y = 1 << j; j < i; j++, y <<= 1)
          -    if ((y -= c[j]) < 0)
          -      return Z_DATA_ERROR;
          -  if ((y -= c[i]) < 0)
          -    return Z_DATA_ERROR;
          -  c[i] += y;
          +       sym increments through all symbols, and the loop terminates when
          +       all codes of length max, i.e. all codes, have been processed.  This
          +       routine permits incomplete codes, so another loop after this one fills
          +       in the rest of the decoding tables with invalid code markers.
          +     */
           
          +    /* set up for code type */
          +    switch (type) {
          +    case CODES:
          +        base = extra = work;    /* dummy value--not used */
          +        match = 20;
          +        break;
          +    case LENS:
          +        base = lbase;
          +        extra = lext;
          +        match = 257;
          +        break;
          +    default:    /* DISTS */
          +        base = dbase;
          +        extra = dext;
          +        match = 0;
          +    }
           
          -  /* Generate starting offsets into the value table for each length */
          -  x[1] = j = 0;
          -  p = c + 1;  xp = x + 2;
          -  while (--i) {                 /* note that i == g from above */
          -    *xp++ = (j += *p++);
          -  }
          +    /* initialize state for loop */
          +    huff = 0;                   /* starting code */
          +    sym = 0;                    /* starting code symbol */
          +    len = min;                  /* starting code length */
          +    next = *table;              /* current table to fill in */
          +    curr = root;                /* current table index bits */
          +    drop = 0;                   /* current bits to drop from code for index */
          +    low = (unsigned)(-1);       /* trigger new sub-table when len > root */
          +    used = 1U << root;          /* use root table entries */
          +    mask = used - 1;            /* mask for comparing low */
           
          +    /* check available table space */
          +    if ((type == LENS && used > ENOUGH_LENS) ||
          +        (type == DISTS && used > ENOUGH_DISTS))
          +        return 1;
           
          -  /* Make a table of values in order of bit lengths */
          -  p = b;  i = 0;
          -  do {
          -    if ((j = *p++) != 0)
          -      v[x[j]++] = i;
          -  } while (++i < n);
          -  n = x[g];                     /* set n to length of v */
          -
          -
          -  /* Generate the Huffman codes and for each, make the table entries */
          -  x[0] = i = 0;                 /* first Huffman code is zero */
          -  p = v;                        /* grab values in bit order */
          -  h = -1;                       /* no tables yet--level -1 */
          -  w = -l;                       /* bits decoded == (l * h) */
          -  u[0] = (inflate_huft *)Z_NULL;        /* just to keep compilers happy */
          -  q = (inflate_huft *)Z_NULL;   /* ditto */
          -  z = 0;                        /* ditto */
          -
          -  /* go through the bit lengths (k already is bits in shortest code) */
          -  for (; k <= g; k++)
          -  {
          -    a = c[k];
          -    while (a--)
          -    {
          -      /* here i is the Huffman code of length k bits for value *p */
          -      /* make tables up to required level */
          -      while (k > w + l)
          -      {
          -        h++;
          -        w += l;                 /* previous table always l bits */
          -
          -        /* compute minimum size table less than or equal to l bits */
          -        z = g - w;
          -        z = z > (uInt)l ? (uInt)l : z;        /* table size upper limit */
          -        if ((f = 1 << (j = k - w)) > a + 1)     /* try a k-w bit table */
          -        {                       /* too few codes for k-w bit table */
          -          f -= a + 1;           /* deduct codes from patterns left */
          -          xp = c + k;
          -          if (j < z)
          -            while (++j < z)     /* try smaller tables up to z bits */
          -            {
          -              if ((f <<= 1) <= *++xp)
          -                break;          /* enough codes to use up j bits */
          -              f -= *xp;         /* else deduct codes from patterns */
          -            }
          +    /* process all codes and make table entries */
          +    for (;;) {
          +        /* create table entry */
          +        here.bits = (unsigned char)(len - drop);
          +        if (work[sym] + 1U < match) {
          +            here.op = (unsigned char)0;
          +            here.val = work[sym];
          +        }
          +        else if (work[sym] >= match) {
          +            here.op = (unsigned char)(extra[work[sym] - match]);
          +            here.val = base[work[sym] - match];
          +        }
          +        else {
          +            here.op = (unsigned char)(32 + 64);         /* end of block */
          +            here.val = 0;
                   }
          -        z = 1 << j;             /* table entries for j-bit table */
           
          -        /* allocate new table */
          -        if (*hn + z > MANY)     /* (note: doesn't matter for fixed) */
          -          return Z_DATA_ERROR;  /* overflow of MANY */
          -        u[h] = q = hp + *hn;
          -        *hn += z;
          +        /* replicate for those indices with low len bits equal to huff */
          +        incr = 1U << (len - drop);
          +        fill = 1U << curr;
          +        min = fill;                 /* save offset to next table */
          +        do {
          +            fill -= incr;
          +            next[(huff >> drop) + fill] = here;
          +        } while (fill != 0);
           
          -        /* connect to last table, if there is one */
          -        if (h)
          -        {
          -          x[h] = i;             /* save pattern for backing up */
          -          r.bits = (Byte)l;     /* bits to dump before this table */
          -          r.exop = (Byte)j;     /* bits in this table */
          -          j = i >> (w - l);
          -          r.base = (uInt)(q - u[h-1] - j);   /* offset to this table */
          -          u[h-1][j] = r;        /* connect to last table */
          +        /* backwards increment the len-bit code huff */
          +        incr = 1U << (len - 1);
          +        while (huff & incr)
          +            incr >>= 1;
          +        if (incr != 0) {
          +            huff &= incr - 1;
          +            huff += incr;
                   }
                   else
          -          *t = q;               /* first table is returned result */
          -      }
          +            huff = 0;
           
          -      /* set up table entry in r */
          -      r.bits = (Byte)(k - w);
          -      if (p >= v + n)
          -        r.exop = 128 + 64;      /* out of values--invalid code */
          -      else if (*p < s)
          -      {
          -        r.exop = (Byte)(*p < 256 ? 0 : 32 + 64);     /* 256 is end-of-block */
          -        r.base = *p++;          /* simple code is just the value */
          -      }
          -      else
          -      {
          -        r.exop = (Byte)(e[*p - s] + 16 + 64);/* non-simple--look up in lists */
          -        r.base = d[*p++ - s];
          -      }
          +        /* go to next symbol, update count, len */
          +        sym++;
          +        if (--(count[len]) == 0) {
          +            if (len == max) break;
          +            len = lens[work[sym]];
          +        }
           
          -      /* fill code-like entries with r */
          -      f = 1 << (k - w);
          -      for (j = i >> w; j < z; j += f)
          -        q[j] = r;
          +        /* create new sub-table if needed */
          +        if (len > root && (huff & mask) != low) {
          +            /* if first time, transition to sub-tables */
          +            if (drop == 0)
          +                drop = root;
           
          -      /* backwards increment the k-bit code i */
          -      for (j = 1 << (k - 1); i & j; j >>= 1)
          -        i ^= j;
          -      i ^= j;
          +            /* increment past last table */
          +            next += min;            /* here min is 1 << curr */
           
          -      /* backup over finished tables */
          -      mask = (1 << w) - 1;      /* needed on HP, cc -O bug */
          -      while ((i & mask) != x[h])
          -      {
          -        h--;                    /* don't need to update q */
          -        w -= l;
          -        mask = (1 << w) - 1;
          -      }
          +            /* determine length of next table */
          +            curr = len - drop;
          +            left = (int)(1 << curr);
          +            while (curr + drop < max) {
          +                left -= count[curr + drop];
          +                if (left <= 0) break;
          +                curr++;
          +                left <<= 1;
          +            }
          +
          +            /* check for enough space */
          +            used += 1U << curr;
          +            if ((type == LENS && used > ENOUGH_LENS) ||
          +                (type == DISTS && used > ENOUGH_DISTS))
          +                return 1;
          +
          +            /* point entry in root table to sub-table */
          +            low = huff & mask;
          +            (*table)[low].op = (unsigned char)curr;
          +            (*table)[low].bits = (unsigned char)root;
          +            (*table)[low].val = (unsigned short)(next - *table);
          +        }
               }
          -  }
           
          +    /* fill in remaining table entry if code is incomplete (guaranteed to have
          +       at most one remaining entry, since if the code is incomplete, the
          +       maximum code length that was allowed to get this far is one bit) */
          +    if (huff != 0) {
          +        here.op = (unsigned char)64;            /* invalid code marker */
          +        here.bits = (unsigned char)(len - drop);
          +        here.val = (unsigned short)0;
          +        next[huff] = here;
          +    }
           
          -  /* Return Z_BUF_ERROR if we were given an incomplete table */
          -  return y != 0 && g != 1 ? Z_BUF_ERROR : Z_OK;
          -}
          -
          -
          -local int inflate_trees_bits( /* c, bb, tb, hp, z) */
          -uIntf *c,               /* 19 code lengths */
          -uIntf *bb,              /* bits tree desired/actual depth */
          -inflate_huft * FAR *tb, /* bits tree result */
          -inflate_huft *hp,       /* space for trees */
          -z_streamp z             /* for messages */
          -)
          -{
          -  int r;
          -  uInt hn = 0;          /* hufts used in space */
          -  uIntf *v;             /* work area for huft_build */
          -
          -  if ((v = (uIntf*)ZALLOC(z, 19, sizeof(uInt))) == Z_NULL)
          -    return Z_MEM_ERROR;
          -  r = huft_build(c, 19, 19, (uIntf*)Z_NULL, (uIntf*)Z_NULL,
          -                 tb, bb, hp, &hn, v);
          -  if (r == Z_DATA_ERROR)
          -    z->msg = (char*)"oversubscribed dynamic bit lengths tree";
          -  else if (r == Z_BUF_ERROR || *bb == 0)
          -  {
          -    z->msg = (char*)"incomplete dynamic bit lengths tree";
          -    r = Z_DATA_ERROR;
          -  }
          -  ZFREE(z, v);
          -  return r;
          -}
          -
          -
          -local int inflate_trees_dynamic( /* nl, nd, c, bl, bd, tl, td, hp, z) */
          -uInt nl,                /* number of literal/length codes */
          -uInt nd,                /* number of distance codes */
          -uIntf *c,               /* that many (total) code lengths */
          -uIntf *bl,              /* literal desired/actual bit depth */
          -uIntf *bd,              /* distance desired/actual bit depth */
          -inflate_huft * FAR *tl, /* literal/length tree result */
          -inflate_huft * FAR *td, /* distance tree result */
          -inflate_huft *hp,       /* space for trees */
          -z_streamp z             /* for messages */
          -)
          -{
          -  int r;
          -  uInt hn = 0;          /* hufts used in space */
          -  uIntf *v;             /* work area for huft_build */
          -
          -  /* allocate work area */
          -  if ((v = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL)
          -    return Z_MEM_ERROR;
          -
          -  /* build literal/length tree */
          -  r = huft_build(c, nl, 257, cplens, cplext, tl, bl, hp, &hn, v);
          -  if (r != Z_OK || *bl == 0)
          -  {
          -    if (r == Z_DATA_ERROR)
          -      z->msg = (char*)"oversubscribed literal/length tree";
          -    else if (r != Z_MEM_ERROR)
          -    {
          -      z->msg = (char*)"incomplete literal/length tree";
          -      r = Z_DATA_ERROR;
          -    }
          -    ZFREE(z, v);
          -    return r;
          -  }
          -
          -  /* build distance tree */
          -  r = huft_build(c + nl, nd, 0, cpdist, cpdext, td, bd, hp, &hn, v);
          -  if (r != Z_OK || (*bd == 0 && nl > 257))
          -  {
          -    if (r == Z_DATA_ERROR)
          -      z->msg = (char*)"oversubscribed distance tree";
          -    else if (r == Z_BUF_ERROR) {
          -#if 0
          -    {
          -#endif
          -#ifdef PKZIP_BUG_WORKAROUND
          -      r = Z_OK;
          -    }
          -#else
          -      z->msg = (char*)"incomplete distance tree";
          -      r = Z_DATA_ERROR;
          -    }
          -    else if (r != Z_MEM_ERROR)
          -    {
          -      z->msg = (char*)"empty distance tree with lengths";
          -      r = Z_DATA_ERROR;
          -    }
          -    ZFREE(z, v);
          -    return r;
          -#endif
          -  }
          -
          -  /* done */
          -  ZFREE(z, v);
          -  return Z_OK;
          -}
          -
          -
          -/* build fixed tables only once--keep them here */
          -#ifdef BUILDFIXED
          -local int fixed_built = 0;
          -#define FIXEDH 544      /* number of hufts used by fixed tables */
          -local inflate_huft fixed_mem[FIXEDH];
          -local uInt fixed_bl;
          -local uInt fixed_bd;
          -local inflate_huft *fixed_tl;
          -local inflate_huft *fixed_td;
          -#else
          -#include "inffixed.h"
          -#endif
          -
          -
          -local int inflate_trees_fixed( /* bl, bd, tl, td, z) */
          -uIntf *bl,                      /* literal desired/actual bit depth */
          -uIntf *bd,                      /* distance desired/actual bit depth */
          -const inflate_huft * FAR *tl,   /* literal/length tree result */
          -const inflate_huft * FAR *td,   /* distance tree result */
          -z_streamp z                     /* for memory allocation */
          -)
          -{
          -#ifdef BUILDFIXED
          -  /* build fixed tables if not already */
          -  if (!fixed_built)
          -  {
          -    int k;              /* temporary variable */
          -    uInt f = 0;         /* number of hufts used in fixed_mem */
          -    uIntf *c;           /* length list for huft_build */
          -    uIntf *v;           /* work area for huft_build */
          -
          -    /* allocate memory */
          -    if ((c = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL)
          -      return Z_MEM_ERROR;
          -    if ((v = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL)
          -    {
          -      ZFREE(z, c);
          -      return Z_MEM_ERROR;
          -    }
          -
          -    /* literal table */
          -    for (k = 0; k < 144; k++)
          -      c[k] = 8;
          -    for (; k < 256; k++)
          -      c[k] = 9;
          -    for (; k < 280; k++)
          -      c[k] = 7;
          -    for (; k < 288; k++)
          -      c[k] = 8;
          -    fixed_bl = 9;
          -    huft_build(c, 288, 257, cplens, cplext, &fixed_tl, &fixed_bl,
          -               fixed_mem, &f, v);
          -
          -    /* distance table */
          -    for (k = 0; k < 30; k++)
          -      c[k] = 5;
          -    fixed_bd = 5;
          -    huft_build(c, 30, 0, cpdist, cpdext, &fixed_td, &fixed_bd,
          -               fixed_mem, &f, v);
          -
          -    /* done */
          -    ZFREE(z, v);
          -    ZFREE(z, c);
          -    fixed_built = 1;
          -  }
          -#else
          -  FT_UNUSED(z);
          -#endif
          -  *bl = fixed_bl;
          -  *bd = fixed_bd;
          -  *tl = fixed_tl;
          -  *td = fixed_td;
          -  return Z_OK;
          +    /* set return parameters */
          +    *table += used;
          +    *bits = root;
          +    return 0;
           }
          diff --git a/thirdparty/freetype/src/gzip/inftrees.h b/thirdparty/freetype/src/gzip/inftrees.h
          index 07bf2aa0bf..c94eb78b5d 100644
          --- a/thirdparty/freetype/src/gzip/inftrees.h
          +++ b/thirdparty/freetype/src/gzip/inftrees.h
          @@ -1,63 +1,67 @@
           /* inftrees.h -- header to use inftrees.c
          - * Copyright (C) 1995-2002 Mark Adler
          + * Copyright (C) 1995-2005, 2010 Mark Adler
            * For conditions of distribution and use, see copyright notice in zlib.h
            */
           
          +#ifndef INFTREES_H
          +#define INFTREES_H
          +
           /* WARNING: this file should *not* be used by applications. It is
              part of the implementation of the compression library and is
              subject to change. Applications should only use zlib.h.
            */
           
          -/* Huffman code lookup table entry--this entry is four bytes for machines
          -   that have 16-bit pointers (e.g. PC's in the small or medium model). */
          +/* Structure for decoding tables.  Each entry provides either the
          +   information needed to do the operation requested by the code that
          +   indexed that table entry, or it provides a pointer to another
          +   table that indexes more bits of the code.  op indicates whether
          +   the entry is a pointer to another table, a literal, a length or
          +   distance, an end-of-block, or an invalid code.  For a table
          +   pointer, the low four bits of op is the number of index bits of
          +   that table.  For a length or distance, the low four bits of op
          +   is the number of extra bits to get after the code.  bits is
          +   the number of bits in this code or part of the code to drop off
          +   of the bit buffer.  val is the actual byte to output in the case
          +   of a literal, the base length or distance, or the offset from
          +   the current table to the next table.  Each entry is four bytes. */
          +typedef struct {
          +    unsigned char op;           /* operation, extra bits, table bits */
          +    unsigned char bits;         /* bits in this part of the code */
          +    unsigned short val;         /* offset in table or code value */
          +} code;
           
          -#ifndef _INFTREES_H
          -#define _INFTREES_H
          +/* op values as set by inflate_table():
          +    00000000 - literal
          +    0000tttt - table link, tttt != 0 is the number of table index bits
          +    0001eeee - length or distance, eeee is the number of extra bits
          +    01100000 - end of block
          +    01000000 - invalid code
          + */
           
          -typedef struct inflate_huft_s FAR inflate_huft;
          +/* Maximum size of the dynamic table.  The maximum number of code structures is
          +   1444, which is the sum of 852 for literal/length codes and 592 for distance
          +   codes.  These values were found by exhaustive searches using the program
          +   examples/enough.c found in the zlib distribtution.  The arguments to that
          +   program are the number of symbols, the initial root table size, and the
          +   maximum bit length of a code.  "enough 286 9 15" for literal/length codes
          +   returns returns 852, and "enough 30 6 15" for distance codes returns 592.
          +   The initial root table size (9 or 6) is found in the fifth argument of the
          +   inflate_table() calls in inflate.c and infback.c.  If the root table size is
          +   changed, then these maximum sizes would be need to be recalculated and
          +   updated. */
          +#define ENOUGH_LENS 852
          +#define ENOUGH_DISTS 592
          +#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS)
           
          -struct inflate_huft_s {
          -  union {
          -    struct {
          -      Byte Exop;        /* number of extra bits or operation */
          -      Byte Bits;        /* number of bits in this code or subcode */
          -    } what;
          -    uInt pad;           /* pad structure to a power of 2 (4 bytes for */
          -  } word;               /*  16-bit, 8 bytes for 32-bit int's) */
          -  uInt base;            /* literal, length base, distance base,
          -                           or table offset */
          -};
          +/* Type of code to build for inflate_table() */
          +typedef enum {
          +    CODES,
          +    LENS,
          +    DISTS
          +} codetype;
           
          -/* Maximum size of dynamic tree.  The maximum found in a long but non-
          -   exhaustive search was 1004 huft structures (850 for length/literals
          -   and 154 for distances, the latter actually the result of an
          -   exhaustive search).  The actual maximum is not known, but the
          -   value below is more than safe. */
          -#define MANY 1440
          +int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
          +                             unsigned codes, code FAR * FAR *table,
          +                             unsigned FAR *bits, unsigned short FAR *work));
           
          -local  int inflate_trees_bits OF((
          -    uIntf *,                    /* 19 code lengths */
          -    uIntf *,                    /* bits tree desired/actual depth */
          -    inflate_huft * FAR *,       /* bits tree result */
          -    inflate_huft *,             /* space for trees */
          -    z_streamp));                /* for messages */
          -
          -local  int inflate_trees_dynamic OF((
          -    uInt,                       /* number of literal/length codes */
          -    uInt,                       /* number of distance codes */
          -    uIntf *,                    /* that many (total) code lengths */
          -    uIntf *,                    /* literal desired/actual bit depth */
          -    uIntf *,                    /* distance desired/actual bit depth */
          -    inflate_huft * FAR *,       /* literal/length tree result */
          -    inflate_huft * FAR *,       /* distance tree result */
          -    inflate_huft *,             /* space for trees */
          -    z_streamp));                /* for messages */
          -
          -local  int inflate_trees_fixed OF((
          -    uIntf *,                    /* literal desired/actual bit depth */
          -    uIntf *,                    /* distance desired/actual bit depth */
          -    const inflate_huft * FAR *, /* literal/length tree result */
          -    const inflate_huft * FAR *, /* distance tree result */
          -    z_streamp));                /* for memory allocation */
          -
          -#endif /* _INFTREES_H */
          +#endif  /* INFTREES_H_ */
          diff --git a/thirdparty/freetype/src/gzip/infutil.c b/thirdparty/freetype/src/gzip/infutil.c
          deleted file mode 100644
          index 6087b40647..0000000000
          --- a/thirdparty/freetype/src/gzip/infutil.c
          +++ /dev/null
          @@ -1,86 +0,0 @@
          -/* inflate_util.c -- data and routines common to blocks and codes
          - * Copyright (C) 1995-2002 Mark Adler
          - * For conditions of distribution and use, see copyright notice in zlib.h
          - */
          -
          -#include "zutil.h"
          -#include "infblock.h"
          -#include "inftrees.h"
          -#include "infcodes.h"
          -#include "infutil.h"
          -
          -
          -/* And'ing with mask[n] masks the lower n bits */
          -local const uInt inflate_mask[17] = {
          -    0x0000,
          -    0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
          -    0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
          -};
          -
          -
          -/* copy as much as possible from the sliding window to the output area */
          -local int inflate_flush( /* s, z, r) */
          -inflate_blocks_statef *s,
          -z_streamp z,
          -int r )
          -{
          -  uInt n;
          -  Bytef *p;
          -  Bytef *q;
          -
          -  /* local copies of source and destination pointers */
          -  p = z->next_out;
          -  q = s->read;
          -
          -  /* compute number of bytes to copy as far as end of window */
          -  n = (uInt)((q <= s->write ? s->write : s->end) - q);
          -  if (n > z->avail_out) n = z->avail_out;
          -  if (n && r == Z_BUF_ERROR) r = Z_OK;
          -
          -  /* update counters */
          -  z->avail_out -= n;
          -  z->total_out += n;
          -
          -  /* update check information */
          -  if (s->checkfn != Z_NULL)
          -    z->adler = s->check = (*s->checkfn)(s->check, q, n);
          -
          -  /* copy as far as end of window */
          -  zmemcpy(p, q, n);
          -  p += n;
          -  q += n;
          -
          -  /* see if more to copy at beginning of window */
          -  if (q == s->end)
          -  {
          -    /* wrap pointers */
          -    q = s->window;
          -    if (s->write == s->end)
          -      s->write = s->window;
          -
          -    /* compute bytes to copy */
          -    n = (uInt)(s->write - q);
          -    if (n > z->avail_out) n = z->avail_out;
          -    if (n && r == Z_BUF_ERROR) r = Z_OK;
          -
          -    /* update counters */
          -    z->avail_out -= n;
          -    z->total_out += n;
          -
          -    /* update check information */
          -    if (s->checkfn != Z_NULL)
          -      z->adler = s->check = (*s->checkfn)(s->check, q, n);
          -
          -    /* copy */
          -    zmemcpy(p, q, n);
          -    p += n;
          -    q += n;
          -  }
          -
          -  /* update pointers */
          -  z->next_out = p;
          -  s->read = q;
          -
          -  /* done */
          -  return r;
          -}
          diff --git a/thirdparty/freetype/src/gzip/infutil.h b/thirdparty/freetype/src/gzip/infutil.h
          deleted file mode 100644
          index cdf18b4f90..0000000000
          --- a/thirdparty/freetype/src/gzip/infutil.h
          +++ /dev/null
          @@ -1,98 +0,0 @@
          -/* infutil.h -- types and macros common to blocks and codes
          - * Copyright (C) 1995-2002 Mark Adler
          - * For conditions of distribution and use, see copyright notice in zlib.h
          - */
          -
          -/* WARNING: this file should *not* be used by applications. It is
          -   part of the implementation of the compression library and is
          -   subject to change. Applications should only use zlib.h.
          - */
          -
          -#ifndef _INFUTIL_H
          -#define _INFUTIL_H
          -
          -typedef enum {
          -      TYPE,     /* get type bits (3, including end bit) */
          -      LENS,     /* get lengths for stored */
          -      STORED,   /* processing stored block */
          -      TABLE,    /* get table lengths */
          -      BTREE,    /* get bit lengths tree for a dynamic block */
          -      DTREE,    /* get length, distance trees for a dynamic block */
          -      CODES,    /* processing fixed or dynamic block */
          -      DRY,      /* output remaining window bytes */
          -      DONE,     /* finished last block, done */
          -      BAD}      /* got a data error--stuck here */
          -inflate_block_mode;
          -
          -/* inflate blocks semi-private state */
          -struct inflate_blocks_state {
          -
          -  /* mode */
          -  inflate_block_mode  mode;     /* current inflate_block mode */
          -
          -  /* mode dependent information */
          -  union {
          -    uInt left;          /* if STORED, bytes left to copy */
          -    struct {
          -      uInt table;               /* table lengths (14 bits) */
          -      uInt index;               /* index into blens (or border) */
          -      uIntf *blens;             /* bit lengths of codes */
          -      uInt bb;                  /* bit length tree depth */
          -      inflate_huft *tb;         /* bit length decoding tree */
          -    } trees;            /* if DTREE, decoding info for trees */
          -    struct {
          -      inflate_codes_statef
          -         *codes;
          -    } decode;           /* if CODES, current state */
          -  } sub;                /* submode */
          -  uInt last;            /* true if this block is the last block */
          -
          -  /* mode independent information */
          -  uInt bitk;            /* bits in bit buffer */
          -  uLong bitb;           /* bit buffer */
          -  inflate_huft *hufts;  /* single malloc for tree space */
          -  Bytef *window;        /* sliding window */
          -  Bytef *end;           /* one byte after sliding window */
          -  Bytef *read;          /* window read pointer */
          -  Bytef *write;         /* window write pointer */
          -  check_func checkfn;   /* check function */
          -  uLong check;          /* check on output */
          -
          -};
          -
          -
          -/* defines for inflate input/output */
          -/*   update pointers and return */
          -#define UPDBITS {s->bitb=b;s->bitk=k;}
          -#define UPDIN {z->avail_in=n;z->total_in+=p-z->next_in;z->next_in=p;}
          -#define UPDOUT {s->write=q;}
          -#define UPDATE {UPDBITS UPDIN UPDOUT}
          -#define LEAVE {UPDATE return inflate_flush(s,z,r);}
          -/*   get bytes and bits */
          -#define LOADIN {p=z->next_in;n=z->avail_in;b=s->bitb;k=s->bitk;}
          -#define NEEDBYTE {if(n)r=Z_OK;else LEAVE}
          -#define NEXTBYTE (n--,*p++)
          -#define NEEDBITS(j) {while(k<(j)){NEEDBYTE;b|=((uLong)NEXTBYTE)<>=(j);k-=(j);}
          -/*   output bytes */
          -#define WAVAIL (uInt)(qread?s->read-q-1:s->end-q)
          -#define LOADOUT {q=s->write;m=(uInt)WAVAIL;}
          -#define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=(uInt)WAVAIL;}}
          -#define FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT}
          -#define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;}
          -#define OUTBYTE(a) {*q++=(Byte)(a);m--;}
          -/*   load local pointers */
          -#define LOAD {LOADIN LOADOUT}
          -
          -/* masks for lower bits (size given to avoid silly warnings with Visual C++) */
          -#ifndef NO_INFLATE_MASK
          -local const uInt inflate_mask[17];
          -#endif
          -
          -/* copy as much as possible from the sliding window to the output area */
          -local int inflate_flush OF((
          -    inflate_blocks_statef *,
          -    z_streamp ,
          -    int));
          -
          -#endif
          diff --git a/thirdparty/freetype/src/gzip/patches/freetype-zlib.diff b/thirdparty/freetype/src/gzip/patches/freetype-zlib.diff
          new file mode 100644
          index 0000000000..90dd6c863f
          --- /dev/null
          +++ b/thirdparty/freetype/src/gzip/patches/freetype-zlib.diff
          @@ -0,0 +1,396 @@
          +[zlib] Fix zlib sources for compilation with FreeType
          +
          +We must ensure that they do not issue compiler errors or warnings when they
          +are compiled as part of `src/gzip/ftgzip.c`.
          +
          +* src/gzip/adler32.c: Do not define unused functions when `Z_FREETYPE`
          +is set.
          +
          +* src/gzip/crc32.c (DO1, DO8): Undefine.  Already defined in `adler32.c`.
          +
          +* src/gzip/gzguts.h (COPY): Rename to...
          +(COPY__): ... this since `COPY` and `COPY_` conflict with enum values,
          +which have the same name in `zlib.h`.
          +
          +* src/gzip/inflate.c, src/gzip/adler32.c: Omit unused function
          +declarations when `Z_FREETYPE` is defined.
          +
          +* src/gzip/zlib.h: Include `ftzconf.h` instead of `zconf.h` to avoid
          +conflicts with system-installed headers.
          +Omit unused function declarations when `Z_FREETYPE` is defined.
          +
          +* src/gzip/zutil.h: Use `ft_memxxx` functions instead of `memxxx`.
          +Omit unused function declarations when `Z_FREETYPE` is defined.
          +
          +* src/gzip/inflate.h, src/gzip/inftrees.h: Add header guard macros to
          +prevent compiler errors.
          +
          +diff --git b/src/gzip/adler32.c a/src/gzip/adler32.c
          +index be5e8a247..aa032e1dd 100644
          +--- b/src/gzip/adler32.c
          ++++ a/src/gzip/adler32.c
          +@@ -7,7 +7,9 @@
          + 
          + #include "zutil.h"
          + 
          ++#ifndef Z_FREETYPE
          + local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
          ++#endif
          + 
          + #define BASE 65521U     /* largest prime smaller than 65536 */
          + #define NMAX 5552
          +@@ -139,6 +141,8 @@ uLong ZEXPORT adler32(
          +     return adler32_z(adler, buf, len);
          + }
          + 
          ++#ifndef Z_FREETYPE
          ++
          + /* ========================================================================= */
          + local uLong adler32_combine_(
          +     uLong adler1,
          +@@ -184,3 +188,5 @@ uLong ZEXPORT adler32_combine64(
          + {
          +     return adler32_combine_(adler1, adler2, len2);
          + }
          ++
          ++#endif  /* !Z_FREETYPE */
          +diff --git b/src/gzip/crc32.c a/src/gzip/crc32.c
          +index 3e3eb1794..ffced1ea7 100644
          +--- b/src/gzip/crc32.c
          ++++ a/src/gzip/crc32.c
          +@@ -195,6 +195,8 @@ const z_crc_t FAR * ZEXPORT get_crc_table()
          + }
          + 
          + /* ========================================================================= */
          ++#undef DO1
          ++#undef DO8
          + #define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8)
          + #define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
          + 
          +diff --git b/src/gzip/gzguts.h a/src/gzip/gzguts.h
          +index 990a4d251..c81f8f392 100644
          +--- b/src/gzip/gzguts.h
          ++++ a/src/gzip/gzguts.h
          +@@ -163,7 +163,7 @@
          + 
          + /* values for gz_state how */
          + #define LOOK 0      /* look for a gzip header */
          +-#define COPY 1      /* copy input directly */
          ++#define COPY__ 1    /* copy input directly */
          + #define GZIP 2      /* decompress a gzip stream */
          + 
          + /* internal gzip file state data structure */
          +diff --git b/src/gzip/inflate.c a/src/gzip/inflate.c
          +index 3f7ea647b..7387e6f57 100644
          +--- b/src/gzip/inflate.c
          ++++ a/src/gzip/inflate.c
          +@@ -99,8 +99,10 @@ local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
          + #ifdef BUILDFIXED
          +    void makefixed OF((void));
          + #endif
          ++#ifndef Z_FREETYPE
          + local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf,
          +                               unsigned len));
          ++#endif
          + 
          + local int inflateStateCheck(
          +     z_streamp strm)
          +@@ -244,6 +246,8 @@ int ZEXPORT inflateInit_(
          +     return inflateInit2_(strm, DEF_WBITS, version, stream_size);
          + }
          + 
          ++#ifndef Z_FREETYPE
          ++
          + int ZEXPORT inflatePrime(
          +     z_streamp strm,
          +     int bits,
          +@@ -265,6 +269,8 @@ int ZEXPORT inflatePrime(
          +     return Z_OK;
          + }
          + 
          ++#endif  /* Z_FREETYPE */
          ++
          + /*
          +    Return state with length and distance decoding tables and index sizes set to
          +    fixed code decoding.  Normally this returns fixed tables from inffixed.h.
          +@@ -1288,6 +1294,8 @@ int ZEXPORT inflateEnd(
          +     return Z_OK;
          + }
          + 
          ++#ifndef Z_FREETYPE
          ++
          + int ZEXPORT inflateGetDictionary(
          +     z_streamp strm,
          +     Bytef *dictionary,
          +@@ -1440,6 +1448,8 @@ int ZEXPORT inflateSync(
          +     return Z_OK;
          + }
          + 
          ++#endif  /* !Z_FREETYPE */
          ++
          + /*
          +    Returns true if inflate is currently at the end of a block generated by
          +    Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP
          +@@ -1458,6 +1468,8 @@ int ZEXPORT inflateSyncPoint(
          +     return state->mode == STORED && state->bits == 0;
          + }
          + 
          ++#if !Z_FREETYPE
          ++
          + int ZEXPORT inflateCopy(
          +     z_streamp dest,
          +     z_streamp source)
          +@@ -1505,6 +1517,8 @@ int ZEXPORT inflateCopy(
          +     return Z_OK;
          + }
          + 
          ++#endif  /* !Z_FREETYPE */
          ++
          + int ZEXPORT inflateUndermine(
          +     z_streamp strm,
          +     int subvert)
          +@@ -1538,6 +1552,8 @@ int ZEXPORT inflateValidate(
          +     return Z_OK;
          + }
          + 
          ++#ifndef Z_FREETYPE
          ++
          + long ZEXPORT inflateMark(
          +     z_streamp strm)
          + {
          +@@ -1559,3 +1575,5 @@ unsigned long ZEXPORT inflateCodesUsed(
          +     state = (struct inflate_state FAR *)strm->state;
          +     return (unsigned long)(state->next - state->codes);
          + }
          ++
          ++#endif  /* !Z_FREETYPE */
          +diff --git b/src/gzip/inflate.h a/src/gzip/inflate.h
          +index a46cce6b6..92ea758e2 100644
          +--- b/src/gzip/inflate.h
          ++++ a/src/gzip/inflate.h
          +@@ -3,6 +3,9 @@
          +  * For conditions of distribution and use, see copyright notice in zlib.h
          +  */
          + 
          ++#ifndef INFLATE_H
          ++#define INFLATE_H
          ++
          + /* WARNING: this file should *not* be used by applications. It is
          +    part of the implementation of the compression library and is
          +    subject to change. Applications should only use zlib.h.
          +@@ -123,3 +126,5 @@ struct inflate_state {
          +     int back;                   /* bits back of last unprocessed length/lit */
          +     unsigned was;               /* initial length of match */
          + };
          ++
          ++#endif  /* INFLATE_H */
          +diff --git b/src/gzip/inftrees.h a/src/gzip/inftrees.h
          +index baa53a0b1..c94eb78b5 100644
          +--- b/src/gzip/inftrees.h
          ++++ a/src/gzip/inftrees.h
          +@@ -3,6 +3,9 @@
          +  * For conditions of distribution and use, see copyright notice in zlib.h
          +  */
          + 
          ++#ifndef INFTREES_H
          ++#define INFTREES_H
          ++
          + /* WARNING: this file should *not* be used by applications. It is
          +    part of the implementation of the compression library and is
          +    subject to change. Applications should only use zlib.h.
          +@@ -60,3 +63,5 @@ typedef enum {
          + int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
          +                              unsigned codes, code FAR * FAR *table,
          +                              unsigned FAR *bits, unsigned short FAR *work));
          ++
          ++#endif  /* INFTREES_H_ */
          +diff --git b/src/gzip/zlib.h a/src/gzip/zlib.h
          +index f09cdaf1e..1807c0645 100644
          +--- b/src/gzip/zlib.h
          ++++ a/src/gzip/zlib.h
          +@@ -31,7 +31,7 @@
          + #ifndef ZLIB_H
          + #define ZLIB_H
          + 
          +-#include "zconf.h"
          ++#include "ftzconf.h"
          + 
          + #ifdef __cplusplus
          + extern "C" {
          +@@ -211,6 +211,8 @@ typedef gz_header FAR *gz_headerp;
          + 
          + #define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
          + 
          ++#ifndef Z_FREETYPE
          ++
          + #define zlib_version zlibVersion()
          + /* for compatibility with versions < 1.0.2 */
          + 
          +@@ -246,7 +248,6 @@ ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
          +    this will be done by deflate().
          + */
          + 
          +-
          + ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
          + /*
          +     deflate compresses as much data as possible, and stops when the input
          +@@ -373,6 +374,7 @@ ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
          +    deallocated).
          + */
          + 
          ++#endif  /* !Z_FREETYPE */
          + 
          + /*
          + ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
          +@@ -534,6 +536,8 @@ ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
          +     The following functions are needed only in some special applications.
          + */
          + 
          ++#ifndef Z_FREETYPE
          ++
          + /*
          + ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
          +                                      int  level,
          +@@ -954,6 +958,8 @@ ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
          +    destination.
          + */
          + 
          ++#endif  /* !Z_FREETYPE */
          ++
          + ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
          + /*
          +      This function is equivalent to inflateEnd followed by inflateInit,
          +@@ -978,6 +984,8 @@ ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
          +    the windowBits parameter is invalid.
          + */
          + 
          ++#ifndef Z_FREETYPE
          ++
          + ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
          +                                      int bits,
          +                                      int value));
          +@@ -1067,6 +1075,8 @@ ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
          +    stream state was inconsistent.
          + */
          + 
          ++#endif  /* !Z_FREETYPE */
          ++
          + /*
          + ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
          +                                         unsigned char FAR *window));
          +@@ -1093,6 +1103,8 @@ typedef unsigned (*in_func) OF((void FAR *,
          +                                 z_const unsigned char FAR * FAR *));
          + typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
          + 
          ++#ifndef Z_FREETYPE
          ++
          + ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
          +                                     in_func in, void FAR *in_desc,
          +                                     out_func out, void FAR *out_desc));
          +@@ -1212,6 +1224,8 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
          +      27-31: 0 (reserved)
          +  */
          + 
          ++#endif  /* !Z_FREETYPE */
          ++
          + #ifndef Z_SOLO
          + 
          +                         /* utility functions */
          +@@ -1739,6 +1753,8 @@ ZEXTERN uLong ZEXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));
          +      if (crc != original_crc) error();
          + */
          + 
          ++#ifndef Z_FREETYPE
          ++
          + ZEXTERN uLong ZEXPORT crc32_z OF((uLong adler, const Bytef *buf,
          +                                   z_size_t len));
          + /*
          +@@ -1805,6 +1821,19 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
          +                            ZLIB_VERSION, (int)sizeof(z_stream))
          + #endif
          + 
          ++#else  /* Z_FREETYPE */
          ++
          ++
          ++ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,
          ++                                      const char *version, int stream_size));
          ++
          ++#  define inflateInit2(strm, windowBits) \
          ++          inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
          ++                        (int)sizeof(z_stream))
          ++
          ++#endif  /* Z_FREETYPE */
          ++
          ++
          + #ifndef Z_SOLO
          + 
          + /* gzgetc() macro and its supporting function and exposed data structure.  Note
          +@@ -1879,12 +1908,15 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file));  /* backward compatibility */
          + 
          + #else /* Z_SOLO */
          + 
          ++#ifndef Z_FREETYPE
          +    ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
          +    ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
          ++#endif
          + 
          + #endif /* !Z_SOLO */
          + 
          + /* undocumented functions */
          ++#ifndef Z_FREETYPE
          + ZEXTERN const char   * ZEXPORT zError           OF((int));
          + ZEXTERN int            ZEXPORT inflateSyncPoint OF((z_streamp));
          + ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table    OF((void));
          +@@ -1904,6 +1936,7 @@ ZEXTERN int            ZEXPORTVA gzvprintf Z_ARG((gzFile file,
          +                                                   va_list va));
          + #  endif
          + #endif
          ++#endif  /* !Z_FREETYPE */
          + 
          + #ifdef __cplusplus
          + }
          +diff --git b/src/gzip/zutil.h a/src/gzip/zutil.h
          +index b079ea6a8..2d734a835 100644
          +--- b/src/gzip/zutil.h
          ++++ a/src/gzip/zutil.h
          +@@ -30,7 +30,9 @@
          + #endif
          + 
          + #ifdef Z_SOLO
          ++#  ifndef Z_FREETYPE
          +    typedef long ptrdiff_t;  /* guess -- will be caught if guess is wrong */
          ++#  endif
          + #endif
          + 
          + #ifndef local
          +@@ -185,6 +187,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
          +   #pragma warn -8066
          + #endif
          + 
          ++#ifndef Z_FREETYPE
          ++
          + /* provide prototypes for these when building zlib without LFS */
          + #if !defined(_WIN32) && \
          +     (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
          +@@ -192,6 +196,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
          +     ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
          + #endif
          + 
          ++#endif  /* !Z_FREETYPE */
          ++
          +         /* common defaults */
          + 
          + #ifndef OS_CODE
          +@@ -223,9 +229,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
          + #    define zmemcmp _fmemcmp
          + #    define zmemzero(dest, len) _fmemset(dest, 0, len)
          + #  else
          +-#    define zmemcpy memcpy
          +-#    define zmemcmp memcmp
          +-#    define zmemzero(dest, len) memset(dest, 0, len)
          ++#    define zmemcpy ft_memcpy
          ++#    define zmemcmp ft_memcmp
          ++#    define zmemzero(dest, len) ft_memset(dest, 0, len)
          + #  endif
          + #else
          +    void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
          diff --git a/thirdparty/freetype/src/gzip/rules.mk b/thirdparty/freetype/src/gzip/rules.mk
          index 1a90ae8fcf..10c8b41c7f 100644
          --- a/thirdparty/freetype/src/gzip/rules.mk
          +++ b/thirdparty/freetype/src/gzip/rules.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 2002-2021 by
          +# Copyright (C) 2002-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          @@ -40,17 +40,17 @@ endif
           # unconditionally.
           #
           GZIP_DRV_SRCS := $(GZIP_DIR)/adler32.c  \
          +                 $(GZIP_DIR)/crc32.c    \
          +                 $(GZIP_DIR)/crc32.h    \
                            $(GZIP_DIR)/ftzconf.h  \
          -                 $(GZIP_DIR)/infblock.c \
          -                 $(GZIP_DIR)/infblock.h \
          -                 $(GZIP_DIR)/infcodes.c \
          -                 $(GZIP_DIR)/infcodes.h \
          +                 $(GZIP_DIR)/infback.c  \
          +                 $(GZIP_DIR)/inffast.c  \
          +                 $(GZIP_DIR)/inffast.h  \
                            $(GZIP_DIR)/inffixed.h \
                            $(GZIP_DIR)/inflate.c  \
          +                 $(GZIP_DIR)/inflate.h  \
                            $(GZIP_DIR)/inftrees.c \
                            $(GZIP_DIR)/inftrees.h \
          -                 $(GZIP_DIR)/infutil.c  \
          -                 $(GZIP_DIR)/infutil.h  \
                            $(GZIP_DIR)/zlib.h     \
                            $(GZIP_DIR)/zutil.c    \
                            $(GZIP_DIR)/zutil.h
          diff --git a/thirdparty/freetype/src/gzip/zlib.h b/thirdparty/freetype/src/gzip/zlib.h
          index a4e82c6a02..1807c0645b 100644
          --- a/thirdparty/freetype/src/gzip/zlib.h
          +++ b/thirdparty/freetype/src/gzip/zlib.h
          @@ -1,7 +1,7 @@
           /* zlib.h -- interface of the 'zlib' general purpose compression library
          -  version 1.1.4, March 11th, 2002
          +  version 1.2.11, January 15th, 2017
           
          -  Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler
          +  Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
           
             This software is provided 'as-is', without any express or implied
             warranty.  In no event will the authors be held liable for any damages
          @@ -24,12 +24,12 @@
           
           
             The data format used by the zlib library is described by RFCs (Request for
          -  Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
          -  (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
          +  Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950
          +  (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).
           */
           
          -#ifndef _ZLIB_H
          -#define _ZLIB_H
          +#ifndef ZLIB_H
          +#define ZLIB_H
           
           #include "ftzconf.h"
           
          @@ -37,27 +37,45 @@
           extern "C" {
           #endif
           
          -#define ZLIB_VERSION "1.1.4"
          +#define ZLIB_VERSION "1.2.11"
          +#define ZLIB_VERNUM 0x12b0
          +#define ZLIB_VER_MAJOR 1
          +#define ZLIB_VER_MINOR 2
          +#define ZLIB_VER_REVISION 11
          +#define ZLIB_VER_SUBREVISION 0
           
           /*
          -     The 'zlib' compression library provides in-memory compression and
          -  decompression functions, including integrity checks of the uncompressed
          -  data.  This version of the library supports only one compression method
          -  (deflation) but other algorithms will be added later and will have the same
          -  stream interface.
          +    The 'zlib' compression library provides in-memory compression and
          +  decompression functions, including integrity checks of the uncompressed data.
          +  This version of the library supports only one compression method (deflation)
          +  but other algorithms will be added later and will have the same stream
          +  interface.
           
          -     Compression can be done in a single step if the buffers are large
          -  enough (for example if an input file is mmap'ed), or can be done by
          -  repeated calls of the compression function.  In the latter case, the
          -  application must provide more input and/or consume the output
          +    Compression can be done in a single step if the buffers are large enough,
          +  or can be done by repeated calls of the compression function.  In the latter
          +  case, the application must provide more input and/or consume the output
             (providing more output space) before each call.
           
          -     The library also supports reading and writing files in gzip (.gz) format
          -  with an interface similar to that of stdio.
          +    The compressed data format used by default by the in-memory functions is
          +  the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
          +  around a deflate stream, which is itself documented in RFC 1951.
           
          -     The library does not install any signal handler. The decoder checks
          -  the consistency of the compressed data, so the library should never
          -  crash even in case of corrupted input.
          +    The library also supports reading and writing files in gzip (.gz) format
          +  with an interface similar to that of stdio using the functions that start
          +  with "gz".  The gzip format is different from the zlib format.  gzip is a
          +  gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
          +
          +    This library can optionally read and write gzip and raw deflate streams in
          +  memory as well.
          +
          +    The zlib format was designed to be compact and fast for use in memory
          +  and on communications channels.  The gzip format was designed for single-
          +  file compression on file systems, has a larger header than zlib to maintain
          +  directory information, and uses a different, slower check method than zlib.
          +
          +    The library does not install any signal handler.  The decoder checks
          +  the consistency of the compressed data, so the library should never crash
          +  even in the case of corrupted input.
           */
           
           typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
          @@ -66,68 +84,95 @@ typedef void   (*free_func)  OF((voidpf opaque, voidpf address));
           struct internal_state;
           
           typedef struct z_stream_s {
          -    Bytef    *next_in;  /* next input byte */
          +    z_const Bytef *next_in;     /* next input byte */
               uInt     avail_in;  /* number of bytes available at next_in */
          -    uLong    total_in;  /* total nb of input bytes read so far */
          +    uLong    total_in;  /* total number of input bytes read so far */
           
          -    Bytef    *next_out; /* next output byte should be put there */
          +    Bytef    *next_out; /* next output byte will go here */
               uInt     avail_out; /* remaining free space at next_out */
          -    uLong    total_out; /* total nb of bytes output so far */
          +    uLong    total_out; /* total number of bytes output so far */
           
          -    char     *msg;      /* last error message, NULL if no error */
          +    z_const char *msg;  /* last error message, NULL if no error */
               struct internal_state FAR *state; /* not visible by applications */
           
               alloc_func zalloc;  /* used to allocate the internal state */
               free_func  zfree;   /* used to free the internal state */
               voidpf     opaque;  /* private data object passed to zalloc and zfree */
           
          -    int     data_type;  /* best guess about the data type: ascii or binary */
          -    uLong   adler;      /* adler32 value of the uncompressed data */
          +    int     data_type;  /* best guess about the data type: binary or text
          +                           for deflate, or the decoding state for inflate */
          +    uLong   adler;      /* Adler-32 or CRC-32 value of the uncompressed data */
               uLong   reserved;   /* reserved for future use */
           } z_stream;
           
           typedef z_stream FAR *z_streamp;
           
           /*
          -   The application must update next_in and avail_in when avail_in has
          -   dropped to zero. It must update next_out and avail_out when avail_out
          -   has dropped to zero. The application must initialize zalloc, zfree and
          -   opaque before calling the init function. All other fields are set by the
          -   compression library and must not be updated by the application.
          +     gzip header information passed to and from zlib routines.  See RFC 1952
          +  for more details on the meanings of these fields.
          +*/
          +typedef struct gz_header_s {
          +    int     text;       /* true if compressed data believed to be text */
          +    uLong   time;       /* modification time */
          +    int     xflags;     /* extra flags (not used when writing a gzip file) */
          +    int     os;         /* operating system */
          +    Bytef   *extra;     /* pointer to extra field or Z_NULL if none */
          +    uInt    extra_len;  /* extra field length (valid if extra != Z_NULL) */
          +    uInt    extra_max;  /* space at extra (only when reading header) */
          +    Bytef   *name;      /* pointer to zero-terminated file name or Z_NULL */
          +    uInt    name_max;   /* space at name (only when reading header) */
          +    Bytef   *comment;   /* pointer to zero-terminated comment or Z_NULL */
          +    uInt    comm_max;   /* space at comment (only when reading header) */
          +    int     hcrc;       /* true if there was or will be a header crc */
          +    int     done;       /* true when done reading gzip header (not used
          +                           when writing a gzip file) */
          +} gz_header;
           
          -   The opaque value provided by the application will be passed as the first
          -   parameter for calls of zalloc and zfree. This can be useful for custom
          -   memory management. The compression library attaches no meaning to the
          +typedef gz_header FAR *gz_headerp;
          +
          +/*
          +     The application must update next_in and avail_in when avail_in has dropped
          +   to zero.  It must update next_out and avail_out when avail_out has dropped
          +   to zero.  The application must initialize zalloc, zfree and opaque before
          +   calling the init function.  All other fields are set by the compression
          +   library and must not be updated by the application.
          +
          +     The opaque value provided by the application will be passed as the first
          +   parameter for calls of zalloc and zfree.  This can be useful for custom
          +   memory management.  The compression library attaches no meaning to the
              opaque value.
           
          -   zalloc must return Z_NULL if there is not enough memory for the object.
          +     zalloc must return Z_NULL if there is not enough memory for the object.
              If zlib is used in a multi-threaded application, zalloc and zfree must be
          -   thread safe.
          +   thread safe.  In that case, zlib is thread-safe.  When zalloc and zfree are
          +   Z_NULL on entry to the initialization function, they are set to internal
          +   routines that use the standard library functions malloc() and free().
           
          -   On 16-bit systems, the functions zalloc and zfree must be able to allocate
          -   exactly 65536 bytes, but will not be required to allocate more than this
          -   if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
          -   pointers returned by zalloc for objects of exactly 65536 bytes *must*
          -   have their offset normalized to zero. The default allocation function
          -   provided by this library ensures this (see zutil.c). To reduce memory
          -   requirements and avoid any allocation of 64K objects, at the expense of
          -   compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
          +     On 16-bit systems, the functions zalloc and zfree must be able to allocate
          +   exactly 65536 bytes, but will not be required to allocate more than this if
          +   the symbol MAXSEG_64K is defined (see zconf.h).  WARNING: On MSDOS, pointers
          +   returned by zalloc for objects of exactly 65536 bytes *must* have their
          +   offset normalized to zero.  The default allocation function provided by this
          +   library ensures this (see zutil.c).  To reduce memory requirements and avoid
          +   any allocation of 64K objects, at the expense of compression ratio, compile
          +   the library with -DMAX_WBITS=14 (see zconf.h).
           
          -   The fields total_in and total_out can be used for statistics or
          -   progress reports. After compression, total_in holds the total size of
          -   the uncompressed data and may be saved for use in the decompressor
          -   (particularly if the decompressor wants to decompress everything in
          -   a single step).
          +     The fields total_in and total_out can be used for statistics or progress
          +   reports.  After compression, total_in holds the total size of the
          +   uncompressed data and may be saved for use by the decompressor (particularly
          +   if the decompressor wants to decompress everything in a single step).
           */
           
                                   /* constants */
           
           #define Z_NO_FLUSH      0
          -#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
          +#define Z_PARTIAL_FLUSH 1
           #define Z_SYNC_FLUSH    2
           #define Z_FULL_FLUSH    3
           #define Z_FINISH        4
          -/* Allowed flush values; see deflate() below for details */
          +#define Z_BLOCK         5
          +#define Z_TREES         6
          +/* Allowed flush values; see deflate() and inflate() below for details */
           
           #define Z_OK            0
           #define Z_STREAM_END    1
          @@ -138,8 +183,8 @@ typedef z_stream FAR *z_streamp;
           #define Z_MEM_ERROR    (-4)
           #define Z_BUF_ERROR    (-5)
           #define Z_VERSION_ERROR (-6)
          -/* Return codes for the compression/decompression functions. Negative
          - * values are errors, positive values are used for special but normal events.
          +/* Return codes for the compression/decompression functions. Negative values
          + * are errors, positive values are used for special but normal events.
            */
           
           #define Z_NO_COMPRESSION         0
          @@ -150,636 +195,1520 @@ typedef z_stream FAR *z_streamp;
           
           #define Z_FILTERED            1
           #define Z_HUFFMAN_ONLY        2
          +#define Z_RLE                 3
          +#define Z_FIXED               4
           #define Z_DEFAULT_STRATEGY    0
           /* compression strategy; see deflateInit2() below for details */
           
           #define Z_BINARY   0
          -#define Z_ASCII    1
          +#define Z_TEXT     1
          +#define Z_ASCII    Z_TEXT   /* for compatibility with 1.2.2 and earlier */
           #define Z_UNKNOWN  2
          -/* Possible values of the data_type field */
          +/* Possible values of the data_type field for deflate() */
           
           #define Z_DEFLATED   8
           /* The deflate compression method (the only one supported in this version) */
           
           #define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
           
          +#ifndef Z_FREETYPE
          +
          +#define zlib_version zlibVersion()
          +/* for compatibility with versions < 1.0.2 */
          +
           
                                   /* basic functions */
           
          +ZEXTERN const char * ZEXPORT zlibVersion OF((void));
           /* The application can compare zlibVersion and ZLIB_VERSION for consistency.
          -   If the first character differs, the library code actually used is
          -   not compatible with the zlib.h header file used by the application.
          -   This check is automatically made by deflateInit and inflateInit.
          +   If the first character differs, the library code actually used is not
          +   compatible with the zlib.h header file used by the application.  This check
          +   is automatically made by deflateInit and inflateInit.
            */
           
           /*
          -ZEXTERN(int)  deflateInit OF((z_streamp strm, int level));
          +ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
           
          -     Initializes the internal stream state for compression. The fields
          -   zalloc, zfree and opaque must be initialized before by the caller.
          -   If zalloc and zfree are set to Z_NULL, deflateInit updates them to
          -   use default allocation functions.
          +     Initializes the internal stream state for compression.  The fields
          +   zalloc, zfree and opaque must be initialized before by the caller.  If
          +   zalloc and zfree are set to Z_NULL, deflateInit updates them to use default
          +   allocation functions.
           
                The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
          -   1 gives best speed, 9 gives best compression, 0 gives no compression at
          -   all (the input data is simply copied a block at a time).
          -   Z_DEFAULT_COMPRESSION requests a default compromise between speed and
          -   compression (currently equivalent to level 6).
          +   1 gives best speed, 9 gives best compression, 0 gives no compression at all
          +   (the input data is simply copied a block at a time).  Z_DEFAULT_COMPRESSION
          +   requests a default compromise between speed and compression (currently
          +   equivalent to level 6).
           
          -     deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
          -   enough memory, Z_STREAM_ERROR if level is not a valid compression level,
          +     deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
          +   memory, Z_STREAM_ERROR if level is not a valid compression level, or
              Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
          -   with the version assumed by the caller (ZLIB_VERSION).
          -   msg is set to null if there is no error message.  deflateInit does not
          -   perform any compression: this will be done by deflate().
          +   with the version assumed by the caller (ZLIB_VERSION).  msg is set to null
          +   if there is no error message.  deflateInit does not perform any compression:
          +   this will be done by deflate().
           */
           
          -
          +ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
           /*
               deflate compresses as much data as possible, and stops when the input
          -  buffer becomes empty or the output buffer becomes full. It may introduce some
          -  output latency (reading input without producing any output) except when
          +  buffer becomes empty or the output buffer becomes full.  It may introduce
          +  some output latency (reading input without producing any output) except when
             forced to flush.
           
          -    The detailed semantics are as follows. deflate performs one or both of the
          +    The detailed semantics are as follows.  deflate performs one or both of the
             following actions:
           
             - Compress more input starting at next_in and update next_in and avail_in
          -    accordingly. If not all input can be processed (because there is not
          +    accordingly.  If not all input can be processed (because there is not
               enough room in the output buffer), next_in and avail_in are updated and
               processing will resume at this point for the next call of deflate().
           
          -  - Provide more output starting at next_out and update next_out and avail_out
          -    accordingly. This action is forced if the parameter flush is non zero.
          +  - Generate more output starting at next_out and update next_out and avail_out
          +    accordingly.  This action is forced if the parameter flush is non zero.
               Forcing flush frequently degrades the compression ratio, so this parameter
          -    should be set only when necessary (in interactive applications).
          -    Some output may be provided even if flush is not set.
          +    should be set only when necessary.  Some output may be provided even if
          +    flush is zero.
           
          -  Before the call of deflate(), the application should ensure that at least
          -  one of the actions is possible, by providing more input and/or consuming
          -  more output, and updating avail_in or avail_out accordingly; avail_out
          -  should never be zero before the call. The application can consume the
          -  compressed output when it wants, for example when the output buffer is full
          -  (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
          -  and with zero avail_out, it must be called again after making room in the
          -  output buffer because there might be more output pending.
          +    Before the call of deflate(), the application should ensure that at least
          +  one of the actions is possible, by providing more input and/or consuming more
          +  output, and updating avail_in or avail_out accordingly; avail_out should
          +  never be zero before the call.  The application can consume the compressed
          +  output when it wants, for example when the output buffer is full (avail_out
          +  == 0), or after each call of deflate().  If deflate returns Z_OK and with
          +  zero avail_out, it must be called again after making room in the output
          +  buffer because there might be more output pending. See deflatePending(),
          +  which can be used if desired to determine whether or not there is more ouput
          +  in that case.
          +
          +    Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
          +  decide how much data to accumulate before producing output, in order to
          +  maximize compression.
           
               If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
             flushed to the output buffer and the output is aligned on a byte boundary, so
          -  that the decompressor can get all input data available so far. (In particular
          -  avail_in is zero after the call if enough output space has been provided
          -  before the call.)  Flushing may degrade compression for some compression
          -  algorithms and so it should be used only when necessary.
          +  that the decompressor can get all input data available so far.  (In
          +  particular avail_in is zero after the call if enough output space has been
          +  provided before the call.) Flushing may degrade compression for some
          +  compression algorithms and so it should be used only when necessary.  This
          +  completes the current deflate block and follows it with an empty stored block
          +  that is three bits plus filler bits to the next byte, followed by four bytes
          +  (00 00 ff ff).
          +
          +    If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the
          +  output buffer, but the output is not aligned to a byte boundary.  All of the
          +  input data so far will be available to the decompressor, as for Z_SYNC_FLUSH.
          +  This completes the current deflate block and follows it with an empty fixed
          +  codes block that is 10 bits long.  This assures that enough bytes are output
          +  in order for the decompressor to finish the block before the empty fixed
          +  codes block.
          +
          +    If flush is set to Z_BLOCK, a deflate block is completed and emitted, as
          +  for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to
          +  seven bits of the current block are held to be written as the next byte after
          +  the next deflate block is completed.  In this case, the decompressor may not
          +  be provided enough bits at this point in order to complete decompression of
          +  the data provided so far to the compressor.  It may need to wait for the next
          +  block to be emitted.  This is for advanced applications that need to control
          +  the emission of deflate blocks.
           
               If flush is set to Z_FULL_FLUSH, all output is flushed as with
             Z_SYNC_FLUSH, and the compression state is reset so that decompression can
             restart from this point if previous compressed data has been damaged or if
          -  random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
          -  the compression.
          +  random access is desired.  Using Z_FULL_FLUSH too often can seriously degrade
          +  compression.
           
               If deflate returns with avail_out == 0, this function must be called again
             with the same value of the flush parameter and more output space (updated
             avail_out), until the flush is complete (deflate returns with non-zero
          -  avail_out).
          +  avail_out).  In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
          +  avail_out is greater than six to avoid repeated flush markers due to
          +  avail_out == 0 on return.
           
               If the parameter flush is set to Z_FINISH, pending input is processed,
          -  pending output is flushed and deflate returns with Z_STREAM_END if there
          -  was enough output space; if deflate returns with Z_OK, this function must be
          -  called again with Z_FINISH and more output space (updated avail_out) but no
          -  more input data, until it returns with Z_STREAM_END or an error. After
          -  deflate has returned Z_STREAM_END, the only possible operations on the
          -  stream are deflateReset or deflateEnd.
          +  pending output is flushed and deflate returns with Z_STREAM_END if there was
          +  enough output space.  If deflate returns with Z_OK or Z_BUF_ERROR, this
          +  function must be called again with Z_FINISH and more output space (updated
          +  avail_out) but no more input data, until it returns with Z_STREAM_END or an
          +  error.  After deflate has returned Z_STREAM_END, the only possible operations
          +  on the stream are deflateReset or deflateEnd.
           
          -    Z_FINISH can be used immediately after deflateInit if all the compression
          -  is to be done in a single step. In this case, avail_out must be at least
          -  0.1% larger than avail_in plus 12 bytes.  If deflate does not return
          -  Z_STREAM_END, then it must be called again as described above.
          +    Z_FINISH can be used in the first deflate call after deflateInit if all the
          +  compression is to be done in a single step.  In order to complete in one
          +  call, avail_out must be at least the value returned by deflateBound (see
          +  below).  Then deflate is guaranteed to return Z_STREAM_END.  If not enough
          +  output space is provided, deflate will not return Z_STREAM_END, and it must
          +  be called again as described above.
           
          -    deflate() sets strm->adler to the adler32 checksum of all input read
          -  so far (that is, total_in bytes).
          +    deflate() sets strm->adler to the Adler-32 checksum of all input read
          +  so far (that is, total_in bytes).  If a gzip stream is being generated, then
          +  strm->adler will be the CRC-32 checksum of the input read so far.  (See
          +  deflateInit2 below.)
           
          -    deflate() may update data_type if it can make a good guess about
          -  the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered
          -  binary. This field is only for information purposes and does not affect
          -  the compression algorithm in any manner.
          +    deflate() may update strm->data_type if it can make a good guess about
          +  the input data type (Z_BINARY or Z_TEXT).  If in doubt, the data is
          +  considered binary.  This field is only for information purposes and does not
          +  affect the compression algorithm in any manner.
           
               deflate() returns Z_OK if some progress has been made (more input
             processed or more output produced), Z_STREAM_END if all input has been
             consumed and all output has been produced (only when flush is set to
             Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
          -  if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
          -  (for example avail_in or avail_out was zero).
          +  if next_in or next_out was Z_NULL or the state was inadvertently written over
          +  by the application), or Z_BUF_ERROR if no progress is possible (for example
          +  avail_in or avail_out was zero).  Note that Z_BUF_ERROR is not fatal, and
          +  deflate() can be called again with more input and more output space to
          +  continue compressing.
           */
           
           
          +ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
           /*
                All dynamically allocated data structures for this stream are freed.
          -   This function discards any unprocessed input and does not flush any
          -   pending output.
          +   This function discards any unprocessed input and does not flush any pending
          +   output.
           
                deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
              stream state was inconsistent, Z_DATA_ERROR if the stream was freed
          -   prematurely (some input or output was discarded). In the error case,
          -   msg may be set but then points to a static string (which must not be
          +   prematurely (some input or output was discarded).  In the error case, msg
          +   may be set but then points to a static string (which must not be
              deallocated).
           */
           
          +#endif  /* !Z_FREETYPE */
           
           /*
          -ZEXTERN(int)  inflateInit OF((z_streamp strm));
          +ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
           
          -     Initializes the internal stream state for decompression. The fields
          +     Initializes the internal stream state for decompression.  The fields
              next_in, avail_in, zalloc, zfree and opaque must be initialized before by
          -   the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
          -   value depends on the compression method), inflateInit determines the
          -   compression method from the zlib header and allocates all data structures
          -   accordingly; otherwise the allocation will be deferred to the first call of
          -   inflate.  If zalloc and zfree are set to Z_NULL, inflateInit updates them to
          -   use default allocation functions.
          +   the caller.  In the current version of inflate, the provided input is not
          +   read or consumed.  The allocation of a sliding window will be deferred to
          +   the first call of inflate (if the decompression does not complete on the
          +   first call).  If zalloc and zfree are set to Z_NULL, inflateInit updates
          +   them to use default allocation functions.
           
                inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
              memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
          -   version assumed by the caller.  msg is set to null if there is no error
          -   message. inflateInit does not perform any decompression apart from reading
          -   the zlib header if present: this will be done by inflate().  (So next_in and
          -   avail_in may be modified, but next_out and avail_out are unchanged.)
          +   version assumed by the caller, or Z_STREAM_ERROR if the parameters are
          +   invalid, such as a null pointer to the structure.  msg is set to null if
          +   there is no error message.  inflateInit does not perform any decompression.
          +   Actual decompression will be done by inflate().  So next_in, and avail_in,
          +   next_out, and avail_out are unused and unchanged.  The current
          +   implementation of inflateInit() does not process any header information --
          +   that is deferred until inflate() is called.
           */
           
           
          -ZEXTERN(int) inflate OF((z_streamp strm, int flush));
          +ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
           /*
               inflate decompresses as much data as possible, and stops when the input
          -  buffer becomes empty or the output buffer becomes full. It may some
          -  introduce some output latency (reading input without producing any output)
          -  except when forced to flush.
          +  buffer becomes empty or the output buffer becomes full.  It may introduce
          +  some output latency (reading input without producing any output) except when
          +  forced to flush.
           
          -  The detailed semantics are as follows. inflate performs one or both of the
          +  The detailed semantics are as follows.  inflate performs one or both of the
             following actions:
           
             - Decompress more input starting at next_in and update next_in and avail_in
          -    accordingly. If not all input can be processed (because there is not
          -    enough room in the output buffer), next_in is updated and processing
          -    will resume at this point for the next call of inflate().
          +    accordingly.  If not all input can be processed (because there is not
          +    enough room in the output buffer), then next_in and avail_in are updated
          +    accordingly, and processing will resume at this point for the next call of
          +    inflate().
           
          -  - Provide more output starting at next_out and update next_out and avail_out
          -    accordingly.  inflate() provides as much output as possible, until there
          -    is no more input data or no more space in the output buffer (see below
          -    about the flush parameter).
          +  - Generate more output starting at next_out and update next_out and avail_out
          +    accordingly.  inflate() provides as much output as possible, until there is
          +    no more input data or no more space in the output buffer (see below about
          +    the flush parameter).
           
          -  Before the call of inflate(), the application should ensure that at least
          -  one of the actions is possible, by providing more input and/or consuming
          -  more output, and updating the next_* and avail_* values accordingly.
          -  The application can consume the uncompressed output when it wants, for
          -  example when the output buffer is full (avail_out == 0), or after each
          -  call of inflate(). If inflate returns Z_OK and with zero avail_out, it
          -  must be called again after making room in the output buffer because there
          -  might be more output pending.
          +    Before the call of inflate(), the application should ensure that at least
          +  one of the actions is possible, by providing more input and/or consuming more
          +  output, and updating the next_* and avail_* values accordingly.  If the
          +  caller of inflate() does not provide both available input and available
          +  output space, it is possible that there will be no progress made.  The
          +  application can consume the uncompressed output when it wants, for example
          +  when the output buffer is full (avail_out == 0), or after each call of
          +  inflate().  If inflate returns Z_OK and with zero avail_out, it must be
          +  called again after making room in the output buffer because there might be
          +  more output pending.
           
          -    If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much
          -  output as possible to the output buffer. The flushing behavior of inflate is
          -  not specified for values of the flush parameter other than Z_SYNC_FLUSH
          -  and Z_FINISH, but the current implementation actually flushes as much output
          -  as possible anyway.
          +    The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH,
          +  Z_BLOCK, or Z_TREES.  Z_SYNC_FLUSH requests that inflate() flush as much
          +  output as possible to the output buffer.  Z_BLOCK requests that inflate()
          +  stop if and when it gets to the next deflate block boundary.  When decoding
          +  the zlib or gzip format, this will cause inflate() to return immediately
          +  after the header and before the first block.  When doing a raw inflate,
          +  inflate() will go ahead and process the first block, and will return when it
          +  gets to the end of that block, or when it runs out of data.
          +
          +    The Z_BLOCK option assists in appending to or combining deflate streams.
          +  To assist in this, on return inflate() always sets strm->data_type to the
          +  number of unused bits in the last byte taken from strm->next_in, plus 64 if
          +  inflate() is currently decoding the last block in the deflate stream, plus
          +  128 if inflate() returned immediately after decoding an end-of-block code or
          +  decoding the complete header up to just before the first byte of the deflate
          +  stream.  The end-of-block will not be indicated until all of the uncompressed
          +  data from that block has been written to strm->next_out.  The number of
          +  unused bits may in general be greater than seven, except when bit 7 of
          +  data_type is set, in which case the number of unused bits will be less than
          +  eight.  data_type is set as noted here every time inflate() returns for all
          +  flush options, and so can be used to determine the amount of currently
          +  consumed input in bits.
          +
          +    The Z_TREES option behaves as Z_BLOCK does, but it also returns when the
          +  end of each deflate block header is reached, before any actual data in that
          +  block is decoded.  This allows the caller to determine the length of the
          +  deflate block header for later use in random access within a deflate block.
          +  256 is added to the value of strm->data_type when inflate() returns
          +  immediately after reaching the end of the deflate block header.
           
               inflate() should normally be called until it returns Z_STREAM_END or an
          -  error. However if all decompression is to be performed in a single step
          -  (a single call of inflate), the parameter flush should be set to
          -  Z_FINISH. In this case all pending input is processed and all pending
          -  output is flushed; avail_out must be large enough to hold all the
          -  uncompressed data. (The size of the uncompressed data may have been saved
          -  by the compressor for this purpose.) The next operation on this stream must
          -  be inflateEnd to deallocate the decompression state. The use of Z_FINISH
          -  is never required, but can be used to inform inflate that a faster routine
          -  may be used for the single inflate() call.
          +  error.  However if all decompression is to be performed in a single step (a
          +  single call of inflate), the parameter flush should be set to Z_FINISH.  In
          +  this case all pending input is processed and all pending output is flushed;
          +  avail_out must be large enough to hold all of the uncompressed data for the
          +  operation to complete.  (The size of the uncompressed data may have been
          +  saved by the compressor for this purpose.)  The use of Z_FINISH is not
          +  required to perform an inflation in one step.  However it may be used to
          +  inform inflate that a faster approach can be used for the single inflate()
          +  call.  Z_FINISH also informs inflate to not maintain a sliding window if the
          +  stream completes, which reduces inflate's memory footprint.  If the stream
          +  does not complete, either because not all of the stream is provided or not
          +  enough output space is provided, then a sliding window will be allocated and
          +  inflate() can be called again to continue the operation as if Z_NO_FLUSH had
          +  been used.
           
          -     If a preset dictionary is needed at this point (see inflateSetDictionary
          -  below), inflate sets strm-adler to the adler32 checksum of the
          -  dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise
          -  it sets strm->adler to the adler32 checksum of all output produced
          -  so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or
          -  an error code as described below. At the end of the stream, inflate()
          -  checks that its computed adler32 checksum is equal to that saved by the
          -  compressor and returns Z_STREAM_END only if the checksum is correct.
          +     In this implementation, inflate() always flushes as much output as
          +  possible to the output buffer, and always uses the faster approach on the
          +  first call.  So the effects of the flush parameter in this implementation are
          +  on the return value of inflate() as noted below, when inflate() returns early
          +  when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of
          +  memory for a sliding window when Z_FINISH is used.
          +
          +     If a preset dictionary is needed after this call (see inflateSetDictionary
          +  below), inflate sets strm->adler to the Adler-32 checksum of the dictionary
          +  chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
          +  strm->adler to the Adler-32 checksum of all output produced so far (that is,
          +  total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
          +  below.  At the end of the stream, inflate() checks that its computed Adler-32
          +  checksum is equal to that saved by the compressor and returns Z_STREAM_END
          +  only if the checksum is correct.
          +
          +    inflate() can decompress and check either zlib-wrapped or gzip-wrapped
          +  deflate data.  The header type is detected automatically, if requested when
          +  initializing with inflateInit2().  Any information contained in the gzip
          +  header is not retained unless inflateGetHeader() is used.  When processing
          +  gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output
          +  produced so far.  The CRC-32 is checked against the gzip trailer, as is the
          +  uncompressed length, modulo 2^32.
           
               inflate() returns Z_OK if some progress has been made (more input processed
             or more output produced), Z_STREAM_END if the end of the compressed data has
             been reached and all uncompressed output has been produced, Z_NEED_DICT if a
             preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
          -  corrupted (input stream not conforming to the zlib format or incorrect
          -  adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent
          -  (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not
          -  enough memory, Z_BUF_ERROR if no progress is possible or if there was not
          -  enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR
          -  case, the application may then call inflateSync to look for a good
          -  compression block.
          +  corrupted (input stream not conforming to the zlib format or incorrect check
          +  value, in which case strm->msg points to a string with a more specific
          +  error), Z_STREAM_ERROR if the stream structure was inconsistent (for example
          +  next_in or next_out was Z_NULL, or the state was inadvertently written over
          +  by the application), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR
          +  if no progress was possible or if there was not enough room in the output
          +  buffer when Z_FINISH is used.  Note that Z_BUF_ERROR is not fatal, and
          +  inflate() can be called again with more input and more output space to
          +  continue decompressing.  If Z_DATA_ERROR is returned, the application may
          +  then call inflateSync() to look for a good compression block if a partial
          +  recovery of the data is to be attempted.
           */
           
           
          -ZEXTERN(int)  inflateEnd OF((z_streamp strm));
          +ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
           /*
                All dynamically allocated data structures for this stream are freed.
          -   This function discards any unprocessed input and does not flush any
          -   pending output.
          +   This function discards any unprocessed input and does not flush any pending
          +   output.
           
          -     inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
          -   was inconsistent. In the error case, msg may be set but then points to a
          -   static string (which must not be deallocated).
          +     inflateEnd returns Z_OK if success, or Z_STREAM_ERROR if the stream state
          +   was inconsistent.
           */
           
          +
                                   /* Advanced functions */
           
           /*
               The following functions are needed only in some special applications.
           */
           
          +#ifndef Z_FREETYPE
          +
           /*
          -ZEXTERN(int)  deflateInit2 OF((z_streamp strm,
          +ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
                                                int  level,
                                                int  method,
                                                int  windowBits,
                                                int  memLevel,
                                                int  strategy));
           
          -     This is another version of deflateInit with more compression options. The
          -   fields next_in, zalloc, zfree and opaque must be initialized before by
          -   the caller.
          +     This is another version of deflateInit with more compression options.  The
          +   fields next_in, zalloc, zfree and opaque must be initialized before by the
          +   caller.
           
          -     The method parameter is the compression method. It must be Z_DEFLATED in
          +     The method parameter is the compression method.  It must be Z_DEFLATED in
              this version of the library.
           
                The windowBits parameter is the base two logarithm of the window size
              (the size of the history buffer).  It should be in the range 8..15 for this
          -   version of the library. Larger values of this parameter result in better
          -   compression at the expense of memory usage. The default value is 15 if
          +   version of the library.  Larger values of this parameter result in better
          +   compression at the expense of memory usage.  The default value is 15 if
              deflateInit is used instead.
           
          +     For the current implementation of deflate(), a windowBits value of 8 (a
          +   window size of 256 bytes) is not supported.  As a result, a request for 8
          +   will result in 9 (a 512-byte window).  In that case, providing 8 to
          +   inflateInit2() will result in an error when the zlib header with 9 is
          +   checked against the initialization of inflate().  The remedy is to not use 8
          +   with deflateInit2() with this initialization, or at least in that case use 9
          +   with inflateInit2().
          +
          +     windowBits can also be -8..-15 for raw deflate.  In this case, -windowBits
          +   determines the window size.  deflate() will then generate raw deflate data
          +   with no zlib header or trailer, and will not compute a check value.
          +
          +     windowBits can also be greater than 15 for optional gzip encoding.  Add
          +   16 to windowBits to write a simple gzip header and trailer around the
          +   compressed data instead of a zlib wrapper.  The gzip header will have no
          +   file name, no extra data, no comment, no modification time (set to zero), no
          +   header crc, and the operating system will be set to the appropriate value,
          +   if the operating system was determined at compile time.  If a gzip stream is
          +   being written, strm->adler is a CRC-32 instead of an Adler-32.
          +
          +     For raw deflate or gzip encoding, a request for a 256-byte window is
          +   rejected as invalid, since only the zlib header provides a means of
          +   transmitting the window size to the decompressor.
          +
                The memLevel parameter specifies how much memory should be allocated
          -   for the internal compression state. memLevel=1 uses minimum memory but
          -   is slow and reduces compression ratio; memLevel=9 uses maximum memory
          -   for optimal speed. The default value is 8. See zconf.h for total memory
          -   usage as a function of windowBits and memLevel.
          +   for the internal compression state.  memLevel=1 uses minimum memory but is
          +   slow and reduces compression ratio; memLevel=9 uses maximum memory for
          +   optimal speed.  The default value is 8.  See zconf.h for total memory usage
          +   as a function of windowBits and memLevel.
           
          -     The strategy parameter is used to tune the compression algorithm. Use the
          +     The strategy parameter is used to tune the compression algorithm.  Use the
              value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
          -   filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no
          -   string match).  Filtered data consists mostly of small values with a
          -   somewhat random distribution. In this case, the compression algorithm is
          -   tuned to compress them better. The effect of Z_FILTERED is to force more
          -   Huffman coding and less string matching; it is somewhat intermediate
          -   between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects
          -   the compression ratio but not the correctness of the compressed output even
          -   if it is not set appropriately.
          +   filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no
          +   string match), or Z_RLE to limit match distances to one (run-length
          +   encoding).  Filtered data consists mostly of small values with a somewhat
          +   random distribution.  In this case, the compression algorithm is tuned to
          +   compress them better.  The effect of Z_FILTERED is to force more Huffman
          +   coding and less string matching; it is somewhat intermediate between
          +   Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY.  Z_RLE is designed to be almost as
          +   fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data.  The
          +   strategy parameter only affects the compression ratio but not the
          +   correctness of the compressed output even if it is not set appropriately.
          +   Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler
          +   decoder for special applications.
           
          -      deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
          -   memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
          -   method). msg is set to null if there is no error message.  deflateInit2 does
          -   not perform any compression: this will be done by deflate().
          +     deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
          +   memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid
          +   method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is
          +   incompatible with the version assumed by the caller (ZLIB_VERSION).  msg is
          +   set to null if there is no error message.  deflateInit2 does not perform any
          +   compression: this will be done by deflate().
           */
           
          +ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
          +                                             const Bytef *dictionary,
          +                                             uInt  dictLength));
           /*
                Initializes the compression dictionary from the given byte sequence
          -   without producing any compressed output. This function must be called
          -   immediately after deflateInit, deflateInit2 or deflateReset, before any
          -   call of deflate. The compressor and decompressor must use exactly the same
          -   dictionary (see inflateSetDictionary).
          +   without producing any compressed output.  When using the zlib format, this
          +   function must be called immediately after deflateInit, deflateInit2 or
          +   deflateReset, and before any call of deflate.  When doing raw deflate, this
          +   function must be called either before any call of deflate, or immediately
          +   after the completion of a deflate block, i.e. after all input has been
          +   consumed and all output has been delivered when using any of the flush
          +   options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH.  The
          +   compressor and decompressor must use exactly the same dictionary (see
          +   inflateSetDictionary).
           
                The dictionary should consist of strings (byte sequences) that are likely
              to be encountered later in the data to be compressed, with the most commonly
          -   used strings preferably put towards the end of the dictionary. Using a
          +   used strings preferably put towards the end of the dictionary.  Using a
              dictionary is most useful when the data to be compressed is short and can be
              predicted with good accuracy; the data can then be compressed better than
              with the default empty dictionary.
           
                Depending on the size of the compression data structures selected by
              deflateInit or deflateInit2, a part of the dictionary may in effect be
          -   discarded, for example if the dictionary is larger than the window size in
          -   deflate or deflate2. Thus the strings most likely to be useful should be
          -   put at the end of the dictionary, not at the front.
          +   discarded, for example if the dictionary is larger than the window size
          +   provided in deflateInit or deflateInit2.  Thus the strings most likely to be
          +   useful should be put at the end of the dictionary, not at the front.  In
          +   addition, the current implementation of deflate will use at most the window
          +   size minus 262 bytes of the provided dictionary.
           
          -     Upon return of this function, strm->adler is set to the Adler32 value
          +     Upon return of this function, strm->adler is set to the Adler-32 value
              of the dictionary; the decompressor may later use this value to determine
          -   which dictionary has been used by the compressor. (The Adler32 value
          +   which dictionary has been used by the compressor.  (The Adler-32 value
              applies to the whole dictionary even if only a subset of the dictionary is
          -   actually used by the compressor.)
          +   actually used by the compressor.) If a raw deflate was requested, then the
          +   Adler-32 value is not computed and strm->adler is not set.
           
                deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
          -   parameter is invalid (such as NULL dictionary) or the stream state is
          +   parameter is invalid (e.g.  dictionary being Z_NULL) or the stream state is
              inconsistent (for example if deflate has already been called for this stream
          -   or if the compression method is bsort). deflateSetDictionary does not
          -   perform any compression: this will be done by deflate().
          +   or if not at a block boundary for raw deflate).  deflateSetDictionary does
          +   not perform any compression: this will be done by deflate().
           */
           
          +ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm,
          +                                             Bytef *dictionary,
          +                                             uInt  *dictLength));
          +/*
          +     Returns the sliding dictionary being maintained by deflate.  dictLength is
          +   set to the number of bytes in the dictionary, and that many bytes are copied
          +   to dictionary.  dictionary must have enough space, where 32768 bytes is
          +   always enough.  If deflateGetDictionary() is called with dictionary equal to
          +   Z_NULL, then only the dictionary length is returned, and nothing is copied.
          +   Similary, if dictLength is Z_NULL, then it is not set.
          +
          +     deflateGetDictionary() may return a length less than the window size, even
          +   when more than the window size in input has been provided. It may return up
          +   to 258 bytes less in that case, due to how zlib's implementation of deflate
          +   manages the sliding window and lookahead for matches, where matches can be
          +   up to 258 bytes long. If the application needs the last window-size bytes of
          +   input, then that would need to be saved by the application outside of zlib.
          +
          +     deflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the
          +   stream state is inconsistent.
          +*/
          +
          +ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
          +                                    z_streamp source));
           /*
                Sets the destination stream as a complete copy of the source stream.
           
                This function can be useful when several compression strategies will be
              tried, for example when there are several ways of pre-processing the input
          -   data with a filter. The streams that will be discarded should then be freed
          +   data with a filter.  The streams that will be discarded should then be freed
              by calling deflateEnd.  Note that deflateCopy duplicates the internal
          -   compression state which can be quite large, so this strategy is slow and
          -   can consume lots of memory.
          +   compression state which can be quite large, so this strategy is slow and can
          +   consume lots of memory.
           
                deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
              enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
          -   (such as zalloc being NULL). msg is left unchanged in both source and
          +   (such as zalloc being Z_NULL).  msg is left unchanged in both source and
              destination.
           */
           
          +ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
           /*
          -     This function is equivalent to deflateEnd followed by deflateInit,
          -   but does not free and reallocate all the internal compression state.
          -   The stream will keep the same compression level and any other attributes
          -   that may have been set by deflateInit2.
          +     This function is equivalent to deflateEnd followed by deflateInit, but
          +   does not free and reallocate the internal compression state.  The stream
          +   will leave the compression level and any other attributes that may have been
          +   set unchanged.
           
          -      deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
          -   stream state was inconsistent (such as zalloc or state being NULL).
          +     deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
          +   stream state was inconsistent (such as zalloc or state being Z_NULL).
           */
           
          +ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
          +                                      int level,
          +                                      int strategy));
           /*
                Dynamically update the compression level and compression strategy.  The
          -   interpretation of level and strategy is as in deflateInit2.  This can be
          +   interpretation of level and strategy is as in deflateInit2().  This can be
              used to switch between compression and straight copy of the input data, or
          -   to switch to a different kind of input data requiring a different
          -   strategy. If the compression level is changed, the input available so far
          -   is compressed with the old level (and may be flushed); the new level will
          -   take effect only at the next call of deflate().
          +   to switch to a different kind of input data requiring a different strategy.
          +   If the compression approach (which is a function of the level) or the
          +   strategy is changed, and if any input has been consumed in a previous
          +   deflate() call, then the input available so far is compressed with the old
          +   level and strategy using deflate(strm, Z_BLOCK).  There are three approaches
          +   for the compression levels 0, 1..3, and 4..9 respectively.  The new level
          +   and strategy will take effect at the next call of deflate().
           
          -     Before the call of deflateParams, the stream state must be set as for
          -   a call of deflate(), since the currently available input may have to
          -   be compressed and flushed. In particular, strm->avail_out must be non-zero.
          +     If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does
          +   not have enough output space to complete, then the parameter change will not
          +   take effect.  In this case, deflateParams() can be called again with the
          +   same parameters and more output space to try again.
           
          -     deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
          -   stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
          -   if strm->avail_out was zero.
          +     In order to assure a change in the parameters on the first try, the
          +   deflate stream should be flushed using deflate() with Z_BLOCK or other flush
          +   request until strm.avail_out is not zero, before calling deflateParams().
          +   Then no more input data should be provided before the deflateParams() call.
          +   If this is done, the old level and strategy will be applied to the data
          +   compressed before deflateParams(), and the new level and strategy will be
          +   applied to the the data compressed after deflateParams().
          +
          +     deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream
          +   state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if
          +   there was not enough output space to complete the compression of the
          +   available input data before a change in the strategy or approach.  Note that
          +   in the case of a Z_BUF_ERROR, the parameters are not changed.  A return
          +   value of Z_BUF_ERROR is not fatal, in which case deflateParams() can be
          +   retried with more output space.
          +*/
          +
          +ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
          +                                    int good_length,
          +                                    int max_lazy,
          +                                    int nice_length,
          +                                    int max_chain));
          +/*
          +     Fine tune deflate's internal compression parameters.  This should only be
          +   used by someone who understands the algorithm used by zlib's deflate for
          +   searching for the best matching string, and even then only by the most
          +   fanatic optimizer trying to squeeze out the last compressed bit for their
          +   specific input data.  Read the deflate.c source code for the meaning of the
          +   max_lazy, good_length, nice_length, and max_chain parameters.
          +
          +     deflateTune() can be called after deflateInit() or deflateInit2(), and
          +   returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
          + */
          +
          +ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
          +                                       uLong sourceLen));
          +/*
          +     deflateBound() returns an upper bound on the compressed size after
          +   deflation of sourceLen bytes.  It must be called after deflateInit() or
          +   deflateInit2(), and after deflateSetHeader(), if used.  This would be used
          +   to allocate an output buffer for deflation in a single pass, and so would be
          +   called before deflate().  If that first deflate() call is provided the
          +   sourceLen input bytes, an output buffer allocated to the size returned by
          +   deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed
          +   to return Z_STREAM_END.  Note that it is possible for the compressed size to
          +   be larger than the value returned by deflateBound() if flush options other
          +   than Z_FINISH or Z_NO_FLUSH are used.
          +*/
          +
          +ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm,
          +                                       unsigned *pending,
          +                                       int *bits));
          +/*
          +     deflatePending() returns the number of bytes and bits of output that have
          +   been generated, but not yet provided in the available output.  The bytes not
          +   provided would be due to the available output space having being consumed.
          +   The number of bits of output not provided are between 0 and 7, where they
          +   await more bits to join them in order to fill out a full byte.  If pending
          +   or bits are Z_NULL, then those values are not set.
          +
          +     deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source
          +   stream state was inconsistent.
          + */
          +
          +ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
          +                                     int bits,
          +                                     int value));
          +/*
          +     deflatePrime() inserts bits in the deflate output stream.  The intent
          +   is that this function is used to start off the deflate output with the bits
          +   leftover from a previous deflate stream when appending to it.  As such, this
          +   function can only be used for raw deflate, and must be used before the first
          +   deflate() call after a deflateInit2() or deflateReset().  bits must be less
          +   than or equal to 16, and that many of the least significant bits of value
          +   will be inserted in the output.
          +
          +     deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough
          +   room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the
          +   source stream state was inconsistent.
          +*/
          +
          +ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
          +                                         gz_headerp head));
          +/*
          +     deflateSetHeader() provides gzip header information for when a gzip
          +   stream is requested by deflateInit2().  deflateSetHeader() may be called
          +   after deflateInit2() or deflateReset() and before the first call of
          +   deflate().  The text, time, os, extra field, name, and comment information
          +   in the provided gz_header structure are written to the gzip header (xflag is
          +   ignored -- the extra flags are set according to the compression level).  The
          +   caller must assure that, if not Z_NULL, name and comment are terminated with
          +   a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
          +   available there.  If hcrc is true, a gzip header crc is included.  Note that
          +   the current versions of the command-line version of gzip (up through version
          +   1.3.x) do not support header crc's, and will report that it is a "multi-part
          +   gzip file" and give up.
          +
          +     If deflateSetHeader is not used, the default gzip header has text false,
          +   the time set to zero, and os set to 255, with no extra, name, or comment
          +   fields.  The gzip header is returned to the default state by deflateReset().
          +
          +     deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
          +   stream state was inconsistent.
           */
           
           /*
          -ZEXTERN(int)  inflateInit2 OF((z_streamp strm,
          +ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
                                                int  windowBits));
           
          -     This is another version of inflateInit with an extra parameter. The
          +     This is another version of inflateInit with an extra parameter.  The
              fields next_in, avail_in, zalloc, zfree and opaque must be initialized
              before by the caller.
           
                The windowBits parameter is the base two logarithm of the maximum window
              size (the size of the history buffer).  It should be in the range 8..15 for
          -   this version of the library. The default value is 15 if inflateInit is used
          -   instead. If a compressed stream with a larger window size is given as
          -   input, inflate() will return with the error code Z_DATA_ERROR instead of
          -   trying to allocate a larger window.
          +   this version of the library.  The default value is 15 if inflateInit is used
          +   instead.  windowBits must be greater than or equal to the windowBits value
          +   provided to deflateInit2() while compressing, or it must be equal to 15 if
          +   deflateInit2() was not used.  If a compressed stream with a larger window
          +   size is given as input, inflate() will return with the error code
          +   Z_DATA_ERROR instead of trying to allocate a larger window.
           
          -      inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
          -   memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative
          -   memLevel). msg is set to null if there is no error message.  inflateInit2
          -   does not perform any decompression apart from reading the zlib header if
          -   present: this will be done by inflate(). (So next_in and avail_in may be
          -   modified, but next_out and avail_out are unchanged.)
          +     windowBits can also be zero to request that inflate use the window size in
          +   the zlib header of the compressed stream.
          +
          +     windowBits can also be -8..-15 for raw inflate.  In this case, -windowBits
          +   determines the window size.  inflate() will then process raw deflate data,
          +   not looking for a zlib or gzip header, not generating a check value, and not
          +   looking for any check values for comparison at the end of the stream.  This
          +   is for use with other formats that use the deflate compressed data format
          +   such as zip.  Those formats provide their own check values.  If a custom
          +   format is developed using the raw deflate format for compressed data, it is
          +   recommended that a check value such as an Adler-32 or a CRC-32 be applied to
          +   the uncompressed data as is done in the zlib, gzip, and zip formats.  For
          +   most applications, the zlib format should be used as is.  Note that comments
          +   above on the use in deflateInit2() applies to the magnitude of windowBits.
          +
          +     windowBits can also be greater than 15 for optional gzip decoding.  Add
          +   32 to windowBits to enable zlib and gzip decoding with automatic header
          +   detection, or add 16 to decode only the gzip format (the zlib format will
          +   return a Z_DATA_ERROR).  If a gzip stream is being decoded, strm->adler is a
          +   CRC-32 instead of an Adler-32.  Unlike the gunzip utility and gzread() (see
          +   below), inflate() will not automatically decode concatenated gzip streams.
          +   inflate() will return Z_STREAM_END at the end of the gzip stream.  The state
          +   would need to be reset to continue decoding a subsequent gzip stream.
          +
          +     inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
          +   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
          +   version assumed by the caller, or Z_STREAM_ERROR if the parameters are
          +   invalid, such as a null pointer to the structure.  msg is set to null if
          +   there is no error message.  inflateInit2 does not perform any decompression
          +   apart from possibly reading the zlib header if present: actual decompression
          +   will be done by inflate().  (So next_in and avail_in may be modified, but
          +   next_out and avail_out are unused and unchanged.) The current implementation
          +   of inflateInit2() does not process any header information -- that is
          +   deferred until inflate() is called.
           */
           
          +ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
          +                                             const Bytef *dictionary,
          +                                             uInt  dictLength));
           /*
                Initializes the decompression dictionary from the given uncompressed byte
          -   sequence. This function must be called immediately after a call of inflate
          -   if this call returned Z_NEED_DICT. The dictionary chosen by the compressor
          -   can be determined from the Adler32 value returned by this call of
          -   inflate. The compressor and decompressor must use exactly the same
          -   dictionary (see deflateSetDictionary).
          +   sequence.  This function must be called immediately after a call of inflate,
          +   if that call returned Z_NEED_DICT.  The dictionary chosen by the compressor
          +   can be determined from the Adler-32 value returned by that call of inflate.
          +   The compressor and decompressor must use exactly the same dictionary (see
          +   deflateSetDictionary).  For raw inflate, this function can be called at any
          +   time to set the dictionary.  If the provided dictionary is smaller than the
          +   window and there is already data in the window, then the provided dictionary
          +   will amend what's there.  The application must insure that the dictionary
          +   that was used for compression is provided.
           
                inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
          -   parameter is invalid (such as NULL dictionary) or the stream state is
          +   parameter is invalid (e.g.  dictionary being Z_NULL) or the stream state is
              inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
          -   expected one (incorrect Adler32 value). inflateSetDictionary does not
          +   expected one (incorrect Adler-32 value).  inflateSetDictionary does not
              perform any decompression: this will be done by subsequent calls of
              inflate().
           */
           
          +ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm,
          +                                             Bytef *dictionary,
          +                                             uInt  *dictLength));
           /*
          -    Skips invalid compressed data until a full flush point (see above the
          -  description of deflate with Z_FULL_FLUSH) can be found, or until all
          -  available input is skipped. No output is provided.
          +     Returns the sliding dictionary being maintained by inflate.  dictLength is
          +   set to the number of bytes in the dictionary, and that many bytes are copied
          +   to dictionary.  dictionary must have enough space, where 32768 bytes is
          +   always enough.  If inflateGetDictionary() is called with dictionary equal to
          +   Z_NULL, then only the dictionary length is returned, and nothing is copied.
          +   Similary, if dictLength is Z_NULL, then it is not set.
           
          -    inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
          -  if no more input was provided, Z_DATA_ERROR if no flush point has been found,
          -  or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
          -  case, the application may save the current value of total_in which
          -  indicates where valid compressed data was found. In the error case, the
          -  application may repeatedly call inflateSync, providing more input each time,
          -  until success or end of the input data.
          +     inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the
          +   stream state is inconsistent.
           */
           
          -ZEXTERN(int)  inflateReset OF((z_streamp strm));
          +ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
          +/*
          +     Skips invalid compressed data until a possible full flush point (see above
          +   for the description of deflate with Z_FULL_FLUSH) can be found, or until all
          +   available input is skipped.  No output is provided.
          +
          +     inflateSync searches for a 00 00 FF FF pattern in the compressed data.
          +   All full flush points have this pattern, but not all occurrences of this
          +   pattern are full flush points.
          +
          +     inflateSync returns Z_OK if a possible full flush point has been found,
          +   Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point
          +   has been found, or Z_STREAM_ERROR if the stream structure was inconsistent.
          +   In the success case, the application may save the current current value of
          +   total_in which indicates where valid compressed data was found.  In the
          +   error case, the application may repeatedly call inflateSync, providing more
          +   input each time, until success or end of the input data.
          +*/
          +
          +ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
          +                                    z_streamp source));
          +/*
          +     Sets the destination stream as a complete copy of the source stream.
          +
          +     This function can be useful when randomly accessing a large stream.  The
          +   first pass through the stream can periodically record the inflate state,
          +   allowing restarting inflate at those points when randomly accessing the
          +   stream.
          +
          +     inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
          +   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
          +   (such as zalloc being Z_NULL).  msg is left unchanged in both source and
          +   destination.
          +*/
          +
          +#endif  /* !Z_FREETYPE */
          +
          +ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
           /*
                This function is equivalent to inflateEnd followed by inflateInit,
          -   but does not free and reallocate all the internal decompression state.
          -   The stream will keep attributes that may have been set by inflateInit2.
          +   but does not free and reallocate the internal decompression state.  The
          +   stream will keep attributes that may have been set by inflateInit2.
           
          -      inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
          -   stream state was inconsistent (such as zalloc or state being NULL).
          +     inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
          +   stream state was inconsistent (such as zalloc or state being Z_NULL).
           */
           
          +ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
          +                                      int windowBits));
          +/*
          +     This function is the same as inflateReset, but it also permits changing
          +   the wrap and window size requests.  The windowBits parameter is interpreted
          +   the same as it is for inflateInit2.  If the window size is changed, then the
          +   memory allocated for the window is freed, and the window will be reallocated
          +   by inflate() if needed.
          +
          +     inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source
          +   stream state was inconsistent (such as zalloc or state being Z_NULL), or if
          +   the windowBits parameter is invalid.
          +*/
          +
          +#ifndef Z_FREETYPE
          +
          +ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
          +                                     int bits,
          +                                     int value));
          +/*
          +     This function inserts bits in the inflate input stream.  The intent is
          +   that this function is used to start inflating at a bit position in the
          +   middle of a byte.  The provided bits will be used before any bytes are used
          +   from next_in.  This function should only be used with raw inflate, and
          +   should be used before the first inflate() call after inflateInit2() or
          +   inflateReset().  bits must be less than or equal to 16, and that many of the
          +   least significant bits of value will be inserted in the input.
          +
          +     If bits is negative, then the input stream bit buffer is emptied.  Then
          +   inflatePrime() can be called again to put bits in the buffer.  This is used
          +   to clear out bits leftover after feeding inflate a block description prior
          +   to feeding inflate codes.
          +
          +     inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
          +   stream state was inconsistent.
          +*/
          +
          +ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));
          +/*
          +     This function returns two values, one in the lower 16 bits of the return
          +   value, and the other in the remaining upper bits, obtained by shifting the
          +   return value down 16 bits.  If the upper value is -1 and the lower value is
          +   zero, then inflate() is currently decoding information outside of a block.
          +   If the upper value is -1 and the lower value is non-zero, then inflate is in
          +   the middle of a stored block, with the lower value equaling the number of
          +   bytes from the input remaining to copy.  If the upper value is not -1, then
          +   it is the number of bits back from the current bit position in the input of
          +   the code (literal or length/distance pair) currently being processed.  In
          +   that case the lower value is the number of bytes already emitted for that
          +   code.
          +
          +     A code is being processed if inflate is waiting for more input to complete
          +   decoding of the code, or if it has completed decoding but is waiting for
          +   more output space to write the literal or match data.
          +
          +     inflateMark() is used to mark locations in the input data for random
          +   access, which may be at bit positions, and to note those cases where the
          +   output of a code may span boundaries of random access blocks.  The current
          +   location in the input stream can be determined from avail_in and data_type
          +   as noted in the description for the Z_BLOCK flush parameter for inflate.
          +
          +     inflateMark returns the value noted above, or -65536 if the provided
          +   source stream state was inconsistent.
          +*/
          +
          +ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
          +                                         gz_headerp head));
          +/*
          +     inflateGetHeader() requests that gzip header information be stored in the
          +   provided gz_header structure.  inflateGetHeader() may be called after
          +   inflateInit2() or inflateReset(), and before the first call of inflate().
          +   As inflate() processes the gzip stream, head->done is zero until the header
          +   is completed, at which time head->done is set to one.  If a zlib stream is
          +   being decoded, then head->done is set to -1 to indicate that there will be
          +   no gzip header information forthcoming.  Note that Z_BLOCK or Z_TREES can be
          +   used to force inflate() to return immediately after header processing is
          +   complete and before any actual data is decompressed.
          +
          +     The text, time, xflags, and os fields are filled in with the gzip header
          +   contents.  hcrc is set to true if there is a header CRC.  (The header CRC
          +   was valid if done is set to one.) If extra is not Z_NULL, then extra_max
          +   contains the maximum number of bytes to write to extra.  Once done is true,
          +   extra_len contains the actual extra field length, and extra contains the
          +   extra field, or that field truncated if extra_max is less than extra_len.
          +   If name is not Z_NULL, then up to name_max characters are written there,
          +   terminated with a zero unless the length is greater than name_max.  If
          +   comment is not Z_NULL, then up to comm_max characters are written there,
          +   terminated with a zero unless the length is greater than comm_max.  When any
          +   of extra, name, or comment are not Z_NULL and the respective field is not
          +   present in the header, then that field is set to Z_NULL to signal its
          +   absence.  This allows the use of deflateSetHeader() with the returned
          +   structure to duplicate the header.  However if those fields are set to
          +   allocated memory, then the application will need to save those pointers
          +   elsewhere so that they can be eventually freed.
          +
          +     If inflateGetHeader is not used, then the header information is simply
          +   discarded.  The header is always checked for validity, including the header
          +   CRC if present.  inflateReset() will reset the process to discard the header
          +   information.  The application would need to call inflateGetHeader() again to
          +   retrieve the header from the next gzip stream.
          +
          +     inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
          +   stream state was inconsistent.
          +*/
          +
          +#endif  /* !Z_FREETYPE */
          +
          +/*
          +ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
          +                                        unsigned char FAR *window));
          +
          +     Initialize the internal stream state for decompression using inflateBack()
          +   calls.  The fields zalloc, zfree and opaque in strm must be initialized
          +   before the call.  If zalloc and zfree are Z_NULL, then the default library-
          +   derived memory allocation routines are used.  windowBits is the base two
          +   logarithm of the window size, in the range 8..15.  window is a caller
          +   supplied buffer of that size.  Except for special applications where it is
          +   assured that deflate was used with small window sizes, windowBits must be 15
          +   and a 32K byte window must be supplied to be able to decompress general
          +   deflate streams.
          +
          +     See inflateBack() for the usage of these routines.
          +
          +     inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
          +   the parameters are invalid, Z_MEM_ERROR if the internal state could not be
          +   allocated, or Z_VERSION_ERROR if the version of the library does not match
          +   the version of the header file.
          +*/
          +
          +typedef unsigned (*in_func) OF((void FAR *,
          +                                z_const unsigned char FAR * FAR *));
          +typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
          +
          +#ifndef Z_FREETYPE
          +
          +ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
          +                                    in_func in, void FAR *in_desc,
          +                                    out_func out, void FAR *out_desc));
          +/*
          +     inflateBack() does a raw inflate with a single call using a call-back
          +   interface for input and output.  This is potentially more efficient than
          +   inflate() for file i/o applications, in that it avoids copying between the
          +   output and the sliding window by simply making the window itself the output
          +   buffer.  inflate() can be faster on modern CPUs when used with large
          +   buffers.  inflateBack() trusts the application to not change the output
          +   buffer passed by the output function, at least until inflateBack() returns.
          +
          +     inflateBackInit() must be called first to allocate the internal state
          +   and to initialize the state with the user-provided window buffer.
          +   inflateBack() may then be used multiple times to inflate a complete, raw
          +   deflate stream with each call.  inflateBackEnd() is then called to free the
          +   allocated state.
          +
          +     A raw deflate stream is one with no zlib or gzip header or trailer.
          +   This routine would normally be used in a utility that reads zip or gzip
          +   files and writes out uncompressed files.  The utility would decode the
          +   header and process the trailer on its own, hence this routine expects only
          +   the raw deflate stream to decompress.  This is different from the default
          +   behavior of inflate(), which expects a zlib header and trailer around the
          +   deflate stream.
          +
          +     inflateBack() uses two subroutines supplied by the caller that are then
          +   called by inflateBack() for input and output.  inflateBack() calls those
          +   routines until it reads a complete deflate stream and writes out all of the
          +   uncompressed data, or until it encounters an error.  The function's
          +   parameters and return types are defined above in the in_func and out_func
          +   typedefs.  inflateBack() will call in(in_desc, &buf) which should return the
          +   number of bytes of provided input, and a pointer to that input in buf.  If
          +   there is no input available, in() must return zero -- buf is ignored in that
          +   case -- and inflateBack() will return a buffer error.  inflateBack() will
          +   call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1].
          +   out() should return zero on success, or non-zero on failure.  If out()
          +   returns non-zero, inflateBack() will return with an error.  Neither in() nor
          +   out() are permitted to change the contents of the window provided to
          +   inflateBackInit(), which is also the buffer that out() uses to write from.
          +   The length written by out() will be at most the window size.  Any non-zero
          +   amount of input may be provided by in().
          +
          +     For convenience, inflateBack() can be provided input on the first call by
          +   setting strm->next_in and strm->avail_in.  If that input is exhausted, then
          +   in() will be called.  Therefore strm->next_in must be initialized before
          +   calling inflateBack().  If strm->next_in is Z_NULL, then in() will be called
          +   immediately for input.  If strm->next_in is not Z_NULL, then strm->avail_in
          +   must also be initialized, and then if strm->avail_in is not zero, input will
          +   initially be taken from strm->next_in[0 ..  strm->avail_in - 1].
          +
          +     The in_desc and out_desc parameters of inflateBack() is passed as the
          +   first parameter of in() and out() respectively when they are called.  These
          +   descriptors can be optionally used to pass any information that the caller-
          +   supplied in() and out() functions need to do their job.
          +
          +     On return, inflateBack() will set strm->next_in and strm->avail_in to
          +   pass back any unused input that was provided by the last in() call.  The
          +   return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR
          +   if in() or out() returned an error, Z_DATA_ERROR if there was a format error
          +   in the deflate stream (in which case strm->msg is set to indicate the nature
          +   of the error), or Z_STREAM_ERROR if the stream was not properly initialized.
          +   In the case of Z_BUF_ERROR, an input or output error can be distinguished
          +   using strm->next_in which will be Z_NULL only if in() returned an error.  If
          +   strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning
          +   non-zero.  (in() will always be called before out(), so strm->next_in is
          +   assured to be defined if out() returns non-zero.)  Note that inflateBack()
          +   cannot return Z_OK.
          +*/
          +
          +ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
          +/*
          +     All memory allocated by inflateBackInit() is freed.
          +
          +     inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream
          +   state was inconsistent.
          +*/
          +
          +ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
          +/* Return flags indicating compile-time options.
          +
          +    Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
          +     1.0: size of uInt
          +     3.2: size of uLong
          +     5.4: size of voidpf (pointer)
          +     7.6: size of z_off_t
          +
          +    Compiler, assembler, and debug options:
          +     8: ZLIB_DEBUG
          +     9: ASMV or ASMINF -- use ASM code
          +     10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
          +     11: 0 (reserved)
          +
          +    One-time table building (smaller code, but not thread-safe if true):
          +     12: BUILDFIXED -- build static block decoding tables when needed
          +     13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed
          +     14,15: 0 (reserved)
          +
          +    Library content (indicates missing functionality):
          +     16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking
          +                          deflate code when not needed)
          +     17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect
          +                    and decode gzip streams (to avoid linking crc code)
          +     18-19: 0 (reserved)
          +
          +    Operation variations (changes in library functionality):
          +     20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate
          +     21: FASTEST -- deflate algorithm with only one, lowest compression level
          +     22,23: 0 (reserved)
          +
          +    The sprintf variant used by gzprintf (zero is best):
          +     24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
          +     25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
          +     26: 0 = returns value, 1 = void -- 1 means inferred string length returned
          +
          +    Remainder:
          +     27-31: 0 (reserved)
          + */
          +
          +#endif  /* !Z_FREETYPE */
          +
          +#ifndef Z_SOLO
           
                                   /* utility functions */
           
           /*
          -     The following utility functions are implemented on top of the
          -   basic stream-oriented functions. To simplify the interface, some
          -   default options are assumed (compression level and memory usage,
          -   standard memory allocation functions). The source code of these
          -   utility functions can easily be modified if you need special options.
          +     The following utility functions are implemented on top of the basic
          +   stream-oriented functions.  To simplify the interface, some default options
          +   are assumed (compression level and memory usage, standard memory allocation
          +   functions).  The source code of these utility functions can be modified if
          +   you need special options.
           */
           
          +ZEXTERN int ZEXPORT compress OF((Bytef *dest,   uLongf *destLen,
          +                                 const Bytef *source, uLong sourceLen));
           /*
                Compresses the source buffer into the destination buffer.  sourceLen is
          -   the byte length of the source buffer. Upon entry, destLen is the total
          -   size of the destination buffer, which must be at least 0.1% larger than
          -   sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the
          -   compressed buffer.
          -     This function can be used to compress a whole file at once if the
          -   input file is mmap'ed.
          +   the byte length of the source buffer.  Upon entry, destLen is the total size
          +   of the destination buffer, which must be at least the value returned by
          +   compressBound(sourceLen).  Upon exit, destLen is the actual size of the
          +   compressed data.  compress() is equivalent to compress2() with a level
          +   parameter of Z_DEFAULT_COMPRESSION.
          +
                compress returns Z_OK if success, Z_MEM_ERROR if there was not
              enough memory, Z_BUF_ERROR if there was not enough room in the output
              buffer.
           */
           
          +ZEXTERN int ZEXPORT compress2 OF((Bytef *dest,   uLongf *destLen,
          +                                  const Bytef *source, uLong sourceLen,
          +                                  int level));
           /*
          -     Compresses the source buffer into the destination buffer. The level
          +     Compresses the source buffer into the destination buffer.  The level
              parameter has the same meaning as in deflateInit.  sourceLen is the byte
          -   length of the source buffer. Upon entry, destLen is the total size of the
          -   destination buffer, which must be at least 0.1% larger than sourceLen plus
          -   12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
          +   length of the source buffer.  Upon entry, destLen is the total size of the
          +   destination buffer, which must be at least the value returned by
          +   compressBound(sourceLen).  Upon exit, destLen is the actual size of the
          +   compressed data.
           
                compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
              memory, Z_BUF_ERROR if there was not enough room in the output buffer,
              Z_STREAM_ERROR if the level parameter is invalid.
           */
           
          +ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
          +/*
          +     compressBound() returns an upper bound on the compressed size after
          +   compress() or compress2() on sourceLen bytes.  It would be used before a
          +   compress() or compress2() call to allocate the destination buffer.
          +*/
          +
          +ZEXTERN int ZEXPORT uncompress OF((Bytef *dest,   uLongf *destLen,
          +                                   const Bytef *source, uLong sourceLen));
           /*
                Decompresses the source buffer into the destination buffer.  sourceLen is
          -   the byte length of the source buffer. Upon entry, destLen is the total
          -   size of the destination buffer, which must be large enough to hold the
          -   entire uncompressed data. (The size of the uncompressed data must have
          -   been saved previously by the compressor and transmitted to the decompressor
          -   by some mechanism outside the scope of this compression library.)
          -   Upon exit, destLen is the actual size of the compressed buffer.
          -     This function can be used to decompress a whole file at once if the
          -   input file is mmap'ed.
          +   the byte length of the source buffer.  Upon entry, destLen is the total size
          +   of the destination buffer, which must be large enough to hold the entire
          +   uncompressed data.  (The size of the uncompressed data must have been saved
          +   previously by the compressor and transmitted to the decompressor by some
          +   mechanism outside the scope of this compression library.) Upon exit, destLen
          +   is the actual size of the uncompressed data.
           
                uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
              enough memory, Z_BUF_ERROR if there was not enough room in the output
          -   buffer, or Z_DATA_ERROR if the input data was corrupted.
          +   buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.  In
          +   the case where there is not enough room, uncompress() will fill the output
          +   buffer with the uncompressed data up to that point.
           */
           
          +ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest,   uLongf *destLen,
          +                                    const Bytef *source, uLong *sourceLen));
          +/*
          +     Same as uncompress, except that sourceLen is a pointer, where the
          +   length of the source is *sourceLen.  On return, *sourceLen is the number of
          +   source bytes consumed.
          +*/
          +
          +                        /* gzip file access functions */
           
           /*
          -     Opens a gzip (.gz) file for reading or writing. The mode parameter
          -   is as in fopen ("rb" or "wb") but can also include a compression level
          -   ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
          -   Huffman only compression as in "wb1h". (See the description
          -   of deflateInit2 for more information about the strategy parameter.)
          +     This library supports reading and writing files in gzip (.gz) format with
          +   an interface similar to that of stdio, using the functions that start with
          +   "gz".  The gzip format is different from the zlib format.  gzip is a gzip
          +   wrapper, documented in RFC 1952, wrapped around a deflate stream.
          +*/
          +
          +typedef struct gzFile_s *gzFile;    /* semi-opaque gzip file descriptor */
          +
          +/*
          +ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
          +
          +     Opens a gzip (.gz) file for reading or writing.  The mode parameter is as
          +   in fopen ("rb" or "wb") but can also include a compression level ("wb9") or
          +   a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only
          +   compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F'
          +   for fixed code compression as in "wb9F".  (See the description of
          +   deflateInit2 for more information about the strategy parameter.)  'T' will
          +   request transparent writing or appending with no compression and not using
          +   the gzip format.
          +
          +     "a" can be used instead of "w" to request that the gzip stream that will
          +   be written be appended to the file.  "+" will result in an error, since
          +   reading and writing to the same gzip file is not supported.  The addition of
          +   "x" when writing will create the file exclusively, which fails if the file
          +   already exists.  On systems that support it, the addition of "e" when
          +   reading or writing will set the flag to close the file on an execve() call.
          +
          +     These functions, as well as gzip, will read and decode a sequence of gzip
          +   streams in a file.  The append function of gzopen() can be used to create
          +   such a file.  (Also see gzflush() for another way to do this.)  When
          +   appending, gzopen does not test whether the file begins with a gzip stream,
          +   nor does it look for the end of the gzip streams to begin appending.  gzopen
          +   will simply append a gzip stream to the existing file.
           
                gzopen can be used to read a file which is not in gzip format; in this
          -   case gzread will directly read from the file without decompression.
          +   case gzread will directly read from the file without decompression.  When
          +   reading, this will be detected automatically by looking for the magic two-
          +   byte gzip header.
           
          -     gzopen returns NULL if the file could not be opened or if there was
          -   insufficient memory to allocate the (de)compression state; errno
          -   can be checked to distinguish the two cases (if errno is zero, the
          -   zlib error is Z_MEM_ERROR).  */
          -
          -/*
          -     gzdopen() associates a gzFile with the file descriptor fd.  File
          -   descriptors are obtained from calls like open, dup, creat, pipe or
          -   fileno (in the file has been previously opened with fopen).
          -   The mode parameter is as in gzopen.
          -     The next call of gzclose on the returned gzFile will also close the
          -   file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
          -   descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
          -     gzdopen returns NULL if there was insufficient memory to allocate
          -   the (de)compression state.
          +     gzopen returns NULL if the file could not be opened, if there was
          +   insufficient memory to allocate the gzFile state, or if an invalid mode was
          +   specified (an 'r', 'w', or 'a' was not provided, or '+' was provided).
          +   errno can be checked to determine if the reason gzopen failed was that the
          +   file could not be opened.
           */
           
          +ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
           /*
          -     Dynamically update the compression level or strategy. See the description
          -   of deflateInit2 for the meaning of these parameters.
          -     gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
          -   opened for writing.
          +     gzdopen associates a gzFile with the file descriptor fd.  File descriptors
          +   are obtained from calls like open, dup, creat, pipe or fileno (if the file
          +   has been previously opened with fopen).  The mode parameter is as in gzopen.
          +
          +     The next call of gzclose on the returned gzFile will also close the file
          +   descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor
          +   fd.  If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd,
          +   mode);.  The duplicated descriptor should be saved to avoid a leak, since
          +   gzdopen does not close fd if it fails.  If you are using fileno() to get the
          +   file descriptor from a FILE *, then you will have to use dup() to avoid
          +   double-close()ing the file descriptor.  Both gzclose() and fclose() will
          +   close the associated file descriptor, so they need to have different file
          +   descriptors.
          +
          +     gzdopen returns NULL if there was insufficient memory to allocate the
          +   gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not
          +   provided, or '+' was provided), or if fd is -1.  The file descriptor is not
          +   used until the next gz* read, write, seek, or close operation, so gzdopen
          +   will not detect if fd is invalid (unless fd is -1).
           */
           
          +ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
           /*
          -     Reads the given number of uncompressed bytes from the compressed file.
          -   If the input file was not in gzip format, gzread copies the given number
          -   of bytes into the buffer.
          -     gzread returns the number of uncompressed bytes actually read (0 for
          -   end of file, -1 for error). */
          +     Set the internal buffer size used by this library's functions.  The
          +   default buffer size is 8192 bytes.  This function must be called after
          +   gzopen() or gzdopen(), and before any other calls that read or write the
          +   file.  The buffer memory allocation is always deferred to the first read or
          +   write.  Three times that size in buffer space is allocated.  A larger buffer
          +   size of, for example, 64K or 128K bytes will noticeably increase the speed
          +   of decompression (reading).
           
          +     The new buffer size also affects the maximum length for gzprintf().
          +
          +     gzbuffer() returns 0 on success, or -1 on failure, such as being called
          +   too late.
          +*/
          +
          +ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
          +/*
          +     Dynamically update the compression level or strategy.  See the description
          +   of deflateInit2 for the meaning of these parameters.  Previously provided
          +   data is flushed before the parameter change.
          +
          +     gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not
          +   opened for writing, Z_ERRNO if there is an error writing the flushed data,
          +   or Z_MEM_ERROR if there is a memory allocation error.
          +*/
          +
          +ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
          +/*
          +     Reads the given number of uncompressed bytes from the compressed file.  If
          +   the input file is not in gzip format, gzread copies the given number of
          +   bytes into the buffer directly from the file.
          +
          +     After reaching the end of a gzip stream in the input, gzread will continue
          +   to read, looking for another gzip stream.  Any number of gzip streams may be
          +   concatenated in the input file, and will all be decompressed by gzread().
          +   If something other than a gzip stream is encountered after a gzip stream,
          +   that remaining trailing garbage is ignored (and no error is returned).
          +
          +     gzread can be used to read a gzip file that is being concurrently written.
          +   Upon reaching the end of the input, gzread will return with the available
          +   data.  If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then
          +   gzclearerr can be used to clear the end of file indicator in order to permit
          +   gzread to be tried again.  Z_OK indicates that a gzip stream was completed
          +   on the last gzread.  Z_BUF_ERROR indicates that the input file ended in the
          +   middle of a gzip stream.  Note that gzread does not return -1 in the event
          +   of an incomplete gzip stream.  This error is deferred until gzclose(), which
          +   will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip
          +   stream.  Alternatively, gzerror can be used before gzclose to detect this
          +   case.
          +
          +     gzread returns the number of uncompressed bytes actually read, less than
          +   len for end of file, or -1 for error.  If len is too large to fit in an int,
          +   then nothing is read, -1 is returned, and the error state is set to
          +   Z_STREAM_ERROR.
          +*/
          +
          +ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems,
          +                                     gzFile file));
          +/*
          +     Read up to nitems items of size size from file to buf, otherwise operating
          +   as gzread() does.  This duplicates the interface of stdio's fread(), with
          +   size_t request and return types.  If the library defines size_t, then
          +   z_size_t is identical to size_t.  If not, then z_size_t is an unsigned
          +   integer type that can contain a pointer.
          +
          +     gzfread() returns the number of full items read of size size, or zero if
          +   the end of the file was reached and a full item could not be read, or if
          +   there was an error.  gzerror() must be consulted if zero is returned in
          +   order to determine if there was an error.  If the multiplication of size and
          +   nitems overflows, i.e. the product does not fit in a z_size_t, then nothing
          +   is read, zero is returned, and the error state is set to Z_STREAM_ERROR.
          +
          +     In the event that the end of file is reached and only a partial item is
          +   available at the end, i.e. the remaining uncompressed data length is not a
          +   multiple of size, then the final partial item is nevetheless read into buf
          +   and the end-of-file flag is set.  The length of the partial item read is not
          +   provided, but could be inferred from the result of gztell().  This behavior
          +   is the same as the behavior of fread() implementations in common libraries,
          +   but it prevents the direct use of gzfread() to read a concurrently written
          +   file, reseting and retrying on end-of-file, when size is not 1.
          +*/
          +
          +ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
          +                                voidpc buf, unsigned len));
           /*
                Writes the given number of uncompressed bytes into the compressed file.
          -   gzwrite returns the number of uncompressed bytes actually written
          -   (0 in case of error).
          +   gzwrite returns the number of uncompressed bytes written or 0 in case of
          +   error.
           */
           
          +ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size,
          +                                      z_size_t nitems, gzFile file));
           /*
          -     Converts, formats, and writes the args to the compressed file under
          -   control of the format string, as in fprintf. gzprintf returns the number of
          -   uncompressed bytes actually written (0 in case of error).
          +     gzfwrite() writes nitems items of size size from buf to file, duplicating
          +   the interface of stdio's fwrite(), with size_t request and return types.  If
          +   the library defines size_t, then z_size_t is identical to size_t.  If not,
          +   then z_size_t is an unsigned integer type that can contain a pointer.
          +
          +     gzfwrite() returns the number of full items written of size size, or zero
          +   if there was an error.  If the multiplication of size and nitems overflows,
          +   i.e. the product does not fit in a z_size_t, then nothing is written, zero
          +   is returned, and the error state is set to Z_STREAM_ERROR.
           */
           
          +ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...));
           /*
          -      Writes the given null-terminated string to the compressed file, excluding
          +     Converts, formats, and writes the arguments to the compressed file under
          +   control of the format string, as in fprintf.  gzprintf returns the number of
          +   uncompressed bytes actually written, or a negative zlib error code in case
          +   of error.  The number of uncompressed bytes written is limited to 8191, or
          +   one less than the buffer size given to gzbuffer().  The caller should assure
          +   that this limit is not exceeded.  If it is exceeded, then gzprintf() will
          +   return an error (0) with nothing written.  In this case, there may also be a
          +   buffer overflow with unpredictable consequences, which is possible only if
          +   zlib was compiled with the insecure functions sprintf() or vsprintf()
          +   because the secure snprintf() or vsnprintf() functions were not available.
          +   This can be determined using zlibCompileFlags().
          +*/
          +
          +ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
          +/*
          +     Writes the given null-terminated string to the compressed file, excluding
              the terminating null character.
          -      gzputs returns the number of characters written, or -1 in case of error.
          +
          +     gzputs returns the number of characters written, or -1 in case of error.
          +*/
          +
          +ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
          +/*
          +     Reads bytes from the compressed file until len-1 characters are read, or a
          +   newline character is read and transferred to buf, or an end-of-file
          +   condition is encountered.  If any characters are read or if len == 1, the
          +   string is terminated with a null character.  If no characters are read due
          +   to an end-of-file or len < 1, then the buffer is left untouched.
          +
          +     gzgets returns buf which is a null-terminated string, or it returns NULL
          +   for end-of-file or in case of error.  If there was an error, the contents at
          +   buf are indeterminate.
          +*/
          +
          +ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
          +/*
          +     Writes c, converted to an unsigned char, into the compressed file.  gzputc
          +   returns the value that was written, or -1 in case of error.
          +*/
          +
          +ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
          +/*
          +     Reads one byte from the compressed file.  gzgetc returns this byte or -1
          +   in case of end of file or error.  This is implemented as a macro for speed.
          +   As such, it does not do all of the checking the other functions do.  I.e.
          +   it does not check to see if file is NULL, nor whether the structure file
          +   points to has been clobbered or not.
          +*/
          +
          +ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
          +/*
          +     Push one character back onto the stream to be read as the first character
          +   on the next read.  At least one character of push-back is allowed.
          +   gzungetc() returns the character pushed, or -1 on failure.  gzungetc() will
          +   fail if c is -1, and may fail if a character has been pushed but not read
          +   yet.  If gzungetc is used immediately after gzopen or gzdopen, at least the
          +   output buffer size of pushed characters is allowed.  (See gzbuffer above.)
          +   The pushed character will be discarded if the stream is repositioned with
          +   gzseek() or gzrewind().
          +*/
          +
          +ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
          +/*
          +     Flushes all pending output into the compressed file.  The parameter flush
          +   is as in the deflate() function.  The return value is the zlib error number
          +   (see function gzerror below).  gzflush is only permitted when writing.
          +
          +     If the flush parameter is Z_FINISH, the remaining data is written and the
          +   gzip stream is completed in the output.  If gzwrite() is called again, a new
          +   gzip stream will be started in the output.  gzread() is able to read such
          +   concatenated gzip streams.
          +
          +     gzflush should be called only when strictly necessary because it will
          +   degrade compression if called too often.
           */
           
           /*
          -      Reads bytes from the compressed file until len-1 characters are read, or
          -   a newline character is read and transferred to buf, or an end-of-file
          -   condition is encountered.  The string is then terminated with a null
          -   character.
          -      gzgets returns buf, or Z_NULL in case of error.
          -*/
          +ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
          +                                   z_off_t offset, int whence));
           
          -/*
          -      Writes c, converted to an unsigned char, into the compressed file.
          -   gzputc returns the value that was written, or -1 in case of error.
          -*/
          -
          -/*
          -      Reads one byte from the compressed file. gzgetc returns this byte
          -   or -1 in case of end of file or error.
          -*/
          -
          -/*
          -     Flushes all pending output into the compressed file. The parameter
          -   flush is as in the deflate() function. The return value is the zlib
          -   error number (see function gzerror below). gzflush returns Z_OK if
          -   the flush parameter is Z_FINISH and all output could be flushed.
          -     gzflush should be called only when strictly necessary because it can
          -   degrade compression.
          -*/
          -
          -/*
          -      Sets the starting position for the next gzread or gzwrite on the
          -   given compressed file. The offset represents a number of bytes in the
          -   uncompressed data stream. The whence parameter is defined as in lseek(2);
          +     Sets the starting position for the next gzread or gzwrite on the given
          +   compressed file.  The offset represents a number of bytes in the
          +   uncompressed data stream.  The whence parameter is defined as in lseek(2);
              the value SEEK_END is not supported.
          +
                If the file is opened for reading, this function is emulated but can be
          -   extremely slow. If the file is opened for writing, only forward seeks are
          +   extremely slow.  If the file is opened for writing, only forward seeks are
              supported; gzseek then compresses a sequence of zeroes up to the new
              starting position.
           
          -      gzseek returns the resulting offset location as measured in bytes from
          +     gzseek returns the resulting offset location as measured in bytes from
              the beginning of the uncompressed stream, or -1 in case of error, in
              particular if the file is opened for writing and the new starting position
              would be before the current position.
           */
           
          +ZEXTERN int ZEXPORT    gzrewind OF((gzFile file));
           /*
                Rewinds the given file. This function is supported only for reading.
           
          -   gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
          +     gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
           */
           
           /*
          -     Returns the starting position for the next gzread or gzwrite on the
          -   given compressed file. This position represents a number of bytes in the
          -   uncompressed data stream.
          +ZEXTERN z_off_t ZEXPORT    gztell OF((gzFile file));
           
          -   gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
          +     Returns the starting position for the next gzread or gzwrite on the given
          +   compressed file.  This position represents a number of bytes in the
          +   uncompressed data stream, and is zero when starting, even if appending or
          +   reading a gzip stream from the middle of a file using gzdopen().
          +
          +     gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
           */
           
           /*
          -     Returns 1 when EOF has previously been detected reading the given
          -   input stream, otherwise zero.
          +ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));
          +
          +     Returns the current offset in the file being read or written.  This offset
          +   includes the count of bytes that precede the gzip stream, for example when
          +   appending or when using gzdopen() for reading.  When reading, the offset
          +   does not include as yet unused buffered input.  This information can be used
          +   for a progress indicator.  On error, gzoffset() returns -1.
           */
           
          +ZEXTERN int ZEXPORT gzeof OF((gzFile file));
           /*
          -     Flushes all pending output if necessary, closes the compressed file
          -   and deallocates all the (de)compression state. The return value is the zlib
          -   error number (see function gzerror below).
          +     Returns true (1) if the end-of-file indicator has been set while reading,
          +   false (0) otherwise.  Note that the end-of-file indicator is set only if the
          +   read tried to go past the end of the input, but came up short.  Therefore,
          +   just like feof(), gzeof() may return false even if there is no more data to
          +   read, in the event that the last read request was for the exact number of
          +   bytes remaining in the input file.  This will happen if the input file size
          +   is an exact multiple of the buffer size.
          +
          +     If gzeof() returns true, then the read functions will return no more data,
          +   unless the end-of-file indicator is reset by gzclearerr() and the input file
          +   has grown since the previous end of file was detected.
           */
           
          +ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
           /*
          -     Returns the error message for the last error which occurred on the
          -   given compressed file. errnum is set to zlib error number. If an
          -   error occurred in the file system and not in the compression library,
          -   errnum is set to Z_ERRNO and the application may consult errno
          -   to get the exact error code.
          +     Returns true (1) if file is being copied directly while reading, or false
          +   (0) if file is a gzip stream being decompressed.
          +
          +     If the input file is empty, gzdirect() will return true, since the input
          +   does not contain a gzip stream.
          +
          +     If gzdirect() is used immediately after gzopen() or gzdopen() it will
          +   cause buffers to be allocated to allow reading the file to determine if it
          +   is a gzip file.  Therefore if gzbuffer() is used, it should be called before
          +   gzdirect().
          +
          +     When writing, gzdirect() returns true (1) if transparent writing was
          +   requested ("wT" for the gzopen() mode), or false (0) otherwise.  (Note:
          +   gzdirect() is not needed when writing.  Transparent writing must be
          +   explicitly requested, so the application already knows the answer.  When
          +   linking statically, using gzdirect() will include all of the zlib code for
          +   gzip file reading and decompression, which may not be desired.)
           */
           
          +ZEXTERN int ZEXPORT    gzclose OF((gzFile file));
          +/*
          +     Flushes all pending output if necessary, closes the compressed file and
          +   deallocates the (de)compression state.  Note that once file is closed, you
          +   cannot call gzerror with file, since its structures have been deallocated.
          +   gzclose must not be called more than once on the same file, just as free
          +   must not be called more than once on the same allocation.
          +
          +     gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a
          +   file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the
          +   last read ended in the middle of a gzip stream, or Z_OK on success.
          +*/
          +
          +ZEXTERN int ZEXPORT gzclose_r OF((gzFile file));
          +ZEXTERN int ZEXPORT gzclose_w OF((gzFile file));
          +/*
          +     Same as gzclose(), but gzclose_r() is only for use when reading, and
          +   gzclose_w() is only for use when writing or appending.  The advantage to
          +   using these instead of gzclose() is that they avoid linking in zlib
          +   compression or decompression code that is not used when only reading or only
          +   writing respectively.  If gzclose() is used, then both compression and
          +   decompression code will be included the application when linking to a static
          +   zlib library.
          +*/
          +
          +ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
          +/*
          +     Returns the error message for the last error which occurred on the given
          +   compressed file.  errnum is set to zlib error number.  If an error occurred
          +   in the file system and not in the compression library, errnum is set to
          +   Z_ERRNO and the application may consult errno to get the exact error code.
          +
          +     The application must not modify the returned string.  Future calls to
          +   this function may invalidate the previously returned string.  If file is
          +   closed, then the string previously returned by gzerror will no longer be
          +   available.
          +
          +     gzerror() should be used to distinguish errors from end-of-file for those
          +   functions above that do not distinguish those cases in their return values.
          +*/
          +
          +ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
          +/*
          +     Clears the error and end-of-file flags for file.  This is analogous to the
          +   clearerr() function in stdio.  This is useful for continuing to read a gzip
          +   file that is being written concurrently.
          +*/
          +
          +#endif /* !Z_SOLO */
          +
                                   /* checksum functions */
           
           /*
                These functions are not related to compression but are exported
          -   anyway because they might be useful in applications using the
          -   compression library.
          +   anyway because they might be useful in applications using the compression
          +   library.
           */
           
          -ZEXTERN(uLong)  adler32 OF((uLong adler, const Bytef *buf, uInt len));
          -
          +ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
           /*
                Update a running Adler-32 checksum with the bytes buf[0..len-1] and
          -   return the updated checksum. If buf is NULL, this function returns
          -   the required initial value for the checksum.
          -   An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
          -   much faster. Usage example:
          +   return the updated checksum.  If buf is Z_NULL, this function returns the
          +   required initial value for the checksum.
          +
          +     An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed
          +   much faster.
          +
          +   Usage example:
           
                uLong adler = adler32(0L, Z_NULL, 0);
           
          @@ -789,11 +1718,31 @@ ZEXTERN(uLong)  adler32 OF((uLong adler, const Bytef *buf, uInt len));
                if (adler != original_adler) error();
           */
           
          +ZEXTERN uLong ZEXPORT adler32_z OF((uLong adler, const Bytef *buf,
          +                                    z_size_t len));
           /*
          -     Update a running crc with the bytes buf[0..len-1] and return the updated
          -   crc. If buf is NULL, this function returns the required initial value
          -   for the crc. Pre- and post-conditioning (one's complement) is performed
          -   within this function so it shouldn't be done by the application.
          +     Same as adler32(), but with a size_t length.
          +*/
          +
          +/*
          +ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
          +                                          z_off_t len2));
          +
          +     Combine two Adler-32 checksums into one.  For two sequences of bytes, seq1
          +   and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
          +   each, adler1 and adler2.  adler32_combine() returns the Adler-32 checksum of
          +   seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.  Note
          +   that the z_off_t type (like off_t) is a signed integer.  If len2 is
          +   negative, the result has no meaning or utility.
          +*/
          +
          +ZEXTERN uLong ZEXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));
          +/*
          +     Update a running CRC-32 with the bytes buf[0..len-1] and return the
          +   updated CRC-32.  If buf is Z_NULL, this function returns the required
          +   initial value for the crc.  Pre- and post-conditioning (one's complement) is
          +   performed within this function so it shouldn't be done by the application.
          +
              Usage example:
           
                uLong crc = crc32(0L, Z_NULL, 0);
          @@ -804,27 +1753,193 @@ ZEXTERN(uLong)  adler32 OF((uLong adler, const Bytef *buf, uInt len));
                if (crc != original_crc) error();
           */
           
          +#ifndef Z_FREETYPE
          +
          +ZEXTERN uLong ZEXPORT crc32_z OF((uLong adler, const Bytef *buf,
          +                                  z_size_t len));
          +/*
          +     Same as crc32(), but with a size_t length.
          +*/
          +
          +/*
          +ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
          +
          +     Combine two CRC-32 check values into one.  For two sequences of bytes,
          +   seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
          +   calculated for each, crc1 and crc2.  crc32_combine() returns the CRC-32
          +   check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
          +   len2.
          +*/
          +
           
                                   /* various hacks, don't look :) */
           
           /* deflateInit and inflateInit are macros to allow checking the zlib version
            * and the compiler's view of z_stream:
            */
          -ZEXTERN(int)  inflateInit2_ OF((z_streamp strm, int  windowBits,
          +ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
          +                                     const char *version, int stream_size));
          +ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
          +                                     const char *version, int stream_size));
          +ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int  level, int  method,
          +                                      int windowBits, int memLevel,
          +                                      int strategy, const char *version,
          +                                      int stream_size));
          +ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,
                                                 const char *version, int stream_size));
          -#define deflateInit(strm, level) \
          -        deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))
          -#define inflateInit(strm) \
          -        inflateInit_((strm),                ZLIB_VERSION, sizeof(z_stream))
          -#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
          -        deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
          -                      (strategy),           ZLIB_VERSION, sizeof(z_stream))
          -#define inflateInit2(strm, windowBits) \
          -        inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
          +ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
          +                                         unsigned char FAR *window,
          +                                         const char *version,
          +                                         int stream_size));
          +#ifdef Z_PREFIX_SET
          +#  define z_deflateInit(strm, level) \
          +          deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
          +#  define z_inflateInit(strm) \
          +          inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
          +#  define z_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
          +          deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
          +                        (strategy), ZLIB_VERSION, (int)sizeof(z_stream))
          +#  define z_inflateInit2(strm, windowBits) \
          +          inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
          +                        (int)sizeof(z_stream))
          +#  define z_inflateBackInit(strm, windowBits, window) \
          +          inflateBackInit_((strm), (windowBits), (window), \
          +                           ZLIB_VERSION, (int)sizeof(z_stream))
          +#else
          +#  define deflateInit(strm, level) \
          +          deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
          +#  define inflateInit(strm) \
          +          inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
          +#  define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
          +          deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
          +                        (strategy), ZLIB_VERSION, (int)sizeof(z_stream))
          +#  define inflateInit2(strm, windowBits) \
          +          inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
          +                        (int)sizeof(z_stream))
          +#  define inflateBackInit(strm, windowBits, window) \
          +          inflateBackInit_((strm), (windowBits), (window), \
          +                           ZLIB_VERSION, (int)sizeof(z_stream))
          +#endif
           
          +#else  /* Z_FREETYPE */
          +
          +
          +ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,
          +                                      const char *version, int stream_size));
          +
          +#  define inflateInit2(strm, windowBits) \
          +          inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
          +                        (int)sizeof(z_stream))
          +
          +#endif  /* Z_FREETYPE */
          +
          +
          +#ifndef Z_SOLO
          +
          +/* gzgetc() macro and its supporting function and exposed data structure.  Note
          + * that the real internal state is much larger than the exposed structure.
          + * This abbreviated structure exposes just enough for the gzgetc() macro.  The
          + * user should not mess with these exposed elements, since their names or
          + * behavior could change in the future, perhaps even capriciously.  They can
          + * only be used by the gzgetc() macro.  You have been warned.
          + */
          +struct gzFile_s {
          +    unsigned have;
          +    unsigned char *next;
          +    z_off64_t pos;
          +};
          +ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file));  /* backward compatibility */
          +#ifdef Z_PREFIX_SET
          +#  undef z_gzgetc
          +#  define z_gzgetc(g) \
          +          ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g))
          +#else
          +#  define gzgetc(g) \
          +          ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g))
          +#endif
          +
          +/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
          + * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
          + * both are true, the application gets the *64 functions, and the regular
          + * functions are changed to 64 bits) -- in case these are set on systems
          + * without large file support, _LFS64_LARGEFILE must also be true
          + */
          +#ifdef Z_LARGE64
          +   ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
          +   ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
          +   ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
          +   ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
          +   ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));
          +   ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
          +#endif
          +
          +#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64)
          +#  ifdef Z_PREFIX_SET
          +#    define z_gzopen z_gzopen64
          +#    define z_gzseek z_gzseek64
          +#    define z_gztell z_gztell64
          +#    define z_gzoffset z_gzoffset64
          +#    define z_adler32_combine z_adler32_combine64
          +#    define z_crc32_combine z_crc32_combine64
          +#  else
          +#    define gzopen gzopen64
          +#    define gzseek gzseek64
          +#    define gztell gztell64
          +#    define gzoffset gzoffset64
          +#    define adler32_combine adler32_combine64
          +#    define crc32_combine crc32_combine64
          +#  endif
          +#  ifndef Z_LARGE64
          +     ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
          +     ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
          +     ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
          +     ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile));
          +     ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
          +     ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
          +#  endif
          +#else
          +   ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));
          +   ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int));
          +   ZEXTERN z_off_t ZEXPORT gztell OF((gzFile));
          +   ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile));
          +   ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
          +   ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
          +#endif
          +
          +#else /* Z_SOLO */
          +
          +#ifndef Z_FREETYPE
          +   ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
          +   ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
          +#endif
          +
          +#endif /* !Z_SOLO */
          +
          +/* undocumented functions */
          +#ifndef Z_FREETYPE
          +ZEXTERN const char   * ZEXPORT zError           OF((int));
          +ZEXTERN int            ZEXPORT inflateSyncPoint OF((z_streamp));
          +ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table    OF((void));
          +ZEXTERN int            ZEXPORT inflateUndermine OF((z_streamp, int));
          +ZEXTERN int            ZEXPORT inflateValidate OF((z_streamp, int));
          +ZEXTERN unsigned long  ZEXPORT inflateCodesUsed OF ((z_streamp));
          +ZEXTERN int            ZEXPORT inflateResetKeep OF((z_streamp));
          +ZEXTERN int            ZEXPORT deflateResetKeep OF((z_streamp));
          +#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(Z_SOLO)
          +ZEXTERN gzFile         ZEXPORT gzopen_w OF((const wchar_t *path,
          +                                            const char *mode));
          +#endif
          +#if defined(STDC) || defined(Z_HAVE_STDARG_H)
          +#  ifndef Z_SOLO
          +ZEXTERN int            ZEXPORTVA gzvprintf Z_ARG((gzFile file,
          +                                                  const char *format,
          +                                                  va_list va));
          +#  endif
          +#endif
          +#endif  /* !Z_FREETYPE */
           
           #ifdef __cplusplus
           }
           #endif
           
          -#endif /* _ZLIB_H */
          +#endif /* ZLIB_H */
          diff --git a/thirdparty/freetype/src/gzip/zutil.c b/thirdparty/freetype/src/gzip/zutil.c
          index 7ad0c1f81b..ff06651f23 100644
          --- a/thirdparty/freetype/src/gzip/zutil.c
          +++ b/thirdparty/freetype/src/gzip/zutil.c
          @@ -1,23 +1,155 @@
           /* zutil.c -- target dependent utility functions for the compression library
          - * Copyright (C) 1995-2002 Jean-loup Gailly.
          + * Copyright (C) 1995-2017 Jean-loup Gailly
            * For conditions of distribution and use, see copyright notice in zlib.h
            */
           
           /* @(#) $Id$ */
           
           #include "zutil.h"
          -
          -#ifndef STDC
          -extern void exit OF((int));
          +#ifndef Z_SOLO
          +#  include "gzguts.h"
           #endif
           
          +z_const char * const z_errmsg[10] = {
          +    (z_const char *)"need dictionary",     /* Z_NEED_DICT       2  */
          +    (z_const char *)"stream end",          /* Z_STREAM_END      1  */
          +    (z_const char *)"",                    /* Z_OK              0  */
          +    (z_const char *)"file error",          /* Z_ERRNO         (-1) */
          +    (z_const char *)"stream error",        /* Z_STREAM_ERROR  (-2) */
          +    (z_const char *)"data error",          /* Z_DATA_ERROR    (-3) */
          +    (z_const char *)"insufficient memory", /* Z_MEM_ERROR     (-4) */
          +    (z_const char *)"buffer error",        /* Z_BUF_ERROR     (-5) */
          +    (z_const char *)"incompatible version",/* Z_VERSION_ERROR (-6) */
          +    (z_const char *)""
          +};
          +
          +
          +const char * ZEXPORT zlibVersion()
          +{
          +    return ZLIB_VERSION;
          +}
          +
          +uLong ZEXPORT zlibCompileFlags()
          +{
          +    uLong flags;
          +
          +    flags = 0;
          +    switch ((int)(sizeof(uInt))) {
          +    case 2:     break;
          +    case 4:     flags += 1;     break;
          +    case 8:     flags += 2;     break;
          +    default:    flags += 3;
          +    }
          +    switch ((int)(sizeof(uLong))) {
          +    case 2:     break;
          +    case 4:     flags += 1 << 2;        break;
          +    case 8:     flags += 2 << 2;        break;
          +    default:    flags += 3 << 2;
          +    }
          +    switch ((int)(sizeof(voidpf))) {
          +    case 2:     break;
          +    case 4:     flags += 1 << 4;        break;
          +    case 8:     flags += 2 << 4;        break;
          +    default:    flags += 3 << 4;
          +    }
          +    switch ((int)(sizeof(z_off_t))) {
          +    case 2:     break;
          +    case 4:     flags += 1 << 6;        break;
          +    case 8:     flags += 2 << 6;        break;
          +    default:    flags += 3 << 6;
          +    }
          +#ifdef ZLIB_DEBUG
          +    flags += 1 << 8;
          +#endif
          +#if defined(ASMV) || defined(ASMINF)
          +    flags += 1 << 9;
          +#endif
          +#ifdef ZLIB_WINAPI
          +    flags += 1 << 10;
          +#endif
          +#ifdef BUILDFIXED
          +    flags += 1 << 12;
          +#endif
          +#ifdef DYNAMIC_CRC_TABLE
          +    flags += 1 << 13;
          +#endif
          +#ifdef NO_GZCOMPRESS
          +    flags += 1L << 16;
          +#endif
          +#ifdef NO_GZIP
          +    flags += 1L << 17;
          +#endif
          +#ifdef PKZIP_BUG_WORKAROUND
          +    flags += 1L << 20;
          +#endif
          +#ifdef FASTEST
          +    flags += 1L << 21;
          +#endif
          +#if defined(STDC) || defined(Z_HAVE_STDARG_H)
          +#  ifdef NO_vsnprintf
          +    flags += 1L << 25;
          +#    ifdef HAS_vsprintf_void
          +    flags += 1L << 26;
          +#    endif
          +#  else
          +#    ifdef HAS_vsnprintf_void
          +    flags += 1L << 26;
          +#    endif
          +#  endif
          +#else
          +    flags += 1L << 24;
          +#  ifdef NO_snprintf
          +    flags += 1L << 25;
          +#    ifdef HAS_sprintf_void
          +    flags += 1L << 26;
          +#    endif
          +#  else
          +#    ifdef HAS_snprintf_void
          +    flags += 1L << 26;
          +#    endif
          +#  endif
          +#endif
          +    return flags;
          +}
          +
          +#ifdef ZLIB_DEBUG
          +#include 
          +#  ifndef verbose
          +#    define verbose 0
          +#  endif
          +int ZLIB_INTERNAL z_verbose = verbose;
          +
          +void ZLIB_INTERNAL z_error (
          +    char *m)
          +{
          +    fprintf(stderr, "%s\n", m);
          +    exit(1);
          +}
          +#endif
          +
          +/* exported to allow conversion of error code to string for compress() and
          + * uncompress()
          + */
          +const char * ZEXPORT zError(
          +    int err)
          +{
          +    return ERR_MSG(err);
          +}
          +
          +#if defined(_WIN32_WCE)
          +    /* The Microsoft C Run-Time Library for Windows CE doesn't have
          +     * errno.  We define it as a global variable to simplify porting.
          +     * Its value is always 0 and should not be used.
          +     */
          +    int errno = 0;
          +#endif
           
           #ifndef HAVE_MEMCPY
           
          -void zmemcpy(dest, source, len)
          -    Bytef* dest;
          -    const Bytef* source;
          -    uInt  len;
          +void ZLIB_INTERNAL zmemcpy(
          +    Bytef* dest,
          +    const Bytef* source,
          +    uInt  len)
           {
               if (len == 0) return;
               do {
          @@ -25,10 +157,10 @@ void zmemcpy(dest, source, len)
               } while (--len != 0);
           }
           
          -int zmemcmp(s1, s2, len)
          -    const Bytef* s1;
          -    const Bytef* s2;
          -    uInt  len;
          +int ZLIB_INTERNAL zmemcmp(
          +    const Bytef* s1,
          +    const Bytef* s2,
          +    uInt  len)
           {
               uInt j;
           
          @@ -38,9 +170,9 @@ int zmemcmp(s1, s2, len)
               return 0;
           }
           
          -void zmemzero(dest, len)
          -    Bytef* dest;
          -    uInt  len;
          +void ZLIB_INTERNAL zmemzero(
          +    Bytef* dest,
          +    uInt  len)
           {
               if (len == 0) return;
               do {
          @@ -49,11 +181,13 @@ void zmemzero(dest, len)
           }
           #endif
           
          -#if defined( MSDOS ) && defined( __TURBOC__ ) && !defined( MY_ZCALLOC )
          -#if (defined( __BORLANDC__) || !defined(SMALL_MEDIUM)) && !defined(__32BIT__)
          -/* Small and medium model in Turbo C are for now limited to near allocation
          - * with reduced MAX_WBITS and MAX_MEM_LEVEL
          - */
          +#ifndef Z_SOLO
          +
          +#ifdef SYS16BIT
          +
          +#ifdef __TURBOC__
          +/* Turbo C in 16-bit mode */
          +
           #  define MY_ZCALLOC
           
           /* Turbo C malloc() does not allow dynamic allocation of 64K bytes
          @@ -80,11 +214,13 @@ local ptr_table table[MAX_PTR];
            * a protected system like OS/2. Use Microsoft C instead.
            */
           
          -voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
          +voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
           {
          -    voidpf buf = opaque; /* just to make some compilers happy */
          +    voidpf buf;
               ulg bsize = (ulg)items*size;
           
          +    (void)opaque;
          +
               /* If we allocate less than 65520 bytes, we assume that farmalloc
                * will return a usable pointer which doesn't have to be normalized.
                */
          @@ -104,9 +240,12 @@ voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
               return buf;
           }
           
          -void  zcfree (voidpf opaque, voidpf ptr)
          +void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
           {
               int n;
          +
          +    (void)opaque;
          +
               if (*(ush*)&ptr != 0) { /* object < 64K */
                   farfree(ptr);
                   return;
          @@ -122,14 +261,13 @@ void  zcfree (voidpf opaque, voidpf ptr)
                   next_ptr--;
                   return;
               }
          -    ptr = opaque; /* just to make some compilers happy */
               Assert(0, "zcfree: ptr not found");
           }
          -#endif
          -#endif /* MSDOS && __TURBOC__ */
          +
          +#endif /* __TURBOC__ */
           
           
          -#if defined(M_I86) && !defined(__32BIT__) && !defined( MY_ZCALLOC )
          +#ifdef M_I86
           /* Microsoft C in 16-bit mode */
           
           #  define MY_ZCALLOC
          @@ -139,43 +277,49 @@ void  zcfree (voidpf opaque, voidpf ptr)
           #  define _hfree   hfree
           #endif
           
          -voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
          +voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size)
           {
          -    if (opaque) opaque = 0; /* to make compiler happy */
          +    (void)opaque;
               return _halloc((long)items, size);
           }
           
          -void  zcfree (voidpf opaque, voidpf ptr)
          +void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
           {
          -    if (opaque) opaque = 0; /* to make compiler happy */
          +    (void)opaque;
               _hfree(ptr);
           }
           
          -#endif /* MSC */
          +#endif /* M_I86 */
          +
          +#endif /* SYS16BIT */
           
           
           #ifndef MY_ZCALLOC /* Any system without a special alloc function */
           
           #ifndef STDC
          -extern voidp  ft_scalloc OF((uInt items, uInt size));
          -extern void   ft_sfree   OF((voidpf ptr));
          +extern voidp  malloc OF((uInt size));
          +extern voidp  calloc OF((uInt items, uInt size));
          +extern void   free   OF((voidpf ptr));
           #endif
           
          -voidpf zcalloc (opaque, items, size)
          -    voidpf opaque;
          -    unsigned items;
          -    unsigned size;
          +voidpf ZLIB_INTERNAL zcalloc (
          +    voidpf opaque,
          +    unsigned items,
          +    unsigned size)
           {
          -    if (opaque) items += size - size; /* make compiler happy */
          -    return (voidpf)ft_scalloc(items, size);
          +    (void)opaque;
          +    return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
          +                              (voidpf)calloc(items, size);
           }
           
          -void  zcfree (opaque, ptr)
          -    voidpf opaque;
          -    voidpf ptr;
          +void ZLIB_INTERNAL zcfree (
          +    voidpf opaque,
          +    voidpf ptr)
           {
          -    ft_sfree(ptr);
          -    if (opaque) return; /* make compiler happy */
          +    (void)opaque;
          +    free(ptr);
           }
           
           #endif /* MY_ZCALLOC */
          +
          +#endif /* !Z_SOLO */
          diff --git a/thirdparty/freetype/src/gzip/zutil.h b/thirdparty/freetype/src/gzip/zutil.h
          index c9688cd9c0..2d734a835d 100644
          --- a/thirdparty/freetype/src/gzip/zutil.h
          +++ b/thirdparty/freetype/src/gzip/zutil.h
          @@ -1,5 +1,5 @@
           /* zutil.h -- internal interface and configuration of the compression library
          - * Copyright (C) 1995-2002 Jean-loup Gailly.
          + * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
            * For conditions of distribution and use, see copyright notice in zlib.h
            */
           
          @@ -10,26 +10,37 @@
           
           /* @(#) $Id$ */
           
          -#ifndef _Z_UTIL_H
          -#define _Z_UTIL_H
          +#ifndef ZUTIL_H
          +#define ZUTIL_H
          +
          +#ifdef HAVE_HIDDEN
          +#  define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
          +#else
          +#  define ZLIB_INTERNAL
          +#endif
           
           #include "zlib.h"
           
          -#ifdef STDC
          -#  include 
          +#if defined(STDC) && !defined(Z_SOLO)
          +#  if !(defined(_WIN32_WCE) && defined(_MSC_VER))
          +#    include 
          +#  endif
           #  include 
           #  include 
           #endif
          -#ifdef NO_ERRNO_H
          -    extern int errno;
          -#else
          -#   include 
          +
          +#ifdef Z_SOLO
          +#  ifndef Z_FREETYPE
          +   typedef long ptrdiff_t;  /* guess -- will be caught if guess is wrong */
          +#  endif
           #endif
           
           #ifndef local
           #  define local static
           #endif
          -/* compile with -Dlocal if your debugger can't find static symbols */
          +/* since "static" is used to mean two completely different things in C, we
          +   define "local" for the non-static meaning of "static", for readability
          +   (compile with -Dlocal if your debugger can't find static symbols) */
           
           typedef unsigned char  uch;
           typedef uch FAR uchf;
          @@ -37,9 +48,13 @@ typedef unsigned short ush;
           typedef ush FAR ushf;
           typedef unsigned long  ulg;
           
          +extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
          +/* (size given to avoid silly warnings with Visual C++) */
          +
          +#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
           
           #define ERR_RETURN(strm,err) \
          -  return (strm->msg = (char*)ERR_MSG(err), (err))
          +  return (strm->msg = ERR_MSG(err), (err))
           /* To be used only when the state is known to be valid */
           
                   /* common constants */
          @@ -69,90 +84,133 @@ typedef unsigned long  ulg;
           
                   /* target dependencies */
           
          -#ifdef MSDOS
          +#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
           #  define OS_CODE  0x00
          -#  if defined(__TURBOC__) || defined(__BORLANDC__)
          -#    if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
          -       /* Allow compilation with ANSI keywords only enabled */
          -       void _Cdecl farfree( void *block );
          -       void *_Cdecl farmalloc( unsigned long nbytes );
          -#    else
          -#     include 
          +#  ifndef Z_SOLO
          +#    if defined(__TURBOC__) || defined(__BORLANDC__)
          +#      if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
          +         /* Allow compilation with ANSI keywords only enabled */
          +         void _Cdecl farfree( void *block );
          +         void *_Cdecl farmalloc( unsigned long nbytes );
          +#      else
          +#        include 
          +#      endif
          +#    else /* MSC or DJGPP */
          +#      include 
           #    endif
          -#  else /* MSC or DJGPP */
           #  endif
           #endif
           
          -#ifdef OS2
          -#  define OS_CODE  0x06
          -#endif
          -
          -#ifdef WIN32 /* Window 95 & Windows NT */
          -#  define OS_CODE  0x0b
          -#endif
          -
          -#if defined(VAXC) || defined(VMS)
          -#  define OS_CODE  0x02
          -#  define F_OPEN(name, mode) \
          -     ft_fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
          -#endif
          -
           #ifdef AMIGA
          -#  define OS_CODE  0x01
          +#  define OS_CODE  1
          +#endif
          +
          +#if defined(VAXC) || defined(VMS)
          +#  define OS_CODE  2
          +#  define F_OPEN(name, mode) \
          +     fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
          +#endif
          +
          +#ifdef __370__
          +#  if __TARGET_LIB__ < 0x20000000
          +#    define OS_CODE 4
          +#  elif __TARGET_LIB__ < 0x40000000
          +#    define OS_CODE 11
          +#  else
          +#    define OS_CODE 8
          +#  endif
           #endif
           
           #if defined(ATARI) || defined(atarist)
          -#  define OS_CODE  0x05
          +#  define OS_CODE  5
          +#endif
          +
          +#ifdef OS2
          +#  define OS_CODE  6
          +#  if defined(M_I86) && !defined(Z_SOLO)
          +#    include 
          +#  endif
           #endif
           
           #if defined(MACOS) || defined(TARGET_OS_MAC)
          -#  define OS_CODE  0x07
          -#  if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
          -#    include  /* for fdopen */
          -#  else
          -#    ifndef fdopen
          -#      define fdopen(fd,mode) NULL /* No fdopen() */
          +#  define OS_CODE  7
          +#  ifndef Z_SOLO
          +#    if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
          +#      include  /* for fdopen */
          +#    else
          +#      ifndef fdopen
          +#        define fdopen(fd,mode) NULL /* No fdopen() */
          +#      endif
           #    endif
           #  endif
           #endif
           
          -#ifdef __50SERIES /* Prime/PRIMOS */
          -#  define OS_CODE  0x0F
          +#ifdef __acorn
          +#  define OS_CODE 13
           #endif
           
          -#ifdef TOPS20
          -#  define OS_CODE  0x0a
          +#if defined(WIN32) && !defined(__CYGWIN__)
          +#  define OS_CODE  10
          +#endif
          +
          +#ifdef _BEOS_
          +#  define OS_CODE  16
          +#endif
          +
          +#ifdef __TOS_OS400__
          +#  define OS_CODE 18
          +#endif
          +
          +#ifdef __APPLE__
          +#  define OS_CODE 19
           #endif
           
           #if defined(_BEOS_) || defined(RISCOS)
           #  define fdopen(fd,mode) NULL /* No fdopen() */
           #endif
           
          -#if (defined(_MSC_VER) && (_MSC_VER > 600))
          -#  define fdopen(fd,type)  _fdopen(fd,type)
          +#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
          +#  if defined(_WIN32_WCE)
          +#    define fdopen(fd,mode) NULL /* No fdopen() */
          +#    ifndef _PTRDIFF_T_DEFINED
          +       typedef int ptrdiff_t;
          +#      define _PTRDIFF_T_DEFINED
          +#    endif
          +#  else
          +#    define fdopen(fd,type)  _fdopen(fd,type)
          +#  endif
           #endif
           
          +#if defined(__BORLANDC__) && !defined(MSDOS)
          +  #pragma warn -8004
          +  #pragma warn -8008
          +  #pragma warn -8066
          +#endif
           
          -        /* Common defaults */
          +#ifndef Z_FREETYPE
          +
          +/* provide prototypes for these when building zlib without LFS */
          +#if !defined(_WIN32) && \
          +    (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
          +    ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
          +    ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
          +#endif
          +
          +#endif  /* !Z_FREETYPE */
          +
          +        /* common defaults */
           
           #ifndef OS_CODE
          -#  define OS_CODE  0x03  /* assume Unix */
          +#  define OS_CODE  3     /* assume Unix */
           #endif
           
           #ifndef F_OPEN
          -#  define F_OPEN(name, mode) ft_fopen((name), (mode))
          +#  define F_OPEN(name, mode) fopen((name), (mode))
           #endif
           
                    /* functions */
           
          -#ifdef HAVE_STRERROR
          -   extern char *strerror OF((int));
          -#  define zstrerror(errnum) strerror(errnum)
          -#else
          -#  define zstrerror(errnum) ""
          -#endif
          -
          -#if defined(pyr)
          +#if defined(pyr) || defined(Z_SOLO)
           #  define NO_MEMCPY
           #endif
           #if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
          @@ -176,16 +234,16 @@ typedef unsigned long  ulg;
           #    define zmemzero(dest, len) ft_memset(dest, 0, len)
           #  endif
           #else
          -   extern void zmemcpy  OF((Bytef* dest, const Bytef* source, uInt len));
          -   extern int  zmemcmp  OF((const Bytef* s1, const Bytef* s2, uInt len));
          -   extern void zmemzero OF((Bytef* dest, uInt len));
          +   void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
          +   int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
          +   void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));
           #endif
           
           /* Diagnostic functions */
          -#ifdef DEBUG
          +#ifdef ZLIB_DEBUG
           #  include 
          -   extern int z_verbose;
          -   extern void z_error    OF((char *m));
          +   extern int ZLIB_INTERNAL z_verbose;
          +   extern void ZLIB_INTERNAL z_error OF((char *m));
           #  define Assert(cond,msg) {if(!(cond)) z_error(msg);}
           #  define Trace(x) {if (z_verbose>=0) fprintf x ;}
           #  define Tracev(x) {if (z_verbose>0) fprintf x ;}
          @@ -201,15 +259,19 @@ typedef unsigned long  ulg;
           #  define Tracecv(c,x)
           #endif
           
          -
          -typedef uLong (*check_func) OF((uLong check, const Bytef *buf,
          -                                uInt len));
          -local voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
          -local void   zcfree  OF((voidpf opaque, voidpf ptr));
          +#ifndef Z_SOLO
          +   voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
          +                                    unsigned size));
          +   void ZLIB_INTERNAL zcfree  OF((voidpf opaque, voidpf ptr));
          +#endif
           
           #define ZALLOC(strm, items, size) \
                      (*((strm)->zalloc))((strm)->opaque, (items), (size))
           #define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
           #define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
           
          -#endif /* _Z_UTIL_H */
          +/* Reverse the bytes in a 32-bit value */
          +#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
          +                    (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
          +
          +#endif /* ZUTIL_H */
          diff --git a/thirdparty/freetype/src/lzw/ftlzw.c b/thirdparty/freetype/src/lzw/ftlzw.c
          index e112418ab1..e12efcaa56 100644
          --- a/thirdparty/freetype/src/lzw/ftlzw.c
          +++ b/thirdparty/freetype/src/lzw/ftlzw.c
          @@ -8,7 +8,7 @@
            * be used to parse compressed PCF fonts, as found with many X11 server
            * distributions.
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * Albert Chin-A-Young.
            *
            * based on code in `src/gzip/ftgzip.c'
          @@ -369,7 +369,7 @@
               FT_ZERO( stream );
               stream->memory = memory;
           
          -    if ( !FT_NEW( zip ) )
          +    if ( !FT_QNEW( zip ) )
               {
                 error = ft_lzw_file_init( zip, stream, source );
                 if ( error )
          diff --git a/thirdparty/freetype/src/lzw/ftzopen.c b/thirdparty/freetype/src/lzw/ftzopen.c
          index 8b5b357f36..aaa98be211 100644
          --- a/thirdparty/freetype/src/lzw/ftzopen.c
          +++ b/thirdparty/freetype/src/lzw/ftzopen.c
          @@ -8,7 +8,7 @@
            * be used to parse compressed PCF fonts, as found with many X11 server
            * distributions.
            *
          - * Copyright (C) 2005-2021 by
          + * Copyright (C) 2005-2022 by
            * David Turner.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/lzw/ftzopen.h b/thirdparty/freetype/src/lzw/ftzopen.h
          index 9ada742c73..86fccfe3be 100644
          --- a/thirdparty/freetype/src/lzw/ftzopen.h
          +++ b/thirdparty/freetype/src/lzw/ftzopen.h
          @@ -8,7 +8,7 @@
            * be used to parse compressed PCF fonts, as found with many X11 server
            * distributions.
            *
          - * Copyright (C) 2005-2021 by
          + * Copyright (C) 2005-2022 by
            * David Turner.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/lzw/rules.mk b/thirdparty/freetype/src/lzw/rules.mk
          index 747cbdcca8..d3aa1efadd 100644
          --- a/thirdparty/freetype/src/lzw/rules.mk
          +++ b/thirdparty/freetype/src/lzw/rules.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 2004-2021 by
          +# Copyright (C) 2004-2022 by
           # Albert Chin-A-Young.
           #
           # based on `src/lzw/rules.mk'
          diff --git a/thirdparty/freetype/src/otvalid/module.mk b/thirdparty/freetype/src/otvalid/module.mk
          index 3009349209..1d08012e44 100644
          --- a/thirdparty/freetype/src/otvalid/module.mk
          +++ b/thirdparty/freetype/src/otvalid/module.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 2004-2021 by
          +# Copyright (C) 2004-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/otvalid/otvalid.c b/thirdparty/freetype/src/otvalid/otvalid.c
          index 869233ce8c..f5344ca031 100644
          --- a/thirdparty/freetype/src/otvalid/otvalid.c
          +++ b/thirdparty/freetype/src/otvalid/otvalid.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType validator for OpenType tables (body only).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/otvalid/otvalid.h b/thirdparty/freetype/src/otvalid/otvalid.h
          index f8ca454d6e..6274858f51 100644
          --- a/thirdparty/freetype/src/otvalid/otvalid.h
          +++ b/thirdparty/freetype/src/otvalid/otvalid.h
          @@ -4,7 +4,7 @@
            *
            *   OpenType table validation (specification only).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/otvalid/otvbase.c b/thirdparty/freetype/src/otvalid/otvbase.c
          index 83f998cdb1..70de653b19 100644
          --- a/thirdparty/freetype/src/otvalid/otvbase.c
          +++ b/thirdparty/freetype/src/otvalid/otvbase.c
          @@ -4,7 +4,7 @@
            *
            *   OpenType BASE table validation (body).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/otvalid/otvcommn.c b/thirdparty/freetype/src/otvalid/otvcommn.c
          index 40624bb159..b9873ff21b 100644
          --- a/thirdparty/freetype/src/otvalid/otvcommn.c
          +++ b/thirdparty/freetype/src/otvalid/otvcommn.c
          @@ -4,7 +4,7 @@
            *
            *   OpenType common tables validation (body).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/otvalid/otvcommn.h b/thirdparty/freetype/src/otvalid/otvcommn.h
          index 3b096ecca8..f1e4a6a9a6 100644
          --- a/thirdparty/freetype/src/otvalid/otvcommn.h
          +++ b/thirdparty/freetype/src/otvalid/otvcommn.h
          @@ -4,7 +4,7 @@
            *
            *   OpenType common tables validation (specification).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/otvalid/otverror.h b/thirdparty/freetype/src/otvalid/otverror.h
          index 3e23234f36..8c75c58299 100644
          --- a/thirdparty/freetype/src/otvalid/otverror.h
          +++ b/thirdparty/freetype/src/otvalid/otverror.h
          @@ -4,7 +4,7 @@
            *
            *   OpenType validation module error codes (specification only).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/otvalid/otvgdef.c b/thirdparty/freetype/src/otvalid/otvgdef.c
          index 5a160a4142..425335336d 100644
          --- a/thirdparty/freetype/src/otvalid/otvgdef.c
          +++ b/thirdparty/freetype/src/otvalid/otvgdef.c
          @@ -4,7 +4,7 @@
            *
            *   OpenType GDEF table validation (body).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/otvalid/otvgpos.c b/thirdparty/freetype/src/otvalid/otvgpos.c
          index e0d4e420de..52e2cd1c22 100644
          --- a/thirdparty/freetype/src/otvalid/otvgpos.c
          +++ b/thirdparty/freetype/src/otvalid/otvgpos.c
          @@ -4,7 +4,7 @@
            *
            *   OpenType GPOS table validation (body).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/otvalid/otvgpos.h b/thirdparty/freetype/src/otvalid/otvgpos.h
          index 176a68883f..85ef609160 100644
          --- a/thirdparty/freetype/src/otvalid/otvgpos.h
          +++ b/thirdparty/freetype/src/otvalid/otvgpos.h
          @@ -4,7 +4,7 @@
            *
            *   OpenType GPOS table validator (specification).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/otvalid/otvgsub.c b/thirdparty/freetype/src/otvalid/otvgsub.c
          index b426a17449..3b6dcbb7ae 100644
          --- a/thirdparty/freetype/src/otvalid/otvgsub.c
          +++ b/thirdparty/freetype/src/otvalid/otvgsub.c
          @@ -4,7 +4,7 @@
            *
            *   OpenType GSUB table validation (body).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/otvalid/otvjstf.c b/thirdparty/freetype/src/otvalid/otvjstf.c
          index 404dda88a1..0934716a5a 100644
          --- a/thirdparty/freetype/src/otvalid/otvjstf.c
          +++ b/thirdparty/freetype/src/otvalid/otvjstf.c
          @@ -4,7 +4,7 @@
            *
            *   OpenType JSTF table validation (body).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/otvalid/otvmath.c b/thirdparty/freetype/src/otvalid/otvmath.c
          index b4bfabb62e..a59557b375 100644
          --- a/thirdparty/freetype/src/otvalid/otvmath.c
          +++ b/thirdparty/freetype/src/otvalid/otvmath.c
          @@ -4,7 +4,7 @@
            *
            *   OpenType MATH table validation (body).
            *
          - * Copyright (C) 2007-2021 by
          + * Copyright (C) 2007-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * Written by George Williams.
          diff --git a/thirdparty/freetype/src/otvalid/otvmod.c b/thirdparty/freetype/src/otvalid/otvmod.c
          index b7d674b5e2..3fc2dbe504 100644
          --- a/thirdparty/freetype/src/otvalid/otvmod.c
          +++ b/thirdparty/freetype/src/otvalid/otvmod.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType's OpenType validation module implementation (body).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/otvalid/otvmod.h b/thirdparty/freetype/src/otvalid/otvmod.h
          index 37c20e0023..2f0bcd6e44 100644
          --- a/thirdparty/freetype/src/otvalid/otvmod.h
          +++ b/thirdparty/freetype/src/otvalid/otvmod.h
          @@ -5,7 +5,7 @@
            *   FreeType's OpenType validation module implementation
            *   (specification).
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/otvalid/rules.mk b/thirdparty/freetype/src/otvalid/rules.mk
          index 634a3506be..924d2b6bef 100644
          --- a/thirdparty/freetype/src/otvalid/rules.mk
          +++ b/thirdparty/freetype/src/otvalid/rules.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 2004-2021 by
          +# Copyright (C) 2004-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/pcf/pcfread.c b/thirdparty/freetype/src/pcf/pcfread.c
          index e60a0a5141..f167bcb8ae 100644
          --- a/thirdparty/freetype/src/pcf/pcfread.c
          +++ b/thirdparty/freetype/src/pcf/pcfread.c
          @@ -1034,16 +1034,6 @@ THE SOFTWARE.
                    enc->lastRow  > 0xFF         )
                 return FT_THROW( Invalid_Table );
           
          -    nencoding = (FT_ULong)( enc->lastCol - enc->firstCol + 1 ) *
          -                (FT_ULong)( enc->lastRow - enc->firstRow + 1 );
          -
          -    if ( FT_NEW_ARRAY( enc->offset, nencoding ) )
          -      goto Bail;
          -
          -    error = FT_Stream_EnterFrame( stream, 2 * nencoding );
          -    if ( error )
          -      goto Exit;
          -
               FT_TRACE5(( "\n" ));
           
               defaultCharRow = enc->defaultChar >> 8;
          @@ -1064,6 +1054,13 @@ THE SOFTWARE.
                 defaultCharCol = enc->firstCol;
               }
           
          +    nencoding = (FT_ULong)( enc->lastCol - enc->firstCol + 1 ) *
          +                (FT_ULong)( enc->lastRow - enc->firstRow + 1 );
          +
          +    error = FT_Stream_EnterFrame( stream, 2 * nencoding );
          +    if ( error )
          +      goto Bail;
          +
               /*
                * FreeType mandates that glyph index 0 is the `undefined glyph', which
                * PCF calls the `default character'.  However, FreeType needs glyph
          @@ -1109,6 +1106,9 @@ THE SOFTWARE.
               /* copy metrics of default character to index 0 */
               face->metrics[0] = face->metrics[defaultCharEncodingOffset];
           
          +    if ( FT_QNEW_ARRAY( enc->offset, nencoding ) )
          +      goto Bail;
          +
               /* now loop over all values */
               offset = enc->offset;
               for ( i = enc->firstRow; i <= enc->lastRow; i++ )
          @@ -1131,11 +1131,6 @@ THE SOFTWARE.
               }
               FT_Stream_ExitFrame( stream );
           
          -    return error;
          -
          -  Exit:
          -    FT_FREE( enc->offset );
          -
             Bail:
               return error;
             }
          diff --git a/thirdparty/freetype/src/pfr/module.mk b/thirdparty/freetype/src/pfr/module.mk
          index 4f49e12da8..570d400b1f 100644
          --- a/thirdparty/freetype/src/pfr/module.mk
          +++ b/thirdparty/freetype/src/pfr/module.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 2002-2021 by
          +# Copyright (C) 2002-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/pfr/pfr.c b/thirdparty/freetype/src/pfr/pfr.c
          index 4058ad5652..1dd38f9393 100644
          --- a/thirdparty/freetype/src/pfr/pfr.c
          +++ b/thirdparty/freetype/src/pfr/pfr.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType PFR driver component.
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/pfr/pfrcmap.c b/thirdparty/freetype/src/pfr/pfrcmap.c
          index 6a7f573594..6fa2417dc1 100644
          --- a/thirdparty/freetype/src/pfr/pfrcmap.c
          +++ b/thirdparty/freetype/src/pfr/pfrcmap.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType PFR cmap handling (body).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/pfr/pfrcmap.h b/thirdparty/freetype/src/pfr/pfrcmap.h
          index 17c02a2b4b..afde164f9b 100644
          --- a/thirdparty/freetype/src/pfr/pfrcmap.h
          +++ b/thirdparty/freetype/src/pfr/pfrcmap.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType PFR cmap handling (specification).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/pfr/pfrdrivr.c b/thirdparty/freetype/src/pfr/pfrdrivr.c
          index 16b8f79471..2a753c583a 100644
          --- a/thirdparty/freetype/src/pfr/pfrdrivr.c
          +++ b/thirdparty/freetype/src/pfr/pfrdrivr.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType PFR driver interface (body).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/pfr/pfrdrivr.h b/thirdparty/freetype/src/pfr/pfrdrivr.h
          index 6ff16fea06..cfd749ab0e 100644
          --- a/thirdparty/freetype/src/pfr/pfrdrivr.h
          +++ b/thirdparty/freetype/src/pfr/pfrdrivr.h
          @@ -4,7 +4,7 @@
            *
            *   High-level Type PFR driver interface (specification).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/pfr/pfrerror.h b/thirdparty/freetype/src/pfr/pfrerror.h
          index 255696efed..98b8f2fd58 100644
          --- a/thirdparty/freetype/src/pfr/pfrerror.h
          +++ b/thirdparty/freetype/src/pfr/pfrerror.h
          @@ -4,7 +4,7 @@
            *
            *   PFR error codes (specification only).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/pfr/pfrgload.c b/thirdparty/freetype/src/pfr/pfrgload.c
          index b400042a86..1b8d6cdecc 100644
          --- a/thirdparty/freetype/src/pfr/pfrgload.c
          +++ b/thirdparty/freetype/src/pfr/pfrgload.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType PFR glyph loader (body).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/pfr/pfrgload.h b/thirdparty/freetype/src/pfr/pfrgload.h
          index b726d564fc..af59296910 100644
          --- a/thirdparty/freetype/src/pfr/pfrgload.h
          +++ b/thirdparty/freetype/src/pfr/pfrgload.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType PFR glyph loader (specification).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/pfr/pfrload.c b/thirdparty/freetype/src/pfr/pfrload.c
          index a9c1e2834a..6bf7979750 100644
          --- a/thirdparty/freetype/src/pfr/pfrload.c
          +++ b/thirdparty/freetype/src/pfr/pfrload.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType PFR loader (body).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -993,7 +993,7 @@
           
                 PFR_CHECK_SIZE( count * Size );
           
          -      if ( FT_NEW_ARRAY( phy_font->chars, count ) )
          +      if ( FT_QNEW_ARRAY( phy_font->chars, count ) )
                   goto Fail;
           
                 for ( n = 0; n < count; n++ )
          diff --git a/thirdparty/freetype/src/pfr/pfrload.h b/thirdparty/freetype/src/pfr/pfrload.h
          index 4f467d1bad..5e0f451fa0 100644
          --- a/thirdparty/freetype/src/pfr/pfrload.h
          +++ b/thirdparty/freetype/src/pfr/pfrload.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType PFR loader (specification).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/pfr/pfrobjs.c b/thirdparty/freetype/src/pfr/pfrobjs.c
          index 3080cb650b..73eb857842 100644
          --- a/thirdparty/freetype/src/pfr/pfrobjs.c
          +++ b/thirdparty/freetype/src/pfr/pfrobjs.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType PFR object methods (body).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/pfr/pfrobjs.h b/thirdparty/freetype/src/pfr/pfrobjs.h
          index 70b05395b8..9ffc297d59 100644
          --- a/thirdparty/freetype/src/pfr/pfrobjs.h
          +++ b/thirdparty/freetype/src/pfr/pfrobjs.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType PFR object methods (specification).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/pfr/pfrsbit.c b/thirdparty/freetype/src/pfr/pfrsbit.c
          index 255fd58772..8b23fa156d 100644
          --- a/thirdparty/freetype/src/pfr/pfrsbit.c
          +++ b/thirdparty/freetype/src/pfr/pfrsbit.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType PFR bitmap loader (body).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/pfr/pfrsbit.h b/thirdparty/freetype/src/pfr/pfrsbit.h
          index f50d8013aa..b948a3842f 100644
          --- a/thirdparty/freetype/src/pfr/pfrsbit.h
          +++ b/thirdparty/freetype/src/pfr/pfrsbit.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType PFR bitmap loader (specification).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/pfr/pfrtypes.h b/thirdparty/freetype/src/pfr/pfrtypes.h
          index dc4fead700..d9a0c78953 100644
          --- a/thirdparty/freetype/src/pfr/pfrtypes.h
          +++ b/thirdparty/freetype/src/pfr/pfrtypes.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType PFR data structures (specification only).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/pfr/rules.mk b/thirdparty/freetype/src/pfr/rules.mk
          index 00c791f11c..b5dffaaa26 100644
          --- a/thirdparty/freetype/src/pfr/rules.mk
          +++ b/thirdparty/freetype/src/pfr/rules.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 2002-2021 by
          +# Copyright (C) 2002-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/psaux/afmparse.c b/thirdparty/freetype/src/psaux/afmparse.c
          index 0ad1760518..bd86129f7e 100644
          --- a/thirdparty/freetype/src/psaux/afmparse.c
          +++ b/thirdparty/freetype/src/psaux/afmparse.c
          @@ -4,7 +4,7 @@
            *
            *   AFM parser (body).
            *
          - * Copyright (C) 2006-2021 by
          + * Copyright (C) 2006-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/psaux/afmparse.h b/thirdparty/freetype/src/psaux/afmparse.h
          index 44b05b2cac..eee49e3601 100644
          --- a/thirdparty/freetype/src/psaux/afmparse.h
          +++ b/thirdparty/freetype/src/psaux/afmparse.h
          @@ -4,7 +4,7 @@
            *
            *   AFM parser (specification).
            *
          - * Copyright (C) 2006-2021 by
          + * Copyright (C) 2006-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/psaux/cffdecode.c b/thirdparty/freetype/src/psaux/cffdecode.c
          index 29b68a8e4f..62be58f168 100644
          --- a/thirdparty/freetype/src/psaux/cffdecode.c
          +++ b/thirdparty/freetype/src/psaux/cffdecode.c
          @@ -4,7 +4,7 @@
            *
            *   PostScript CFF (Type 2) decoding routines (body).
            *
          - * Copyright (C) 2017-2021 by
          + * Copyright (C) 2017-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/psaux/cffdecode.h b/thirdparty/freetype/src/psaux/cffdecode.h
          index b1314ed1c1..a9f6761824 100644
          --- a/thirdparty/freetype/src/psaux/cffdecode.h
          +++ b/thirdparty/freetype/src/psaux/cffdecode.h
          @@ -4,7 +4,7 @@
            *
            *   PostScript CFF (Type 2) decoding routines (specification).
            *
          - * Copyright (C) 2017-2021 by
          + * Copyright (C) 2017-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/psaux/module.mk b/thirdparty/freetype/src/psaux/module.mk
          index 06f7e72c1c..e52e987968 100644
          --- a/thirdparty/freetype/src/psaux/module.mk
          +++ b/thirdparty/freetype/src/psaux/module.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/psaux/psaux.c b/thirdparty/freetype/src/psaux/psaux.c
          index 2960c8b696..2ac7949479 100644
          --- a/thirdparty/freetype/src/psaux/psaux.c
          +++ b/thirdparty/freetype/src/psaux/psaux.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType auxiliary PostScript driver component (body only).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/psaux/psauxerr.h b/thirdparty/freetype/src/psaux/psauxerr.h
          index e8ee29166c..1504b34ee5 100644
          --- a/thirdparty/freetype/src/psaux/psauxerr.h
          +++ b/thirdparty/freetype/src/psaux/psauxerr.h
          @@ -4,7 +4,7 @@
            *
            *   PS auxiliary module error codes (specification only).
            *
          - * Copyright (C) 2001-2021 by
          + * Copyright (C) 2001-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/psaux/psauxmod.c b/thirdparty/freetype/src/psaux/psauxmod.c
          index 52da23365e..113490abcd 100644
          --- a/thirdparty/freetype/src/psaux/psauxmod.c
          +++ b/thirdparty/freetype/src/psaux/psauxmod.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType auxiliary PostScript module implementation (body).
            *
          - * Copyright (C) 2000-2021 by
          + * Copyright (C) 2000-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/psaux/psauxmod.h b/thirdparty/freetype/src/psaux/psauxmod.h
          index e3e8063220..2d508edc2a 100644
          --- a/thirdparty/freetype/src/psaux/psauxmod.h
          +++ b/thirdparty/freetype/src/psaux/psauxmod.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType auxiliary PostScript module implementation (specification).
            *
          - * Copyright (C) 2000-2021 by
          + * Copyright (C) 2000-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/psaux/psconv.c b/thirdparty/freetype/src/psaux/psconv.c
          index c28d65df29..ff186643da 100644
          --- a/thirdparty/freetype/src/psaux/psconv.c
          +++ b/thirdparty/freetype/src/psaux/psconv.c
          @@ -4,7 +4,7 @@
            *
            *   Some convenience conversions (body).
            *
          - * Copyright (C) 2006-2021 by
          + * Copyright (C) 2006-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/psaux/psconv.h b/thirdparty/freetype/src/psaux/psconv.h
          index cd91a7bb56..650d7c93b2 100644
          --- a/thirdparty/freetype/src/psaux/psconv.h
          +++ b/thirdparty/freetype/src/psaux/psconv.h
          @@ -4,7 +4,7 @@
            *
            *   Some convenience conversions (specification).
            *
          - * Copyright (C) 2006-2021 by
          + * Copyright (C) 2006-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/psaux/psintrp.c b/thirdparty/freetype/src/psaux/psintrp.c
          index c550533a0f..6c640eebd5 100644
          --- a/thirdparty/freetype/src/psaux/psintrp.c
          +++ b/thirdparty/freetype/src/psaux/psintrp.c
          @@ -1900,7 +1900,8 @@
                                 /*     WeightVector                         */
                                 {
                                   FT_UInt   idx;
          -                        PS_Blend  blend = decoder->blend;
          +                        PS_Blend  blend         = decoder->blend;
          +                        FT_UInt   len_buildchar = decoder->len_buildchar;
           
           
                                   if ( arg_cnt != 1 || !blend )
          @@ -1908,14 +1909,15 @@
           
                                   idx = (FT_UInt)cf2_stack_popInt( opStack );
           
          -                        if ( idx + blend->num_designs >
          -                               decoder->len_buildchar   )
          +                        if ( len_buildchar < blend->num_designs       ||
          +                             len_buildchar - blend->num_designs < idx )
                                     goto Unexpected_OtherSubr;
           
          -                        ft_memcpy( &decoder->buildchar[idx],
          -                                   blend->weight_vector,
          -                                   blend->num_designs *
          -                                   sizeof ( blend->weight_vector[0] ) );
          +                        if ( decoder->buildchar && blend->weight_vector )
          +                          ft_memcpy( &decoder->buildchar[idx],
          +                                     blend->weight_vector,
          +                                     blend->num_designs *
          +                                       sizeof ( blend->weight_vector[0] ) );
                                 }
                                 break;
           
          diff --git a/thirdparty/freetype/src/psaux/psobjs.c b/thirdparty/freetype/src/psaux/psobjs.c
          index 30f501916a..6ab503806b 100644
          --- a/thirdparty/freetype/src/psaux/psobjs.c
          +++ b/thirdparty/freetype/src/psaux/psobjs.c
          @@ -4,7 +4,7 @@
            *
            *   Auxiliary functions for PostScript fonts (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -99,45 +99,31 @@
             }
           
           
          -  static void
          -  shift_elements( PS_Table  table,
          -                  FT_Byte*  old_base )
          -  {
          -    FT_PtrDist  delta  = table->block - old_base;
          -    FT_Byte**   offset = table->elements;
          -    FT_Byte**   limit  = offset + table->max_elems;
          -
          -
          -    for ( ; offset < limit; offset++ )
          -    {
          -      if ( offset[0] )
          -        offset[0] += delta;
          -    }
          -  }
          -
          -
             static FT_Error
          -  reallocate_t1_table( PS_Table   table,
          -                       FT_Offset  new_size )
          +  ps_table_realloc( PS_Table   table,
          +                    FT_Offset  new_size )
             {
               FT_Memory  memory   = table->memory;
               FT_Byte*   old_base = table->block;
               FT_Error   error;
           
           
          -    /* allocate new base block */
          -    if ( FT_ALLOC( table->block, new_size ) )
          -    {
          -      table->block = old_base;
          +    /* (re)allocate the base block */
          +    if ( FT_REALLOC( table->block, table->capacity, new_size ) )
                 return error;
          -    }
           
          -    /* copy elements and shift offsets */
          -    if ( old_base )
          +    /* rebase offsets if necessary */
          +    if ( old_base && table->block != old_base )
               {
          -      FT_MEM_COPY( table->block, old_base, table->capacity );
          -      shift_elements( table, old_base );
          -      FT_FREE( old_base );
          +      FT_Byte**   offset = table->elements;
          +      FT_Byte**   limit  = offset + table->max_elems;
          +
          +
          +      for ( ; offset < limit; offset++ )
          +      {
          +        if ( *offset )
          +          *offset = table->block + ( *offset - old_base );
          +      }
               }
           
               table->capacity = new_size;
          @@ -204,7 +190,7 @@
                   new_size  = FT_PAD_CEIL( new_size, 1024 );
                 }
           
          -      error = reallocate_t1_table( table, new_size );
          +      error = ps_table_realloc( table, new_size );
                 if ( error )
                   return error;
           
          @@ -234,32 +220,12 @@
              * @InOut:
              *   table ::
              *     The target table.
          -   *
          -   * @Note:
          -   *   This function does NOT release the heap's memory block.  It is up
          -   *   to the caller to clean it, or reference it in its own structures.
              */
             FT_LOCAL_DEF( void )
             ps_table_done( PS_Table  table )
             {
          -    FT_Memory  memory = table->memory;
          -    FT_Error   error;
          -    FT_Byte*   old_base = table->block;
          -
          -
          -    /* should never fail, because rec.cursor <= rec.size */
          -    if ( !old_base )
          -      return;
          -
          -    if ( FT_QALLOC( table->block, table->cursor ) )
          -      return;
          -    FT_MEM_COPY( table->block, old_base, table->cursor );
          -    shift_elements( table, old_base );
          -
          -    table->capacity = table->cursor;
          -    FT_FREE( old_base );
          -
          -    FT_UNUSED( error );
          +    /* no problem if shrinking fails */
          +    ps_table_realloc( table, table->cursor );
             }
           
           
          @@ -1098,7 +1064,6 @@
               {
                 FT_Byte*    q      = (FT_Byte*)objects[idx] + field->offset;
                 FT_Long     val;
          -      FT_String*  string = NULL;
           
           
                 skip_spaces( &cur, limit );
          @@ -1148,8 +1113,9 @@
                 case T1_FIELD_TYPE_STRING:
                 case T1_FIELD_TYPE_KEY:
                   {
          -          FT_Memory  memory = parser->memory;
          -          FT_UInt    len    = (FT_UInt)( limit - cur );
          +          FT_Memory   memory = parser->memory;
          +          FT_UInt     len    = (FT_UInt)( limit - cur );
          +          FT_String*  string = NULL;
           
           
                     if ( cur >= limit )
          @@ -1190,7 +1156,6 @@
                       FT_TRACE0(( "ps_parser_load_field: overwriting field %s\n",
                                   field->ident ));
                       FT_FREE( *(FT_String**)q );
          -            *(FT_String**)q = NULL;
                     }
           
                     if ( FT_QALLOC( string, len + 1 ) )
          diff --git a/thirdparty/freetype/src/psaux/psobjs.h b/thirdparty/freetype/src/psaux/psobjs.h
          index 99d16959a7..f01d4bd503 100644
          --- a/thirdparty/freetype/src/psaux/psobjs.h
          +++ b/thirdparty/freetype/src/psaux/psobjs.h
          @@ -4,7 +4,7 @@
            *
            *   Auxiliary functions for PostScript fonts (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/psaux/rules.mk b/thirdparty/freetype/src/psaux/rules.mk
          index 05439120dd..d20ff3e639 100644
          --- a/thirdparty/freetype/src/psaux/rules.mk
          +++ b/thirdparty/freetype/src/psaux/rules.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/psaux/t1cmap.c b/thirdparty/freetype/src/psaux/t1cmap.c
          index 3e7c577a18..f297ce75e1 100644
          --- a/thirdparty/freetype/src/psaux/t1cmap.c
          +++ b/thirdparty/freetype/src/psaux/t1cmap.c
          @@ -4,7 +4,7 @@
            *
            *   Type 1 character map support (body).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/psaux/t1cmap.h b/thirdparty/freetype/src/psaux/t1cmap.h
          index 8f69600ca4..460d91f590 100644
          --- a/thirdparty/freetype/src/psaux/t1cmap.h
          +++ b/thirdparty/freetype/src/psaux/t1cmap.h
          @@ -4,7 +4,7 @@
            *
            *   Type 1 character map support (specification).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/psaux/t1decode.c b/thirdparty/freetype/src/psaux/t1decode.c
          index 7e65bde632..1cdf436fa7 100644
          --- a/thirdparty/freetype/src/psaux/t1decode.c
          +++ b/thirdparty/freetype/src/psaux/t1decode.c
          @@ -4,7 +4,7 @@
            *
            *   PostScript Type 1 decoding routines (body).
            *
          - * Copyright (C) 2000-2021 by
          + * Copyright (C) 2000-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/psaux/t1decode.h b/thirdparty/freetype/src/psaux/t1decode.h
          index eea9d34b04..d60d61c904 100644
          --- a/thirdparty/freetype/src/psaux/t1decode.h
          +++ b/thirdparty/freetype/src/psaux/t1decode.h
          @@ -4,7 +4,7 @@
            *
            *   PostScript Type 1 decoding routines (specification).
            *
          - * Copyright (C) 2000-2021 by
          + * Copyright (C) 2000-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/pshinter/module.mk b/thirdparty/freetype/src/pshinter/module.mk
          index ca181ee6bf..bdb05c10ee 100644
          --- a/thirdparty/freetype/src/pshinter/module.mk
          +++ b/thirdparty/freetype/src/pshinter/module.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/pshinter/pshalgo.c b/thirdparty/freetype/src/pshinter/pshalgo.c
          index 227caeae33..dca539766f 100644
          --- a/thirdparty/freetype/src/pshinter/pshalgo.c
          +++ b/thirdparty/freetype/src/pshinter/pshalgo.c
          @@ -4,7 +4,7 @@
            *
            *   PostScript hinting algorithm (body).
            *
          - * Copyright (C) 2001-2021 by
          + * Copyright (C) 2001-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used
          @@ -182,13 +182,13 @@
               count = hints->num_hints;
           
               /* allocate our tables */
          -    if ( FT_NEW_ARRAY( table->sort,  2 * count     ) ||
          -         FT_NEW_ARRAY( table->hints,     count     ) ||
          -         FT_NEW_ARRAY( table->zones, 2 * count + 1 ) )
          +    if ( FT_QNEW_ARRAY( table->sort,  2 * count     ) ||
          +         FT_QNEW_ARRAY( table->hints,     count     ) ||
          +         FT_QNEW_ARRAY( table->zones, 2 * count + 1 ) )
                 goto Exit;
           
               table->max_hints   = count;
          -    table->sort_global = table->sort + count;
          +    table->sort_global = FT_OFFSET( table->sort, count );
               table->num_hints   = 0;
               table->num_zones   = 0;
               table->zone        = NULL;
          @@ -1167,8 +1167,8 @@
               memory = glyph->memory = globals->memory;
           
               /* allocate and setup points + contours arrays */
          -    if ( FT_NEW_ARRAY( glyph->points,   outline->n_points   ) ||
          -         FT_NEW_ARRAY( glyph->contours, outline->n_contours ) )
          +    if ( FT_QNEW_ARRAY( glyph->points,   outline->n_points   ) ||
          +         FT_QNEW_ARRAY( glyph->contours, outline->n_contours ) )
                 goto Exit;
           
               glyph->num_points   = (FT_UInt)outline->n_points;
          @@ -1228,8 +1228,9 @@
                   FT_Pos  dxi, dyi, dxo, dyo;
           
           
          +        point->flags = 0;
                   if ( !( outline->tags[n] & FT_CURVE_TAG_ON ) )
          -          point->flags = PSH_POINT_OFF;
          +          psh_point_set_off( point );
           
                   dxi = vec[n].x - vec[n_prev].x;
                   dyi = vec[n].y - vec[n_prev].y;
          @@ -1242,14 +1243,14 @@
                   point->dir_out = psh_compute_dir( dxo, dyo );
           
                   /* detect smooth points */
          -        if ( point->flags & PSH_POINT_OFF )
          -          point->flags |= PSH_POINT_SMOOTH;
          +        if ( psh_point_is_off( point ) )
          +          psh_point_set_smooth( point );
           
                   else if ( point->dir_in == point->dir_out )
                   {
                     if ( point->dir_out != PSH_DIR_NONE           ||
                          psh_corner_is_flat( dxi, dyi, dxo, dyo ) )
          -            point->flags |= PSH_POINT_SMOOTH;
          +            psh_point_set_smooth( point );
                   }
                 }
               }
          @@ -1547,8 +1548,9 @@
             /* the accepted shift for strong points in fractional pixels */
           #define PSH_STRONG_THRESHOLD  32
           
          -  /* the maximum shift value in font units */
          -#define PSH_STRONG_THRESHOLD_MAXIMUM  30
          +  /* the maximum shift value in font units tuned to distinguish */
          +  /* between stems and serifs in URW+ font collection           */
          +#define PSH_STRONG_THRESHOLD_MAXIMUM  12
           
           
             /* find strong points in a glyph */
          @@ -1797,7 +1799,7 @@
                 FT_Error  error;
           
           
          -      if ( FT_NEW_ARRAY( strongs, num_strongs ) )
          +      if ( FT_QNEW_ARRAY( strongs, num_strongs ) )
                   return;
               }
           
          @@ -2110,14 +2112,17 @@
                 FT_Fixed  old_x_scale = x_scale;
                 FT_Fixed  old_y_scale = y_scale;
           
          -      FT_Fixed  scaled;
          -      FT_Fixed  fitted;
          +      FT_Fixed  scaled = 0;
          +      FT_Fixed  fitted = 0;
           
                 FT_Bool  rescale = FALSE;
           
           
          -      scaled = FT_MulFix( globals->blues.normal_top.zones->org_ref, y_scale );
          -      fitted = FT_PIX_ROUND( scaled );
          +      if ( globals->blues.normal_top.count )
          +      {
          +        scaled = FT_MulFix( globals->blues.normal_top.zones->org_ref, y_scale );
          +        fitted = FT_PIX_ROUND( scaled );
          +      }
           
                 if ( fitted != 0 && scaled != fitted )
                 {
          diff --git a/thirdparty/freetype/src/pshinter/pshalgo.h b/thirdparty/freetype/src/pshinter/pshalgo.h
          index 999c60192b..ab978bf6d0 100644
          --- a/thirdparty/freetype/src/pshinter/pshalgo.h
          +++ b/thirdparty/freetype/src/pshinter/pshalgo.h
          @@ -4,7 +4,7 @@
            *
            *   PostScript hinting algorithm (specification).
            *
          - * Copyright (C) 2001-2021 by
          + * Copyright (C) 2001-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/pshinter/pshglob.c b/thirdparty/freetype/src/pshinter/pshglob.c
          index 2ca0f665c6..887ea8d9c1 100644
          --- a/thirdparty/freetype/src/pshinter/pshglob.c
          +++ b/thirdparty/freetype/src/pshinter/pshglob.c
          @@ -5,7 +5,7 @@
            *   PostScript hinter global hinting management (body).
            *   Inspired by the new auto-hinter module.
            *
          - * Copyright (C) 2001-2021 by
          + * Copyright (C) 2001-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used
          @@ -650,7 +650,7 @@
               FT_Error     error;
           
           
          -    if ( !FT_NEW( globals ) )
          +    if ( !FT_QNEW( globals ) )
               {
                 FT_UInt    count;
                 FT_Short*  read;
          diff --git a/thirdparty/freetype/src/pshinter/pshglob.h b/thirdparty/freetype/src/pshinter/pshglob.h
          index a8f9953fa0..47247f969e 100644
          --- a/thirdparty/freetype/src/pshinter/pshglob.h
          +++ b/thirdparty/freetype/src/pshinter/pshglob.h
          @@ -4,7 +4,7 @@
            *
            *   PostScript hinter global hinting management.
            *
          - * Copyright (C) 2001-2021 by
          + * Copyright (C) 2001-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/pshinter/pshinter.c b/thirdparty/freetype/src/pshinter/pshinter.c
          index 705143dcdc..22315685f9 100644
          --- a/thirdparty/freetype/src/pshinter/pshinter.c
          +++ b/thirdparty/freetype/src/pshinter/pshinter.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType PostScript Hinting module
            *
          - * Copyright (C) 2001-2021 by
          + * Copyright (C) 2001-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/pshinter/pshmod.c b/thirdparty/freetype/src/pshinter/pshmod.c
          index 6674041f7e..a74a4fe99f 100644
          --- a/thirdparty/freetype/src/pshinter/pshmod.c
          +++ b/thirdparty/freetype/src/pshinter/pshmod.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType PostScript hinter module implementation (body).
            *
          - * Copyright (C) 2001-2021 by
          + * Copyright (C) 2001-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/pshinter/pshmod.h b/thirdparty/freetype/src/pshinter/pshmod.h
          index 8b229bb077..cdf95b7c20 100644
          --- a/thirdparty/freetype/src/pshinter/pshmod.h
          +++ b/thirdparty/freetype/src/pshinter/pshmod.h
          @@ -4,7 +4,7 @@
            *
            *   PostScript hinter module interface (specification).
            *
          - * Copyright (C) 2001-2021 by
          + * Copyright (C) 2001-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/pshinter/pshnterr.h b/thirdparty/freetype/src/pshinter/pshnterr.h
          index 567d765132..789afb5990 100644
          --- a/thirdparty/freetype/src/pshinter/pshnterr.h
          +++ b/thirdparty/freetype/src/pshinter/pshnterr.h
          @@ -4,7 +4,7 @@
            *
            *   PS Hinter error codes (specification only).
            *
          - * Copyright (C) 2003-2021 by
          + * Copyright (C) 2003-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/pshinter/pshrec.c b/thirdparty/freetype/src/pshinter/pshrec.c
          index 1faabdaafa..2a5cffbada 100644
          --- a/thirdparty/freetype/src/pshinter/pshrec.c
          +++ b/thirdparty/freetype/src/pshinter/pshrec.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType PostScript hints recorder (body).
            *
          - * Copyright (C) 2001-2021 by
          + * Copyright (C) 2001-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -63,16 +63,14 @@
             {
               FT_UInt   old_max = table->max_hints;
               FT_UInt   new_max = count;
          -    FT_Error  error   = FT_Err_Ok;
          +    FT_Error  error;
           
           
          -    if ( new_max > old_max )
          -    {
          -      /* try to grow the table */
          -      new_max = FT_PAD_CEIL( new_max, 8 );
          -      if ( !FT_RENEW_ARRAY( table->hints, old_max, new_max ) )
          -        table->max_hints = new_max;
          -    }
          +    /* try to grow the table */
          +    new_max = FT_PAD_CEIL( new_max, 8 );
          +    if ( !FT_QRENEW_ARRAY( table->hints, old_max, new_max ) )
          +      table->max_hints = new_max;
          +
               return error;
             }
           
          @@ -90,17 +88,14 @@
               count = table->num_hints;
               count++;
           
          -    if ( count >= table->max_hints )
          +    if ( count > table->max_hints )
               {
                 error = ps_hint_table_ensure( table, count, memory );
                 if ( error )
                   goto Exit;
               }
           
          -    hint        = table->hints + count - 1;
          -    hint->pos   = 0;
          -    hint->len   = 0;
          -    hint->flags = 0;
          +    hint = table->hints + count - 1;  /* initialized upstream */
           
               table->num_hints = count;
           
          @@ -136,14 +131,15 @@
                             FT_UInt    count,
                             FT_Memory  memory )
             {
          -    FT_UInt   old_max = ( mask->max_bits + 7 ) >> 3;
          -    FT_UInt   new_max = ( count          + 7 ) >> 3;
          +    FT_UInt   old_max = mask->max_bits >> 3;
          +    FT_UInt   new_max = ( count + 7 ) >> 3;
               FT_Error  error   = FT_Err_Ok;
           
           
               if ( new_max > old_max )
               {
                 new_max = FT_PAD_CEIL( new_max, 8 );
          +      /* added bytes are zeroed here */
                 if ( !FT_RENEW_ARRAY( mask->bytes, old_max, new_max ) )
                   mask->max_bits = new_max * 8;
               }
          @@ -154,31 +150,15 @@
             /* test a bit value in a given mask */
             static FT_Int
             ps_mask_test_bit( PS_Mask  mask,
          -                    FT_Int   idx )
          +                    FT_UInt  idx )
             {
          -    if ( (FT_UInt)idx >= mask->num_bits )
          +    if ( idx >= mask->num_bits )
                 return 0;
           
               return mask->bytes[idx >> 3] & ( 0x80 >> ( idx & 7 ) );
             }
           
           
          -  /* clear a given bit */
          -  static void
          -  ps_mask_clear_bit( PS_Mask  mask,
          -                     FT_UInt  idx )
          -  {
          -    FT_Byte*  p;
          -
          -
          -    if ( idx >= mask->num_bits )
          -      return;
          -
          -    p    = mask->bytes + ( idx >> 3 );
          -    p[0] = (FT_Byte)( p[0] & ~( 0x80 >> ( idx & 7 ) ) );
          -  }
          -
          -
             /* set a given bit, possibly grow the mask */
             static FT_Error
             ps_mask_set_bit( PS_Mask    mask,
          @@ -269,6 +249,10 @@
               mask             = table->masks + count - 1;
               mask->num_bits   = 0;
               mask->end_point  = 0;
          +    /* reused mask must be cleared */
          +    if ( mask->max_bits )
          +      FT_MEM_ZERO( mask->bytes, mask->max_bits >> 3 );
          +
               table->num_masks = count;
           
             Exit:
          @@ -426,7 +410,7 @@
                 PS_Mask  mask2  = table->masks + index2;
                 FT_UInt  count1 = mask1->num_bits;
                 FT_UInt  count2 = mask2->num_bits;
          -      FT_Int   delta;
          +      FT_UInt  delta;
           
           
                 if ( count2 > 0 )
          @@ -437,15 +421,14 @@
           
           
                   /* if "count2" is greater than "count1", we need to grow the */
          -        /* first bitset, and clear the highest bits                  */
          +        /* first bitset                                              */
                   if ( count2 > count1 )
                   {
                     error = ps_mask_ensure( mask1, count2, memory );
                     if ( error )
                       goto Exit;
           
          -          for ( pos = count1; pos < count2; pos++ )
          -            ps_mask_clear_bit( mask1, pos );
          +          mask1->num_bits = count2;
                   }
           
                   /* merge (unite) the bitsets */
          @@ -467,7 +450,7 @@
                 mask2->end_point = 0;
           
                 /* number of masks to move */
          -      delta = (FT_Int)( table->num_masks - 1 - index2 );
          +      delta = table->num_masks - 1 - index2;
                 if ( delta > 0 )
                 {
                   /* move to end of table for reuse */
          @@ -476,7 +459,7 @@
           
                   ft_memmove( mask2,
                               mask2 + 1,
          -                    (FT_UInt)delta * sizeof ( PS_MaskRec ) );
          +                    delta * sizeof ( PS_MaskRec ) );
           
                   mask2[delta] = dummy;
                 }
          @@ -647,7 +630,7 @@
                                      FT_Int        pos,
                                      FT_Int        len,
                                      FT_Memory     memory,
          -                           FT_Int       *aindex )
          +                           FT_UInt      *aindex )
             {
               FT_Error  error = FT_Err_Ok;
               FT_UInt   flags = 0;
          @@ -665,9 +648,6 @@
                 len = 0;
               }
           
          -    if ( aindex )
          -      *aindex = -1;
          -
               /* now, lookup stem in the current hints table */
               {
                 PS_Mask  mask;
          @@ -704,7 +684,7 @@
                   goto Exit;
           
                 if ( aindex )
          -        *aindex = (FT_Int)idx;
          +        *aindex = idx;
               }
           
             Exit:
          @@ -715,9 +695,9 @@
             /* add a "hstem3/vstem3" counter to our dimension table */
             static FT_Error
             ps_dimension_add_counter( PS_Dimension  dim,
          -                            FT_Int        hint1,
          -                            FT_Int        hint2,
          -                            FT_Int        hint3,
          +                            FT_UInt       hint1,
          +                            FT_UInt       hint2,
          +                            FT_UInt       hint3,
                                       FT_Memory     memory )
             {
               FT_Error  error   = FT_Err_Ok;
          @@ -744,26 +724,17 @@
               }
           
               /* now, set the bits for our hints in the counter mask */
          -    if ( hint1 >= 0 )
          -    {
          -      error = ps_mask_set_bit( counter, (FT_UInt)hint1, memory );
          -      if ( error )
          -        goto Exit;
          -    }
          +    error = ps_mask_set_bit( counter, hint1, memory );
          +    if ( error )
          +      goto Exit;
           
          -    if ( hint2 >= 0 )
          -    {
          -      error = ps_mask_set_bit( counter, (FT_UInt)hint2, memory );
          -      if ( error )
          -        goto Exit;
          -    }
          +    error = ps_mask_set_bit( counter, hint2, memory );
          +    if ( error )
          +      goto Exit;
           
          -    if ( hint3 >= 0 )
          -    {
          -      error = ps_mask_set_bit( counter, (FT_UInt)hint3, memory );
          -      if ( error )
          -        goto Exit;
          -    }
          +    error = ps_mask_set_bit( counter, hint3, memory );
          +    if ( error )
          +      goto Exit;
           
             Exit:
               return error;
          @@ -892,7 +863,7 @@
                 PS_Dimension  dim;
                 FT_Memory     memory = hints->memory;
                 FT_Int        count;
          -      FT_Int        idx[3];
          +      FT_UInt       idx[3];
           
           
                 /* limit "dimension" to 0..1 */
          diff --git a/thirdparty/freetype/src/pshinter/pshrec.h b/thirdparty/freetype/src/pshinter/pshrec.h
          index e483981d9d..a0d37979cc 100644
          --- a/thirdparty/freetype/src/pshinter/pshrec.h
          +++ b/thirdparty/freetype/src/pshinter/pshrec.h
          @@ -4,7 +4,7 @@
            *
            *   Postscript (Type1/Type2) hints recorder (specification).
            *
          - * Copyright (C) 2001-2021 by
          + * Copyright (C) 2001-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/pshinter/rules.mk b/thirdparty/freetype/src/pshinter/rules.mk
          index 3c5a59a807..ee5968048b 100644
          --- a/thirdparty/freetype/src/pshinter/rules.mk
          +++ b/thirdparty/freetype/src/pshinter/rules.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 2001-2021 by
          +# Copyright (C) 2001-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/psnames/module.mk b/thirdparty/freetype/src/psnames/module.mk
          index abfb54ffc6..4bd2ee6248 100644
          --- a/thirdparty/freetype/src/psnames/module.mk
          +++ b/thirdparty/freetype/src/psnames/module.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/psnames/psmodule.c b/thirdparty/freetype/src/psnames/psmodule.c
          index 74adefa15b..e7d51e950e 100644
          --- a/thirdparty/freetype/src/psnames/psmodule.c
          +++ b/thirdparty/freetype/src/psnames/psmodule.c
          @@ -4,7 +4,7 @@
            *
            *   psnames module implementation (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/psnames/psmodule.h b/thirdparty/freetype/src/psnames/psmodule.h
          index e92a975e9d..ff3eda564c 100644
          --- a/thirdparty/freetype/src/psnames/psmodule.h
          +++ b/thirdparty/freetype/src/psnames/psmodule.h
          @@ -4,7 +4,7 @@
            *
            *   High-level psnames module interface (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/psnames/psnamerr.h b/thirdparty/freetype/src/psnames/psnamerr.h
          index 888b76c4f6..ae56620275 100644
          --- a/thirdparty/freetype/src/psnames/psnamerr.h
          +++ b/thirdparty/freetype/src/psnames/psnamerr.h
          @@ -4,7 +4,7 @@
            *
            *   PS names module error codes (specification only).
            *
          - * Copyright (C) 2001-2021 by
          + * Copyright (C) 2001-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/psnames/psnames.c b/thirdparty/freetype/src/psnames/psnames.c
          index e7be6707d6..c844a317fd 100644
          --- a/thirdparty/freetype/src/psnames/psnames.c
          +++ b/thirdparty/freetype/src/psnames/psnames.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType psnames module component (body only).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/psnames/pstables.h b/thirdparty/freetype/src/psnames/pstables.h
          index 0bcadca9cc..d28d580b9c 100644
          --- a/thirdparty/freetype/src/psnames/pstables.h
          +++ b/thirdparty/freetype/src/psnames/pstables.h
          @@ -4,7 +4,7 @@
            *
            *   PostScript glyph names.
            *
          - * Copyright (C) 2005-2021 by
          + * Copyright (C) 2005-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/psnames/rules.mk b/thirdparty/freetype/src/psnames/rules.mk
          index 6694f4eb6c..3768e2f1d8 100644
          --- a/thirdparty/freetype/src/psnames/rules.mk
          +++ b/thirdparty/freetype/src/psnames/rules.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/raster/ftmisc.h b/thirdparty/freetype/src/raster/ftmisc.h
          index b12a051234..75fb5f8437 100644
          --- a/thirdparty/freetype/src/raster/ftmisc.h
          +++ b/thirdparty/freetype/src/raster/ftmisc.h
          @@ -5,7 +5,7 @@
            *   Miscellaneous macros for stand-alone rasterizer (specification
            *   only).
            *
          - * Copyright (C) 2005-2021 by
          + * Copyright (C) 2005-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used
          diff --git a/thirdparty/freetype/src/raster/ftraster.c b/thirdparty/freetype/src/raster/ftraster.c
          index bfc059c1e8..4be70e3e79 100644
          --- a/thirdparty/freetype/src/raster/ftraster.c
          +++ b/thirdparty/freetype/src/raster/ftraster.c
          @@ -4,7 +4,7 @@
            *
            *   The FreeType glyph rasterizer (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/raster/ftraster.h b/thirdparty/freetype/src/raster/ftraster.h
          index 4affd48b51..e9ece8cf0b 100644
          --- a/thirdparty/freetype/src/raster/ftraster.h
          +++ b/thirdparty/freetype/src/raster/ftraster.h
          @@ -4,7 +4,7 @@
            *
            *   The FreeType glyph rasterizer (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used
          diff --git a/thirdparty/freetype/src/raster/ftrend1.c b/thirdparty/freetype/src/raster/ftrend1.c
          index 236a8daf0a..f319f03d9c 100644
          --- a/thirdparty/freetype/src/raster/ftrend1.c
          +++ b/thirdparty/freetype/src/raster/ftrend1.c
          @@ -4,7 +4,7 @@
            *
            *   The FreeType glyph rasterizer interface (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/raster/ftrend1.h b/thirdparty/freetype/src/raster/ftrend1.h
          index e4cea53741..14ec336b11 100644
          --- a/thirdparty/freetype/src/raster/ftrend1.h
          +++ b/thirdparty/freetype/src/raster/ftrend1.h
          @@ -4,7 +4,7 @@
            *
            *   The FreeType glyph rasterizer interface (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/raster/module.mk b/thirdparty/freetype/src/raster/module.mk
          index fbc1d64ec2..b56a4902ba 100644
          --- a/thirdparty/freetype/src/raster/module.mk
          +++ b/thirdparty/freetype/src/raster/module.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/raster/raster.c b/thirdparty/freetype/src/raster/raster.c
          index ad81a39414..324cc5661c 100644
          --- a/thirdparty/freetype/src/raster/raster.c
          +++ b/thirdparty/freetype/src/raster/raster.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType monochrome rasterer module component (body only).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/raster/rasterrs.h b/thirdparty/freetype/src/raster/rasterrs.h
          index 852dd5bc31..8b1ebf07a3 100644
          --- a/thirdparty/freetype/src/raster/rasterrs.h
          +++ b/thirdparty/freetype/src/raster/rasterrs.h
          @@ -4,7 +4,7 @@
            *
            *   monochrome renderer error codes (specification only).
            *
          - * Copyright (C) 2001-2021 by
          + * Copyright (C) 2001-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/raster/rules.mk b/thirdparty/freetype/src/raster/rules.mk
          index 7ffda77276..0cf3b4bff5 100644
          --- a/thirdparty/freetype/src/raster/rules.mk
          +++ b/thirdparty/freetype/src/raster/rules.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/sdf/ftbsdf.c b/thirdparty/freetype/src/sdf/ftbsdf.c
          index 8da5c9d9e0..1328ac4988 100644
          --- a/thirdparty/freetype/src/sdf/ftbsdf.c
          +++ b/thirdparty/freetype/src/sdf/ftbsdf.c
          @@ -4,7 +4,7 @@
            *
            *   Signed Distance Field support for bitmap fonts (body only).
            *
          - * Copyright (C) 2020-2021 by
          + * Copyright (C) 2020-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * Written by Anuj Verma.
          @@ -177,11 +177,11 @@
              *
              * @Fields:
              *   dist ::
          -   *     Vector length of the `near` parameter.  Can be squared or absolute
          +   *     Vector length of the `prox` parameter.  Can be squared or absolute
              *     depending on the `USE_SQUARED_DISTANCES` macro defined in file
              *     `ftsdfcommon.h`.
              *
          -   *   near ::
          +   *   prox ::
              *     Vector to the nearest edge.  Can also be interpreted as shortest
              *     distance of a point.
              *
          @@ -194,7 +194,7 @@
             typedef struct  ED_
             {
               FT_16D16      dist;
          -    FT_16D16_Vec  near;
          +    FT_16D16_Vec  prox;
               FT_Byte       alpha;
           
             } ED;
          @@ -595,18 +595,18 @@
                                      worker->rows ) )
                   {
                     /* approximate the edge distance for edge pixels */
          -          ed[index].near = compute_edge_distance( ed + index,
          +          ed[index].prox = compute_edge_distance( ed + index,
                                                             i, j,
                                                             worker->width,
                                                             worker->rows );
          -          ed[index].dist = VECTOR_LENGTH_16D16( ed[index].near );
          +          ed[index].dist = VECTOR_LENGTH_16D16( ed[index].prox );
                   }
                   else
                   {
                     /* for non-edge pixels assign far away distances */
                     ed[index].dist   = 400 * ONE;
          -          ed[index].near.x = 200 * ONE;
          -          ed[index].near.y = 200 * ONE;
          +          ed[index].prox.x = 200 * ONE;
          +          ed[index].prox.y = 200 * ONE;
                   }
                 }
               }
          @@ -756,8 +756,6 @@
                       byte  = (FT_Byte)( 1 << mod );
           
                       t[t_index].alpha = pixel & byte ? 255 : 0;
          -
          -            pixel = 0;
                     }
                   }
                 }
          @@ -873,7 +871,7 @@
           
               if ( dist < current->dist )
               {
          -      dist_vec = to_check->near;
          +      dist_vec = to_check->prox;
           
                 dist_vec.x += x_offset * ONE;
                 dist_vec.y += y_offset * ONE;
          @@ -882,7 +880,7 @@
                 if ( dist < current->dist )
                 {
                   current->dist = dist;
          -        current->near = dist_vec;
          +        current->prox = dist_vec;
                 }
               }
             }
          @@ -1098,7 +1096,7 @@
               FT_Int  i, j;
           
               FT_SDFFormat*  t_buffer;
          -    FT_16D16       spread;
          +    FT_16D16       sp_sq, spread;
           
           
               if ( !worker || !target )
          @@ -1118,11 +1116,13 @@
                 goto Exit;
               }
           
          -#if USE_SQUARED_DISTANCES
          -    spread = FT_INT_16D16( worker->params.spread *
          -                           worker->params.spread );
          -#else
               spread = FT_INT_16D16( worker->params.spread );
          +
          +#if USE_SQUARED_DISTANCES
          +    sp_sq = FT_INT_16D16( worker->params.spread *
          +                          worker->params.spread );
          +#else
          +    sp_sq = FT_INT_16D16( worker->params.spread );
           #endif
           
               for ( j = 0; j < r; j++ )
          @@ -1138,8 +1138,8 @@
                   index = j * w + i;
                   dist  = worker->distance_map[index].dist;
           
          -        if ( dist < 0 || dist > spread )
          -          dist = spread;
          +        if ( dist < 0 || dist > sp_sq )
          +          dist = sp_sq;
           
           #if USE_SQUARED_DISTANCES
                   dist = square_root( dist );
          diff --git a/thirdparty/freetype/src/sdf/ftsdf.c b/thirdparty/freetype/src/sdf/ftsdf.c
          index f69cf49b47..f0e45418cb 100644
          --- a/thirdparty/freetype/src/sdf/ftsdf.c
          +++ b/thirdparty/freetype/src/sdf/ftsdf.c
          @@ -4,7 +4,7 @@
            *
            *   Signed Distance Field support for outline fonts (body).
            *
          - * Copyright (C) 2020-2021 by
          + * Copyright (C) 2020-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * Written by Anuj Verma.
          @@ -497,7 +497,7 @@
                 goto Exit;
               }
           
          -    if ( !FT_QALLOC( ptr, sizeof ( *ptr ) ) )
          +    if ( !FT_QNEW( ptr ) )
               {
                 *ptr = null_edge;
                 *edge = ptr;
          @@ -536,7 +536,7 @@
                 goto Exit;
               }
           
          -    if ( !FT_QALLOC( ptr, sizeof ( *ptr ) ) )
          +    if ( !FT_QNEW( ptr ) )
               {
                 *ptr     = null_contour;
                 *contour = ptr;
          @@ -591,7 +591,7 @@
                 goto Exit;
               }
           
          -    if ( !FT_QALLOC( ptr, sizeof ( *ptr ) ) )
          +    if ( !FT_QNEW( ptr ) )
               {
                 *ptr        = null_shape;
                 ptr->memory = memory;
          @@ -738,6 +738,18 @@
           
               contour = shape->contours;
           
          +    /* If the control point coincides with any of the end points */
          +    /* then it is a line and should be treated as one to avoid   */
          +    /* unnecessary complexity later in the algorithm.            */
          +    if ( ( contour->last_pos.x == control_1->x &&
          +           contour->last_pos.y == control_1->y ) ||
          +         ( control_1->x == to->x &&
          +           control_1->y == to->y )               )
          +    {
          +      sdf_line_to( to, user );
          +      goto Exit;
          +    }
          +
               FT_CALL( sdf_edge_new( memory, &edge ) );
           
               edge->edge_type = SDF_EDGE_CONIC;
          @@ -764,9 +776,9 @@
                           const FT_26D6_Vec*  to,
                           void*               user )
             {
          -    SDF_Shape*    shape    = ( SDF_Shape* )user;
          -    SDF_Edge*     edge     = NULL;
          -    SDF_Contour*  contour  = NULL;
          +    SDF_Shape*    shape   = ( SDF_Shape* )user;
          +    SDF_Edge*     edge    = NULL;
          +    SDF_Contour*  contour = NULL;
           
               FT_Error   error  = FT_Err_Ok;
               FT_Memory  memory = shape->memory;
          @@ -1065,7 +1077,7 @@
             static FT_Error
             split_sdf_conic( FT_Memory     memory,
                              FT_26D6_Vec*  control_points,
          -                   FT_Int        max_splits,
          +                   FT_UInt       max_splits,
                              SDF_Edge**    out )
             {
               FT_Error     error = FT_Err_Ok;
          @@ -1134,26 +1146,41 @@
             static FT_Error
             split_sdf_cubic( FT_Memory     memory,
                              FT_26D6_Vec*  control_points,
          -                   FT_Int        max_splits,
          +                   FT_UInt       max_splits,
                              SDF_Edge**    out )
             {
          -    FT_Error     error = FT_Err_Ok;
          -    FT_26D6_Vec  cpos[7];
          -    SDF_Edge*    left,*  right;
          +    FT_Error       error = FT_Err_Ok;
          +    FT_26D6_Vec    cpos[7];
          +    SDF_Edge*      left, *right;
          +    const FT_26D6  threshold = ONE_PIXEL / 4;
           
           
          -    if ( !memory || !out  )
          +    if ( !memory || !out )
               {
                 error = FT_THROW( Invalid_Argument );
                 goto Exit;
               }
           
          -    /* split the conic */
          +    /* split the cubic */
               cpos[0] = control_points[0];
               cpos[1] = control_points[1];
               cpos[2] = control_points[2];
               cpos[3] = control_points[3];
           
          +    /* If the segment is flat enough we won't get any benefit by */
          +    /* splitting it further, so we can just stop splitting.      */
          +    /*                                                           */
          +    /* Check the deviation of the Bezier curve and stop if it is */
          +    /* smaller than the pre-defined `threshold` value.           */
          +    if ( FT_ABS( 2 * cpos[0].x - 3 * cpos[1].x + cpos[3].x ) < threshold &&
          +         FT_ABS( 2 * cpos[0].y - 3 * cpos[1].y + cpos[3].y ) < threshold &&
          +         FT_ABS( cpos[0].x - 3 * cpos[2].x + 2 * cpos[3].x ) < threshold &&
          +         FT_ABS( cpos[0].y - 3 * cpos[2].y + 2 * cpos[3].y ) < threshold )
          +    {
          +      split_cubic( cpos );
          +      goto Append;
          +    }
          +
               split_cubic( cpos );
           
               /* If max number of splits is done */
          @@ -1250,13 +1277,32 @@
                     /* Subdivide the curve and add it to the list. */
                     {
                       FT_26D6_Vec  ctrls[3];
          +            FT_26D6      dx, dy;
          +            FT_UInt      num_splits;
           
           
                       ctrls[0] = edge->start_pos;
                       ctrls[1] = edge->control_a;
                       ctrls[2] = edge->end_pos;
           
          -            error = split_sdf_conic( memory, ctrls, 32, &new_edges );
          +            dx = FT_ABS( ctrls[2].x + ctrls[0].x - 2 * ctrls[1].x );
          +            dy = FT_ABS( ctrls[2].y + ctrls[0].y - 2 * ctrls[1].y );
          +            if ( dx < dy )
          +              dx = dy;
          +
          +            /* Calculate the number of necessary bisections.  Each      */
          +            /* bisection causes a four-fold reduction of the deviation, */
          +            /* hence we bisect the Bezier curve until the deviation     */
          +            /* becomes less than 1/8th of a pixel.  For more details    */
          +            /* check file `ftgrays.c`.                                  */
          +            num_splits = 1;
          +            while ( dx > ONE_PIXEL / 8 )
          +            {
          +              dx         >>= 2;
          +              num_splits <<= 1;
          +            }
          +
          +            error = split_sdf_conic( memory, ctrls, num_splits, &new_edges );
                     }
                     break;
           
          @@ -1277,9 +1323,11 @@
           
                   default:
                     error = FT_THROW( Invalid_Argument );
          -          goto Exit;
                   }
           
          +        if ( error != FT_Err_Ok )
          +          goto Exit;
          +
                   edges = edges->next;
                 }
           
          @@ -3240,7 +3288,7 @@
               buffer   = (FT_SDFFormat*)bitmap->buffer;
           
               if ( USE_SQUARED_DISTANCES )
          -      sp_sq = fixed_spread * fixed_spread;
          +      sp_sq = FT_INT_16D16( (FT_Int)( spread * spread ) );
               else
                 sp_sq = fixed_spread;
           
          @@ -3284,6 +3332,7 @@
                       FT_26D6_Vec          grid_point = zero_vector;
                       SDF_Signed_Distance  dist       = max_sdf;
                       FT_UInt              index      = 0;
          +            FT_16D16             diff       = 0;
           
           
                       if ( x < 0 || x >= width )
          @@ -3311,7 +3360,7 @@
                       if ( dist.distance > sp_sq )
                         continue;
           
          -            /* square_root the values and fit in a 6.10 fixed-point */
          +            /* take the square root of the distance if required */
                       if ( USE_SQUARED_DISTANCES )
                         dist.distance = square_root( dist.distance );
           
          @@ -3323,11 +3372,15 @@
                       /* check whether the pixel is set or not */
                       if ( dists[index].sign == 0 )
                         dists[index] = dist;
          -            else if ( dists[index].distance > dist.distance )
          -              dists[index] = dist;
          -            else if ( FT_ABS( dists[index].distance - dist.distance )
          -                        < CORNER_CHECK_EPSILON )
          -              dists[index] = resolve_corner( dists[index], dist );
          +            else
          +            {
          +              diff = FT_ABS( dists[index].distance - dist.distance );
          +
          +              if ( diff <= CORNER_CHECK_EPSILON )
          +                dists[index] = resolve_corner( dists[index], dist );
          +              else if ( dists[index].distance > dist.distance )
          +                dists[index] = dist;
          +            }
                     }
                   }
           
          diff --git a/thirdparty/freetype/src/sdf/ftsdf.h b/thirdparty/freetype/src/sdf/ftsdf.h
          index 187b418af3..5f6b3f52aa 100644
          --- a/thirdparty/freetype/src/sdf/ftsdf.h
          +++ b/thirdparty/freetype/src/sdf/ftsdf.h
          @@ -4,7 +4,7 @@
            *
            *   Signed Distance Field support (specification).
            *
          - * Copyright (C) 2020-2021 by
          + * Copyright (C) 2020-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * Written by Anuj Verma.
          diff --git a/thirdparty/freetype/src/sdf/ftsdfcommon.c b/thirdparty/freetype/src/sdf/ftsdfcommon.c
          index 91aa521bb3..072a36ea6c 100644
          --- a/thirdparty/freetype/src/sdf/ftsdfcommon.c
          +++ b/thirdparty/freetype/src/sdf/ftsdfcommon.c
          @@ -4,7 +4,7 @@
            *
            *   Auxiliary data for Signed Distance Field support (body).
            *
          - * Copyright (C) 2020-2021 by
          + * Copyright (C) 2020-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * Written by Anuj Verma.
          diff --git a/thirdparty/freetype/src/sdf/ftsdfcommon.h b/thirdparty/freetype/src/sdf/ftsdfcommon.h
          index 44f6bba53f..af4490bbca 100644
          --- a/thirdparty/freetype/src/sdf/ftsdfcommon.h
          +++ b/thirdparty/freetype/src/sdf/ftsdfcommon.h
          @@ -4,7 +4,7 @@
            *
            *   Auxiliary data for Signed Distance Field support (specification).
            *
          - * Copyright (C) 2020-2021 by
          + * Copyright (C) 2020-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * Written by Anuj Verma.
          @@ -48,6 +48,8 @@ FT_BEGIN_HEADER
           #define MIN_SPREAD      2
             /* maximum spread supported by the renderer */
           #define MAX_SPREAD      32
          +  /* pixel size in 26.6 */
          +#define ONE_PIXEL       ( 1 << 6 )
           
           
             /**************************************************************************
          diff --git a/thirdparty/freetype/src/sdf/ftsdferrs.h b/thirdparty/freetype/src/sdf/ftsdferrs.h
          index dbb113d537..b28867609a 100644
          --- a/thirdparty/freetype/src/sdf/ftsdferrs.h
          +++ b/thirdparty/freetype/src/sdf/ftsdferrs.h
          @@ -4,7 +4,7 @@
            *
            *   Signed Distance Field error codes (specification only).
            *
          - * Copyright (C) 2020-2021 by
          + * Copyright (C) 2020-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * Written by Anuj Verma.
          diff --git a/thirdparty/freetype/src/sdf/ftsdfrend.c b/thirdparty/freetype/src/sdf/ftsdfrend.c
          index 30f2e62a4f..37dbd40d9c 100644
          --- a/thirdparty/freetype/src/sdf/ftsdfrend.c
          +++ b/thirdparty/freetype/src/sdf/ftsdfrend.c
          @@ -4,7 +4,7 @@
            *
            *   Signed Distance Field renderer interface (body).
            *
          - * Copyright (C) 2020-2021 by
          + * Copyright (C) 2020-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * Written by Anuj Verma.
          diff --git a/thirdparty/freetype/src/sdf/ftsdfrend.h b/thirdparty/freetype/src/sdf/ftsdfrend.h
          index bc88707ec2..cdb9c5f02f 100644
          --- a/thirdparty/freetype/src/sdf/ftsdfrend.h
          +++ b/thirdparty/freetype/src/sdf/ftsdfrend.h
          @@ -4,7 +4,7 @@
            *
            *   Signed Distance Field renderer interface (specification).
            *
          - * Copyright (C) 2020-2021 by
          + * Copyright (C) 2020-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * Written by Anuj Verma.
          diff --git a/thirdparty/freetype/src/sdf/module.mk b/thirdparty/freetype/src/sdf/module.mk
          index 6be4b0c6d4..772bc48bf7 100644
          --- a/thirdparty/freetype/src/sdf/module.mk
          +++ b/thirdparty/freetype/src/sdf/module.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 2020-2021 by
          +# Copyright (C) 2020-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/sdf/rules.mk b/thirdparty/freetype/src/sdf/rules.mk
          index 7e7e4fbe86..5239d643ff 100644
          --- a/thirdparty/freetype/src/sdf/rules.mk
          +++ b/thirdparty/freetype/src/sdf/rules.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 2020-2021 by
          +# Copyright (C) 2020-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/sdf/sdf.c b/thirdparty/freetype/src/sdf/sdf.c
          index 1bc3fc385c..297ba9ab02 100644
          --- a/thirdparty/freetype/src/sdf/sdf.c
          +++ b/thirdparty/freetype/src/sdf/sdf.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType Signed Distance Field renderer module component (body only).
            *
          - * Copyright (C) 2020-2021 by
          + * Copyright (C) 2020-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * Written by Anuj Verma.
          diff --git a/thirdparty/freetype/src/sfnt/module.mk b/thirdparty/freetype/src/sfnt/module.mk
          index eabd48f609..dbdde1564e 100644
          --- a/thirdparty/freetype/src/sfnt/module.mk
          +++ b/thirdparty/freetype/src/sfnt/module.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/sfnt/pngshim.c b/thirdparty/freetype/src/sfnt/pngshim.c
          index 02fe37440c..a767076607 100644
          --- a/thirdparty/freetype/src/sfnt/pngshim.c
          +++ b/thirdparty/freetype/src/sfnt/pngshim.c
          @@ -4,7 +4,7 @@
            *
            *   PNG Bitmap glyph support.
            *
          - * Copyright (C) 2013-2021 by
          + * Copyright (C) 2013-2022 by
            * Google, Inc.
            * Written by Stuart Gill and Behdad Esfahbod.
            *
          diff --git a/thirdparty/freetype/src/sfnt/pngshim.h b/thirdparty/freetype/src/sfnt/pngshim.h
          index 89efd27545..36d749c3c3 100644
          --- a/thirdparty/freetype/src/sfnt/pngshim.h
          +++ b/thirdparty/freetype/src/sfnt/pngshim.h
          @@ -4,7 +4,7 @@
            *
            *   PNG Bitmap glyph support.
            *
          - * Copyright (C) 2013-2021 by
          + * Copyright (C) 2013-2022 by
            * Google, Inc.
            * Written by Stuart Gill and Behdad Esfahbod.
            *
          diff --git a/thirdparty/freetype/src/sfnt/rules.mk b/thirdparty/freetype/src/sfnt/rules.mk
          index d41305c0ad..ac4b571226 100644
          --- a/thirdparty/freetype/src/sfnt/rules.mk
          +++ b/thirdparty/freetype/src/sfnt/rules.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          @@ -36,6 +36,7 @@ SFNT_DRV_SRC := $(SFNT_DIR)/pngshim.c   \
                           $(SFNT_DIR)/ttbdf.c     \
                           $(SFNT_DIR)/ttcmap.c    \
                           $(SFNT_DIR)/ttcolr.c    \
          +                $(SFNT_DIR)/ttsvg.c     \
                           $(SFNT_DIR)/ttcpal.c    \
                           $(SFNT_DIR)/ttkern.c    \
                           $(SFNT_DIR)/ttload.c    \
          diff --git a/thirdparty/freetype/src/sfnt/sfdriver.c b/thirdparty/freetype/src/sfnt/sfdriver.c
          index d1d01c99e5..cc121e5790 100644
          --- a/thirdparty/freetype/src/sfnt/sfdriver.c
          +++ b/thirdparty/freetype/src/sfnt/sfdriver.c
          @@ -4,7 +4,7 @@
            *
            *   High-level SFNT driver interface (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -36,6 +36,10 @@
           #include "ttcpal.h"
           #endif
           
          +#ifdef FT_CONFIG_OPTION_SVG
          +#include "ttsvg.h"
          +#endif
          +
           #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
           #include "ttpost.h"
           #endif
          @@ -491,15 +495,13 @@
                             char_type_func  char_type,
                             FT_Bool         report_invalid_characters )
             {
          -    FT_Error  error = FT_Err_Ok;
          +    FT_Error  error;
           
               char*       result = NULL;
               FT_String*  r;
               FT_Char*    p;
               FT_UInt     len;
           
          -    FT_UNUSED( error );
          -
           
               if ( FT_QALLOC( result, entry->stringLength / 2 + 1 ) )
                 return NULL;
          @@ -550,15 +552,13 @@
                               char_type_func  char_type,
                               FT_Bool         report_invalid_characters )
             {
          -    FT_Error  error = FT_Err_Ok;
          +    FT_Error  error;
           
               char*       result = NULL;
               FT_String*  r;
               FT_Char*    p;
               FT_UInt     len;
           
          -    FT_UNUSED( error );
          -
           
               if ( FT_QALLOC( result, entry->stringLength + 1 ) )
                 return NULL;
          @@ -1214,6 +1214,12 @@
           #define PUT_COLOR_LAYERS( a )  NULL
           #endif
           
          +#ifdef FT_CONFIG_OPTION_SVG
          +#define PUT_SVG_SUPPORT( a )  a
          +#else
          +#define PUT_SVG_SUPPORT( a )  NULL
          +#endif
          +
           #define PUT_COLOR_LAYERS_V1( a )  PUT_COLOR_LAYERS( a )
           
           #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
          @@ -1308,7 +1314,14 @@
               tt_face_get_metrics,    /* TT_Get_Metrics_Func     get_metrics     */
           
               tt_face_get_name,       /* TT_Get_Name_Func        get_name        */
          -    sfnt_get_name_id        /* TT_Get_Name_ID_Func     get_name_id     */
          +    sfnt_get_name_id,       /* TT_Get_Name_ID_Func     get_name_id     */
          +
          +    PUT_SVG_SUPPORT( tt_face_load_svg ),
          +                            /* TT_Load_Table_Func      load_svg        */
          +    PUT_SVG_SUPPORT( tt_face_free_svg ),
          +                            /* TT_Free_Table_Func      free_svg        */
          +    PUT_SVG_SUPPORT( tt_face_load_svg_doc )
          +                            /* TT_Load_Svg_Doc_Func    load_svg_doc    */
             )
           
           
          diff --git a/thirdparty/freetype/src/sfnt/sfdriver.h b/thirdparty/freetype/src/sfnt/sfdriver.h
          index 8d5b5ce367..6a2e3e9c7b 100644
          --- a/thirdparty/freetype/src/sfnt/sfdriver.h
          +++ b/thirdparty/freetype/src/sfnt/sfdriver.h
          @@ -4,7 +4,7 @@
            *
            *   High-level SFNT driver interface (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/sfnt/sferrors.h b/thirdparty/freetype/src/sfnt/sferrors.h
          index 78e6f03513..99ef3f9fce 100644
          --- a/thirdparty/freetype/src/sfnt/sferrors.h
          +++ b/thirdparty/freetype/src/sfnt/sferrors.h
          @@ -4,7 +4,7 @@
            *
            *   SFNT error codes (specification only).
            *
          - * Copyright (C) 2001-2021 by
          + * Copyright (C) 2001-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/sfnt/sfnt.c b/thirdparty/freetype/src/sfnt/sfnt.c
          index 97692cdfb0..9b3ceaedc0 100644
          --- a/thirdparty/freetype/src/sfnt/sfnt.c
          +++ b/thirdparty/freetype/src/sfnt/sfnt.c
          @@ -4,7 +4,7 @@
            *
            *   Single object library component.
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -27,6 +27,7 @@
           #include "ttcmap.c"
           #include "ttcolr.c"
           #include "ttcpal.c"
          +#include "ttsvg.c"
           
           #include "ttkern.c"
           #include "ttload.c"
          diff --git a/thirdparty/freetype/src/sfnt/sfobjs.c b/thirdparty/freetype/src/sfnt/sfobjs.c
          index 7891024790..35d3d6c78f 100644
          --- a/thirdparty/freetype/src/sfnt/sfobjs.c
          +++ b/thirdparty/freetype/src/sfnt/sfobjs.c
          @@ -4,7 +4,7 @@
            *
            *   SFNT object management (base).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -566,7 +566,7 @@
               face_index = FT_ABS( face_instance_index ) & 0xFFFF;
           
               /* value -(N+1) requests information on index N */
          -    if ( face_instance_index < 0 )
          +    if ( face_instance_index < 0 && face_index > 0 )
                 face_index--;
           
               if ( face_index >= face->ttc_header.count )
          @@ -784,17 +784,23 @@
                             FT_Int         num_params,
                             FT_Parameter*  params )
             {
          -    FT_Error      error;
          +    FT_Error  error;
           #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
          -    FT_Error      psnames_error;
          +    FT_Error  psnames_error;
           #endif
          -    FT_Bool       has_outline;
          -    FT_Bool       is_apple_sbit;
          -    FT_Bool       is_apple_sbix;
          -    FT_Bool       has_CBLC;
          -    FT_Bool       has_CBDT;
          -    FT_Bool       ignore_typographic_family    = FALSE;
          -    FT_Bool       ignore_typographic_subfamily = FALSE;
          +
          +    FT_Bool  has_outline;
          +    FT_Bool  is_apple_sbit;
          +
          +    FT_Bool  has_CBLC;
          +    FT_Bool  has_CBDT;
          +    FT_Bool  has_EBLC;
          +    FT_Bool  has_bloc;
          +    FT_Bool  has_sbix;
          +
          +    FT_Bool  ignore_typographic_family    = FALSE;
          +    FT_Bool  ignore_typographic_subfamily = FALSE;
          +    FT_Bool  ignore_sbix                  = FALSE;
           
               SFNT_Service  sfnt = (SFNT_Service)face->sfnt;
           
          @@ -813,6 +819,8 @@
                     ignore_typographic_family = TRUE;
                   else if ( params[i].tag == FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY )
                     ignore_typographic_subfamily = TRUE;
          +        else if ( params[i].tag == FT_PARAM_TAG_IGNORE_SBIX )
          +          ignore_sbix = TRUE;
                 }
               }
           
          @@ -848,14 +856,17 @@
                                      tt_face_lookup_table( face, TTAG_CFF2 ) );
           #endif
           
          -    is_apple_sbit = 0;
          -    is_apple_sbix = !face->goto_table( face, TTAG_sbix, stream, 0 );
          +    /* check which sbit formats are present */
          +    has_CBLC = !face->goto_table( face, TTAG_CBLC, stream, 0 );
          +    has_CBDT = !face->goto_table( face, TTAG_CBDT, stream, 0 );
          +    has_EBLC = !face->goto_table( face, TTAG_EBLC, stream, 0 );
          +    has_bloc = !face->goto_table( face, TTAG_bloc, stream, 0 );
          +    has_sbix = !face->goto_table( face, TTAG_sbix, stream, 0 );
           
          -    /* Apple 'sbix' color bitmaps are rendered scaled and then the 'glyf'
          -     * outline rendered on top.  We don't support that yet, so just ignore
          -     * the 'glyf' outline and advertise it as a bitmap-only font. */
          -    if ( is_apple_sbix )
          -      has_outline = FALSE;
          +    is_apple_sbit = FALSE;
          +
          +    if ( ignore_sbix )
          +      has_sbix = FALSE;
           
               /* if this font doesn't contain outlines, we try to load */
               /* a `bhed' table                                        */
          @@ -867,16 +878,13 @@
           
               /* load the font header (`head' table) if this isn't an Apple */
               /* sbit font file                                             */
          -    if ( !is_apple_sbit || is_apple_sbix )
          +    if ( !is_apple_sbit || has_sbix )
               {
                 LOAD_( head );
                 if ( error )
                   goto Exit;
               }
           
          -    has_CBLC = !face->goto_table( face, TTAG_CBLC, stream, 0 );
          -    has_CBDT = !face->goto_table( face, TTAG_CBDT, stream, 0 );
          -
               /* Ignore outlines for CBLC/CBDT fonts. */
               if ( has_CBLC || has_CBDT )
                 has_outline = FALSE;
          @@ -986,7 +994,11 @@
               /* the optional tables */
           
               /* embedded bitmap support */
          -    if ( sfnt->load_eblc )
          +    /* TODO: Replace this clumsy check for all possible sbit tables     */
          +    /*       with something better (for example, by passing a parameter */
          +    /*       to suppress 'sbix' loading).                               */
          +    if ( sfnt->load_eblc                                  &&
          +         ( has_CBLC || has_EBLC || has_bloc || has_sbix ) )
                 LOAD_( eblc );
           
               /* colored glyph support */
          @@ -996,6 +1008,10 @@
                 LOAD_( colr );
               }
           
          +    /* OpenType-SVG glyph support */
          +    if ( sfnt->load_svg )
          +      LOAD_( svg );
          +
               /* consider the pclt, kerning, and gasp tables as optional */
               LOAD_( pclt );
               LOAD_( gasp );
          @@ -1054,7 +1070,14 @@
                   flags |= FT_FACE_FLAG_COLOR;      /* color glyphs */
           
                 if ( has_outline == TRUE )
          -        flags |= FT_FACE_FLAG_SCALABLE;   /* scalable outlines */
          +      {
          +        /* by default (and for backward compatibility) we handle */
          +        /* fonts with an 'sbix' table as bitmap-only             */
          +        if ( has_sbix )
          +          flags |= FT_FACE_FLAG_SBIX;     /* with 'sbix' bitmaps */
          +        else
          +          flags |= FT_FACE_FLAG_SCALABLE; /* scalable outlines */
          +      }
           
                 /* The sfnt driver only supports bitmap fonts natively, thus we */
                 /* don't set FT_FACE_FLAG_HINTER.                               */
          @@ -1277,7 +1300,8 @@
                  *
                  * Set up metrics.
                  */
          -      if ( FT_IS_SCALABLE( root ) )
          +      if ( FT_IS_SCALABLE( root ) ||
          +           FT_HAS_SBIX( root )    )
                 {
                   /* XXX What about if outline header is missing */
                   /*     (e.g. sfnt wrapped bitmap)?             */
          @@ -1416,6 +1440,12 @@
                   sfnt->free_cpal( face );
                   sfnt->free_colr( face );
                 }
          +
          +#ifdef FT_CONFIG_OPTION_SVG
          +      /* free SVG data */
          +      if ( sfnt->free_svg )
          +        sfnt->free_svg( face );
          +#endif
               }
           
           #ifdef TT_CONFIG_OPTION_BDF
          diff --git a/thirdparty/freetype/src/sfnt/sfobjs.h b/thirdparty/freetype/src/sfnt/sfobjs.h
          index 172c47ebb4..1d99bfede4 100644
          --- a/thirdparty/freetype/src/sfnt/sfobjs.h
          +++ b/thirdparty/freetype/src/sfnt/sfobjs.h
          @@ -4,7 +4,7 @@
            *
            *   SFNT object management (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/sfnt/sfwoff.c b/thirdparty/freetype/src/sfnt/sfwoff.c
          index 422c816a21..0e8ec3fa93 100644
          --- a/thirdparty/freetype/src/sfnt/sfwoff.c
          +++ b/thirdparty/freetype/src/sfnt/sfwoff.c
          @@ -4,7 +4,7 @@
            *
            *   WOFF format management (base).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -64,7 +64,6 @@
               FT_FREE( stream->base );
           
               stream->size  = 0;
          -    stream->base  = NULL;
               stream->close = NULL;
             }
           
          diff --git a/thirdparty/freetype/src/sfnt/sfwoff.h b/thirdparty/freetype/src/sfnt/sfwoff.h
          index 3fbdac0fde..5866a16194 100644
          --- a/thirdparty/freetype/src/sfnt/sfwoff.h
          +++ b/thirdparty/freetype/src/sfnt/sfwoff.h
          @@ -4,7 +4,7 @@
            *
            *   WOFFF format management (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/sfnt/sfwoff2.c b/thirdparty/freetype/src/sfnt/sfwoff2.c
          index 5ee8dea28a..4939647654 100644
          --- a/thirdparty/freetype/src/sfnt/sfwoff2.c
          +++ b/thirdparty/freetype/src/sfnt/sfwoff2.c
          @@ -4,7 +4,7 @@
            *
            *   WOFF2 format management (base).
            *
          - * Copyright (C) 2019-2021 by
          + * Copyright (C) 2019-2022 by
            * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -84,6 +84,8 @@
           #define BBOX_STREAM         5
           #define INSTRUCTION_STREAM  6
           
          +#define HAVE_OVERLAP_SIMPLE_BITMAP  0x1
          +
           
             static void
             stream_close( FT_Stream  stream )
          @@ -94,7 +96,6 @@
               FT_FREE( stream->base );
           
               stream->size  = 0;
          -    stream->base  = NULL;
               stream->close = NULL;
             }
           
          @@ -523,6 +524,7 @@
                           const WOFF2_Point  points,
                           FT_UShort          n_contours,
                           FT_UShort          instruction_len,
          +                FT_Bool            have_overlap,
                           FT_Byte*           dst,
                           FT_ULong           dst_size,
                           FT_ULong*          glyph_size )
          @@ -550,6 +552,9 @@
                 FT_Int   dy   = point.y - last_y;
           
           
          +      if ( i == 0 && have_overlap )
          +        flag |= GLYF_OVERLAP_SIMPLE;
          +
                 if ( dx == 0 )
                   flag |= GLYF_THIS_X_IS_SAME;
                 else if ( dx > -256 && dx < 256 )
          @@ -834,15 +839,18 @@
           
               FT_UInt  num_substreams = 7;
           
          +    FT_UShort  option_flags;
               FT_UShort  num_glyphs;
               FT_UShort  index_format;
               FT_ULong   expected_loca_length;
               FT_UInt    offset;
               FT_UInt    i;
               FT_ULong   points_size;
          -    FT_ULong   bitmap_length;
               FT_ULong   glyph_buf_size;
               FT_ULong   bbox_bitmap_offset;
          +    FT_ULong   bbox_bitmap_length;
          +    FT_ULong   overlap_bitmap_offset = 0;
          +    FT_ULong   overlap_bitmap_length = 0;
           
               const FT_ULong  glyf_start  = *out_offset;
               FT_ULong        dest_offset = *out_offset;
          @@ -858,15 +866,17 @@
               if ( FT_NEW_ARRAY( substreams, num_substreams ) )
                 goto Fail;
           
          -    if ( FT_STREAM_SKIP( 4 ) )
          +    if ( FT_STREAM_SKIP( 2 ) )
          +      goto Fail;
          +    if ( FT_READ_USHORT( option_flags ) )
                 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 ));
          +    FT_TRACE4(( "option_flags = %u; num_glyphs = %u; index_format = %u\n",
          +                option_flags, num_glyphs, index_format ));
           
               info->num_glyphs = num_glyphs;
           
          @@ -879,7 +889,7 @@
               if ( info->loca_table->dst_length != expected_loca_length )
                 goto Fail;
           
          -    offset = ( 2 + num_substreams ) * 4;
          +    offset = 2 + 2 + 2 + 2 + ( num_substreams * 4 );
               if ( offset > info->glyf_table->TransformLength )
                 goto Fail;
           
          @@ -902,6 +912,20 @@
                 offset += substream_size;
               }
           
          +    if ( option_flags & HAVE_OVERLAP_SIMPLE_BITMAP )
          +    {
          +      /* Size of overlapBitmap = floor((numGlyphs + 7) / 8) */
          +      overlap_bitmap_length = ( num_glyphs + 7U ) >> 3;
          +      if ( overlap_bitmap_length > info->glyf_table->TransformLength - offset )
          +        goto Fail;
          +
          +      overlap_bitmap_offset = pos + offset;
          +
          +      FT_TRACE5(( "  Overlap bitmap: offset = %lu; size = %lu;\n",
          +                  overlap_bitmap_offset, overlap_bitmap_length ));
          +      offset += overlap_bitmap_length;
          +    }
          +
               if ( FT_NEW_ARRAY( loca_values, num_glyphs + 1 ) )
                 goto Fail;
           
          @@ -909,8 +933,9 @@
               bbox_bitmap_offset = substreams[BBOX_STREAM].offset;
           
               /* Size of bboxBitmap = 4 * floor((numGlyphs + 31) / 32) */
          -    bitmap_length                   = ( ( num_glyphs + 31U ) >> 5 ) << 2;
          -    substreams[BBOX_STREAM].offset += bitmap_length;
          +    bbox_bitmap_length              = ( ( num_glyphs + 31U ) >> 5 ) << 2;
          +    /* bboxStreamSize is the combined size of bboxBitmap and bboxStream. */
          +    substreams[BBOX_STREAM].offset += bbox_bitmap_length;
           
               glyph_buf_size = WOFF2_DEFAULT_GLYPH_BUF;
               if ( FT_NEW_ARRAY( glyph_buf, glyph_buf_size ) )
          @@ -1026,8 +1051,11 @@
                   FT_ULong   flag_size;
                   FT_ULong   triplet_size;
                   FT_ULong   triplet_bytes_used;
          -        FT_Byte*   flags_buf   = NULL;
          -        FT_Byte*   triplet_buf = NULL;
          +        FT_Bool    have_overlap  = FALSE;
          +        FT_Byte    overlap_bitmap;
          +        FT_ULong   overlap_offset;
          +        FT_Byte*   flags_buf     = NULL;
          +        FT_Byte*   triplet_buf   = NULL;
                   FT_UShort  instruction_size;
                   FT_ULong   size_needed;
                   FT_Int     end_point;
          @@ -1036,6 +1064,17 @@
                   FT_Byte*   pointer = NULL;
           
           
          +        /* Set `have_overlap`. */
          +        if ( overlap_bitmap_offset )
          +        {
          +          overlap_offset = overlap_bitmap_offset + ( i >> 3 );
          +          if ( FT_STREAM_SEEK( overlap_offset ) ||
          +               FT_READ_BYTE( overlap_bitmap )   )
          +            goto Fail;
          +          if ( overlap_bitmap & ( 0x80 >> ( i & 7 ) ) )
          +            have_overlap = TRUE;
          +        }
          +
                   if ( FT_NEW_ARRAY( n_points_arr, n_contours ) )
                     goto Fail;
           
          @@ -1156,6 +1195,7 @@
                                      points,
                                      n_contours,
                                      instruction_size,
          +                           have_overlap,
                                      glyph_buf,
                                      glyph_buf_size,
                                      &glyph_size ) )
          @@ -2086,7 +2126,7 @@
               /* Validate requested face index. */
               *num_faces = woff2.num_fonts;
               /* value -(N+1) requests information on index N */
          -    if ( *face_instance_index < 0 )
          +    if ( *face_instance_index < 0 && face_index > 0 )
                 face_index--;
           
               if ( face_index >= woff2.num_fonts )
          diff --git a/thirdparty/freetype/src/sfnt/sfwoff2.h b/thirdparty/freetype/src/sfnt/sfwoff2.h
          index fa78b02429..e84982ed9c 100644
          --- a/thirdparty/freetype/src/sfnt/sfwoff2.h
          +++ b/thirdparty/freetype/src/sfnt/sfwoff2.h
          @@ -4,7 +4,7 @@
            *
            *   WOFFF2 format management (specification).
            *
          - * Copyright (C) 2019-2021 by
          + * Copyright (C) 2019-2022 by
            * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -56,6 +56,7 @@ FT_BEGIN_HEADER
           #define GLYF_REPEAT          1 << 3
           #define GLYF_THIS_X_IS_SAME  1 << 4
           #define GLYF_THIS_Y_IS_SAME  1 << 5
          +#define GLYF_OVERLAP_SIMPLE  1 << 6
           
             /* Other constants */
           #define CONTOUR_OFFSET_END_POINT  10
          diff --git a/thirdparty/freetype/src/sfnt/ttbdf.c b/thirdparty/freetype/src/sfnt/ttbdf.c
          index b8d9473a63..4d2faf2385 100644
          --- a/thirdparty/freetype/src/sfnt/ttbdf.c
          +++ b/thirdparty/freetype/src/sfnt/ttbdf.c
          @@ -4,7 +4,7 @@
            *
            *   TrueType and OpenType embedded BDF properties (body).
            *
          - * Copyright (C) 2005-2021 by
          + * Copyright (C) 2005-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/sfnt/ttbdf.h b/thirdparty/freetype/src/sfnt/ttbdf.h
          index 91271d916f..b7b11c9bec 100644
          --- a/thirdparty/freetype/src/sfnt/ttbdf.h
          +++ b/thirdparty/freetype/src/sfnt/ttbdf.h
          @@ -4,7 +4,7 @@
            *
            *   TrueType and OpenType embedded BDF properties (specification).
            *
          - * Copyright (C) 2005-2021 by
          + * Copyright (C) 2005-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/sfnt/ttcmap.c b/thirdparty/freetype/src/sfnt/ttcmap.c
          index b369d83788..6d099a4877 100644
          --- a/thirdparty/freetype/src/sfnt/ttcmap.c
          +++ b/thirdparty/freetype/src/sfnt/ttcmap.c
          @@ -4,7 +4,7 @@
            *
            *   TrueType character mapping table (cmap) support (body).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/sfnt/ttcmap.h b/thirdparty/freetype/src/sfnt/ttcmap.h
          index 504fc951c4..b10860b345 100644
          --- a/thirdparty/freetype/src/sfnt/ttcmap.h
          +++ b/thirdparty/freetype/src/sfnt/ttcmap.h
          @@ -4,7 +4,7 @@
            *
            *   TrueType character mapping table (cmap) support (specification).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/sfnt/ttcmapc.h b/thirdparty/freetype/src/sfnt/ttcmapc.h
          index 4e6cd46ba8..6822a9cd6b 100644
          --- a/thirdparty/freetype/src/sfnt/ttcmapc.h
          +++ b/thirdparty/freetype/src/sfnt/ttcmapc.h
          @@ -4,7 +4,7 @@
            *
            *   TT CMAP classes definitions (specification only).
            *
          - * Copyright (C) 2009-2021 by
          + * Copyright (C) 2009-2022 by
            * Oran Agra and Mickey Gabel.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/sfnt/ttcolr.c b/thirdparty/freetype/src/sfnt/ttcolr.c
          index 8f5cc8bcd1..d54231fd64 100644
          --- a/thirdparty/freetype/src/sfnt/ttcolr.c
          +++ b/thirdparty/freetype/src/sfnt/ttcolr.c
          @@ -4,7 +4,7 @@
            *
            *   TrueType and OpenType colored glyph layer support (body).
            *
          - * Copyright (C) 2018-2021 by
          + * Copyright (C) 2018-2022 by
            * David Turner, Robert Wilhelm, Dominik Röttsches, and Werner Lemberg.
            *
            * Originally written by Shao Yu Zhang .
          @@ -522,19 +522,29 @@
           
               else if ( apaint->format == FT_COLR_PAINTFORMAT_RADIAL_GRADIENT )
               {
          +      FT_Pos  tmp;
          +
          +
                 if ( !read_color_line( child_table_p,
                                        &apaint->u.radial_gradient.colorline ) )
                   return 0;
           
          +      /* In the OpenType specification, `r0` and `r1` are defined as   */
          +      /* `UFWORD`.  Since FreeType doesn't have a corresponding 16.16  */
          +      /* format we convert to `FWORD` and replace negative values with */
          +      /* (32bit) `FT_INT_MAX`.                                         */
          +
                 apaint->u.radial_gradient.c0.x = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
                 apaint->u.radial_gradient.c0.y = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
           
          -      apaint->u.radial_gradient.r0 = FT_NEXT_USHORT( p ) << 16;
          +      tmp                          = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
          +      apaint->u.radial_gradient.r0 = tmp < 0 ? FT_INT_MAX : tmp;
           
                 apaint->u.radial_gradient.c1.x = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
                 apaint->u.radial_gradient.c1.y = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
           
          -      apaint->u.radial_gradient.r1 = FT_NEXT_USHORT( p ) << 16;
          +      tmp                          = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
          +      apaint->u.radial_gradient.r1 = tmp < 0 ? FT_INT_MAX : tmp;
           
                 return 1;
               }
          @@ -824,7 +834,7 @@
             {
               Colr*  colr;
           
          -    FT_Byte  *p, *p1, *clip_base;
          +    FT_Byte  *p, *p1, *clip_base, *limit;
           
               FT_Byte    clip_list_format;
               FT_ULong   num_clip_boxes, i;
          @@ -847,16 +857,32 @@
           
               p = colr->clip_list;
           
          +    /* Limit points to the first byte after the end of the color table.    */
          +    /* Thus, in subsequent limit checks below we need to check whether the */
          +    /* read pointer is strictly greater than a position offset by certain  */
          +    /* field sizes to the left of that position.                           */
          +    limit = (FT_Byte*)colr->table + colr->table_size;
          +
          +    /* Check whether we can extract one `uint8` and one `uint32`. */
          +    if ( p > limit - ( 1 + 4 ) )
          +      return 0;
          +
               clip_base        = p;
               clip_list_format = FT_NEXT_BYTE ( p );
           
               /* Format byte used here to be able to upgrade ClipList for >16bit */
          -    /* glyph ids; for now we can expect it to be 0. */
          +    /* glyph ids; for now we can expect it to be 0.                    */
               if ( !( clip_list_format == 1 ) )
                 return 0;
           
               num_clip_boxes = FT_NEXT_ULONG( p );
           
          +    /* Check whether we can extract two `uint16` and one `Offset24`, */
          +    /* `num_clip_boxes` times.                                       */
          +    if ( colr->table_size / ( 2 + 2 + 3 ) < num_clip_boxes ||
          +         p > limit - ( 2 + 2 + 3 ) * num_clip_boxes        )
          +      return 0;
          +
               for ( i = 0; i < num_clip_boxes; ++i )
               {
                 gid_start       = FT_NEXT_USHORT( p );
          @@ -867,7 +893,8 @@
                 {
                   p1 = (FT_Byte*)( clip_base + clip_box_offset );
           
          -        if ( p1 >= ( (FT_Byte*)colr->table + colr->table_size ) )
          +        /* Check whether we can extract one `uint8`. */
          +        if ( p1 > limit - 1 )
                     return 0;
           
                   format = FT_NEXT_BYTE( p1 );
          @@ -875,6 +902,10 @@
                   if ( format > 1 )
                     return 0;
           
          +        /* Check whether we can extract four `FWORD`. */
          +        if ( p1 > limit - ( 2 + 2 + 2 + 2 ) )
          +          return 0;
          +
                   /* `face->root.size->metrics.x_scale` and `y_scale` are factors   */
                   /* that scale a font unit value in integers to a 26.6 fixed value */
                   /* according to the requested size, see for example               */
          diff --git a/thirdparty/freetype/src/sfnt/ttcolr.h b/thirdparty/freetype/src/sfnt/ttcolr.h
          index b81e4cb958..4200cb2976 100644
          --- a/thirdparty/freetype/src/sfnt/ttcolr.h
          +++ b/thirdparty/freetype/src/sfnt/ttcolr.h
          @@ -4,7 +4,7 @@
            *
            *   TrueType and OpenType colored glyph layer support (specification).
            *
          - * Copyright (C) 2018-2021 by
          + * Copyright (C) 2018-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * Originally written by Shao Yu Zhang .
          diff --git a/thirdparty/freetype/src/sfnt/ttcpal.c b/thirdparty/freetype/src/sfnt/ttcpal.c
          index a0d84bca3a..9ae535cbda 100644
          --- a/thirdparty/freetype/src/sfnt/ttcpal.c
          +++ b/thirdparty/freetype/src/sfnt/ttcpal.c
          @@ -4,7 +4,7 @@
            *
            *   TrueType and OpenType color palette support (body).
            *
          - * Copyright (C) 2018-2021 by
          + * Copyright (C) 2018-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * Originally written by Shao Yu Zhang .
          diff --git a/thirdparty/freetype/src/sfnt/ttcpal.h b/thirdparty/freetype/src/sfnt/ttcpal.h
          index 1c5586855b..4717d224fc 100644
          --- a/thirdparty/freetype/src/sfnt/ttcpal.h
          +++ b/thirdparty/freetype/src/sfnt/ttcpal.h
          @@ -4,7 +4,7 @@
            *
            *   TrueType and OpenType color palette support (specification).
            *
          - * Copyright (C) 2018-2021 by
          + * Copyright (C) 2018-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * Originally written by Shao Yu Zhang .
          diff --git a/thirdparty/freetype/src/sfnt/ttkern.c b/thirdparty/freetype/src/sfnt/ttkern.c
          index bb1922caf9..ca1c509406 100644
          --- a/thirdparty/freetype/src/sfnt/ttkern.c
          +++ b/thirdparty/freetype/src/sfnt/ttkern.c
          @@ -5,7 +5,7 @@
            *   Load the basic TrueType kerning table.  This doesn't handle
            *   kerning data within the GPOS table at the moment.
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -94,7 +94,7 @@
           
                 p_next = p;
           
          -      p += 2; /* skip version */
          +      p       += 2; /* skip version */
                 length   = FT_NEXT_USHORT( p );
                 coverage = FT_NEXT_USHORT( p );
           
          @@ -144,7 +144,7 @@
           
           
                     cur_pair = FT_NEXT_ULONG( p );
          -          if ( cur_pair <= old_pair )
          +          if ( cur_pair < old_pair )
                       break;
           
                     p += 2;
          @@ -187,11 +187,18 @@
                                  FT_UInt  left_glyph,
                                  FT_UInt  right_glyph )
             {
          -    FT_Int    result = 0;
          -    FT_UInt   count, mask;
          -    FT_Byte*  p       = face->kern_table;
          -    FT_Byte*  p_limit = p + face->kern_table_size;
          +    FT_Int   result = 0;
          +    FT_UInt  count, mask;
           
          +    FT_Byte*  p;
          +    FT_Byte*  p_limit;
          +
          +
          +    if ( !face->kern_table )
          +      return result;
          +
          +    p       = face->kern_table;
          +    p_limit = p + face->kern_table_size;
           
               p   += 4;
               mask = 0x0001;
          diff --git a/thirdparty/freetype/src/sfnt/ttkern.h b/thirdparty/freetype/src/sfnt/ttkern.h
          index 3d8f1e8347..f063558313 100644
          --- a/thirdparty/freetype/src/sfnt/ttkern.h
          +++ b/thirdparty/freetype/src/sfnt/ttkern.h
          @@ -5,7 +5,7 @@
            *   Load the basic TrueType kerning table.  This doesn't handle
            *   kerning data within the GPOS table at the moment.
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/sfnt/ttload.c b/thirdparty/freetype/src/sfnt/ttload.c
          index 51416d80b4..c83bd197fe 100644
          --- a/thirdparty/freetype/src/sfnt/ttload.c
          +++ b/thirdparty/freetype/src/sfnt/ttload.c
          @@ -5,7 +5,7 @@
            *   Load the basic TrueType tables, i.e., tables that can be either in
            *   TTF or OTF fonts (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -205,7 +205,6 @@
           
                 if ( FT_STREAM_READ_FIELDS( table_dir_entry_fields, &table ) )
                 {
          -        nn--;
                   FT_TRACE2(( "check_table_dir:"
                               " can read only %d table%s in font (instead of %d)\n",
                               nn, nn == 1 ? "" : "s", sfnt->num_tables ));
          diff --git a/thirdparty/freetype/src/sfnt/ttload.h b/thirdparty/freetype/src/sfnt/ttload.h
          index cab15cd238..5368971c31 100644
          --- a/thirdparty/freetype/src/sfnt/ttload.h
          +++ b/thirdparty/freetype/src/sfnt/ttload.h
          @@ -5,7 +5,7 @@
            *   Load the basic TrueType tables, i.e., tables that can be either in
            *   TTF or OTF fonts (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/sfnt/ttmtx.c b/thirdparty/freetype/src/sfnt/ttmtx.c
          index 7aece36fb0..88377327c6 100644
          --- a/thirdparty/freetype/src/sfnt/ttmtx.c
          +++ b/thirdparty/freetype/src/sfnt/ttmtx.c
          @@ -4,7 +4,7 @@
            *
            *   Load the metrics tables common to TTF and OTF fonts (body).
            *
          - * Copyright (C) 2006-2021 by
          + * Copyright (C) 2006-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/sfnt/ttmtx.h b/thirdparty/freetype/src/sfnt/ttmtx.h
          index 270170d478..1e45b949a5 100644
          --- a/thirdparty/freetype/src/sfnt/ttmtx.h
          +++ b/thirdparty/freetype/src/sfnt/ttmtx.h
          @@ -4,7 +4,7 @@
            *
            *   Load the metrics tables common to TTF and OTF fonts (specification).
            *
          - * Copyright (C) 2006-2021 by
          + * Copyright (C) 2006-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/sfnt/ttpost.c b/thirdparty/freetype/src/sfnt/ttpost.c
          index b92ca5db14..1a885a15c5 100644
          --- a/thirdparty/freetype/src/sfnt/ttpost.c
          +++ b/thirdparty/freetype/src/sfnt/ttpost.c
          @@ -5,7 +5,7 @@
            *   PostScript name table processing for TrueType and OpenType fonts
            *   (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/sfnt/ttpost.h b/thirdparty/freetype/src/sfnt/ttpost.h
          index 6d65b5766c..bf9342a9f5 100644
          --- a/thirdparty/freetype/src/sfnt/ttpost.h
          +++ b/thirdparty/freetype/src/sfnt/ttpost.h
          @@ -5,7 +5,7 @@
            *   PostScript name table processing for TrueType and OpenType fonts
            *   (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/sfnt/ttsbit.c b/thirdparty/freetype/src/sfnt/ttsbit.c
          index e9ba697dba..bf73d04e54 100644
          --- a/thirdparty/freetype/src/sfnt/ttsbit.c
          +++ b/thirdparty/freetype/src/sfnt/ttsbit.c
          @@ -4,7 +4,7 @@
            *
            *   TrueType and OpenType embedded bitmap support (body).
            *
          - * Copyright (C) 2005-2021 by
          + * Copyright (C) 2005-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * Copyright 2013 by Google, Inc.
          @@ -172,17 +172,8 @@
                     goto Exit;
                   }
           
          -#ifdef FT_DEBUG_LEVEL_TRACE
          -        /* we currently don't support bit 1; however, it is better to */
          -        /* draw at least something...                                 */
                   if ( flags == 3 )
          -        {
          -          FT_TRACE1(( "tt_face_load_sbit_strikes:"
          -                      " sbix overlay not supported yet\n" ));
          -          FT_TRACE1(( "                          "
          -                      " expect bad rendering results\n" ));
          -        }
          -#endif
          +          face->root.face_flags |= FT_FACE_FLAG_SBIX_OVERLAY;
           
                   /*
                    * Count the number of strikes available in the table.  We are a bit
          @@ -730,6 +721,9 @@
               pitch      = bitmap->pitch;
               line       = bitmap->buffer;
           
          +    if ( !line )
          +      goto Exit;
          +
               width  = decoder->metrics->width;
               height = decoder->metrics->height;
           
          @@ -1577,17 +1571,34 @@
           
               if ( !error )
               {
          -      FT_Short   abearing;
          +      FT_Short   abearing; /* not used here */
                 FT_UShort  aadvance;
           
           
                 tt_face_get_metrics( face, FALSE, glyph_index, &abearing, &aadvance );
           
                 metrics->horiBearingX = (FT_Short)originOffsetX;
          -      metrics->horiBearingY = (FT_Short)( -originOffsetY + metrics->height );
          +      metrics->vertBearingX = (FT_Short)originOffsetX;
          +
          +      metrics->horiBearingY = (FT_Short)( originOffsetY + metrics->height );
          +      metrics->vertBearingY = (FT_Short)originOffsetY;
          +
                 metrics->horiAdvance  = (FT_UShort)( aadvance *
                                                      face->root.size->metrics.x_ppem /
                                                      face->header.Units_Per_EM );
          +
          +      if ( face->vertical_info )
          +        tt_face_get_metrics( face, TRUE, glyph_index, &abearing, &aadvance );
          +      else if ( face->os2.version != 0xFFFFU )
          +        aadvance = (FT_UShort)FT_ABS( face->os2.sTypoAscender -
          +                                      face->os2.sTypoDescender );
          +      else
          +        aadvance = (FT_UShort)FT_ABS( face->horizontal.Ascender -
          +                                      face->horizontal.Descender );
          +
          +      metrics->vertAdvance  = (FT_UShort)( aadvance *
          +                                           face->root.size->metrics.x_ppem /
          +                                           face->header.Units_Per_EM );
               }
           
               return error;
          diff --git a/thirdparty/freetype/src/sfnt/ttsbit.h b/thirdparty/freetype/src/sfnt/ttsbit.h
          index 7a0ed92e92..c967bffba3 100644
          --- a/thirdparty/freetype/src/sfnt/ttsbit.h
          +++ b/thirdparty/freetype/src/sfnt/ttsbit.h
          @@ -4,7 +4,7 @@
            *
            *   TrueType and OpenType embedded bitmap support (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/sfnt/ttsvg.c b/thirdparty/freetype/src/sfnt/ttsvg.c
          new file mode 100644
          index 0000000000..69277da577
          --- /dev/null
          +++ b/thirdparty/freetype/src/sfnt/ttsvg.c
          @@ -0,0 +1,403 @@
          +/****************************************************************************
          + *
          + * ttsvg.c
          + *
          + *   OpenType SVG Color (specification).
          + *
          + * Copyright (C) 2022 by
          + * David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti.
          + *
          + * This file is part of the FreeType project, and may only be used,
          + * modified, and distributed under the terms of the FreeType project
          + * license, LICENSE.TXT.  By continuing to use, modify, or distribute
          + * this file you indicate that you have read the license and
          + * understand and accept it fully.
          + *
          + */
          +
          +
          +  /**************************************************************************
          +   *
          +   * 'SVG' table specification:
          +   *
          +   *    https://docs.microsoft.com/en-us/typography/opentype/spec/svg
          +   *
          +   */
          +
          +#include 
          +#include 
          +#include 
          +#include 
          +#include 
          +#include 
          +#include 
          +
          +
          +#ifdef FT_CONFIG_OPTION_SVG
          +
          +#include "ttsvg.h"
          +
          +
          +  /* NOTE: These table sizes are given by the specification. */
          +#define SVG_TABLE_HEADER_SIZE           (10U)
          +#define SVG_DOCUMENT_RECORD_SIZE        (12U)
          +#define SVG_DOCUMENT_LIST_MINIMUM_SIZE  (2U + SVG_DOCUMENT_RECORD_SIZE)
          +#define SVG_MINIMUM_SIZE                (SVG_TABLE_HEADER_SIZE +        \
          +                                         SVG_DOCUMENT_LIST_MINIMUM_SIZE)
          +
          +
          +  typedef struct  Svg_
          +  {
          +    FT_UShort  version;                 /* table version (starting at 0)  */
          +    FT_UShort  num_entries;             /* number of SVG document records */
          +
          +    FT_Byte*  svg_doc_list;  /* pointer to the start of SVG Document List */
          +
          +    void*     table;                          /* memory that backs up SVG */
          +    FT_ULong  table_size;
          +
          +  } Svg;
          +
          +
          +  /**************************************************************************
          +   *
          +   * The macro FT_COMPONENT is used in trace mode.  It is an implicit
          +   * parameter of the FT_TRACE() and FT_ERROR() macros, usued to print/log
          +   * messages during execution.
          +   */
          +#undef  FT_COMPONENT
          +#define FT_COMPONENT  ttsvg
          +
          +
          +  FT_LOCAL_DEF( FT_Error )
          +  tt_face_load_svg( TT_Face    face,
          +                    FT_Stream  stream )
          +  {
          +    FT_Error   error;
          +    FT_Memory  memory = face->root.memory;
          +
          +    FT_ULong  table_size;
          +    FT_Byte*  table = NULL;
          +    FT_Byte*  p     = NULL;
          +    Svg*      svg   = NULL;
          +    FT_ULong  offsetToSVGDocumentList;
          +
          +
          +    error = face->goto_table( face, TTAG_SVG, stream, &table_size );
          +    if ( error )
          +      goto NoSVG;
          +
          +    if ( table_size < SVG_MINIMUM_SIZE )
          +      goto InvalidTable;
          +
          +    if ( FT_FRAME_EXTRACT( table_size, table ) )
          +      goto NoSVG;
          +
          +    /* Allocate memory for the SVG object */
          +    if ( FT_NEW( svg ) )
          +      goto NoSVG;
          +
          +    p                       = table;
          +    svg->version            = FT_NEXT_USHORT( p );
          +    offsetToSVGDocumentList = FT_NEXT_ULONG( p );
          +
          +    if ( offsetToSVGDocumentList < SVG_TABLE_HEADER_SIZE            ||
          +         offsetToSVGDocumentList > table_size -
          +                                     SVG_DOCUMENT_LIST_MINIMUM_SIZE )
          +      goto InvalidTable;
          +
          +    svg->svg_doc_list = (FT_Byte*)( table + offsetToSVGDocumentList );
          +
          +    p                = svg->svg_doc_list;
          +    svg->num_entries = FT_NEXT_USHORT( p );
          +
          +    FT_TRACE3(( "version: %d\n", svg->version ));
          +    FT_TRACE3(( "number of entries: %d\n", svg->num_entries ));
          +
          +    if ( offsetToSVGDocumentList +
          +           svg->num_entries * SVG_DOCUMENT_RECORD_SIZE > table_size )
          +      goto InvalidTable;
          +
          +    svg->table      = table;
          +    svg->table_size = table_size;
          +
          +    face->svg              = svg;
          +    face->root.face_flags |= FT_FACE_FLAG_SVG;
          +
          +    return FT_Err_Ok;
          +
          +  InvalidTable:
          +    error = FT_THROW( Invalid_Table );
          +
          +  NoSVG:
          +    FT_FRAME_RELEASE( table );
          +    FT_FREE( svg );
          +    face->svg = NULL;
          +
          +    return error;
          +  }
          +
          +
          +  FT_LOCAL_DEF( void )
          +  tt_face_free_svg( TT_Face  face )
          +  {
          +    FT_Memory  memory = face->root.memory;
          +    FT_Stream  stream = face->root.stream;
          +
          +    Svg*  svg = (Svg*)face->svg;
          +
          +
          +    if ( svg )
          +    {
          +      FT_FRAME_RELEASE( svg->table );
          +      FT_FREE( svg );
          +    }
          +  }
          +
          +
          +  typedef struct  Svg_doc_
          +  {
          +    FT_UShort  start_glyph_id;
          +    FT_UShort  end_glyph_id;
          +
          +    FT_ULong  offset;
          +    FT_ULong  length;
          +
          +  } Svg_doc;
          +
          +
          +  static Svg_doc
          +  extract_svg_doc( FT_Byte*  stream )
          +  {
          +    Svg_doc  doc;
          +
          +
          +    doc.start_glyph_id = FT_NEXT_USHORT( stream );
          +    doc.end_glyph_id   = FT_NEXT_USHORT( stream );
          +
          +    doc.offset = FT_NEXT_ULONG( stream );
          +    doc.length = FT_NEXT_ULONG( stream );
          +
          +    return doc;
          +  }
          +
          +
          +  static FT_Int
          +  compare_svg_doc( Svg_doc  doc,
          +                   FT_UInt  glyph_index )
          +  {
          +    if ( glyph_index < doc.start_glyph_id )
          +      return -1;
          +    else if ( glyph_index > doc.end_glyph_id )
          +      return 1;
          +    else
          +      return 0;
          +  }
          +
          +
          +  static FT_Error
          +  find_doc( FT_Byte*    stream,
          +            FT_UShort   num_entries,
          +            FT_UInt     glyph_index,
          +            FT_ULong   *doc_offset,
          +            FT_ULong   *doc_length,
          +            FT_UShort  *start_glyph,
          +            FT_UShort  *end_glyph )
          +  {
          +    FT_Error  error;
          +
          +    Svg_doc  start_doc;
          +    Svg_doc  mid_doc;
          +    Svg_doc  end_doc;
          +
          +    FT_Bool  found = FALSE;
          +    FT_UInt  i     = 0;
          +
          +    FT_UInt  start_index = 0;
          +    FT_UInt  end_index   = num_entries - 1;
          +    FT_Int   comp_res;
          +
          +
          +    /* search algorithm */
          +    if ( num_entries == 0 )
          +    {
          +      error = FT_THROW( Invalid_Table );
          +      return error;
          +    }
          +
          +    start_doc = extract_svg_doc( stream + start_index * 12 );
          +    end_doc   = extract_svg_doc( stream + end_index * 12 );
          +
          +    if ( ( compare_svg_doc( start_doc, glyph_index ) == -1 ) ||
          +         ( compare_svg_doc( end_doc, glyph_index ) == 1 )    )
          +    {
          +      error = FT_THROW( Invalid_Glyph_Index );
          +      return error;
          +    }
          +
          +    while ( start_index <= end_index )
          +    {
          +      i        = ( start_index + end_index ) / 2;
          +      mid_doc  = extract_svg_doc( stream + i * 12 );
          +      comp_res = compare_svg_doc( mid_doc, glyph_index );
          +
          +      if ( comp_res == 1 )
          +      {
          +        start_index = i + 1;
          +        start_doc   = extract_svg_doc( stream + start_index * 4 );
          +      }
          +      else if ( comp_res == -1 )
          +      {
          +        end_index = i - 1;
          +        end_doc   = extract_svg_doc( stream + end_index * 4 );
          +      }
          +      else
          +      {
          +        found = TRUE;
          +        break;
          +      }
          +    }
          +    /* search algorithm end */
          +
          +    if ( found != TRUE )
          +    {
          +      FT_TRACE5(( "SVG glyph not found\n" ));
          +      error = FT_THROW( Invalid_Glyph_Index );
          +    }
          +    else
          +    {
          +      *doc_offset = mid_doc.offset;
          +      *doc_length = mid_doc.length;
          +
          +      *start_glyph = mid_doc.start_glyph_id;
          +      *end_glyph   = mid_doc.end_glyph_id;
          +
          +      error = FT_Err_Ok;
          +    }
          +
          +    return error;
          +  }
          +
          +
          +  FT_LOCAL_DEF( FT_Error )
          +  tt_face_load_svg_doc( FT_GlyphSlot  glyph,
          +                        FT_UInt       glyph_index )
          +  {
          +    FT_Byte*   doc_list;        /* pointer to the SVG doc list         */
          +    FT_UShort  num_entries;     /* total number of entries in doc list */
          +    FT_ULong   doc_offset;
          +    FT_ULong   doc_length;
          +
          +    FT_UShort  start_glyph_id;
          +    FT_UShort  end_glyph_id;
          +
          +    FT_Error   error  = FT_Err_Ok;
          +    TT_Face    face   = (TT_Face)glyph->face;
          +    FT_Memory  memory = face->root.memory;
          +    Svg*       svg    = (Svg*)face->svg;
          +
          +    FT_SVG_Document  svg_document = (FT_SVG_Document)glyph->other;
          +
          +
          +    FT_ASSERT( !( svg == NULL ) );
          +
          +    doc_list    = svg->svg_doc_list;
          +    num_entries = FT_NEXT_USHORT( doc_list );
          +
          +    error = find_doc( doc_list, num_entries, glyph_index,
          +                                &doc_offset, &doc_length,
          +                                &start_glyph_id, &end_glyph_id );
          +    if ( error != FT_Err_Ok )
          +      goto Exit;
          +
          +    doc_list = svg->svg_doc_list;      /* reset, so we can use it again */
          +    doc_list = (FT_Byte*)( doc_list + doc_offset );
          +
          +    if ( ( doc_list[0] == 0x1F ) && ( doc_list[1] == 0x8B )
          +                                 && ( doc_list[2] == 0x08 ) )
          +    {
          +#ifdef FT_CONFIG_OPTION_USE_ZLIB
          +
          +      FT_ULong  uncomp_size;
          +      FT_Byte*  uncomp_buffer = NULL;
          +
          +
          +      /*
          +       * Get the size of the original document.  This helps in allotting the
          +       * buffer to accommodate the uncompressed version.  The last 4 bytes
          +       * of the compressed document are equal to the original size modulo
          +       * 2^32.  Since the size of SVG documents is less than 2^32 bytes we
          +       * can use this accurately.  The four bytes are stored in
          +       * little-endian format.
          +       */
          +      FT_TRACE4(( "SVG document is GZIP compressed\n" ));
          +      uncomp_size = (FT_ULong)doc_list[doc_length - 1] << 24 |
          +                    (FT_ULong)doc_list[doc_length - 2] << 16 |
          +                    (FT_ULong)doc_list[doc_length - 3] << 8  |
          +                    (FT_ULong)doc_list[doc_length - 4];
          +
          +      if ( FT_QALLOC( uncomp_buffer, uncomp_size ) )
          +        goto Exit;
          +
          +      error = FT_Gzip_Uncompress( memory,
          +                                  uncomp_buffer,
          +                                  &uncomp_size,
          +                                  doc_list,
          +                                  doc_length );
          +      if ( error )
          +      {
          +        FT_FREE( uncomp_buffer );
          +        error = FT_THROW( Invalid_Table );
          +        goto Exit;
          +      }
          +
          +      glyph->internal->flags |= FT_GLYPH_OWN_GZIP_SVG;
          +
          +      doc_list   = uncomp_buffer;
          +      doc_length = uncomp_size;
          +
          +#else /* !FT_CONFIG_OPTION_USE_ZLIB */
          +
          +      error = FT_THROW( Unimplemented_Feature );
          +      goto Exit;
          +
          +#endif /* !FT_CONFIG_OPTION_USE_ZLIB */
          +    }
          +
          +    svg_document->svg_document        = doc_list;
          +    svg_document->svg_document_length = doc_length;
          +
          +    svg_document->metrics      = glyph->face->size->metrics;
          +    svg_document->units_per_EM = glyph->face->units_per_EM;
          +
          +    svg_document->start_glyph_id = start_glyph_id;
          +    svg_document->end_glyph_id   = end_glyph_id;
          +
          +    svg_document->transform.xx = 0x10000;
          +    svg_document->transform.xy = 0;
          +    svg_document->transform.yx = 0;
          +    svg_document->transform.yy = 0x10000;
          +
          +    svg_document->delta.x = 0;
          +    svg_document->delta.y = 0;
          +
          +    FT_TRACE5(( "start_glyph_id: %d\n", start_glyph_id ));
          +    FT_TRACE5(( "end_glyph_id:   %d\n", end_glyph_id ));
          +    FT_TRACE5(( "svg_document:\n" ));
          +    FT_TRACE5(( " %.*s\n", (FT_UInt)doc_length, doc_list ));
          +
          +    glyph->other = svg_document;
          +
          +  Exit:
          +    return error;
          +  }
          +
          +#else /* !FT_CONFIG_OPTION_SVG */
          +
          +  /* ANSI C doesn't like empty source files */
          +  typedef int  _tt_svg_dummy;
          +
          +#endif /* !FT_CONFIG_OPTION_SVG */
          +
          +
          +/* END */
          diff --git a/thirdparty/freetype/src/sfnt/ttsvg.h b/thirdparty/freetype/src/sfnt/ttsvg.h
          new file mode 100644
          index 0000000000..7c234fd524
          --- /dev/null
          +++ b/thirdparty/freetype/src/sfnt/ttsvg.h
          @@ -0,0 +1,43 @@
          +/****************************************************************************
          + *
          + * ttsvg.h
          + *
          + *   OpenType SVG Color (specification).
          + *
          + * Copyright (C) 2022 by
          + * David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti.
          + *
          + * This file is part of the FreeType project, and may only be used,
          + * modified, and distributed under the terms of the FreeType project
          + * license, LICENSE.TXT.  By continuing to use, modify, or distribute
          + * this file you indicate that you have read the license and
          + * understand and accept it fully.
          + *
          + */
          +
          +#ifndef TTSVG_H_
          +#define TTSVG_H_
          +
          +#include 
          +#include 
          +
          +
          +FT_BEGIN_HEADER
          +
          +  FT_LOCAL( FT_Error )
          +  tt_face_load_svg( TT_Face    face,
          +                    FT_Stream  stream );
          +
          +  FT_LOCAL( void )
          +  tt_face_free_svg( TT_Face  face );
          +
          +  FT_LOCAL( FT_Error )
          +  tt_face_load_svg_doc( FT_GlyphSlot  glyph,
          +                        FT_UInt       glyph_index );
          +
          +FT_END_HEADER
          +
          +#endif /* TTSVG_H_ */
          +
          +
          +/* END */
          diff --git a/thirdparty/freetype/src/sfnt/woff2tags.c b/thirdparty/freetype/src/sfnt/woff2tags.c
          index fe8f5cf76f..7d79fef39a 100644
          --- a/thirdparty/freetype/src/sfnt/woff2tags.c
          +++ b/thirdparty/freetype/src/sfnt/woff2tags.c
          @@ -4,7 +4,7 @@
            *
            *   WOFF2 Font table tags (base).
            *
          - * Copyright (C) 2019-2021 by
          + * Copyright (C) 2019-2022 by
            * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/sfnt/woff2tags.h b/thirdparty/freetype/src/sfnt/woff2tags.h
          index 4ef0a651c3..05df85aba0 100644
          --- a/thirdparty/freetype/src/sfnt/woff2tags.h
          +++ b/thirdparty/freetype/src/sfnt/woff2tags.h
          @@ -4,7 +4,7 @@
            *
            *   WOFF2 Font table tags (specification).
            *
          - * Copyright (C) 2019-2021 by
          + * Copyright (C) 2019-2022 by
            * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/smooth/ftgrays.c b/thirdparty/freetype/src/smooth/ftgrays.c
          index d982c2820b..622035aa79 100644
          --- a/thirdparty/freetype/src/smooth/ftgrays.c
          +++ b/thirdparty/freetype/src/smooth/ftgrays.c
          @@ -4,7 +4,7 @@
            *
            *   A new `perfect' anti-aliasing renderer (body).
            *
          - * Copyright (C) 2000-2021 by
          + * Copyright (C) 2000-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -333,7 +333,9 @@ typedef ptrdiff_t  FT_PtrDist;
           #define PIXEL_BITS  8
           
           #define ONE_PIXEL       ( 1 << PIXEL_BITS )
          +#undef TRUNC
           #define TRUNC( x )      (TCoord)( (x) >> PIXEL_BITS )
          +#undef FRACT
           #define FRACT( x )      (TCoord)( (x) & ( ONE_PIXEL - 1 ) )
           
           #if PIXEL_BITS >= 6
          diff --git a/thirdparty/freetype/src/smooth/ftgrays.h b/thirdparty/freetype/src/smooth/ftgrays.h
          index 3dad0498dc..13bf2baaa2 100644
          --- a/thirdparty/freetype/src/smooth/ftgrays.h
          +++ b/thirdparty/freetype/src/smooth/ftgrays.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType smooth renderer declaration
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/smooth/ftsmerrs.h b/thirdparty/freetype/src/smooth/ftsmerrs.h
          index dc2c40cc9f..7bc6077988 100644
          --- a/thirdparty/freetype/src/smooth/ftsmerrs.h
          +++ b/thirdparty/freetype/src/smooth/ftsmerrs.h
          @@ -4,7 +4,7 @@
            *
            *   smooth renderer error codes (specification only).
            *
          - * Copyright (C) 2001-2021 by
          + * Copyright (C) 2001-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/smooth/ftsmooth.c b/thirdparty/freetype/src/smooth/ftsmooth.c
          index bea3b4a800..df227c3758 100644
          --- a/thirdparty/freetype/src/smooth/ftsmooth.c
          +++ b/thirdparty/freetype/src/smooth/ftsmooth.c
          @@ -4,7 +4,7 @@
            *
            *   Anti-aliasing renderer interface (body).
            *
          - * Copyright (C) 2000-2021 by
          + * Copyright (C) 2000-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/smooth/ftsmooth.h b/thirdparty/freetype/src/smooth/ftsmooth.h
          index 2dd81e84b8..87f09faea4 100644
          --- a/thirdparty/freetype/src/smooth/ftsmooth.h
          +++ b/thirdparty/freetype/src/smooth/ftsmooth.h
          @@ -4,7 +4,7 @@
            *
            *   Anti-aliasing renderer interface (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/smooth/module.mk b/thirdparty/freetype/src/smooth/module.mk
          index ec6537f177..7623551327 100644
          --- a/thirdparty/freetype/src/smooth/module.mk
          +++ b/thirdparty/freetype/src/smooth/module.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/smooth/rules.mk b/thirdparty/freetype/src/smooth/rules.mk
          index de701d91ea..d5109313f9 100644
          --- a/thirdparty/freetype/src/smooth/rules.mk
          +++ b/thirdparty/freetype/src/smooth/rules.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/smooth/smooth.c b/thirdparty/freetype/src/smooth/smooth.c
          index 9e25440635..f341e8f252 100644
          --- a/thirdparty/freetype/src/smooth/smooth.c
          +++ b/thirdparty/freetype/src/smooth/smooth.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType anti-aliasing rasterer module component (body only).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/svg/ftsvg.c b/thirdparty/freetype/src/svg/ftsvg.c
          new file mode 100644
          index 0000000000..55c50718f3
          --- /dev/null
          +++ b/thirdparty/freetype/src/svg/ftsvg.c
          @@ -0,0 +1,350 @@
          +/****************************************************************************
          + *
          + * ftsvg.c
          + *
          + *   The FreeType SVG renderer interface (body).
          + *
          + * Copyright (C) 2022 by
          + * David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti.
          + *
          + * This file is part of the FreeType project, and may only be used,
          + * modified, and distributed under the terms of the FreeType project
          + * license, LICENSE.TXT.  By continuing to use, modify, or distribute
          + * this file you indicate that you have read the license and
          + * understand and accept it fully.
          + *
          + */
          +
          +#include 
          +#include 
          +#include 
          +#include 
          +#include 
          +#include 
          +
          +#include "ftsvg.h"
          +#include "svgtypes.h"
          +
          +
          +  /**************************************************************************
          +   *
          +   * The macro FT_COMPONENT is used in trace mode.  It is an implicit
          +   * parameter of the FT_TRACE() and FT_ERROR() macros, usued to print/log
          +   * messages during execution.
          +   */
          +#undef  FT_COMPONENT
          +#define FT_COMPONENT  otsvg
          +
          +
          +#ifdef FT_CONFIG_OPTION_SVG
          +
          +  /* ft_svg_init */
          +  static FT_Error
          +  ft_svg_init( SVG_Renderer  svg_module )
          +  {
          +    FT_Error  error = FT_Err_Ok;
          +
          +
          +    svg_module->loaded    = FALSE;
          +    svg_module->hooks_set = FALSE;
          +
          +    return error;
          +  }
          +
          +
          +  static void
          +  ft_svg_done( SVG_Renderer  svg_module )
          +  {
          +    if ( svg_module->loaded    == TRUE &&
          +         svg_module->hooks_set == TRUE )
          +      svg_module->hooks.free_svg( &svg_module->state );
          +
          +    svg_module->loaded = FALSE;
          +  }
          +
          +
          +  static FT_Error
          +  ft_svg_preset_slot( FT_Module     module,
          +                      FT_GlyphSlot  slot,
          +                      FT_Bool       cache )
          +  {
          +    SVG_Renderer       svg_renderer = (SVG_Renderer)module;
          +    SVG_RendererHooks  hooks        = svg_renderer->hooks;
          +
          +
          +    if ( svg_renderer->hooks_set == FALSE )
          +    {
          +      FT_TRACE1(( "Hooks are NOT set.  Can't render OT-SVG glyphs\n" ));
          +      return FT_THROW( Missing_SVG_Hooks );
          +    }
          +
          +    if ( svg_renderer->loaded == FALSE )
          +    {
          +      FT_TRACE3(( "ft_svg_preset_slot: first presetting call,"
          +                  " calling init hook\n" ));
          +      hooks.init_svg( &svg_renderer->state );
          +
          +      svg_renderer->loaded = TRUE;
          +    }
          +
          +    return hooks.preset_slot( slot, cache, &svg_renderer->state );
          +  }
          +
          +
          +  static FT_Error
          +  ft_svg_render( FT_Renderer       renderer,
          +                 FT_GlyphSlot      slot,
          +                 FT_Render_Mode    mode,
          +                 const FT_Vector*  origin )
          +  {
          +    SVG_Renderer  svg_renderer = (SVG_Renderer)renderer;
          +
          +    FT_Library  library = renderer->root.library;
          +    FT_Memory   memory  = library->memory;
          +    FT_Error    error;
          +
          +    FT_ULong  size_image_buffer;
          +
          +    SVG_RendererHooks  hooks = svg_renderer->hooks;
          +
          +
          +    FT_UNUSED( mode );
          +    FT_UNUSED( origin );
          +
          +    if ( mode != FT_RENDER_MODE_NORMAL )
          +      return FT_THROW( Bad_Argument );
          +
          +    if ( svg_renderer->hooks_set == FALSE )
          +    {
          +      FT_TRACE1(( "Hooks are NOT set.  Can't render OT-SVG glyphs\n" ));
          +      return FT_THROW( Missing_SVG_Hooks );
          +    }
          +
          +    if ( svg_renderer->loaded == FALSE )
          +    {
          +      FT_TRACE3(( "ft_svg_render: first rendering, calling init hook\n" ));
          +      error = hooks.init_svg( &svg_renderer->state );
          +
          +      svg_renderer->loaded = TRUE;
          +    }
          +
          +    ft_svg_preset_slot( (FT_Module)renderer, slot, TRUE );
          +
          +    size_image_buffer = (FT_ULong)slot->bitmap.pitch * slot->bitmap.rows;
          +    /* No `FT_QALLOC` here since we need a clean, empty canvas */
          +    /* to start with.                                          */
          +    if ( FT_ALLOC( slot->bitmap.buffer, size_image_buffer ) )
          +      return error;
          +
          +    error = hooks.render_svg( slot, &svg_renderer->state );
          +    if ( error )
          +      FT_FREE( slot->bitmap.buffer );
          +    else
          +      slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
          +
          +    return error;
          +  }
          +
          +
          +  static const SVG_Interface  svg_interface =
          +  {
          +    (Preset_Bitmap_Func)ft_svg_preset_slot
          +  };
          +
          +
          +  static FT_Error
          +  ft_svg_property_set( FT_Module    module,
          +                       const char*  property_name,
          +                       const void*  value,
          +                       FT_Bool      value_is_string )
          +  {
          +    FT_Error      error    = FT_Err_Ok;
          +    SVG_Renderer  renderer = (SVG_Renderer)module;
          +
          +
          +    if ( !ft_strcmp( property_name, "svg-hooks" ) )
          +    {
          +      SVG_RendererHooks*  hooks;
          +
          +
          +      if ( value_is_string == TRUE )
          +      {
          +        error = FT_THROW( Invalid_Argument );
          +        goto Exit;
          +      }
          +
          +      hooks = (SVG_RendererHooks*)value;
          +
          +      if ( !hooks->init_svg    ||
          +           !hooks->free_svg    ||
          +           !hooks->render_svg  ||
          +           !hooks->preset_slot )
          +      {
          +        FT_TRACE0(( "ft_svg_property_set:"
          +                    " SVG rendering hooks not set because\n" ));
          +        FT_TRACE0(( "                    "
          +                    " at least one function pointer is NULL\n" ));
          +
          +        error = FT_THROW( Invalid_Argument );
          +        goto Exit;
          +      }
          +
          +      renderer->hooks     = *hooks;
          +      renderer->hooks_set = TRUE;
          +    }
          +    else
          +      error = FT_THROW( Missing_Property );
          +
          +  Exit:
          +    return error;
          +  }
          +
          +
          +  static FT_Error
          +  ft_svg_property_get( FT_Module    module,
          +                       const char*  property_name,
          +                       const void*  value )
          +  {
          +    FT_Error      error    = FT_Err_Ok;
          +    SVG_Renderer  renderer = (SVG_Renderer)module;
          +
          +
          +    if ( !ft_strcmp( property_name, "svg-hooks" ) )
          +    {
          +      SVG_RendererHooks*  hooks = (SVG_RendererHooks*)value;
          +
          +
          +      *hooks = renderer->hooks;
          +    }
          +    else
          +      error = FT_THROW( Missing_Property );
          +
          +    return error;
          +  }
          +
          +
          +  FT_DEFINE_SERVICE_PROPERTIESREC(
          +    ft_svg_service_properties,
          +
          +    (FT_Properties_SetFunc)ft_svg_property_set, /* set_property */
          +    (FT_Properties_GetFunc)ft_svg_property_get  /* get_property */
          +  )
          +
          +
          +  FT_DEFINE_SERVICEDESCREC1(
          +    ft_svg_services,
          +    FT_SERVICE_ID_PROPERTIES, &ft_svg_service_properties )
          +
          +
          +  FT_CALLBACK_DEF( FT_Module_Interface )
          +  ft_svg_get_interface( FT_Module    module,
          +                        const char*  ft_svg_interface )
          +  {
          +    FT_Module_Interface  result;
          +
          +
          +    FT_UNUSED( module );
          +
          +    result = ft_service_list_lookup( ft_svg_services, ft_svg_interface );
          +    if ( result )
          +      return result;
          +
          +    return 0;
          +  }
          +
          +
          +  static FT_Error
          +  ft_svg_transform( FT_Renderer       renderer,
          +                    FT_GlyphSlot      slot,
          +                    const FT_Matrix*  _matrix,
          +                    const FT_Vector*  _delta )
          +  {
          +    FT_SVG_Document  doc    = (FT_SVG_Document)slot->other;
          +    FT_Matrix*       matrix = (FT_Matrix*)_matrix;
          +    FT_Vector*       delta  = (FT_Vector*)_delta;
          +
          +    FT_Matrix  tmp_matrix;
          +    FT_Vector  tmp_delta;
          +
          +    FT_Matrix  a, b;
          +    FT_Pos     x, y;
          +
          +
          +    FT_UNUSED( renderer );
          +
          +    if ( !matrix )
          +    {
          +      tmp_matrix.xx = 0x10000;
          +      tmp_matrix.xy = 0;
          +      tmp_matrix.yx = 0;
          +      tmp_matrix.yy = 0x10000;
          +
          +      matrix = &tmp_matrix;
          +    }
          +
          +    if ( !delta )
          +    {
          +      tmp_delta.x = 0;
          +      tmp_delta.y = 0;
          +
          +      delta = &tmp_delta;
          +    }
          +
          +    a = doc->transform;
          +    b = *matrix;
          +    FT_Matrix_Multiply( &b, &a );
          +
          +
          +    x = ADD_LONG( ADD_LONG( FT_MulFix( matrix->xx, doc->delta.x ),
          +                            FT_MulFix( matrix->xy, doc->delta.y ) ),
          +                  delta->x );
          +    y = ADD_LONG( ADD_LONG( FT_MulFix( matrix->yx, doc->delta.x ),
          +                            FT_MulFix( matrix->yy, doc->delta.y ) ),
          +                  delta->y );
          +
          +    doc->delta.x   = x;
          +    doc->delta.y   = y;
          +    doc->transform = a;
          +
          +    return FT_Err_Ok;
          +  }
          +
          +#endif /* FT_CONFIG_OPTION_SVG */
          +
          +
          +#ifdef FT_CONFIG_OPTION_SVG
          +#define PUT_SVG_MODULE( a )  a
          +#define SVG_GLYPH_FORMAT     FT_GLYPH_FORMAT_SVG
          +#else
          +#define PUT_SVG_MODULE( a )  NULL
          +#define SVG_GLYPH_FORMAT     FT_GLYPH_FORMAT_NONE
          +#endif
          +
          +
          +  FT_DEFINE_RENDERER(
          +    ft_svg_renderer_class,
          +
          +      FT_MODULE_RENDERER,
          +      sizeof ( SVG_RendererRec ),
          +
          +      "ot-svg",
          +      0x10000L,
          +      0x20000L,
          +
          +      (const void*)PUT_SVG_MODULE( &svg_interface ), /* module specific interface */
          +
          +      (FT_Module_Constructor)PUT_SVG_MODULE( ft_svg_init ), /* module_init   */
          +      (FT_Module_Destructor)PUT_SVG_MODULE( ft_svg_done ),  /* module_done   */
          +      PUT_SVG_MODULE( ft_svg_get_interface ),               /* get_interface */
          +
          +      SVG_GLYPH_FORMAT,
          +
          +      (FT_Renderer_RenderFunc)   PUT_SVG_MODULE( ft_svg_render ),    /* render_glyph    */
          +      (FT_Renderer_TransformFunc)PUT_SVG_MODULE( ft_svg_transform ), /* transform_glyph */
          +      NULL,                                                          /* get_glyph_cbox  */
          +      NULL,                                                          /* set_mode        */
          +      NULL                                                           /* raster_class    */
          +  )
          +
          +
          +/* END */
          diff --git a/thirdparty/freetype/src/svg/ftsvg.h b/thirdparty/freetype/src/svg/ftsvg.h
          new file mode 100644
          index 0000000000..73514b8cf3
          --- /dev/null
          +++ b/thirdparty/freetype/src/svg/ftsvg.h
          @@ -0,0 +1,35 @@
          +/****************************************************************************
          + *
          + * ftsvg.h
          + *
          + *   The FreeType SVG renderer interface (specification).
          + *
          + * Copyright (C) 2022 by
          + * David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti.
          + *
          + * This file is part of the FreeType project, and may only be used,
          + * modified, and distributed under the terms of the FreeType project
          + * license, LICENSE.TXT.  By continuing to use, modify, or distribute
          + * this file you indicate that you have read the license and
          + * understand and accept it fully.
          + *
          + */
          +
          +#ifndef FTSVG_H_
          +#define FTSVG_H_
          +
          +#include 
          +#include 
          +#include 
          +
          +
          +FT_BEGIN_HEADER
          +
          +  FT_DECLARE_RENDERER( ft_svg_renderer_class )
          +
          +FT_END_HEADER
          +
          +#endif /* FTSVG_H_ */
          +
          +
          +/* END */
          diff --git a/thirdparty/freetype/src/svg/module.mk b/thirdparty/freetype/src/svg/module.mk
          new file mode 100644
          index 0000000000..30c3525747
          --- /dev/null
          +++ b/thirdparty/freetype/src/svg/module.mk
          @@ -0,0 +1,23 @@
          +#
          +# FreeType 2 SVG renderer module definition
          +#
          +
          +
          +# Copyright (C) 2022 by
          +# David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti.
          +#
          +# This file is part of the FreeType project, and may only be used, modified,
          +# and distributed under the terms of the FreeType project license,
          +# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
          +# indicate that you have read the license and understand and accept it
          +# fully.
          +
          +
          +FTMODULE_H_COMMANDS += SVG_MODULE
          +
          +define SVG_MODULE
          +$(OPEN_DRIVER) FT_Renderer_Class, ft_svg_renderer_class $(CLOSE_DRIVER)
          +$(ECHO_DRIVER)ot-svg    $(ECHO_DRIVER_DESC)OT-SVG glyph renderer module$(ECHO_DRIVER_DONE)
          +endef
          +
          +# EOF
          diff --git a/thirdparty/freetype/src/svg/rules.mk b/thirdparty/freetype/src/svg/rules.mk
          new file mode 100644
          index 0000000000..9c53128c4a
          --- /dev/null
          +++ b/thirdparty/freetype/src/svg/rules.mk
          @@ -0,0 +1,70 @@
          +#
          +# FreeType 2 SVG renderer module build rules
          +#
          +
          +
          +# Copyright (C) 2022 by
          +# David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti.
          +#
          +# This file is part of the FreeType project, and may only be used, modified,
          +# and distributed under the terms of the FreeType project license,
          +# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
          +# indicate that you have read the license and understand and accept it
          +# fully.
          +
          +
          +# SVG renderer driver directory
          +#
          +SVG_DIR := $(SRC_DIR)/svg
          +
          +# compilation flags for the driver
          +#
          +SVG_COMPILE := $(CC) $(ANSIFLAGS)                            \
          +                     $I$(subst /,$(COMPILER_SEP),$(SVG_DIR)) \
          +                     $(INCLUDE_FLAGS)                        \
          +                     $(FT_CFLAGS)
          +
          +# SVG renderer sources (i.e., C files)
          +#
          +SVG_DRV_SRC := $(SVG_DIR)/ftsvg.c
          +
          +
          +# SVG renderer headers
          +#
          +SVG_DRV_H := $(SVG_DIR)/ftsvg.h    \
          +             $(SVG_DIR)/svgtypes.h
          +
          +
          +# SVG renderer object(s)
          +#
          +#   SVG_DRV_OBJ_M is used during `multi' builds.
          +#   SVG_DRV_OBJ_S is used during `single' builds.
          +#
          +SVG_DRV_OBJ_M := $(SVG_DRV_SRC:$(SVG_DIR)/%.c=$(OBJ_DIR)/%.$O)
          +SVG_DRV_OBJ_S := $(OBJ_DIR)/svg.$O
          +
          +# SVG renderer source file for single build
          +#
          +SVG_DRV_SRC_S := $(SVG_DIR)/svg.c
          +
          +
          +# SVG renderer - single object
          +#
          +$(SVG_DRV_OBJ_S): $(SVG_DRV_SRC_S) $(SVG_DRV_SRC) \
          +                  $(FREETYPE_H) $(SVG_DRV_H)
          +	$(SVG_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(SVG_DRV_SRC_S))
          +
          +
          +# SVG renderer - multiple objects
          +#
          +$(OBJ_DIR)/%.$O: $(SVG_DIR)/%.c $(FREETYPE_H) $(SVG_DRV_H)
          +	$(SVG_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<)
          +
          +
          +# update main driver object lists
          +#
          +DRV_OBJS_S += $(SVG_DRV_OBJ_S)
          +DRV_OBJS_M += $(SVG_DRV_OBJ_M)
          +
          +
          +# EOF
          diff --git a/thirdparty/freetype/src/svg/svg.c b/thirdparty/freetype/src/svg/svg.c
          new file mode 100644
          index 0000000000..b7e62a418c
          --- /dev/null
          +++ b/thirdparty/freetype/src/svg/svg.c
          @@ -0,0 +1,24 @@
          +/****************************************************************************
          + *
          + * svg.c
          + *
          + *   FreeType SVG renderer module component (body only).
          + *
          + * Copyright (C) 2022 by
          + * David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti.
          + *
          + * This file is part of the FreeType project, and may only be used,
          + * modified, and distributed under the terms of the FreeType project
          + * license, LICENSE.TXT.  By continuing to use, modify, or distribute
          + * this file you indicate that you have read the license and
          + * understand and accept it fully.
          + *
          + */
          +
          +#define FT_MAKE_OPTION_SINGLE_OBJECT
          +
          +#include "svgtypes.h"
          +#include "ftsvg.c"
          +
          +
          +/* END */
          diff --git a/thirdparty/freetype/src/svg/svgtypes.h b/thirdparty/freetype/src/svg/svgtypes.h
          new file mode 100644
          index 0000000000..34fce47a34
          --- /dev/null
          +++ b/thirdparty/freetype/src/svg/svgtypes.h
          @@ -0,0 +1,42 @@
          +/****************************************************************************
          + *
          + * svgtypes.h
          + *
          + *   The FreeType SVG renderer internal types (specification).
          + *
          + * Copyright (C) 2022 by
          + * David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti.
          + *
          + * This file is part of the FreeType project, and may only be used,
          + * modified, and distributed under the terms of the FreeType project
          + * license, LICENSE.TXT.  By continuing to use, modify, or distribute
          + * this file you indicate that you have read the license and
          + * understand and accept it fully.
          + *
          + */
          +
          +#ifndef SVGTYPES_H_
          +#define SVGTYPES_H_
          +
          +#include 
          +#include 
          +#include 
          +#include 
          +
          +
          +  typedef struct SVG_RendererRec_
          +  {
          +    FT_RendererRec     root;   /* this inherits FT_RendererRec                */
          +    FT_Bool            loaded;
          +    FT_Bool            hooks_set;
          +    SVG_RendererHooks  hooks;  /* this holds hooks for SVG rendering          */
          +    FT_Pointer         state;  /* a place for hooks to store state, if needed */
          +
          +  } SVG_RendererRec;
          +
          +  typedef struct SVG_RendererRec_*  SVG_Renderer;
          +
          +#endif /* SVGTYPES_H_ */
          +
          +
          +/* EOF */
          diff --git a/thirdparty/freetype/src/tools/afblue.pl b/thirdparty/freetype/src/tools/afblue.pl
          index 954816276b..f4f3845e7a 100644
          --- a/thirdparty/freetype/src/tools/afblue.pl
          +++ b/thirdparty/freetype/src/tools/afblue.pl
          @@ -5,7 +5,7 @@
           #
           # Process a blue zone character data file.
           #
          -# Copyright (C) 2013-2021 by
          +# Copyright (C) 2013-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/tools/glnames.py b/thirdparty/freetype/src/tools/glnames.py
          index c6f2f27893..ad7786d291 100644
          --- a/thirdparty/freetype/src/tools/glnames.py
          +++ b/thirdparty/freetype/src/tools/glnames.py
          @@ -6,7 +6,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/tools/update-copyright-year b/thirdparty/freetype/src/tools/update-copyright-year
          index 69d63b60ab..f699db76e9 100755
          --- a/thirdparty/freetype/src/tools/update-copyright-year
          +++ b/thirdparty/freetype/src/tools/update-copyright-year
          @@ -2,7 +2,7 @@ eval '(exit $?0)' && eval 'exec perl -wS -i "$0" ${1+"$@"}'
             & eval 'exec perl -wS -i "$0" $argv:q'
               if 0;
           
          -# Copyright (C) 2015-2021 by
          +# Copyright (C) 2015-2022 by
           # Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/truetype/module.mk b/thirdparty/freetype/src/truetype/module.mk
          index 485ef05c2d..f6e1c91a5d 100644
          --- a/thirdparty/freetype/src/truetype/module.mk
          +++ b/thirdparty/freetype/src/truetype/module.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/truetype/rules.mk b/thirdparty/freetype/src/truetype/rules.mk
          index cfd6b3b2f4..d0d2404b8f 100644
          --- a/thirdparty/freetype/src/truetype/rules.mk
          +++ b/thirdparty/freetype/src/truetype/rules.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/truetype/truetype.c b/thirdparty/freetype/src/truetype/truetype.c
          index 4232aca6ec..41c844acbb 100644
          --- a/thirdparty/freetype/src/truetype/truetype.c
          +++ b/thirdparty/freetype/src/truetype/truetype.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType TrueType driver component (body only).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/truetype/ttdriver.c b/thirdparty/freetype/src/truetype/ttdriver.c
          index 6fcfdb23e4..245d97cb58 100644
          --- a/thirdparty/freetype/src/truetype/ttdriver.c
          +++ b/thirdparty/freetype/src/truetype/ttdriver.c
          @@ -4,7 +4,7 @@
            *
            *   TrueType font driver implementation (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/truetype/ttdriver.h b/thirdparty/freetype/src/truetype/ttdriver.h
          index 4e6d52d22c..c477c0b1dd 100644
          --- a/thirdparty/freetype/src/truetype/ttdriver.h
          +++ b/thirdparty/freetype/src/truetype/ttdriver.h
          @@ -4,7 +4,7 @@
            *
            *   High-level TrueType driver interface (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/truetype/tterrors.h b/thirdparty/freetype/src/truetype/tterrors.h
          index 0ce247e376..2c95ea17b2 100644
          --- a/thirdparty/freetype/src/truetype/tterrors.h
          +++ b/thirdparty/freetype/src/truetype/tterrors.h
          @@ -4,7 +4,7 @@
            *
            *   TrueType error codes (specification only).
            *
          - * Copyright (C) 2001-2021 by
          + * Copyright (C) 2001-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/truetype/ttgload.c b/thirdparty/freetype/src/truetype/ttgload.c
          index 11968f6fdc..b189f982ff 100644
          --- a/thirdparty/freetype/src/truetype/ttgload.c
          +++ b/thirdparty/freetype/src/truetype/ttgload.c
          @@ -4,7 +4,7 @@
            *
            *   TrueType Glyph Loader (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -2230,10 +2230,6 @@
                                    FT_UInt    glyph_index )
             {
               TT_Face    face   = loader->face;
          -#if defined TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY || \
          -    defined TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
          -    TT_Driver  driver = (TT_Driver)FT_FACE_DRIVER( face );
          -#endif
           
               FT_BBox       bbox;
               FT_Fixed      y_scale;
          @@ -2256,53 +2252,10 @@
           
               glyph->metrics.horiBearingX = bbox.xMin;
               glyph->metrics.horiBearingY = bbox.yMax;
          -    glyph->metrics.horiAdvance  = SUB_LONG(loader->pp2.x, loader->pp1.x);
          -
          -    /* Adjust advance width to the value contained in the hdmx table   */
          -    /* unless FT_LOAD_COMPUTE_METRICS is set or backward compatibility */
          -    /* mode of the v40 interpreter is active.  See `ttinterp.h' for    */
          -    /* details on backward compatibility mode.                         */
          -    if (
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
          -         !( driver->interpreter_version == TT_INTERPRETER_VERSION_40  &&
          -            ( loader->exec && loader->exec->backward_compatibility  ) ) &&
          -#endif
          -         !face->postscript.isFixedPitch                                 &&
          -         IS_HINTED( loader->load_flags )                                &&
          -         !( loader->load_flags & FT_LOAD_COMPUTE_METRICS )              )
          -    {
          -      FT_Byte*  widthp;
          -
          -
          -      widthp = tt_face_get_device_metrics( face,
          -                                           size->metrics->x_ppem,
          -                                           glyph_index );
          -
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -
          -      if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
          -      {
          -        FT_Bool  ignore_x_mode;
          -
          -
          -        ignore_x_mode = FT_BOOL( FT_LOAD_TARGET_MODE( loader->load_flags ) !=
          -                                 FT_RENDER_MODE_MONO );
          -
          -        if ( widthp                                                   &&
          -             ( ( ignore_x_mode && loader->exec->compatible_widths ) ||
          -                !ignore_x_mode                                      ||
          -                SPH_OPTION_BITMAP_WIDTHS                            ) )
          -          glyph->metrics.horiAdvance = *widthp * 64;
          -      }
          -      else
          -
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
          -      {
          -        if ( widthp )
          -          glyph->metrics.horiAdvance = *widthp * 64;
          -      }
          -    }
          +    if ( loader->widthp )
          +      glyph->metrics.horiAdvance = loader->widthp[glyph_index] * 64;
          +    else
          +      glyph->metrics.horiAdvance = SUB_LONG(loader->pp2.x, loader->pp1.x);
           
               /* set glyph dimensions */
               glyph->metrics.width  = SUB_LONG( bbox.xMax, bbox.xMin );
          @@ -2735,12 +2688,58 @@
                 /* note that this flag can also be modified in a glyph's bytecode */
                 if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 &&
                      exec->GS.instruct_control & 4                            )
          -        exec->ignore_x_mode = 0;
          -#endif
          +        exec->ignore_x_mode = FALSE;
          +#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          +
          +#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
          +      /*
          +       * Toggle backward compatibility according to what font wants, except
          +       * when
          +       *
          +       * 1) we have a `tricky' font that heavily relies on the interpreter to
          +       *    render glyphs correctly, for example DFKai-SB, or
          +       * 2) FT_RENDER_MODE_MONO (i.e, monochome rendering) is requested.
          +       *
          +       * In those cases, backward compatibility needs to be turned off to get
          +       * correct rendering.  The rendering is then completely up to the
          +       * font's programming.
          +       *
          +       */
          +      if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 &&
          +           subpixel_hinting_lean                                    &&
          +           !FT_IS_TRICKY( glyph->face )                             )
          +        exec->backward_compatibility = !( exec->GS.instruct_control & 4 );
          +      else
          +        exec->backward_compatibility = FALSE;
          +#endif /* TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL */
           
                 exec->pedantic_hinting = FT_BOOL( load_flags & FT_LOAD_PEDANTIC );
                 loader->exec = exec;
                 loader->instructions = exec->glyphIns;
          +
          +      /* Use the hdmx table if any unless FT_LOAD_COMPUTE_METRICS */
          +      /* is set or backward compatibility mode of the v38 or v40  */
          +      /* interpreters is active.  See `ttinterp.h' for details on */
          +      /* backward compatibility mode.                             */
          +      if ( IS_HINTED( loader->load_flags )                                &&
          +           !( loader->load_flags & FT_LOAD_COMPUTE_METRICS )              &&
          +#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
          +           !( driver->interpreter_version == TT_INTERPRETER_VERSION_40  &&
          +              exec->backward_compatibility                              ) &&
          +#endif
          +#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          +           !( driver->interpreter_version == TT_INTERPRETER_VERSION_38  &&
          +              !SPH_OPTION_BITMAP_WIDTHS                                 &&
          +              FT_LOAD_TARGET_MODE( loader->load_flags ) !=
          +                                                   FT_RENDER_MODE_MONO  &&
          +              exec->compatible_widths                                   ) &&
          +#endif
          +           !face->postscript.isFixedPitch                                 )
          +      {
          +        loader->widthp = size->widthp;
          +      }
          +      else
          +        loader->widthp = NULL;
               }
           
           #endif /* TT_USE_BYTECODE_INTERPRETER */
          @@ -2788,11 +2787,12 @@
              *   A function used to load a single glyph within a given glyph slot,
              *   for a given size.
              *
          -   * @Input:
          +   * @InOut:
              *   glyph ::
              *     A handle to a target slot object where the glyph
              *     will be loaded.
              *
          +   * @Input:
              *   size ::
              *     A handle to the source face size at which the glyph
              *     must be scaled/loaded.
          @@ -2897,8 +2897,12 @@
                 }
                 else
                 {
          -        if ( FT_IS_SCALABLE( glyph->face ) )
          +        if ( FT_IS_SCALABLE( glyph->face ) ||
          +             FT_HAS_SBIX( glyph->face )    )
                   {
          +          TT_Face  face = (TT_Face)glyph->face;
          +
          +
                     /* for the bbox we need the header only */
                     (void)tt_loader_init( &loader, size, glyph, load_flags, TRUE );
                     (void)load_truetype_glyph( &loader, glyph_index, 0, TRUE );
          @@ -2906,6 +2910,35 @@
                     glyph->linearHoriAdvance = loader.linear;
                     glyph->linearVertAdvance = loader.vadvance;
           
          +          /* Bitmaps from the 'sbix' table need special treatment:  */
          +          /* if there is a glyph contour, the bitmap origin must be */
          +          /* shifted to be relative to the lower left corner of the */
          +          /* glyph bounding box, also taking the left-side bearing  */
          +          /* (or top bearing) into account.                         */
          +          if ( face->sbit_table_type == TT_SBIT_TABLE_TYPE_SBIX &&
          +               loader.n_contours > 0                            )
          +          {
          +            FT_Int  bitmap_left;
          +            FT_Int  bitmap_top;
          +
          +
          +            if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
          +            {
          +              /* This is a guess, since Apple's CoreText engine doesn't */
          +              /* really do vertical typesetting.                        */
          +              bitmap_left = loader.bbox.xMin;
          +              bitmap_top  = loader.top_bearing;
          +            }
          +            else
          +            {
          +              bitmap_left = loader.left_bearing;
          +              bitmap_top  = loader.bbox.yMin;
          +            }
          +
          +            glyph->bitmap_left += FT_MulFix( bitmap_left, x_scale ) >> 6;
          +            glyph->bitmap_top  += FT_MulFix( bitmap_top,  y_scale ) >> 6;
          +          }
          +
                     /* sanity checks: if `xxxAdvance' in the sbit metric */
                     /* structure isn't set, use `linearXXXAdvance'      */
                     if ( !glyph->metrics.horiAdvance && glyph->linearHoriAdvance )
          @@ -2920,6 +2953,12 @@
                 }
               }
           
          +    if ( load_flags & FT_LOAD_SBITS_ONLY )
          +    {
          +      error = FT_THROW( Invalid_Argument );
          +      goto Exit;
          +    }
          +
           #endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
           
               /* if FT_LOAD_NO_SCALE is not set, `ttmetrics' must be valid */
          @@ -2929,16 +2968,81 @@
                 goto Exit;
               }
           
          -    if ( load_flags & FT_LOAD_SBITS_ONLY )
          +#ifdef FT_CONFIG_OPTION_SVG
          +
          +    /* check for OT-SVG */
          +    if ( ( load_flags & FT_LOAD_COLOR ) && ( (TT_Face)glyph->face )->svg )
          +    {
          +      SFNT_Service  sfnt;
          +
          +      FT_Short   leftBearing;
          +      FT_Short   topBearing;
          +      FT_UShort  advanceX;
          +      FT_UShort  advanceY;
          +
          +
          +      FT_TRACE3(( "Trying to load SVG glyph\n" ));
          +      sfnt = (SFNT_Service)( (TT_Face)glyph->face )->sfnt;
          +
          +      error = sfnt->load_svg_doc( glyph, glyph_index );
          +      if ( !error )
          +      {
          +        TT_Face  face = (TT_Face)glyph->face;
          +
          +
          +        FT_TRACE3(( "Successfully loaded SVG glyph\n" ));
          +
          +        glyph->format = FT_GLYPH_FORMAT_SVG;
          +
          +        sfnt->get_metrics( face,
          +                           FALSE,
          +                           glyph_index,
          +                           &leftBearing,
          +                           &advanceX );
          +        sfnt->get_metrics( face,
          +                           TRUE,
          +                           glyph_index,
          +                           &topBearing,
          +                           &advanceY );
          +
          +        advanceX = (FT_UShort)FT_MulDiv( advanceX,
          +                                         glyph->face->size->metrics.x_ppem,
          +                                         glyph->face->units_per_EM );
          +        advanceY = (FT_UShort)FT_MulDiv( advanceY,
          +                                         glyph->face->size->metrics.y_ppem,
          +                                         glyph->face->units_per_EM );
          +
          +        glyph->metrics.horiAdvance = advanceX << 6;
          +        glyph->metrics.vertAdvance = advanceY << 6;
          +
          +        return error;
          +      }
          +
          +      FT_TRACE3(( "Failed to load SVG glyph\n" ));
          +    }
          +
          +    /* return immediately if we only want SVG glyphs */
          +    if ( load_flags & FT_LOAD_SVG_ONLY )
               {
                 error = FT_THROW( Invalid_Argument );
                 goto Exit;
               }
           
          +#endif /* FT_CONFIG_OPTION_SVG */
          +
               error = tt_loader_init( &loader, size, glyph, load_flags, FALSE );
               if ( error )
                 goto Exit;
           
          +    /* done if we are only interested in the `hdmx` advance */
          +    if ( load_flags & FT_LOAD_ADVANCE_ONLY         &&
          +         !( load_flags & FT_LOAD_VERTICAL_LAYOUT ) &&
          +         loader.widthp                             )
          +    {
          +      glyph->metrics.horiAdvance = loader.widthp[glyph_index] * 64;
          +      goto Done;
          +    }
          +
               glyph->format        = FT_GLYPH_FORMAT_OUTLINE;
               glyph->num_subglyphs = 0;
               glyph->outline.flags = 0;
          @@ -3017,6 +3121,7 @@
                           glyph->outline.n_points,
                           glyph->outline.flags ));
           
          +  Done:
               tt_loader_done( &loader );
           
             Exit:
          diff --git a/thirdparty/freetype/src/truetype/ttgload.h b/thirdparty/freetype/src/truetype/ttgload.h
          index 78fdeaa73d..3195351f78 100644
          --- a/thirdparty/freetype/src/truetype/ttgload.h
          +++ b/thirdparty/freetype/src/truetype/ttgload.h
          @@ -4,7 +4,7 @@
            *
            *   TrueType Glyph Loader (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/truetype/ttgxvar.c b/thirdparty/freetype/src/truetype/ttgxvar.c
          index 7f2db0cbdc..6a0edef29b 100644
          --- a/thirdparty/freetype/src/truetype/ttgxvar.c
          +++ b/thirdparty/freetype/src/truetype/ttgxvar.c
          @@ -4,7 +4,7 @@
            *
            *   TrueType GX Font Variation loader
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * David Turner, Robert Wilhelm, Werner Lemberg, and George Williams.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -151,9 +151,7 @@
               FT_UInt    i, j;
               FT_UShort  first;
               FT_Memory  memory = stream->memory;
          -    FT_Error   error  = FT_Err_Ok;
          -
          -    FT_UNUSED( error );
          +    FT_Error   error;
           
           
               *point_cnt = 0;
          @@ -266,9 +264,7 @@
               FT_UInt    i, j;
               FT_UInt    bytes_used;
               FT_Memory  memory = stream->memory;
          -    FT_Error   error  = FT_Err_Ok;
          -
          -    FT_UNUSED( error );
          +    FT_Error   error;
           
           
               if ( FT_QNEW_ARRAY( deltas, delta_cnt ) )
          @@ -361,14 +357,12 @@
               FT_Memory       memory = stream->memory;
               GX_Blend        blend  = face->blend;
               GX_AVarSegment  segment;
          -    FT_Error        error = FT_Err_Ok;
          +    FT_Error        error;
               FT_Long         version;
               FT_Long         axisCount;
               FT_Int          i, j;
               FT_ULong        table_len;
           
          -    FT_UNUSED( error );
          -
           
               FT_TRACE2(( "AVAR " ));
           
          @@ -421,7 +415,6 @@
                     FT_FREE( blend->avar_segment[j].correspondence );
           
                   FT_FREE( blend->avar_segment );
          -        blend->avar_segment = NULL;
                   goto Exit;
                 }
           
          @@ -2753,7 +2746,6 @@
                   /* The cvt table has been loaded already; every time we change the */
                   /* blend we may need to reload and remodify the cvt table.         */
                   FT_FREE( face->cvt );
          -        face->cvt = NULL;
           
                   error = tt_face_load_cvt( face, face->root.stream );
                   break;
          @@ -2772,7 +2764,6 @@
           
               /* enforce recomputation of the PostScript name; */
               FT_FREE( face->postscript_name );
          -    face->postscript_name = NULL;
           
             Exit:
               return error;
          @@ -3476,6 +3467,7 @@
                 }
                 else
                 {
          +        localpoints = NULL;
                   points      = sharedpoints;
                   point_count = spoint_count;
                 }
          diff --git a/thirdparty/freetype/src/truetype/ttgxvar.h b/thirdparty/freetype/src/truetype/ttgxvar.h
          index ded9ea1d6d..17915f00d3 100644
          --- a/thirdparty/freetype/src/truetype/ttgxvar.h
          +++ b/thirdparty/freetype/src/truetype/ttgxvar.h
          @@ -4,7 +4,7 @@
            *
            *   TrueType GX Font Variation loader (specification)
            *
          - * Copyright (C) 2004-2021 by
          + * Copyright (C) 2004-2022 by
            * David Turner, Robert Wilhelm, Werner Lemberg and George Williams.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/truetype/ttinterp.c b/thirdparty/freetype/src/truetype/ttinterp.c
          index 731095ed0c..be3922bfa0 100644
          --- a/thirdparty/freetype/src/truetype/ttinterp.c
          +++ b/thirdparty/freetype/src/truetype/ttinterp.c
          @@ -4,7 +4,7 @@
            *
            *   TrueType bytecode interpreter (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -516,6 +516,14 @@
               exec->GS.round_state = 1;
               exec->GS.loop        = 1;
           
          +#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          +    exec->iup_called  = FALSE;
          +#endif
          +#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
          +    exec->iupx_called = FALSE;
          +    exec->iupy_called = FALSE;
          +#endif
          +
               /* some glyphs leave something on the stack. so we clean it */
               /* before a new execution.                                  */
               exec->top     = 0;
          @@ -5260,16 +5268,21 @@
                 }
               }
           
          -    exc->GS.instruct_control &= ~(FT_Byte)Kf;
          -    exc->GS.instruct_control |= (FT_Byte)L;
          +    /* INSTCTRL should only be used in the CVT program */
          +    if ( exc->iniRange == tt_coderange_cvt )
          +    {
          +      exc->GS.instruct_control &= ~(FT_Byte)Kf;
          +      exc->GS.instruct_control |= (FT_Byte)L;
          +    }
           
          -    if ( K == 3 )
          +    /* except to change the subpixel flags temporarily */
          +    else if ( exc->iniRange == tt_coderange_glyph && K == 3 )
               {
           #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
                 /* INSTCTRL modifying flag 3 also has an effect */
                 /* outside of the CVT program                   */
                 if ( SUBPIXEL_HINTING_INFINALITY )
          -        exc->ignore_x_mode = FT_BOOL( L == 4 );
          +        exc->ignore_x_mode = !FT_BOOL( L == 4 );
           #endif
           
           #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
          @@ -5280,6 +5293,8 @@
                   exc->backward_compatibility = !FT_BOOL( L == 4 );
           #endif
               }
          +    else if ( exc->pedantic_hinting )
          +      exc->error = FT_THROW( Invalid_Reference );
             }
           
           
          @@ -7755,35 +7770,6 @@
           #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
           
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -    exc->iup_called = FALSE;
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
          -    /*
          -     * Toggle backward compatibility according to what font wants, except
          -     * when
          -     *
          -     * 1) we have a `tricky' font that heavily relies on the interpreter to
          -     *    render glyphs correctly, for example DFKai-SB, or
          -     * 2) FT_RENDER_MODE_MONO (i.e, monochome rendering) is requested.
          -     *
          -     * In those cases, backward compatibility needs to be turned off to get
          -     * correct rendering.  The rendering is then completely up to the
          -     * font's programming.
          -     *
          -     */
          -    if ( SUBPIXEL_HINTING_MINIMAL          &&
          -         exc->subpixel_hinting_lean        &&
          -         !FT_IS_TRICKY( &exc->face->root ) )
          -      exc->backward_compatibility = !( exc->GS.instruct_control & 4 );
          -    else
          -      exc->backward_compatibility = FALSE;
          -
          -    exc->iupx_called = FALSE;
          -    exc->iupy_called = FALSE;
          -#endif
          -
               /* We restrict the number of twilight points to a reasonable,     */
               /* heuristic value to avoid slow execution of malformed bytecode. */
               num_twilight_points = FT_MAX( 30,
          diff --git a/thirdparty/freetype/src/truetype/ttinterp.h b/thirdparty/freetype/src/truetype/ttinterp.h
          index 9c01ec83cb..48f618dc9d 100644
          --- a/thirdparty/freetype/src/truetype/ttinterp.h
          +++ b/thirdparty/freetype/src/truetype/ttinterp.h
          @@ -4,7 +4,7 @@
            *
            *   TrueType bytecode interpreter (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/truetype/ttobjs.c b/thirdparty/freetype/src/truetype/ttobjs.c
          index 93fc548447..f4f3c69336 100644
          --- a/thirdparty/freetype/src/truetype/ttobjs.c
          +++ b/thirdparty/freetype/src/truetype/ttobjs.c
          @@ -4,7 +4,7 @@
            *
            *   Objects manager (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -727,7 +727,8 @@
               if ( error )
                 goto Exit;
           
          -    if ( FT_IS_SCALABLE( ttface ) )
          +    if ( FT_IS_SCALABLE( ttface ) ||
          +         FT_HAS_SBIX( ttface )    )
               {
           #ifdef FT_CONFIG_OPTION_INCREMENTAL
                 if ( !ttface->internal->incremental_interface )
          @@ -1435,6 +1436,8 @@
                 size->ttmetrics.y_ratio = 0x10000L;
               }
           
          +    size->widthp = tt_face_get_device_metrics( face, size_metrics->x_ppem, 0 );
          +
               size->metrics = size_metrics;
           
           #ifdef TT_USE_BYTECODE_INTERPRETER
          diff --git a/thirdparty/freetype/src/truetype/ttobjs.h b/thirdparty/freetype/src/truetype/ttobjs.h
          index fd72378721..5fa239d43a 100644
          --- a/thirdparty/freetype/src/truetype/ttobjs.h
          +++ b/thirdparty/freetype/src/truetype/ttobjs.h
          @@ -4,7 +4,7 @@
            *
            *   Objects manager (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -282,6 +282,8 @@ FT_BEGIN_HEADER
           
               TT_Size_Metrics    ttmetrics;
           
          +    FT_Byte*           widthp;          /* glyph widths from the hdmx table */
          +
               FT_ULong           strike_index;      /* 0xFFFFFFFF to indicate invalid */
           
           #ifdef TT_USE_BYTECODE_INTERPRETER
          diff --git a/thirdparty/freetype/src/truetype/ttpload.c b/thirdparty/freetype/src/truetype/ttpload.c
          index 71db75ae1f..6982c717ab 100644
          --- a/thirdparty/freetype/src/truetype/ttpload.c
          +++ b/thirdparty/freetype/src/truetype/ttpload.c
          @@ -4,7 +4,7 @@
            *
            *   TrueType-specific tables loader (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -498,6 +498,14 @@
             }
           
           
          +  FT_COMPARE_DEF( int )
          +  compare_ppem( const void*  a,
          +                const void*  b )
          +  {
          +    return **(FT_Byte**)a - **(FT_Byte**)b;
          +  }
          +
          +
             /**************************************************************************
              *
              * @Function:
          @@ -574,20 +582,21 @@
                 goto Fail;
               }
           
          -    if ( FT_QNEW_ARRAY( face->hdmx_record_sizes, num_records ) )
          +    if ( FT_QNEW_ARRAY( face->hdmx_records, num_records ) )
                 goto Fail;
           
          -    /* XXX: We do not check if the records are sorted by ppem */
          -    /* and cannot use binary search later.                    */
               for ( nn = 0; nn < num_records; nn++ )
               {
                 if ( p + record_size > limit )
                   break;
          -
          -      face->hdmx_record_sizes[nn] = p[0];
          -      p                          += record_size;
          +      face->hdmx_records[nn] = p;
          +      p                     += record_size;
               }
           
          +    /* The records must be already sorted by ppem but it does not */
          +    /* hurt to make sure so that the binary search works later.   */
          +    ft_qsort( face->hdmx_records, nn, sizeof ( FT_Byte* ), compare_ppem );
          +
               face->hdmx_record_count = nn;
               face->hdmx_table_size   = table_size;
               face->hdmx_record_size  = record_size;
          @@ -611,7 +620,7 @@
               FT_Memory  memory = stream->memory;
           
           
          -    FT_FREE( face->hdmx_record_sizes );
          +    FT_FREE( face->hdmx_records );
               FT_FRAME_RELEASE( face->hdmx_table );
             }
           
          @@ -619,27 +628,34 @@
             /**************************************************************************
              *
              * Return the advance width table for a given pixel size if it is found
          -   * in the font's `hdmx' table (if any).
          +   * in the font's `hdmx' table (if any).  The records must be sorted for
          +   * the binary search to work properly.
              */
             FT_LOCAL_DEF( FT_Byte* )
             tt_face_get_device_metrics( TT_Face  face,
                                         FT_UInt  ppem,
                                         FT_UInt  gindex )
             {
          -    FT_UInt   nn;
          -    FT_Byte*  result      = NULL;
          -    FT_ULong  record_size = face->hdmx_record_size;
          -    FT_Byte*  record      = FT_OFFSET( face->hdmx_table, 8 );
          +    FT_UInt   min    = 0;
          +    FT_UInt   max    = face->hdmx_record_count;
          +    FT_UInt   mid;
          +    FT_Byte*  result = NULL;
           
           
          -    for ( nn = 0; nn < face->hdmx_record_count; nn++ )
          -      if ( face->hdmx_record_sizes[nn] == ppem )
          +    while ( min < max )
          +    {
          +      mid = ( min + max ) >> 1;
          +
          +      if ( face->hdmx_records[mid][0] > ppem )
          +        max = mid;
          +      else if ( face->hdmx_records[mid][0] < ppem )
          +        min = mid + 1;
          +      else
                 {
          -        gindex += 2;
          -        if ( gindex < record_size )
          -          result = record + nn * record_size + gindex;
          +        result = face->hdmx_records[mid] + 2 + gindex;
                   break;
                 }
          +    }
           
               return result;
             }
          diff --git a/thirdparty/freetype/src/truetype/ttpload.h b/thirdparty/freetype/src/truetype/ttpload.h
          index 84c42cdaf4..fa5d96ed35 100644
          --- a/thirdparty/freetype/src/truetype/ttpload.h
          +++ b/thirdparty/freetype/src/truetype/ttpload.h
          @@ -4,7 +4,7 @@
            *
            *   TrueType-specific tables loader (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/truetype/ttsubpix.c b/thirdparty/freetype/src/truetype/ttsubpix.c
          index c484665b95..2438d3a2a2 100644
          --- a/thirdparty/freetype/src/truetype/ttsubpix.c
          +++ b/thirdparty/freetype/src/truetype/ttsubpix.c
          @@ -4,7 +4,7 @@
            *
            *   TrueType Subpixel Hinting.
            *
          - * Copyright (C) 2010-2021 by
          + * Copyright (C) 2010-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/truetype/ttsubpix.h b/thirdparty/freetype/src/truetype/ttsubpix.h
          index 762b7c98a3..181f83810c 100644
          --- a/thirdparty/freetype/src/truetype/ttsubpix.h
          +++ b/thirdparty/freetype/src/truetype/ttsubpix.h
          @@ -4,7 +4,7 @@
            *
            *   TrueType Subpixel Hinting.
            *
          - * Copyright (C) 2010-2021 by
          + * Copyright (C) 2010-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/type1/module.mk b/thirdparty/freetype/src/type1/module.mk
          index 5da4716f41..0342a08ffa 100644
          --- a/thirdparty/freetype/src/type1/module.mk
          +++ b/thirdparty/freetype/src/type1/module.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/type1/rules.mk b/thirdparty/freetype/src/type1/rules.mk
          index 985248d315..cae0ee553b 100644
          --- a/thirdparty/freetype/src/type1/rules.mk
          +++ b/thirdparty/freetype/src/type1/rules.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/type1/t1afm.c b/thirdparty/freetype/src/type1/t1afm.c
          index 4c18ed1955..4549b0f6a7 100644
          --- a/thirdparty/freetype/src/type1/t1afm.c
          +++ b/thirdparty/freetype/src/type1/t1afm.c
          @@ -4,7 +4,7 @@
            *
            *   AFM support for Type 1 fonts (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/type1/t1afm.h b/thirdparty/freetype/src/type1/t1afm.h
          index 86fe45ea3e..040ed68298 100644
          --- a/thirdparty/freetype/src/type1/t1afm.h
          +++ b/thirdparty/freetype/src/type1/t1afm.h
          @@ -4,7 +4,7 @@
            *
            *   AFM support for Type 1 fonts (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/type1/t1driver.c b/thirdparty/freetype/src/type1/t1driver.c
          index f4d7a089ae..dd31545cf6 100644
          --- a/thirdparty/freetype/src/type1/t1driver.c
          +++ b/thirdparty/freetype/src/type1/t1driver.c
          @@ -4,7 +4,7 @@
            *
            *   Type 1 driver interface (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/type1/t1driver.h b/thirdparty/freetype/src/type1/t1driver.h
          index 20a827f898..9fe1940334 100644
          --- a/thirdparty/freetype/src/type1/t1driver.h
          +++ b/thirdparty/freetype/src/type1/t1driver.h
          @@ -4,7 +4,7 @@
            *
            *   High-level Type 1 driver interface (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/type1/t1errors.h b/thirdparty/freetype/src/type1/t1errors.h
          index 18ef75452b..1b87c42f18 100644
          --- a/thirdparty/freetype/src/type1/t1errors.h
          +++ b/thirdparty/freetype/src/type1/t1errors.h
          @@ -4,7 +4,7 @@
            *
            *   Type 1 error codes (specification only).
            *
          - * Copyright (C) 2001-2021 by
          + * Copyright (C) 2001-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/type1/t1gload.c b/thirdparty/freetype/src/type1/t1gload.c
          index 86649edf3a..540231561c 100644
          --- a/thirdparty/freetype/src/type1/t1gload.c
          +++ b/thirdparty/freetype/src/type1/t1gload.c
          @@ -4,7 +4,7 @@
            *
            *   Type 1 Glyph Loader (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/type1/t1gload.h b/thirdparty/freetype/src/type1/t1gload.h
          index a924d551a9..fdb985264f 100644
          --- a/thirdparty/freetype/src/type1/t1gload.h
          +++ b/thirdparty/freetype/src/type1/t1gload.h
          @@ -4,7 +4,7 @@
            *
            *   Type 1 Glyph Loader (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/type1/t1load.c b/thirdparty/freetype/src/type1/t1load.c
          index bb62c79902..6f54e7d3f9 100644
          --- a/thirdparty/freetype/src/type1/t1load.c
          +++ b/thirdparty/freetype/src/type1/t1load.c
          @@ -4,7 +4,7 @@
            *
            *   Type 1 font loader (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -1530,8 +1530,8 @@
           
                 /* we use a T1_Table to store our charnames */
                 loader->num_chars = encode->num_chars = array_size;
          -      if ( FT_NEW_ARRAY( encode->char_index, array_size )     ||
          -           FT_NEW_ARRAY( encode->char_name,  array_size )     ||
          +      if ( FT_QNEW_ARRAY( encode->char_index, array_size )    ||
          +           FT_QNEW_ARRAY( encode->char_name,  array_size )    ||
                      FT_SET_ERROR( psaux->ps_table_funcs->init(
                                      char_table, array_size, memory ) ) )
                 {
          @@ -1772,7 +1772,7 @@
           
                 if ( !loader->subrs_hash )
                 {
          -        if ( FT_NEW( loader->subrs_hash ) )
          +        if ( FT_QNEW( loader->subrs_hash ) )
                     goto Fail;
           
                   error = ft_hash_num_init( loader->subrs_hash, memory );
          diff --git a/thirdparty/freetype/src/type1/t1load.h b/thirdparty/freetype/src/type1/t1load.h
          index ba19adb147..a6d46eb1e4 100644
          --- a/thirdparty/freetype/src/type1/t1load.h
          +++ b/thirdparty/freetype/src/type1/t1load.h
          @@ -4,7 +4,7 @@
            *
            *   Type 1 font loader (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/type1/t1objs.c b/thirdparty/freetype/src/type1/t1objs.c
          index 50dad038fd..847ae0e64b 100644
          --- a/thirdparty/freetype/src/type1/t1objs.c
          +++ b/thirdparty/freetype/src/type1/t1objs.c
          @@ -4,7 +4,7 @@
            *
            *   Type 1 objects manager (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/type1/t1objs.h b/thirdparty/freetype/src/type1/t1objs.h
          index 5f103b5066..e632fb58bd 100644
          --- a/thirdparty/freetype/src/type1/t1objs.h
          +++ b/thirdparty/freetype/src/type1/t1objs.h
          @@ -4,7 +4,7 @@
            *
            *   Type 1 objects manager (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/type1/t1parse.c b/thirdparty/freetype/src/type1/t1parse.c
          index 9f226296a9..95dc97d79a 100644
          --- a/thirdparty/freetype/src/type1/t1parse.c
          +++ b/thirdparty/freetype/src/type1/t1parse.c
          @@ -4,7 +4,7 @@
            *
            *   Type 1 parser (body).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/type1/t1parse.h b/thirdparty/freetype/src/type1/t1parse.h
          index 247ff73b2c..d9c7e3b56a 100644
          --- a/thirdparty/freetype/src/type1/t1parse.h
          +++ b/thirdparty/freetype/src/type1/t1parse.h
          @@ -4,7 +4,7 @@
            *
            *   Type 1 parser (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/type1/t1tokens.h b/thirdparty/freetype/src/type1/t1tokens.h
          index 13ac8ac1c7..79080d9e4d 100644
          --- a/thirdparty/freetype/src/type1/t1tokens.h
          +++ b/thirdparty/freetype/src/type1/t1tokens.h
          @@ -4,7 +4,7 @@
            *
            *   Type 1 tokenizer (specification).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/type1/type1.c b/thirdparty/freetype/src/type1/type1.c
          index 003b78cb86..6f11249288 100644
          --- a/thirdparty/freetype/src/type1/type1.c
          +++ b/thirdparty/freetype/src/type1/type1.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType Type 1 driver component (body only).
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/type42/module.mk b/thirdparty/freetype/src/type42/module.mk
          index ec3214cda6..f619fa5c73 100644
          --- a/thirdparty/freetype/src/type42/module.mk
          +++ b/thirdparty/freetype/src/type42/module.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 2002-2021 by
          +# Copyright (C) 2002-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/type42/rules.mk b/thirdparty/freetype/src/type42/rules.mk
          index 9821943eaf..9d26c879d9 100644
          --- a/thirdparty/freetype/src/type42/rules.mk
          +++ b/thirdparty/freetype/src/type42/rules.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 2002-2021 by
          +# Copyright (C) 2002-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/type42/t42drivr.c b/thirdparty/freetype/src/type42/t42drivr.c
          index e74ba1deba..45d8c3821b 100644
          --- a/thirdparty/freetype/src/type42/t42drivr.c
          +++ b/thirdparty/freetype/src/type42/t42drivr.c
          @@ -4,7 +4,7 @@
            *
            *   High-level Type 42 driver interface (body).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * Roberto Alameda.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -150,22 +150,13 @@
             }
           
           
          -  static FT_Error
          -  t42_ps_get_font_private( FT_Face         face,
          -                           PS_PrivateRec*  afont_private )
          -  {
          -    *afont_private = ((T42_Face)face)->type1.private_dict;
          -
          -    return FT_Err_Ok;
          -  }
          -
          -
             static const FT_Service_PsInfoRec  t42_service_ps_info =
             {
               (PS_GetFontInfoFunc)   t42_ps_get_font_info,    /* ps_get_font_info    */
               (PS_GetFontExtraFunc)  t42_ps_get_font_extra,   /* ps_get_font_extra   */
               (PS_HasGlyphNamesFunc) t42_ps_has_glyph_names,  /* ps_has_glyph_names  */
          -    (PS_GetFontPrivateFunc)t42_ps_get_font_private, /* ps_get_font_private */
          +    /* Type42 fonts don't have a Private dict */
          +    (PS_GetFontPrivateFunc)NULL,                    /* ps_get_font_private */
               /* not implemented */
               (PS_GetFontValueFunc)  NULL                     /* ps_get_font_value   */
             };
          diff --git a/thirdparty/freetype/src/type42/t42drivr.h b/thirdparty/freetype/src/type42/t42drivr.h
          index c6d8a4409e..95e1207b68 100644
          --- a/thirdparty/freetype/src/type42/t42drivr.h
          +++ b/thirdparty/freetype/src/type42/t42drivr.h
          @@ -4,7 +4,7 @@
            *
            *   High-level Type 42 driver interface (specification).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * Roberto Alameda.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/type42/t42error.h b/thirdparty/freetype/src/type42/t42error.h
          index 470f5189a8..b278221006 100644
          --- a/thirdparty/freetype/src/type42/t42error.h
          +++ b/thirdparty/freetype/src/type42/t42error.h
          @@ -4,7 +4,7 @@
            *
            *   Type 42 error codes (specification only).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/type42/t42objs.c b/thirdparty/freetype/src/type42/t42objs.c
          index 03955e945b..4078777f25 100644
          --- a/thirdparty/freetype/src/type42/t42objs.c
          +++ b/thirdparty/freetype/src/type42/t42objs.c
          @@ -4,7 +4,7 @@
            *
            *   Type 42 objects manager (body).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * Roberto Alameda.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -44,14 +44,8 @@
           
               parser = &loader.parser;
           
          -    if ( FT_QALLOC( face->ttf_data, 12 ) )
          -      goto Exit;
          -
          -    /* while parsing the font we always update `face->ttf_size' so that */
          -    /* even in case of buggy data (which might lead to premature end of */
          -    /* scanning without causing an error) the call to `FT_Open_Face' in */
          -    /* `T42_Face_Init' passes the correct size                          */
          -    face->ttf_size = 12;
          +    face->ttf_data = NULL;
          +    face->ttf_size = 0;
           
               error = t42_parser_init( parser,
                                        face->root.stream,
          @@ -152,6 +146,11 @@
           
             Exit:
               t42_loader_done( &loader );
          +    if ( error )
          +    {
          +      FT_FREE(face->ttf_data);
          +      face->ttf_size = 0;
          +    }
               return error;
             }
           
          diff --git a/thirdparty/freetype/src/type42/t42objs.h b/thirdparty/freetype/src/type42/t42objs.h
          index cbd344ffbd..e677996a30 100644
          --- a/thirdparty/freetype/src/type42/t42objs.h
          +++ b/thirdparty/freetype/src/type42/t42objs.h
          @@ -4,7 +4,7 @@
            *
            *   Type 42 objects manager (specification).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * Roberto Alameda.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/type42/t42parse.c b/thirdparty/freetype/src/type42/t42parse.c
          index ea2c5198a9..f14b4226c7 100644
          --- a/thirdparty/freetype/src/type42/t42parse.c
          +++ b/thirdparty/freetype/src/type42/t42parse.c
          @@ -4,7 +4,7 @@
            *
            *   Type 42 font parser (body).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * Roberto Alameda.
            *
            * This file is part of the FreeType project, and may only be used,
          @@ -363,8 +363,8 @@
           
                 /* we use a T1_Table to store our charnames */
                 loader->num_chars = encode->num_chars = count;
          -      if ( FT_NEW_ARRAY( encode->char_index, count )     ||
          -           FT_NEW_ARRAY( encode->char_name,  count )     ||
          +      if ( FT_QNEW_ARRAY( encode->char_index, count )    ||
          +           FT_QNEW_ARRAY( encode->char_name,  count )    ||
                      FT_SET_ERROR( psaux->ps_table_funcs->init(
                                      char_table, count, memory ) ) )
                 {
          @@ -538,7 +538,8 @@
               FT_Byte*    limit  = parser->root.limit;
               FT_Error    error;
               FT_Int      num_tables = 0;
          -    FT_Long     count;
          +    FT_Long     ttf_count;
          +    FT_Long     ttf_reserved;
           
               FT_ULong    n, string_size, old_string_size, real_size;
               FT_Byte*    string_buf = NULL;
          @@ -546,6 +547,9 @@
           
               T42_Load_Status  status;
           
          +    /** There should only be one sfnts array, but free any previous. */
          +    FT_FREE( face->ttf_data );
          +    face->ttf_size = 0;
           
               /* The format is                                */
               /*                                              */
          @@ -574,7 +578,10 @@
               status          = BEFORE_START;
               string_size     = 0;
               old_string_size = 0;
          -    count           = 0;
          +    ttf_count       = 0;
          +    ttf_reserved    = 12;
          +    if ( FT_QALLOC( face->ttf_data, ttf_reserved ) )
          +      goto Fail;
           
               FT_TRACE2(( "\n" ));
               FT_TRACE2(( "t42_parse_sfnts:\n" ));
          @@ -589,6 +596,7 @@
                 if ( *cur == ']' )
                 {
                   parser->root.cursor++;
          +        face->ttf_size = ttf_count;
                   goto Exit;
                 }
           
          @@ -684,7 +692,7 @@
                 }
           
                 FT_TRACE2(( "  PS string size %5lu bytes, offset 0x%08lx (%lu)\n",
          -                  string_size, count, count ));
          +                  string_size, ttf_count, ttf_count ));
           
                 /* The whole TTF is now loaded into `string_buf'.  We are */
                 /* checking its contents while copying it to `ttf_data'.  */
          @@ -697,43 +705,48 @@
                   {
                   case BEFORE_START:
                     /* load offset table, 12 bytes */
          -          if ( count < 12 )
          +          if ( ttf_count < 12 )
                     {
          -            face->ttf_data[count++] = string_buf[n];
          +            face->ttf_data[ttf_count++] = string_buf[n];
                       continue;
                     }
                     else
                     {
          -            num_tables     = 16 * face->ttf_data[4] + face->ttf_data[5];
          -            status         = BEFORE_TABLE_DIR;
          -            face->ttf_size = 12 + 16 * num_tables;
          +            FT_Long ttf_reserved_prev = ttf_reserved;
          +
          +
          +            num_tables   = 16 * face->ttf_data[4] + face->ttf_data[5];
          +            status       = BEFORE_TABLE_DIR;
          +            ttf_reserved = 12 + 16 * num_tables;
           
                       FT_TRACE2(( "  SFNT directory contains %d tables\n",
                                   num_tables ));
           
          -            if ( (FT_Long)size < face->ttf_size )
          +            if ( (FT_Long)size < ttf_reserved )
                       {
                         FT_ERROR(( "t42_parse_sfnts: invalid data in sfnts array\n" ));
                         error = FT_THROW( Invalid_File_Format );
                         goto Fail;
                       }
           
          -            if ( FT_QREALLOC( face->ttf_data, 12, face->ttf_size ) )
          +            if ( FT_QREALLOC( face->ttf_data, ttf_reserved_prev,
          +                              ttf_reserved ) )
                         goto Fail;
                     }
                     /* fall through */
           
                   case BEFORE_TABLE_DIR:
                     /* the offset table is read; read the table directory */
          -          if ( count < face->ttf_size )
          +          if ( ttf_count < ttf_reserved )
                     {
          -            face->ttf_data[count++] = string_buf[n];
          +            face->ttf_data[ttf_count++] = string_buf[n];
                       continue;
                     }
                     else
                     {
                       int       i;
                       FT_ULong  len;
          +            FT_Long ttf_reserved_prev = ttf_reserved;
           
           
                       FT_TRACE2(( "\n" ));
          @@ -749,7 +762,7 @@
                         FT_TRACE2(( "   %4i  0x%08lx (%lu)\n", i, len, len ));
           
                         if ( len > size                               ||
          -                   face->ttf_size > (FT_Long)( size - len ) )
          +                   ttf_reserved > (FT_Long)( size - len ) )
                         {
                           FT_ERROR(( "t42_parse_sfnts:"
                                      " invalid data in sfnts array\n" ));
          @@ -758,30 +771,31 @@
                         }
           
                         /* Pad to a 4-byte boundary length */
          -              face->ttf_size += (FT_Long)( ( len + 3 ) & ~3U );
          +              ttf_reserved += (FT_Long)( ( len + 3 ) & ~3U );
                       }
          +            ttf_reserved += 1;
           
                       status = OTHER_TABLES;
           
                       FT_TRACE2(( "\n" ));
          -            FT_TRACE2(( "  allocating %ld bytes\n", face->ttf_size + 1 ));
          +            FT_TRACE2(( "  allocating %ld bytes\n", ttf_reserved ));
                       FT_TRACE2(( "\n" ));
           
          -            if ( FT_QREALLOC( face->ttf_data, 12 + 16 * num_tables,
          -                              face->ttf_size + 1 ) )
          +            if ( FT_QREALLOC( face->ttf_data, ttf_reserved_prev,
          +                              ttf_reserved ) )
                         goto Fail;
                     }
                     /* fall through */
           
                   case OTHER_TABLES:
                     /* all other tables are just copied */
          -          if ( count >= face->ttf_size )
          +          if ( ttf_count >= ttf_reserved )
                     {
                       FT_ERROR(( "t42_parse_sfnts: too much binary data\n" ));
                       error = FT_THROW( Invalid_File_Format );
                       goto Fail;
                     }
          -          face->ttf_data[count++] = string_buf[n];
          +          face->ttf_data[ttf_count++] = string_buf[n];
                   }
                 }
           
          @@ -795,6 +809,11 @@
               parser->root.error = error;
           
             Exit:
          +    if ( parser->root.error )
          +    {
          +      FT_FREE( face->ttf_data );
          +      face->ttf_size = 0;
          +    }
               if ( allocated )
                 FT_FREE( string_buf );
             }
          diff --git a/thirdparty/freetype/src/type42/t42parse.h b/thirdparty/freetype/src/type42/t42parse.h
          index 0fbd2b5e0b..fa633e7f1e 100644
          --- a/thirdparty/freetype/src/type42/t42parse.h
          +++ b/thirdparty/freetype/src/type42/t42parse.h
          @@ -4,7 +4,7 @@
            *
            *   Type 42 font parser (specification).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * Roberto Alameda.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/type42/t42types.h b/thirdparty/freetype/src/type42/t42types.h
          index ea2f03e893..985bdfda98 100644
          --- a/thirdparty/freetype/src/type42/t42types.h
          +++ b/thirdparty/freetype/src/type42/t42types.h
          @@ -4,7 +4,7 @@
            *
            *   Type 42 font data types (specification only).
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * Roberto Alameda.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/type42/type42.c b/thirdparty/freetype/src/type42/type42.c
          index d8d3936bdf..ccf5d472b8 100644
          --- a/thirdparty/freetype/src/type42/type42.c
          +++ b/thirdparty/freetype/src/type42/type42.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType Type 42 driver component.
            *
          - * Copyright (C) 2002-2021 by
          + * Copyright (C) 2002-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/winfonts/fnterrs.h b/thirdparty/freetype/src/winfonts/fnterrs.h
          index d582a9b99c..10564e107f 100644
          --- a/thirdparty/freetype/src/winfonts/fnterrs.h
          +++ b/thirdparty/freetype/src/winfonts/fnterrs.h
          @@ -4,7 +4,7 @@
            *
            *   Win FNT/FON error codes (specification only).
            *
          - * Copyright (C) 2001-2021 by
          + * Copyright (C) 2001-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            *
            * This file is part of the FreeType project, and may only be used,
          diff --git a/thirdparty/freetype/src/winfonts/module.mk b/thirdparty/freetype/src/winfonts/module.mk
          index 4a8580cabd..7a49201fa8 100644
          --- a/thirdparty/freetype/src/winfonts/module.mk
          +++ b/thirdparty/freetype/src/winfonts/module.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/winfonts/rules.mk b/thirdparty/freetype/src/winfonts/rules.mk
          index 1384f23b6f..2f67ab45f4 100644
          --- a/thirdparty/freetype/src/winfonts/rules.mk
          +++ b/thirdparty/freetype/src/winfonts/rules.mk
          @@ -3,7 +3,7 @@
           #
           
           
          -# Copyright (C) 1996-2021 by
          +# Copyright (C) 1996-2022 by
           # David Turner, Robert Wilhelm, and Werner Lemberg.
           #
           # This file is part of the FreeType project, and may only be used, modified,
          diff --git a/thirdparty/freetype/src/winfonts/winfnt.c b/thirdparty/freetype/src/winfonts/winfnt.c
          index b4fabad283..361990da33 100644
          --- a/thirdparty/freetype/src/winfonts/winfnt.c
          +++ b/thirdparty/freetype/src/winfonts/winfnt.c
          @@ -4,7 +4,7 @@
            *
            *   FreeType font driver for Windows FNT/FON files
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            * Copyright 2003 Huw D M Davies for Codeweavers
            * Copyright 2007 Dmitry Timoshkov for Codeweavers
          @@ -352,6 +352,10 @@
           
                     count = FT_GET_USHORT_LE();
           
          +          FT_TRACE2(( type_id == 0x8007U ? "RT_FONTDIR count %hu\n" :
          +                      type_id == 0x8008U ? "RT_FONT count %hu\n" : "",
          +                                           count ));
          +
                     if ( type_id == 0x8008U )
                     {
                       font_count  = count;
          diff --git a/thirdparty/freetype/src/winfonts/winfnt.h b/thirdparty/freetype/src/winfonts/winfnt.h
          index a7134abd9c..7e6f5915e7 100644
          --- a/thirdparty/freetype/src/winfonts/winfnt.h
          +++ b/thirdparty/freetype/src/winfonts/winfnt.h
          @@ -4,7 +4,7 @@
            *
            *   FreeType font driver for Windows FNT/FON files
            *
          - * Copyright (C) 1996-2021 by
          + * Copyright (C) 1996-2022 by
            * David Turner, Robert Wilhelm, and Werner Lemberg.
            * Copyright 2007 Dmitry Timoshkov for Codeweavers
            *