Snap for 7550844 from f8938a05251ef87913311e331869f8ea900a0d68 to mainline-os-statsd-release

Change-Id: Ieba2857f2ddbeaa25c09a91238d2f2319f143c71
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..fbd04c1
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,16 @@
+BasedOnStyle: Chromium
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: true
+AlignConsecutiveDeclarations: true
+AlignConsecutiveMacros: true
+AlignEscapedNewlines: true
+# AlignOperands: Align
+AlignTrailingComments: true
+AlwaysBreakAfterReturnType: AllDefinitions
+BreakBeforeBraces: Allman
+ColumnLimit: 80
+DerivePointerAlignment: false
+IndentCaseLabels: false
+PointerAlignment: Left
+SpaceBeforeParens: ControlStatements
+SpacesInParentheses: true
diff --git a/.mailmap b/.mailmap
index c406e23..52d0506 100644
--- a/.mailmap
+++ b/.mailmap
@@ -7,3 +7,4 @@
 Suzuki, Toshiya (鈴木俊哉) <mpsuzuki@hiroshima-u.ac.jp> suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
 Ben Wagner <bungeman@gmail.com> Bungeman <bungeman@gmail.com>
 Ewald Hew (Hew Yih Shiuan 丘毅宣) <ewaldhew@gmail.com>
+Nikhil Ramakrishnan (निखिल रामकृष्णन) <ramakrishnan.nikhil@gmail.com>
diff --git a/Android.bp b/Android.bp
index 8b3d01d..127d6e6 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,12 +1,49 @@
-cc_library {
-    name: "libft2",
+package {
+    default_applicable_licenses: ["external_freetype_license"],
+}
+
+// Added automatically by a large-scale-change that took the approach of
+// 'apply every license found to every target'. While this makes sure we respect
+// every license restriction, it may not be entirely correct.
+//
+// e.g. GPL in an MIT project might only apply to the contrib/ directory.
+//
+// Please consider splitting the single license below into multiple licenses,
+// taking care not to lose any license_kind information, and overriding the
+// default license using the 'licenses: [...]' property on targets as needed.
+//
+// For unused files, consider creating a 'fileGroup' with "//visibility:private"
+// to attach the license to, and including a comment whether the files may be
+// used in the current project.
+// See: http://go/android-license-faq
+license {
+    name: "external_freetype_license",
+    visibility: [":__subpackages__"],
+    license_kinds: [
+        "SPDX-license-identifier-BSD",
+        "SPDX-license-identifier-FTL",
+        "SPDX-license-identifier-GPL",
+        "SPDX-license-identifier-GPL-2.0",
+        "SPDX-license-identifier-GPL-3.0",
+        "SPDX-license-identifier-ISC",
+        "SPDX-license-identifier-LGPL",
+        "SPDX-license-identifier-MIT",
+        "SPDX-license-identifier-Zlib",
+        "legacy_unencumbered",
+    ],
+    license_text: [
+        "NOTICE",
+    ],
+}
+
+cc_defaults {
+    name: "libft2_defaults",
     host_supported: true,
     // TODO(b/153609531): remove when no longer needed.
     native_bridge_supported: true,
 
     // compile in ARM mode, since the glyph loader/renderer is a hotspot
     // when loading complex pages in the browser
-    //
     arch: {
         arm: {
             instruction_set: "arm",
@@ -50,18 +87,26 @@
         "-DDARWIN_NO_CARBON",
         "-DFT2_BUILD_LIBRARY",
 
-        // Usually these are defined in include/freetype/config/ftoption.h
-        // we have commented them and defined them here to allow for the
-        // no dependency variant libft2.nodep below.
-        "-DFT_CONFIG_OPTION_USE_PNG",
-        "-DFT_CONFIG_OPTION_USE_ZLIB",
-
         "-O2",
 
         // Upstream ignores unused parameter warning
         "-Wno-unused-parameter",
         // Disabling some of modules results in warnings
         "-Wno-unused-variable",
+    ],
+}
+
+cc_library {
+    name: "libft2",
+    defaults: ["libft2_defaults"],
+
+    cflags: [
+        // Usually these are defined in include/freetype/config/ftoption.h
+        // we have commented them and defined them here to allow for the
+        // no dependency variant libft2.nodep below.
+        "-DFT_CONFIG_OPTION_USE_PNG",
+        "-DFT_CONFIG_OPTION_USE_ZLIB",
+
         // the following is for testing only, and should not be used in final
         // builds of the product
         // "-DTT_CONFIG_OPTION_BYTECODE_INTERPRETER",
@@ -89,65 +134,16 @@
             enabled: true,
         },
     },
-}
 
-llndk_library {
-    name: "libft2",
-    vendor_available: false,
-    symbol_file: "libft2.map.txt",
-    export_include_dirs: ["include"],
+    llndk: {
+        private: true,
+        symbol_file: "libft2.map.txt",
+    },
 }
 
 // variant of libft2 without any library dependencies.
 cc_library_static {
     name: "libft2.nodep",
-    host_supported: true,
-
-    // compile in ARM mode, since the glyph loader/renderer is a hotspot
-    // when loading complex pages in the browser
-    arch: {
-        arm: {
-            instruction_set: "arm",
-        },
-    },
-
-    srcs: [
-        "src/autofit/autofit.c",
-        "src/base/ftbase.c",
-        "src/base/ftbbox.c",
-        "src/base/ftbitmap.c",
-        "src/base/ftdebug.c",
-        "src/base/ftfstype.c",
-        "src/base/ftgasp.c",
-        "src/base/ftglyph.c",
-        "src/base/ftinit.c",
-        "src/base/ftmm.c",
-        "src/base/ftstroke.c",
-        "src/base/fttype1.c",
-        "src/base/ftsystem.c",
-        "src/cid/type1cid.c",
-        "src/cff/cff.c",
-        "src/gzip/ftgzip.c",
-        "src/psaux/psaux.c",
-        "src/pshinter/pshinter.c",
-        "src/psnames/psnames.c",
-        "src/raster/raster.c",
-        "src/sfnt/sfnt.c",
-        "src/smooth/smooth.c",
-        "src/truetype/truetype.c",
-        "src/type1/type1.c",
-    ],
-
-    export_include_dirs: ["include"],
-
-    cflags: [
-        "-W",
-        "-Wall",
-        "-Werror",
-
-        "-DDARWIN_NO_CARBON",
-        "-DFT2_BUILD_LIBRARY",
-
-        "-O2",
-    ],
+    vendor_available: true,
+    defaults: ["libft2_defaults"],
 }
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e3ffb83..3ed55aa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
 # CMakeLists.txt
 #
-# Copyright (C) 2013-2019 by
+# Copyright (C) 2013-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # Written originally by John Cary <cary@txcorp.com>
@@ -14,14 +14,14 @@
 #
 # The following will 1. create a build directory and 2. change into it and
 # call cmake to configure the build with default parameters as a static
-# library.
+# library. See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html
+# for information about Debug, Release, etc. builds.
 #
-#   cmake -E make_directory build
-#   cmake -E chdir build cmake ..
+#   cmake -B build -D CMAKE_BUILD_TYPE=Release
 #
 # For a dynamic library, use
 #
-#   cmake -E chdir build cmake -D BUILD_SHARED_LIBS:BOOL=true ..
+#   cmake -B build -D BUILD_SHARED_LIBS=true -D CMAKE_BUILD_TYPE=Release
 #
 # For a framework on OS X, use
 #
@@ -68,14 +68,26 @@
 # . `CMakeLists.txt' is provided as-is since it is normally not used by the
 #   developer team.
 #
-# . Set the `FT_WITH_ZLIB', `FT_WITH_BZIP2', `FT_WITH_PNG', and
-#   `FT_WITH_HARFBUZZ' CMake variables to `ON' to force using a dependency.
-#   Leave a variable undefined (which is the default) to use the dependency
-#   only if it is available.  Set `CMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=TRUE' to
-#   disable a dependency completely (CMake package name, so `BZip2' instead of
-#   `BZIP2'). Example:
+# . Set the `FT_WITH_ZLIB', `FT_WITH_BZIP2', `FT_WITH_PNG',
+#   `FT_WITH_HARFBUZZ', and `FT_WITH_BROTLI' CMake variables to `ON' to
+#   force using a dependency.  Leave a variable undefined (which is the
+#   default) to use the dependency only if it is available. Example:
 #
-#     cmake -DFT_WITH_ZLIB=ON -DCMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=TRUE [...]
+#     cmake -B build -D FT_WITH_ZLIB=ON \
+#                    -D FT_WITH_BZIP2=ON \
+#                    -D FT_WITH_PNG=ON \
+#                    -D FT_WITH_HARFBUZZ=ON \
+#                    -D FT_WITH_BROTLI=ON [...]
+#
+#   Set `CMAKE_DISABLE_FIND_PACKAGE_XXX=TRUE' to disable a dependency completely
+#   (where `XXX' is a CMake package name like `BZip2').  Example for disabling all
+#   dependencies:
+#
+#     cmake -B build -D CMAKE_DISABLE_FIND_PACKAGE_ZLIB=TRUE \
+#                    -D CMAKE_DISABLE_FIND_PACKAGE_BZip2=TRUE \
+#                    -D CMAKE_DISABLE_FIND_PACKAGE_PNG=TRUE \
+#                    -D CMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=TRUE \
+#                    -D CMAKE_DISABLE_FIND_PACKAGE_BrotliDec=TRUE [...]
 #
 # . Installation of FreeType can be controlled with the CMake variables
 #   `SKIP_INSTALL_HEADERS', `SKIP_INSTALL_LIBRARIES', and `SKIP_INSTALL_ALL'
@@ -89,7 +101,7 @@
 
 if (NOT CMAKE_VERSION VERSION_LESS 3.3)
   # Allow symbol visibility settings also on static libraries. CMake < 3.3
-  # only sets the propery on a shared library build.
+  # only sets the property on a shared library build.
   cmake_policy(SET CMP0063 NEW)
 endif ()
 
@@ -135,26 +147,34 @@
 
 set(VERSION_MAJOR "2")
 set(VERSION_MINOR "10")
-set(VERSION_PATCH "1")
+set(VERSION_PATCH "4")
 
-# SOVERSION scheme: CURRENT.AGE.REVISION
-#   If there was an incompatible interface change:
-#     Increment CURRENT. Set AGE and REVISION to 0
-#   If there was a compatible interface change:
-#     Increment AGE. Set REVISION to 0
-#   If the source code was changed, but there were no interface changes:
-#     Increment REVISION.
-set(LIBRARY_VERSION "6.16.0")
-set(LIBRARY_SOVERSION "6")
+# Generate LIBRARY_VERSION and LIBRARY_SOVERSION.
+set(LIBTOOL_REGEX "version_info='([0-9]+):([0-9]+):([0-9]+)'")
+file(STRINGS "${PROJECT_SOURCE_DIR}/builds/unix/configure.raw"
+  VERSION_INFO
+  REGEX ${LIBTOOL_REGEX})
+string(REGEX REPLACE
+  ${LIBTOOL_REGEX} "\\1"
+  LIBTOOL_CURRENT "${VERSION_INFO}")
+string(REGEX REPLACE
+  ${LIBTOOL_REGEX} "\\2"
+  LIBTOOL_REVISION "${VERSION_INFO}")
+string(REGEX REPLACE
+  ${LIBTOOL_REGEX} "\\3"
+  LIBTOOL_AGE "${VERSION_INFO}")
 
-# These options mean "require x and complain if not found". They'll get
-# optionally found anyway. Use `-DCMAKE_DISABLE_FIND_PACKAGE_x=TRUE` to disable
-# searching for a packge entirely (x is the CMake package name, so "BZip2"
-# instead of "BZIP2").
+# This is what libtool does internally on Unix platforms.
+math(EXPR LIBRARY_SOVERSION "${LIBTOOL_CURRENT} - ${LIBTOOL_AGE}")
+set(LIBRARY_VERSION "${LIBRARY_SOVERSION}.${LIBTOOL_AGE}.${LIBTOOL_REVISION}")
+
+# External dependency library detection is automatic. See the notes at the top
+# of this file, for how to force or disable dependencies completely.
 option(FT_WITH_ZLIB "Use system zlib instead of internal library." OFF)
 option(FT_WITH_BZIP2 "Support bzip2 compressed fonts." OFF)
 option(FT_WITH_PNG "Support PNG compressed OpenType embedded bitmaps." OFF)
 option(FT_WITH_HARFBUZZ "Improve auto-hinting of OpenType fonts." OFF)
+option(FT_WITH_BROTLI "Support compressed WOFF2 fonts." OFF)
 
 
 # Disallow in-source builds
@@ -185,10 +205,11 @@
 
 
 # Find dependencies
+set(HARFBUZZ_MIN_VERSION "1.8.0")
 if (FT_WITH_HARFBUZZ)
-  find_package(HarfBuzz 1.3.0 REQUIRED)
+  find_package(HarfBuzz ${HARFBUZZ_MIN_VERSION} REQUIRED)
 else ()
-  find_package(HarfBuzz 1.3.0)
+  find_package(HarfBuzz ${HARFBUZZ_MIN_VERSION})
 endif ()
 
 if (FT_WITH_PNG)
@@ -209,13 +230,18 @@
   find_package(BZip2)
 endif ()
 
+if (FT_WITH_BROTLI)
+  find_package(BrotliDec REQUIRED)
+else ()
+  find_package(BrotliDec)
+endif ()
+
 # Create the configuration file
 if (UNIX)
   check_include_file("unistd.h" HAVE_UNISTD_H)
   check_include_file("fcntl.h" HAVE_FCNTL_H)
-  check_include_file("stdint.h" HAVE_STDINT_H)
 
-  file(READ "${PROJECT_SOURCE_DIR}/builds/unix/ftconfig.in"
+  file(READ "${PROJECT_SOURCE_DIR}/builds/unix/ftconfig.h.in"
     FTCONFIG_H)
   if (HAVE_UNISTD_H)
     string(REGEX REPLACE
@@ -227,13 +253,6 @@
       "#undef +(HAVE_FCNTL_H)" "#define \\1 1"
       FTCONFIG_H "${FTCONFIG_H}")
   endif ()
-  if (HAVE_STDINT_H)
-    string(REGEX REPLACE
-      "#undef +(HAVE_STDINT_H)" "#define \\1 1"
-      FTCONFIG_H "${FTCONFIG_H}")
-  endif ()
-  string(REPLACE "/undef " "#undef "
-    FTCONFIG_H "${FTCONFIG_H}")
 else ()
   file(READ "${PROJECT_SOURCE_DIR}/include/freetype/config/ftconfig.h"
     FTCONFIG_H)
@@ -273,6 +292,11 @@
     "/\\* +(#define +FT_CONFIG_OPTION_USE_HARFBUZZ) +\\*/" "\\1"
     FTOPTION_H "${FTOPTION_H}")
 endif ()
+if (BROTLIDEC_FOUND)
+  string(REGEX REPLACE
+    "/\\* +(#define +FT_CONFIG_OPTION_USE_BROTLI) +\\*/" "\\1"
+    FTOPTION_H "${FTOPTION_H}")
+endif ()
 
 set(FTOPTION_H_NAME "${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h")
 if (EXISTS "${FTOPTION_H_NAME}")
@@ -308,7 +332,6 @@
   src/base/ftpfr.c
   src/base/ftstroke.c
   src/base/ftsynth.c
-  src/base/ftsystem.c
   src/base/fttype1.c
   src/base/ftwinfnt.c
   src/bdf/bdf.c
@@ -332,6 +355,12 @@
   src/winfonts/winfnt.c
 )
 
+if (UNIX)
+  list(APPEND BASE_SRCS "builds/unix/ftsystem.c")
+else ()
+  list(APPEND BASE_SRCS "src/base/ftsystem.c")
+endif ()
+
 if (WIN32)
   enable_language(RC)
   list(APPEND BASE_SRCS builds/windows/ftdebug.c
@@ -390,7 +419,11 @@
       $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
     PRIVATE
       ${CMAKE_CURRENT_BINARY_DIR}/include
-      ${CMAKE_CURRENT_SOURCE_DIR}/include)
+      ${CMAKE_CURRENT_SOURCE_DIR}/include
+      
+      # Make <ftconfig.h> available for builds/unix/ftsystem.c.
+      ${CMAKE_CURRENT_BINARY_DIR}/include/freetype/config
+)
 
 
 if (BUILD_FRAMEWORK)
@@ -411,23 +444,29 @@
 if (ZLIB_FOUND)
   target_link_libraries(freetype PRIVATE ${ZLIB_LIBRARIES})
   target_include_directories(freetype PRIVATE ${ZLIB_INCLUDE_DIRS})
-  list(APPEND PKG_CONFIG_REQUIRED_PRIVATE zlib)
+  list(APPEND PKG_CONFIG_REQUIRED_PRIVATE "zlib")
 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_REQUIRED_PRIVATE bzip2)
+  list(APPEND PKG_CONFIG_REQUIRED_PRIVATE "bzip2")
 endif ()
 if (PNG_FOUND)
   target_link_libraries(freetype PRIVATE ${PNG_LIBRARIES})
   target_compile_definitions(freetype PRIVATE ${PNG_DEFINITIONS})
   target_include_directories(freetype PRIVATE ${PNG_INCLUDE_DIRS})
-  list(APPEND PKG_CONFIG_REQUIRED_PRIVATE libpng)
+  list(APPEND PKG_CONFIG_REQUIRED_PRIVATE "libpng")
 endif ()
 if (HARFBUZZ_FOUND)
   target_link_libraries(freetype PRIVATE ${HARFBUZZ_LIBRARIES})
   target_include_directories(freetype PRIVATE ${HARFBUZZ_INCLUDE_DIRS})
-  list(APPEND PKG_CONFIG_REQUIRED_PRIVATE harfbuzz)
+  list(APPEND PKG_CONFIG_REQUIRED_PRIVATE "harfbuzz >= ${HARFBUZZ_MIN_VERSION}")
+endif ()
+if (BROTLIDEC_FOUND)
+  target_link_libraries(freetype PRIVATE ${BROTLIDEC_LIBRARIES})
+  target_compile_definitions(freetype PRIVATE ${BROTLIDEC_DEFINITIONS})
+  target_include_directories(freetype PRIVATE ${BROTLIDEC_INCLUDE_DIRS})
+  list(APPEND PKG_CONFIG_REQUIRED_PRIVATE "libbrotlidec")
 endif ()
 
 
@@ -453,7 +492,7 @@
 if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
   # Generate the pkg-config file
   if (UNIX)
-    file(READ ${PROJECT_SOURCE_DIR}/builds/unix/freetype2.in FREETYPE2_PC_IN)
+    file(READ "${PROJECT_SOURCE_DIR}/builds/unix/freetype2.in" FREETYPE2_PC_IN)
 
     string(REPLACE ";" ", " PKG_CONFIG_REQUIRED_PRIVATE "${PKG_CONFIG_REQUIRED_PRIVATE}")
 
@@ -465,7 +504,7 @@
            FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
     string(REPLACE "%includedir%" "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}"
            FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
-    string(REPLACE "%ft_version%" "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
+    string(REPLACE "%ft_version%" "${LIBTOOL_CURRENT}.${LIBTOOL_REVISION}.${LIBTOOL_AGE}"
            FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
     string(REPLACE "%REQUIRES_PRIVATE%" "${PKG_CONFIG_REQUIRED_PRIVATE}"
            FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
@@ -488,6 +527,12 @@
       COMPONENT pkgconfig)
   endif ()
 
+  include(CMakePackageConfigHelpers)
+  write_basic_package_version_file(
+    ${PROJECT_BINARY_DIR}/freetype-config-version.cmake
+    VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
+    COMPATIBILITY SameMajorVersion)
+
   install(
     TARGETS freetype
       EXPORT freetype-targets
@@ -501,6 +546,10 @@
       DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/freetype
       FILE freetype-config.cmake
       COMPONENT headers)
+  install(
+    FILES ${PROJECT_BINARY_DIR}/freetype-config-version.cmake
+    DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/freetype
+    COMPONENT headers)
 endif ()
 
 
diff --git a/ChangeLog b/ChangeLog
index 6450a60..42f7c34 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,1949 @@
+2020-10-20  Werner Lemberg  <wl@gnu.org>
+
+	* Version 2.10.4 released.
+	==========================
+
+
+	Tag sources with `VER-2-10-4'.
+
+	* docs/VERSION.TXT: Add entry for version 2.10.4.
+	* docs/CHANGES: Updated.
+
+	* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
+	builds/windows/visualc/index.html,
+	builds/windows/visualce/index.html,
+	builds/wince/vc2005-ce/index.html,
+	builds/wince/vc2008-ce/index.html, docs/freetype-config.1:
+	s/2.10.3/2.10.4/, s/2103/2104/.
+
+	* include/freetype/freetype.h (FREETYPE_PATCH): Set to 4.
+
+	* builds/unix/configure.raw (version_info): Set to 23:4:17.
+	* CMakeLists.txt (VERSION_PATCH): Set to 4.
+
+2020-10-19  Werner Lemberg  <wl@gnu.org>
+
+	[sfnt] Fix heap buffer overflow (#59308).
+
+	This is CVE-2020-15999.
+
+	* src/sfnt/pngshim.c (Load_SBit_Png): Test bitmap size earlier.
+
+2020-10-17  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	* src/sfnt/tt{colr,cpal}.c: Fix signedness warnings from VC++.
+
+2020-10-17  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	* src/sfnt/sfwoff2.c (Read255UShort): Tweak types to please VC++.
+
+2020-10-10  Werner Lemberg  <wl@gnu.org>
+
+	* Version 2.10.3 released.
+	==========================
+
+
+	Tag sources with `VER-2-10-3'.
+
+	* docs/VERSION.TXT: Add entry for version 2.10.3.
+
+	* README, src/base/ftver.rc, builds/windows/vc2010/index.html,
+	builds/windows/visualc/index.html,
+	builds/windows/visualce/index.html,
+	builds/wince/vc2005-ce/index.html,
+	builds/wince/vc2008-ce/index.html, docs/freetype-config.1:
+	s/2.10.2/2.10.3/, s/2102/2103/.
+
+	* include/freetype/freetype.h (FREETYPE_PATCH): Set to 3.
+
+	* builds/unix/configure.raw (version_info): Set to 23:3:17.
+	* CMakeLists.txt (VERSION_PATCH): Set to 3.
+
+2020-09-25  Werner Lemberg  <wl@gnu.org>
+
+	[autofit] Synchronize with ttfautohint.
+
+	This corresponds to the following commits in the ttfautohint git
+	repository:
+
+	  bb6842bd3bd437b7b4a7921b0376c860f5e73d18  Typo, formatting.
+	  d5c91ddb1cb310257a3dfe9a8e20e1fc51335faa  Add Medefaidrin script.
+
+	* src/autofit/afblue.dat: Add blue zone data for Medefaidrin.
+	* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
+
+	* src/autofit/afscript.h: Add Medefaidrin standard characters.
+
+	* src/autofit/afranges.c, src/autofit/afstyles.h: Add Medefaidrin
+	data.
+
+2020-09-25  Werner Lemberg  <wl@gnu.org>
+
+	Move `scripts/make_distribution_archives.py` to `src/tools`.
+
+	* scr/tools/scripts/make_distribution_archives.py: (_TOP_DIR,
+	_SCRIPT_DIR): Updated to new location.
+	(main): s/shutils.copyfile/shutils.copy/ to preserve file
+	permissions.
+	(main): Prefix source file paths with `git_dir` while copying files
+	to allow calls of the script from other places than the top-level
+	directory.
+
+2020-09-24  Werner Lemberg  <wl@gnu.org>
+
+	* src/cff/cffgload.c (cff_slot_load): Scale `vertBearingY`.
+
+	Towards the end of the the function there is a call to
+	`FT_Outline_Get_CBox` that retrieves the glyph bbox in scaled units.
+	That sets `horiBearing{X,Y}` and `vertBearingX` but `vertBearingY`
+	is left alone, and is not scaled.
+
+	Patch from Eric Muller <emuller@amazon.com>.
+
+2020-09-24  Werner Lemberg  <wl@gnu.org>
+
+	* src/base/ftobjs.c (FT_Load_Glyph): Trace glyph metrics.
+
+2020-09-22  Werner Lemberg  <wl@gnu.org>
+
+	[meson] Move auxiliary scripts to `builds/meson`.
+
+	Suggested by Alexei.
+
+	* scripts/*.py: Move meson scripts to...
+	* builds/meson/*.py: ... this new location.
+
+	* meson.build: Updated.
+
+2020-09-21  David Turner  <david@freetype.org>
+
+	Add python script for building tarballs.
+
+	* scripts/make_distribution_archives.py: New file.
+
+	This standalone Python script should be equivalent to running `make
+	dist` with the Make-based build system, with the following minor
+	differences:
+
+	- Since `make distclean` doesn't always clean up `objs/` properly,
+	  `make dist` archives may contain some stale binaries like
+	  `objs/.libs/libfreetype.so.6` or others.
+
+	- `config.guess` and `config.sub` are not updated unless option
+	  `--gnu-config-dir=DIR` is used to specify the location of these
+	  files.
+
+	- Some bits of the auto-generated reference documentation may
+	  appear in slightly different order, probably due to issues related
+	  to mkdocs and docwriter.
+
+	As an example, the call
+
+	  scripts/make_distribution_archives.py /tmp/freetype2-dist
+
+	creates the following files under `/tmp/freetype2-dist`:
+
+	  freetype-<version>.tar.gz
+	  freetype-<version>.tar.xz
+	  ft<winversion>.zip
+
+2020-09-21  Werner Lemberg  <wl@gnu.org>
+
+	* scripts/extract_freetype_version.py: Fix regex typos.
+
+2020-09-21  David Turner  <david@freetype.org>
+
+	Add Meson build project file.
+
+	Example usage:
+
+	  # Configure Meson build in directory `build-meson` to generate
+	  # release binaries comparable to to the ones from the
+	  # autotools/make build system.
+	  meson setup build-meson \
+	        --prefix=/usr/local \
+	        --buildtype=debugoptimized \
+	        --strip \
+	        -Db_ndebug=true
+
+	  # After configuring the Meson build with the above command,
+	  # compile and install to `/usr/local/`; this includes a pkg-config
+	  # file.
+	  ninja -C build-meson install
+
+	  # Alternatively, compile and install to `/tmp/aa/usr/local/...`
+	  # for packaging.
+	  DESTDIR=/tmp/aa ninja -C build-meson install
+
+	  # Generate documentation under `build-meson/docs`.
+	  ninja -C build-meson docs
+
+	Library size comparison for stripped `libfreetype.so` generated by
+	all three build systems:
+
+	  - Default build (autotools + libtool): 712 KiB
+	  - CMake build (RelWithDebInfo):        712 KiB
+	  - Meson build:                         712 KiB
+
+
+	* meson.build: New top-level Meson build file for the library.
+
+	* meson_options.txt: New file.  It holds user-selectable options for
+	the build, which can be printed with `meson configure`, and selected
+	at `meson setup` or `meson --reconfigure` time with
+	`-D<option>=<value>`.
+
+	* scripts/parse_modules_cfg.py: A script invoked by `meson.build` to
+	parse `modules.cfg` and extract important information out of it
+	(i.e., the list of modules).
+
+	* scripts/process_ftoption_h.py: New script invoked by `meson.build`
+	to process the original `ftoption.h` file.  It enables or disables
+	configuration macro variables based on the available dependencies.
+	This is similar to what other build systems are using (i.e., Meson's
+	`configure_file()` command is not used here).
+
+	* scripts/extract_freetype_version.py: New script invoked by
+	`meson.build` to extract the FreeType version number from
+	`<freetype/freetype.h>`.
+
+	* scripts/extract_libtool_version.py: New script invoked by
+	`meson.build` to extract the libtool `revision_info` data from
+	`builds/unix/configure.raw`, and to generate the corresponding
+	shared library suffix.
+
+	* scripts/generate_reference_docs.py: New script invoked by
+	`meson.build` to generate the FreeType 2 reference documentation
+	(using the `docwriter` and `mkdocs` packages, which must be already
+	installed).
+
+2020-09-11  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	[raster] Improve the second pass (#58373).
+
+	Besides dropout control the second horizontal sweep is supposed to
+	clean up straight horizontal edges that are mishandled by the first
+	vertical sweep when a line passes through pixel centers.  This line
+	would present as perfectly aligned span edges in the second sweep.
+
+	* src/raster/ftraster.c (Horizontal_Sweep_Span): Replace the old
+	implementation with a better one focusing on aligned span edges only.
+
+2020-09-08  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	[raster] Tune SMART macro (#58352).
+
+	Windows seems to perform smart dropout control at 26.6 precision.
+	To mimick Windows independent of increased precision, we need to tweak
+	the macro so that some close calls break down rather than up.
+
+	* src/raster/ftraster.c (SMART): Tweak the macro.
+
+2020-09-08  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	[raster] Introduce SMART macro.
+
+	* src/raster/ftraster.c (SMART): New macro for smart dropout rounding.
+	(Verstical_Sweep_Drop, Horizontal_Sweep_Drop): Use it.
+
+2020-09-03  Boris Dalstein  <dalboris@gmail.com>
+
+	[build] Make CMake install basic version information.
+
+	* CMakeLists.txt: Do it.
+
+2020-09-02  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	[truetype] Reduce Infinality footprint (cont'd).
+
+	* src/truetype/ttinterp.c (Ins_DELTAP): Shrink variable scope.
+	(Ins_SHPIX, Ins_MIRP): Revise if-logic.
+
+2020-09-02  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	[truetype] Reduce Infinality footprint.
+
+	* src/truetype/ttinterp.c (Ins_SHPIX, Ins_MSIRP, Ins_MIAP, Ins_MDRP,
+	Ins_MIRP): Shrink variable scopes and consolidate ifdefs.
+
+2020-09-01  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	[truetype] Refactor compensation color.
+
+	* src/truetype/ttinterp.h (TT_Round_Func): Change the last argument.
+	* src/truetype/ttinterp.c (Ins_ROUND, Ins_NROUND, Ins_MDAP, Ins_MIAP,
+	Ins_MDRP, Ins_MIRP): Move compensation retrieval from here...
+	(Round_*): ... to here.
+	* src/truetype/ttobjs.c (tt_size_init_bytecode): Reserve zero
+	compensation at color index 3.
+
+2020-08-28  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	[smooth] Don't set target in direct mode.
+
+	* src/smooth/ftsmooth.c (ft_smooth_raster_overlap): Remove assignment.
+	(ft_smooth_raster_lcd) [!FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Ditto.
+
+2020-08-25  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	* src/smooth/ftsmooth.c (ft_smooth_raster_overlap): Limit width.
+
+	Segmentation fault reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=24729
+
+2020-08-22  Werner Lemberg  <wl@gnu.org>
+
+	* src/truetype/ttgload.c (TT_Get_VMetrics): Add tracing message.
+
+2020-08-05  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	[truetype] Retain OVERLAP_SIMPLE and OVERLAP_COMPOUND.
+
+	For glyphs with OVERLAP_SIMPLE or OVERLAP_COMPOUND, set
+	FT_OUTLINE_OVERLAP to render them with direct oversampling, which
+	mitigates artifacts (see 3bb512bc9f62).
+
+	* include/freetype/ftimage.h (FT_OUTLINE_OVERLAP): Redefine to rhyme
+	with OVERLAP_SIMPLE.
+	* src/base/ftgloadr.c (FT_GlyphLoader_Rewind): Reset outline flags.
+	* src/truetype/ttgload.c
+	(TT_Load_Simple_Glyph): Retain OVERLAP_SIMPLE.
+	(load_truetype_glyph): Retain OVERLAP_COMPOUND.
+
+2020-08-04  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	* src/truetype/ttgload.c (TT_Load_Glyph): More tracing.
+
+2020-07-28  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	Hide internal functions with SunPro.
+
+	* include/freetype/internal/compiler-macros.h
+	(FT_INTERNAL_FUNCTION_ATTRIBUTE) <__SUNPRO_C>: Define as __hidden.
+
+2020-07-28  Anuj Verma  <anujv@iitbhilai.ac.in>
+
+	Fix static compilation with Visual C.
+
+	* include/freetype/internal/compiler-macros.h
+	(FT_INTERNAL_FUNCTION_ATTRIBUTE) <_WIN32>: Define as empty.
+
+2020-07-28  Priyesh Kumar  <priyeshkkumar@gmail.com>
+
+	Fix `-Wformat' compiler warnings.
+
+	* src/*: Fix format specifiers.
+
+	* builds/unix/ftsystem.c (FT_Stream_Open): Ditto.
+
+2020-07-25  Werner Lemberg  <wl@gnu.org>
+
+	Fix `-Wformat' compiler warnings.
+
+	Problem reported by Priyesh kumar <priyeshkkumar@gmail.com>
+
+	* src/base/ftoutln.c (FT_Outline_Decompose): Fix number of arguments
+	to tracing macro.
+
+	* src/bdf/bdfdrivr.c (bdf_cmap_char_next, bdf_get_bdf_property):
+	Ditto.
+
+	* src/cache/ftcbasic.c (ftc_basic_family_get_count): Ditto.
+	Reformulate message.
+
+	* src/pcf/pcfdrivr.c (pcf_get_bdf_property): Ditto.
+
+	* src/sfnt/sfwoff2.c (woff2_open_font): Ditto.
+	Trace table offset, too.
+
+	* src/truetype/ttgxvar.c (ft_var_apply_tuple): Ditto.
+
+2020-07-23  Werner Lemberg  <wl@gnu.org>
+
+	* src/sfnt/sfwoff2.c (woff2_decompress): Fix compiler warning.
+
+	Reported by Hin-Tak.
+
+2020-07-12  Werner Lemberg  <wl@gnu.org>
+
+	* builds/unix/configure.raw: Fix inclusion of `ftoption.h'.
+
+2020-07-07  Werner Lemberg  <wl@gnu.org>
+
+	Fix clang warnings.
+
+	* include/freetype/internal/autohint.h
+	(FT_DECLARE_AUTOHINTER_INTERFACE): New macro.
+	* src/autofit/afmodule.h: Use it to declare
+	`af_autofitter_interface'.
+
+	* include/freetype/internal/ftobjs.h (FT_DECLARE_GLYPH): New macro.
+	* src/base/ftbase.h: Use it to declare `ft_bitmap_glyph_class' and
+	`ft_outline_glyph_class'.
+
+	* src/base/ftglyph.c: Include `ftbase.h'.
+
+	* src/cff/cffparse.c (cff_parser_run): Fix type of `t2_size'.
+
+	* src/pcf/pcfdrivr.c (pcf_cmap_char_next): Fix type of `result'.
+
+	* src/psaux/psauxmod.c (psaux_module_class): Use `FT_DEFINE_MODULE'.
+	* src/psaux/psauxmod.h: Declare `afm_parser_funcs',
+	`t1_cmap_classes', `cff_decoder_funcs', and `psaux_module_class'.
+
+	* src/pshinter/pshmod.c: Include `pshmod.h'.
+
+	* src/sfnt/sfwoff2.c (ROUND4, WRITE_SHORT): Fix implicit sign
+	conversion.
+	(compute_ULong_sum): Fix return type.
+	Fix implicit sign conversion.
+	(store_points): Fix type of `last_flag', `repeat_count', and `flag'.
+	Use casts to avoid warnings.
+	(reconstruct_glyf): Fix implicit sign conversion.
+	Use cast to avoid warning.
+	(get_x_mins): Fix implicit sign conversion.
+	* src/sfnt/ttcmap.c: Undef `TTCMAPCITEM'.
+	* src/sfnt/ttcmap.h: Define `TTCMAPCITEM' and include `ttcmapc.h' to
+	declare cmap classes.
+
+	* src/smooth/ftsmooth.c (ft_smooth_overlap_spans): Use cast.
+
+	* src/truetype/ttinterp.c (Ins_MIAP): Fix typo.
+
+2020-07-07  David Turner  <david@freetype.org>
+
+	[build] Really fix multi and C++ builds.
+
+	The following builds were still failing due to previous changes:
+
+	  make multi
+	  make multi CC="c++"
+	  make CC="c++"
+
+	This patch fixes the issues, which were missing includes to get the
+	right macro definitions in multi-build mode.
+
+	Also, `FT_UNUSED' is actually used by third-party code, so move it
+	back to `public-macros.h' to avoid breaking it.
+
+	* include/freetype/config/public-macros.h (FT_EXPORT): Remove
+	special definition for C++.
+	(FT_UNUSED): Define here instead of...
+	* include/freetype/config/compiler-macros.h: ... here.
+	(FT_FUNCTION_DECLARATION): Remove special definition for C++.
+	(FT_LOCAL_ARRAY_DEF): Fix definition.
+
+	* src/cache/ftccback.h, src/lzw/ftzopen.h, src/gxvalid/gxvmort.h,
+	src/gxvalid/gxvmorx.h: Add `FT_BEGIN_HEADER' and `FT_END_HEADER'.
+
+2020-07-06  David Turner  <david@freetype.org>
+
+	[build] Fix multi and C++ builds.
+
+	The following builds were failing due to previous changes:
+
+	  make multi
+	  make multi CC="c++"
+
+	* include/freetype/config/ftconfig.h: Remove `FT_END_HEADER'.
+
+	* include/freetype/config/ftheader.h (FT_BEGIN_HEADER,
+	FT_END_HEADER): Protect against redefinition.
+
+	* src/cache/ftccache.h, src/cache/ftcmru.h, src/pcf/pcfutil.h,
+	src/psaux/pserror.h, src/psaux/psft.h, src/psaux/psstack.h,
+	src/sfnt/woff2tags.h: Include `compiler-macros.h'.
+
+	* src/sfnt/woff2tags.c: Include `woff2tags.h'.
+
+2020-07-06  Werner Lemberg  <wl@gnu.org>
+
+	[psaux] Improve `t1_decoder_parse_metrics' (#58646).
+
+	* src/psaux/t1decode.c (t1_decoder_parse_metrics): Copy
+	corresponding code from old engine's `t1_decoder_parse_charstrings'
+	function to handle `op_callsubr' and `op_return'.
+
+2020-07-05  David Turner  <david@freetype.org>
+
+	[build] Improve visibility support of library function names.
+
+	* include/freetype/config/public-macros.h
+	(FT_PUBLIC_FUNCTION_ATTRIBUTE): New macro to tag functions as
+	public (and thus exportable).
+	(FT_EXPORT): Use it.
+
+	* include/freetype/config/compiler-macros.h
+	(FT_INTERNAL_FUNCTION_ATTRIBUTE): New macro to tag functions as
+	internal to the library (and thus hidden).  Note that on ELF
+	systems, all internal functions have hidden visibility, which avoids
+	the need to enforce this when invoking the compiler (e.g., with an
+	option like `-fvisibility=hidden').
+
+	(FT_FUNCTION_DECLARATION, FT_FUNCTION_DEFINITION): New base macros
+	to deal with C and C++ linkage issues at the same time.
+
+	(FT_LOCAL, FT_LOCAL_DEF, FT_LOCAL_ARRAY, FT_LOCAL_ARRAY_DEF,
+	FT_BASE, FT_BASE_DEF, FT_EXPORT_VAR, FT_BASE_CALLBACK,
+	FT_BASE_CALLBACK_DEF): Redefined using new macros.
+
+2020-07-05  David Turner  <david@freetype.org>
+
+	[build] Split off more stuff from `ftconfig.h'.
+
+	* builds/unix/ftconfig.h.in, builds/vms/ftconfig.h,
+	include/freetype/config/ftconfig.h: Split off macro definitions
+	required by the FreeType API headers to...
+	* include/freetype/config/public-macros.h: ...this new file.
+
+	* builds/unix/ftconfig.h.in, builds/vms/ftconfig.h,
+	include/freetype/config/ftconfig.h: Split off macro definitions used
+	by the library but not to be exposed to clients to...
+	* include/freetype/config/compiler-macros.h: ...this new file.
+
+	* include/freetype/internal/*.h, src/raster/ftraster.h: Include
+	`compiler-macros.h' where needed.
+
+2020-07-05  David Turner  <david@freetype.org>
+
+	[build] Move mac support code to `mac-support.h'.
+
+	* builds/unix/ftconfig.h.in, builds/vms/ftconfig.h,
+	include/freetype/config/ftconfig.h: Split off mac-specific stuff
+	to...
+	* include/freetype/config/mac-support.h: ...this new file.
+
+	* CMakeLists.txt, builds/unix/configure.raw: Remove `/undef ->
+	#undef' string replacement; the affected code is no longer part of
+	the `ftconfig.h' template.
+
+2020-07-05  David Turner  <david@freetype.org>
+
+	[build] Put integer type definitions into `integer-types.h'.
+
+	Refactor some of the `ftconfig.h' headers and template to move the
+	definition of the FreeType integer types (e.g., `FT_Int16') to a
+	common header file `freetype/config/integer-types.h'.
+
+	* builds/unix/ftconfig.h.in, builds/vms/ftconfig.h,
+	include/freetype/config/ftconfig.h: Split off integer type
+	definition stuff to...
+	* include/freetype/config/integer-types.h: ...this new file.
+
+	* builds/unix/ftconfig.h.in: Control the definition of
+	`FT_SIZEOF_INT' and `FT_SIZEOF_LONG' with macro
+	`FT_USE_AUTOCONF_SIZEOF_TYPES'.  If these are not defined, auto
+	detection happens in `integer-types.h' as usual based on `INTXX_MAX'
+	values.  Otherwise the autoconf-detected values are used.
+
+	* builds/unix/configure.raw (CPPFLAGS): Don't include path to
+	`config' directory.  Instead, ...
+	(FT_CONFIG_STANDARD_LIBRARY_H): Use complete path.
+
+2020-07-05  David Turner  <david@freetype.org>
+
+	[build] Rename `build/unix/ftconfig.in' to `ftconfig.h.in'.
+
+	Since we are no longer limited to 8.3 file names, it is simpler to
+	follow the usual conventions for template files.
+
+	* builds/unix/ftconfig.in: Renamed to...
+	* builds/unix/ftconfig.h.in: ...this.
+
+	* CMakeLists.txt, builds/unix/configure.raw: Updated.
+
+2020-07-03  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	[smooth] Introduce direct oversampling for overlaps.
+
+	This implements oversampling to mitigate artifacts in pixels partially
+	covered by overlapping contours.  It turns out that the 4x4
+	oversampling is sufficient but, at least, quadruples the rendering
+	time.  The outline has to set FT_OUTLINE_OVERLAP to use this method.
+
+	* include/freetype/ftimage.h (FT_OUTLINE_OVERLAP): New flag.
+	* src/smooth/ftsmooth.c (ft_smooth_render): Check it to...
+	(ft_smooth_raster_overlap): ... inflate outline and set up direct
+	rendering for oversampling with...
+	(ft_smooth_overlap_spans): ... new span function that integrates them.
+
+2020-07-03  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	[smooth] Use direct rendering mode in Harmony.
+
+	Instead of rendering 3 bitmaps side by side and reshuffling, we use
+	direct rendering to deliver the bitmaps on each third byte.
+
+	* src/smooth/ftsmooth.c (ft_smooth_raster_lcd)
+	[!FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Set up direct mode with...
+	(ft_smooth_lcd_spans): ... new span function.
+
+2020-07-03  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	[smooth] Separate LCD paths from gray rendering.
+
+	This makes `ft_smooth_render' a lot smaller and easier to follow. It
+	also cleanly separates Harmony and ClearType-style LCD rendering
+	algorithms. Now I only wish to move LCD filtering and geometry from
+	FT_Library to FT_Renderer.
+
+	* src/smooth/ftsmooth.c (ft_smooth_render): Move LCD code from here...
+	(ft_smooth_raster_lcd, ft_smooth_raster_lcdv): ... to here.
+	[FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Reorganize #ifdef's.
+
+2020-06-20  Sebastian Rasmussen  <sebras@gmail.com>
+
+	[cff] Fix handling of `style_name == NULL' (#58630).
+
+	* src/cff/cffobjs.c (cff_face_init): If a call to `cff_strcpy' fails
+	by returning NULL in `cff_face_init', `remove_style' is still
+	called.  This means that the NULL pointer is dereferenced, causing a
+	crash.
+
+2020-06-19  Sebastian Rasmussen  <sebras@gmail.com>
+
+	[cff] Fix another two memory leaks (#58629).
+
+	* src/cff/cffobjs.c (cff_size_init): If a call to `funcs->create'
+	fails to allocate one of the `internal->subfont' variables, make
+	sure to free `internal->topfont' and any successfully allocated
+	subfonts.
+
+2020-06-19  Sebastian Rasmussen  <sebras@gmail.com>
+
+	[psaux] Fix memory leak (#58626).
+
+	* src/psaux/psstack.c (cf2_stack_init): If `cf2_stack_init' fails to
+	allocate the stack, return error early.
+
+2020-06-19  Sebastian Rasmussen  <sebras@gmail.com>
+
+	[base] Fix memory leak (#58624).
+
+	* src/base/ftobjs.c (FT_New_Size): Avoid trying to free
+	`size->internal' unless `size' has been allocated.  This mistake
+	appeared in the fix for issue #58611.
+
+2020-06-19  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	[base] Rework d1180b5f9598 until further notice.
+
+	* src/base/ftoutln.c (FT_Outline_Get_Orientation): Reject large
+	outlines.
+
+2020-06-19  Sebastian Rasmussen  <sebras@gmail.com>
+
+	[cff, cid] Fix segfaults in case of error (#58621).
+
+	* src/cff/cffobjs.c (cff_slot_done), src/cid/cidobjs.c
+	(cid_slot_done): If `ft_glyphslot_init' fails to allocate
+	`internal', then the class' `done_slot' callback (called by
+	`ft_glyphslot_done') must not dereference the pointer to `internal'.
+
+2020-06-19  Werner Lemberg  <wl@gnu.org>
+
+	[base] Fix UBSAN error.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=23166
+
+	* src/base/ftoutln.c (FT_Outline_Get_Orientation): Avoid values
+	larger than 32 bits.
+
+2020-06-19  Werner Lemberg  <wl@gnu.org>
+
+	[woff2] Fix segfault.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=23402
+
+	* src/sfnt/sfwoff2.c (get_x_mins): Check whether `loca' table
+	exists.
+
+2020-06-19  Stephen McDowell  <svenevs.dev@gmail.com>
+
+	[sfnt] Support Intel compilers.
+
+	* src/sfnt/pngshim.c (premultiply_data): Intel compilers do not
+	currently support `__builtin_shuffle'.
+
+2020-06-19  Sebastian Rasmussen  <sebras@gmail.com>
+
+	[base] Fix memory leak (#58611).
+
+	* src/base/ftobjs.c (FT_New_Size): When the call to `clazz->init_size'
+	fails, make sure to free `size->internal'.
+
+2020-06-19  Sebastian Rasmussen  <sebras@gmail.com>
+
+	[cff] Fix memory leak (#58610).
+
+	* src/cff/cffobjs.c (cff_size_init): When the call to
+	`funcs->create' fails, make sure to free `internal'.
+
+2020-06-19  Werner Lemberg  <wl@gnu.org>
+
+	* src/cff/cffload.c (cff_index_get_pointers): Rename `t' to `tbl'.
+
+2020-06-19  Sebastian Rasmussen  <sebras@gmail.com>
+
+	[cff] Free table upon error allocating other data (#58609).
+
+	* src/cff/cffload.c (cff_index_get_pointers): When new_bytes fails
+	to allocate, make sure to free the table.  Do the same for both
+	allocations if there is a later error.
+
+2020-06-13  Werner Lemberg  <wl@gnu.org>
+
+	Remove redundant inclusion of `ft2build.h'.
+
+	* */*: Remove `#include <ft2build.h>' where possible.
+
+	* include/freetype/freetype.h: Remove cpp error about missing
+	inclusion of `ft2build.h'.
+
+2020-06-08  David Turner  <david@freetype.org>
+
+	Make macros for header file names optional.
+
+	We no longer have to take care of the 8.3 file name limit; this
+	allows us (a) to introduce longer, meaningful file names, and (b) to
+	avoid macro names in `#include' lines altogether since some
+	compilers (most notably Visual C++) doesn't support this properly.
+
+	*/*: Replace
+
+	   #include FOO_H
+
+	with
+
+	   #include <freetype/foo.h>
+
+	or something similar.  Also update the documentation.
+
+2020-06-02  Werner Lemberg  <wl@gnu.org>
+
+	* src/sfnt/ttcmap.c (tt_face_build_cmaps): Trace number of cmaps.
+
+2020-05-18  David Turner  <david@freetype.org>
+
+	Remove obsolete HAVE_STDINT_H probing macro.
+
+	This macro was updated by the unix configure script and the
+	`CMakeLists.txt' one, but is never used in the source tree (nor is
+	<stdint.h> included anywhere).
+
+	* CMakeLists.txt, builds/unix/ftconfig.in: Don't handle
+	`HAVE_STDINT_H'.
+
+2020-05-18  David Turner  <david@freetype.org>
+
+	Remove Jamfile files from the tree.
+
+	These have not been used in a very, very long time, so better remove
+	them.  A corresponding patch will be submitted to the
+	`freetype2-demos' repository.
+
+	* src/Jamfile, src/*/Jamfile, Jamrules: Delete.
+
+2020-05-12  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	[smooth] Turn on LCD filtering during FreeType initialization.
+
+	* src/smooth/ftsmooth.c (ft_smooth_init): Enable LCD filtering.
+
+	* include/freetype/ftlcdfil.h: Document it, remove patent warnings.
+	* include/freetype/freetype.h (FT_Render_Mode): Updated.
+	* include/freetype/config/ftoption.h, devel/ftoption.h
+	[FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Do not mention patents.
+
+2020-05-11  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	[smooth] Stop using dedicated LCD modules and classes.
+
+	The LCD modules were never truly independent. They mostly served as
+	a way to disable patented LCD rendering, which is no longer necessary.
+	The `smooth' module now handles LCD modes as well.
+
+	* src/smooth/ftsmooth.c (ft_smooth_lcd_renderer_class.
+	ft_smooth_lcdv_renderer_class): Deleted.
+	(ft_render_smooth): Reworked from `ft_render_smooth_generic'.
+	* src/smooth/ftsmooth.h: Remove dedicated LCD classes.
+	* src/smooth/module.mk: Remove dedicated LCD modules.
+	* include/freetype/config/ftmodule.h: Ditto.
+	* builds/amiga/include/config/ftmodule.h: Ditto.
+	* include/freetype/ftmodapi.h: Do not mention LCD modules.
+
+2020-05-09  Werner Lemberg  <wl@gnu.org>
+
+	* Version 2.10.2 released.
+	==========================
+
+
+	Tag sources with `VER-2-10-2'.
+
+	* docs/VERSION.TXT: Add entry for version 2.10.2.
+
+	* README, Jamfile (RefDoc), src/base/ftver.rc,
+	builds/windows/vc2010/index.html, builds/windows/visualc/index.html,
+	builds/windows/visualce/index.html,
+	builds/wince/vc2005-ce/index.html,
+	builds/wince/vc2008-ce/index.html, docs/freetype-config.1:
+	s/2.10.1/2.10.2/, s/2101/2102/.
+
+	* include/freetype/freetype.h (FREETYPE_PATCH): Set to 2.
+
+	* builds/unix/configure.raw (version_info): Set to 23:2:17.
+	* CMakeLists.txt (VERSION_PATCH): Set to 2.
+
+	* docs/CHANGES: Updated.
+
+2020-05-08  Jakub Alba  <jalba@vewd.com>
+
+	* src/truetype/ttinterp.c (TT_RunIns): Adjust loop counter (#58319).
+
+	The font that exceeds the old limit is Icono Regular, version
+	1.00000.
+
+2020-05-03  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	* builds/freetype.mk: Refactor for readability.
+
+2020-05-02  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	[builds] Clean up Windows CE project files.
+
+	Remove version from filenames that caused a lot of polution in the
+	release process. Use VERSIONINFO resource instead.
+
+	* builds/wince/vc2005-ce/freetype.vcproj,
+	builds/wince/vc2008-ce/freetype.vcproj,
+	builds/windows/visualce/freetype.vcproj,
+	builds/windows/visualce/freetype.dsp: s/2101//g, but add `ftver.rc'.
+	* builds/wince/vc2008-ce/index.html,
+	builds/wince/vc2005-ce/index.html,
+	builds/windows/visualce/index.html: s/2101//g.
+
+2020-05-01  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	* devel/ft2build.h: Override FT_CONFIG_MODULES_H here as well.
+
+2020-05-01  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	[builds/unix] Consolidate marco overrides (for the demos to see them).
+
+	* builds/unix/unix-cc.in (FT_CONFIG_MODULES_H, FT_CONFIG_OPTIONS_H):
+	Override them here...
+	* builds/freetype.mk: ... instead of here.
+
+2020-04-08  Werner Lemberg  <wl@gnu.org>
+
+	Allow setting `CC' in Unix build (#58051).
+
+	* builds/unix/unix-cc.in (CC): Use `override'.  The command line
+	  value of `CC' (if any) is stored already in `CCraw'.
+
+2020-04-04  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	[woff2] Return if single stream operation fails.
+
+	* src/sfnt/sfwoff2.c (get_x_mins): Do it.
+
+	* src/sfnt/woff2tags.c: Remove unused include.
+
+2020-03-22  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	[docs] Fix building docs if `srcdir' != `builddir'.
+
+	`docs/reference/*' was moved one directory up in commit 237fed6.
+
+	* builds/unix/unix-def.in (PIP): Remove variable.
+
+	* configure: Create `docs' directory and copy assets from
+	`docs/markdown'.
+
+	* docs/README: Output directory is `reference'.
+
+2020-03-21  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	[docwriter] Drop support for Python < 3.5.
+
+	Python versions < 3.5 have reached end-of-life and as such, no
+	security or bug fixes will be provided for those versions.  See
+
+	  https://devguide.python.org/#status-of-python-branches
+	
+	for more information.
+
+	* Jamfile (RefDoc): Add `site' parameter.
+
+	* builds/detect.mk (std_setup): Update Python version requirement.
+
+	* builds/freetype.mk (refdoc-venv): Use pip as `python -m pip'.
+
+	* builds/unix/ax_compare_version.m4,
+	builds/unix/ax_prog_python_version.m4: Macros to detect Python
+	version.  New files.
+
+	* builds/unix/configure.raw: Check for Python >= 3.5 and remove
+	check for `pip'.
+
+	* docs/CHANGES, docs/INSTALL.GNU, docs/README: Updated.
+
+2020-03-02  Moazin Khatti  <moazinkhatri@gmail.com>
+
+	[gzip] Support `gzip' encoded header conditionally.
+
+	In order to support `gzip' encoded header the call to
+	`inflateInit2' was modified in commit 6a92b1fadde26477a9179.
+	However, this code breaks with the outdated internal version
+	of zlib.  This is a temporary fix to conditionally support
+	`gzip' encoded header whenever a system installation of zlib
+	is being used.
+
+	Problem report in
+
+	  https://lists.nongnu.org/archive/html/freetype-devel/2020-02/msg00023.html
+
+	* src/gzip/ftgzip.c (FT_Gzip_Uncompress): Change the the call to
+	`inflateInit2' depending on whether the system installation is
+	being used or the internal copy.
+
+2020-02-29  Ben Wagner  <bungeman@google.com>
+
+	[truetype] Fix state of `FT_Face' for buggy `gvar' tables (#57923).
+
+	By resetting the blend as implemented with this commit fonts with
+	invalid `gvar' tables may keep calling into `ft_var_load_gvar' from
+	`tt_set_mm_blend' and failing, but the font was invalid anyway and
+	we want to keep seeing the failure in `tt_set_mm_blend'.
+
+	* src/truetype/ttgxvar.c (ft_var_load_gvar): Calculate length of
+	offset array once.
+	Allocate arrays after `FT_FRAME_ENTER' (extra check before
+	allocating and avoid needing to free array later if error entering
+	frame).
+	Always call `FT_FRAME_EXIT'.
+	Consistently set counts immediately after array initialized.
+	Reset the blend (particularly `blend->glyphoffsets') on failure.
+
+2020-03-01  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	[docs] Update docwriter stylesheet.
+
+	This change is required to support docwriter 1.2.1.
+
+	See
+
+	  https://github.com/freetype/docwriter/issues/36
+
+	for more information.
+
+	* docs/markdown/stylesheets/extra.css:
+	(.md-typeset code) -> (.md-typeset pre>code)
+	(pre) -> (pre>code)
+	(p, .md-typeset p, h4): Remove commented styles.
+	(table.index): Remove unused styles.
+
+2020-02-28  Ben Wagner  <bungeman@google.com>
+
+	[truetype] Add better checks for loading `gvar' table (#57905).
+
+	* src/truetype/ttgxvar.c (ft_var_load_gvar): Delay settings of any
+	`blend->xxxcount' values until the corresponding data has been
+	checked.
+	Also do some sanitizing to avoid a too early exit.
+
+	(TT_Vary_Apply_Glyph_Deltas): Improve tracing message.
+
+2020-02-27  Werner Lemberg  <wl@gnu.org>
+
+	Make `FT_HAS_*' and `FT_IS_*' really return true (#57906).
+
+	* include/freetype/freetype.h (FT_HAS_*, FT_IS_*): Implement it.
+
+2020-02-25  Dominik Röttsches  <drott@chromium.org>
+
+	Fix for CFF space glyph regression (#57541).
+
+	* src/psaux/psft.c (cf2_decoder_parse_substrings): Replace early-out
+	  with FT_OFFSET.
+
+2020-02-22  Werner Lemberg  <wl@gnu.org>
+
+	[woff2] Fix font table access.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20778
+
+	* src/sfnt/sfwoff2.c (get_x_mins): Explicitly check for presence of
+	`head' table, which might not have been processed yet.
+
+2020-02-21  Werner Lemberg  <wl@gnu.org>
+
+	[psaux] Make `t1_decoder_parse_metrics' handle `op_div' (#57519).
+
+	* src/psaux/t1decode.c (t1_decoder_parse_metrics): Copy
+	corresponding code from old engine's `t1_decoder_parse_charstrings'
+	function.
+
+2020-02-19  Nikolaus Waxweiler  <nikolaus.waxweiler@daltonmaag.com>
+
+	[autofit] Add support for Hanifi Rohingya script.
+
+	* src/autofit/afblue.dat: Add blue zone data for Hanifi Rohingya.
+	* src/autofit/afblue.c, src/autofit/afblue.h: Regenerated.
+
+	* src/autofit/afscript.h: Add Hanifi Rohingya standard character.
+
+	* src/autofit/afranges.c, src/autofit/afstyles.h: Add Hanifi
+	  Rohingya data.
+
+2020-02-19  Werner Lemberg  <wl@gnu.org>
+
+	Require HarfBuzz 1.8.
+
+	* builds/unix/configure.raw, CMakeLists.txt: Request HarfBuzz 1.8.0
+	or newer.
+
+	We are going to add auto-hinter support for Hanifi Rohingya, which
+	was introduced in Unicode 11.0.
+
+2020-02-12  Werner Lemberg  <wl@gnu.org>
+
+	* src/sfnt/ttcmap.c (tt_face_build_cmaps): Ignore version (#57708).
+
+2020-02-04  Werner Lemberg  <wl@gnu.org>
+
+	* src/truetype/ttinterp.c (TT_RunIns): Adjust loop counter (#57732).
+
+	The font that exceeds the old limit is Constantine, version 1.001.
+
+2020-01-04  Werner Lemberg  <wl@gnu.org>
+
+	[base] Fix `FREETYPE_PROPERTIES=type1:hinting-engine=adobe`.
+
+	* src/base/ftpsprop.c (ps_property_set) [hinting-engine]: Avoid an
+	incorrect return value that caused a warning.  The function did the
+	right thing, though.
+
+2020-01-03  Werner Lemberg  <wl@gnu.org>
+
+	[woff2] Fix memory leaks and a runtime warning.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19773
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18101
+
+	* src/sfnt/sfwoff2.c (compute_ULong_sum): Add missing cast.
+	(reconstruct_hmtx): Add missing deallocation calls.
+
+2020-01-02  Dominik Röttsches  <drott@chromium.org>
+
+	[truetype] Fix UBSan warning on offset to nullptr (#57501).
+
+	* src/truetype/ttinterp.c (Ins_CALL): Fail if `exc->FDefs' is null.
+
+2019-12-31  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	[woff2] Allow bitmap-only fonts (#57394).
+
+	* src/sfnt/sfwoff2.c (reconstruct_font): Fix test for `glyf' and
+	`loca' tables.
+
+2019-12-21  Hugh McMaster  <hugh.mcmaster@outlook.com>
+
+	[docs] (2/2) Fix generation of API documentation (#56745).
+
+	Creating the API Reference in the (new) `reference' sub-directory is
+	consistent with other documentation sub-topics, such as `design',
+	`glyphs' and `tutorial'.
+
+	This patch fixes broken hyperlinks in the documentation pointing to
+	and from the API Reference.  It also allows web assets to load from
+	their relative paths.
+
+	* builds/freetype.mk (DOC_DIR): Adjust.
+	(refdoc, refdoc-venv): Add `--site' argument.
+
+	* builds/toplevel.mk (do-dist): Updated.
+
+2019-12-21  Hugh McMaster  <hugh.mcmaster@outlook.com>
+
+	[docs] (1/2) Move static web assets (#56745).
+
+	* docs/reference/*: Move ...
+	* docs: ... one directory up.
+
+2019-12-21  Dominik Röttsches  <drott@chromium.org>
+
+	Fix more UBSan warnings on adding offset to nullptr (#57432).
+
+	* src/truetype/ttinterp.c (Ins_LOOPCALL), src/psaux/psft.c
+	(cf2_initLocalRegionBuffer): Use `FT_OFFSET'.
+
+2019-12-16  Werner Lemberg  <wl@gnu.org>
+
+	[truetype] Fix UBSan warnings on adding offsets to nullptr.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/chromium/issues/detail?id=1032152
+
+	* src/truetype/ttinterp.c (Ins_FDEF, Ins_IDEF): Use `FT_OFFSET'.
+
+2019-12-14  Werner Lemberg  <wl@gnu.org>
+
+	[truetype] Fix integer overflow.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19305
+
+	* src/truetype/ttinterp.c (Ins_MIRP): Use `ADD_LONG'.
+
+2019-12-13  Werner Lemberg  <wl@gnu.org>
+
+	Another bunch of UBSan warnings on adding offsets to nullptr.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19427
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19433
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19441
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19451
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19452
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19457
+
+	* src/autofit/aflatin.c (af_latin_hints_compute_segments,
+	af_latin_hints_compute_edges): Use `FT_OFFSET'.
+
+	* src/base/ftstream.c (FT_Stream_EnterFrame): Use `FT_OFFSET'.
+
+	* src/psaux/cffdecode.c (cff_decoder_parse_charstrings): Exit early
+	if there is no charstring.
+
+	* src/psaux/psobjs.c (t1_decrypt): Use `FT_OFFSET'.
+
+	* src/smooth/ftsmooth.c (ft_smooth_render_generic): Exit early for
+	zero bitmap dimensions.
+
+2019-12-09  Dominik Röttsches  <drott@chromium.org>
+
+	Fix more UBSan warnings on adding offset to nullptr (#57384).
+
+	* src/smooth/ftsmooth.c (ft_smooth_render_generic),
+	src/psaux/psobjs.c (ps_table_add): Use `FT_OFFSET'.
+
+2019-12-05  Werner Lemberg  <wl@gnu.org>
+
+	* src/truetype/ttinterp.c (TT_RunIns): Use `FT_OFFSET'.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/chromium/issues/detail?id=1030614
+
+2019-12-03  Werner Lemberg  <wl@gnu.org>
+
+	More nullptr offset UBSan warnings (#57331, #57347).
+
+	* src/autofit/afcjk.c (af_cjk_hints_compute_segments),
+	src/psaux/psft.c (cf2_getSeacComponent), src/truetype/ttinterp.c
+	(Ins_UNKNOWN): Use `FT_OFFSET'.
+
+2019-11-29  Dominik Röttsches  <drott@chromium.org>
+
+	Avoid more nullptr offset UBSan warnings (#57316).
+
+	* src/base/ftoutln.c (FT_Outline_Transform): Bail on empty points.
+	* src/cff/cffload.c (cff_subfont_load): Use `FT_OFFSET'.
+	* src/psaux/psft.c (cf2_decoder_parse_substrings): Early out if
+	`charstring_base' or `charstring_len' are null.
+	* src/sfnt/ttload.c (tt_face_load_name): Use `FT_OFFSET'.
+
+2019-11-23  John Stracke  <jstracke@Google.com>
+
+	[base] Really fix #57194.
+
+	Apply accidentally missed second part of patch.
+
+	* src/base/ftgloadr.c (FT_GlyphLoader_CheckPoints): Call
+	`FT_GlyphLoader_CreateExtra'.
+
+2019-11-23  Werner Lemberg  <wl@gnu.org>
+
+	[truetype] Avoid sanitizer warning (#57289).
+
+	* src/truetype/ttpload.c (tt_face_get_device_metrics): Use
+	`FT_OFFSET'.
+
+2019-11-23  Armin Hasitzka  <prince.cherusker@gmail.com>
+
+	[truetype] Fix integer overflow (#57287).
+
+	* src/truetype/ttgload.c (compute_glyph_metrics): Use `SUB_LONG'.
+
+2019-11-23  Ben Wagner  <bungeman@google.com>
+
+	[sfnt] Avoid sanitizer warning (#57286).
+
+	* src/sfnt/ttcmap.c (tt_face_build_cmaps): Avoid possible `NULL +
+	offset' computation.
+	Tag `table' as `const'.
+
+2019-11-23  John Stracke  <jstracke@Google.com>
+            Werner Lemberg  <wl@gnu.org>
+
+	[base] Fix `NULL + offset' sanitizer warnings (#57194).
+
+	* src/base/ftgloadr.c (FT_GlyphLoader_Adjust_Points,
+	FT_GlyphLoader_Adjust_Subglyphs): Use `FT_OFFSET'.
+	(FT_GlyphLoader_CreateExtra): Add short cut if some values are zero.
+
+2019-11-23  Werner Lemberg  <wl@gnu.org>
+
+	* include/freetype/internal/ftmemory.h (FT_OFFSET): New macro.
+
+	Use this for `base + offset' pointer calculations where `base' can
+	be NULL (triggering a sanitizer warning even if the resulting
+	pointer gets never dereferenced since it is undefined behaviour
+	in C).
+
+	Suggested by Ben Wagner.
+
+2019-11-23  Ben Wagner  <bungeman@google.com>
+
+	[sfnt] Ensure OTTO fonts have tables (#57285).
+
+	* src/sfnt/ttload.c (tt_face_load_font_dir): Add test.
+
+2019-11-23  Behdad Esfahbod  <behdad@behdad.org>
+
+	Minor fixes for recent compilers.
+
+	* src/gzip/infutil.h (inflate_mask): Add `const'.
+
+	* src/autofit/aflatin2.c: Include `ft2build.h'.
+
+2019-11-07  Nikolaus Waxweiler  <madigens@gmail.com>
+
+	* CMakeLists.txt: Minor additions to the notes, compile
+	  builds/unix/ftsystem.c instead of src/base/ftsystem.c on UNIX.
+
+	The latter change is based on the code proposed by rim in #55235.
+
+2019-10-25  Werner Lemberg  <wl@gnu.org>
+
+	* src/sfnt/sfwoff2.c (woff2_open_font): Check `num_fonts' for TTCs.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18494
+
+2019-10-22  Werner Lemberg  <wl@gnu.org>
+
+	* src/sfnt/sfwoff2.c (woff2_open_font): Avoid undefined shift.
+
+	Also improve tracing.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18390
+
+2019-10-10  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	* src/sfnt/pngshim.c (premultiply_data): Optimize for __SSE__ only.
+
+2019-10-10  Werner Lemberg  <wl@gnu.org>
+
+	* src/sfnt/sfwoff2.c (reconstruct_glyf): Check `triplet_size'.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18108
+
+2019-10-09  John Tytgat  <John.Tytgat@esko.com>
+
+	[cff] Fix FT_FACE_FLAG_GLYPH_NAMES for CFF2 based fonts (#57023).
+
+	* src/cff/cffobjs.c (cff_face_init): Don't set
+	FT_FACE_FLAG_GLYPH_NAMES for CFF2 based fonts.
+
+2019-10-08  Werner Lemberg  <wl@gnu.org>
+
+	[woff2] Fix SFNT table checks.
+
+	Also reduce number of SFNT table lookups.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18065
+
+	* include/freetype/internal/wofftypes.h (WOFF2_InfoRec): Add fields
+	`glyf_table', `loca_table', and `head_table'.
+
+	* src/sfnt/sfwoff2.c (reconstruct_glyf): Update signature.
+	Use table pointers in `info' parameter.
+	(get_x_mins): Check `maxp_table'
+	Use table pointers in `info' parameter.
+	(reconstruct_font):  Use and set table pointers in `info' parameter.
+	Fix check for `glyf' and `loca' tables.
+	Update call to `reconstruct_glyf'.
+	(woff2_open_font): Updated.
+
+2019-10-06  Werner Lemberg  <wl@gnu.org>
+
+	* src/sfnt/sfwoff2.c (reconstruct_glyf): Fix reallocation.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18046
+
+2019-10-06  Werner Lemberg  <wl@gnu.org>
+
+	Improve memory debugging.
+
+	* include/freetype/internal/ftmemory.h (FT_MEM_FREE): Use
+	`FT_DEBUG_INNER' to set source code file name and line.
+
+	* src/base/ftdbgmem.c (ft_mem_table_remove): Better formatting of
+	tracing message.
+
+2019-10-03  Werner Lemberg  <wl@gnu.org>
+
+	* src/sfnt/sfwoff2 (reconstruct_font): Fix reallocation.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17966
+
+2019-10-01  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	* src/base/ftstroke.c (ft_stroker_inside): Speed up.
+
+2019-10-01  Werner Lemberg  <wl@gnu.org>
+
+	* src/sfnt/sfwoff2 (woff2_open_font): Initialize `woff2.ttc_fonts'.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17804
+
+2019-09-30  Werner Lemberg  <wl@gnu.org>
+
+	* src/sfnt/sfwoff2.c (reconstruct_font): Fix memory leak.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17812
+
+2019-09-30  Werner Lemberg  <wl@gnu.org>
+
+	[woff2] Reject fonts without `head' table.
+
+	Also fix memory deallocation in case of error.
+
+	`head' problem reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17820
+
+	* src/sfnt/sfwoff2.c (reconstruct_glyf): Don't use `stream_close'.
+	Abort if `head_table' is NULL.
+	Don't free `transformed_buf' in case of error.
+	(woff2_open_font): Don't set `uncompressed_buf' to NULL.
+
+2019-09-29  Werner Lemberg  <wl@gnu.org>
+
+	[woff2] Fix compiler warnings.
+
+	Problem reported by Alexei.
+
+	* src/sfnt/sfwoff2.c (reconstruct_glyf): Initialize `x_min'.
+	(reconstruct_font): Initialize `num_hmetrics'.
+	(woff2_open_font): Initialize `info'.
+
+2019-09-28  Werner Lemberg  <wl@gnu.org>
+
+	* src/sfnt/sfwoff2.c (woff2_open_font): Fix sanity check.
+
+	Correct thinkos in patch from 2019-09-01.
+
+2019-09-28  Werner Lemberg  <wl@gnu.org>
+
+	[woff2] Fix memory leaks.
+
+	One of them reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17766
+
+	* src/sfnt/sfwoff2.c (woff2_open_font): Free `info->x_mins' and
+	`woff2->ttc_fonts'.
+
+	(reconstruct_glyf): Initialize `info->x_mins'.
+
+2019-09-27  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	* src/base/ftstroke.c (ft_stroker_cap): Speed up caps.
+
+2019-09-25  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	* src/base/ftstroke.c (ft_stroker_outside): Speed up clipped miter.
+	* include/freetype/ftstroke.h: Wordsmith miter docs.
+
+2019-09-25  Werner Lemberg  <wl@gnu.org>
+
+	* src/sfnt/sfwoff2.c (woff2_open_font): Check (sum of) table sizes.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17684
+
+2019-09-23  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	* src/base/ftstroke.c (ft_stroke_border_arcto): Speed up calculations.
+
+2019-09-20  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	[woff2] Fix memory leaks.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16896
+
+	* src/sfnt/sfwoff2.c (woff2_open_font): Fix error handling.
+	Free `uncompressed_buf'.
+	(reconstruct_font): Free `transformed_buf'.
+
+2019-09-17  Werner Lemberg  <wl@gnu.org>
+
+	* src/otvalid/otvcommon.c (otv_Coverage_get_last): Guard `count'.
+
+	Problem reported by Marc Schönefeld <marc.schoenefeld@gmx.org>.
+
+2019-09-17  Werner Lemberg  <wl@gnu.org>
+
+	* src/sfnt/sfwoff2.c (woff2_open_font): Check table index.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17100
+
+2019-09-15  Avi Halachmi (:avih)  <avihpit@yahoo.com>
+
+	[cmake] Don't fail if brotli is missing (#56894).
+
+	The libs which cmake controls are commented out at
+
+	  include/freetype/config/ftoption.h
+
+	and cmake un-comment each enabled library, but the brotli option was
+	not commented out, therefore `FT_CONFIG_OPTION_USE_BROTLI' remained
+	defined even if brotli was missing/disabled/etc.
+
+	Comment it such that cmake can control it, which means leaving it
+	undefined if brotli is missing.
+
+	* include/freetype/config/ftoption.h: Fix typo.
+
+2019-09-05  Werner Lemberg  <wl@gnu.org>
+
+	[cmake] Add brotli support.
+
+	* CMakeLists.txt (FT_WITH_BROTLI): New option.
+
+	* builds/cmake/FindBrotliDec.cmake: New file.
+
+2019-09-05  Werner Lemberg  <wl@gnu.org>
+
+	Fix handling of `AF_CONFIG_OPTION_INDIC'.
+
+	* devel/ftoption.h, include/freetype/config/ftoption.h:
+	`AF_CONFIG_OPTION_INDIC' needs `AF_CONFIG_OPTION_CJK'.
+
+2019-09-05  Werner Lemberg  <wl@gnu.org>
+
+	CMakeLists.txt: Fix generation of DLL related stuff (#56852).
+
+	Extract `version_info' variable from `builds/unix/configure.raw' and
+	use the data to correctly set `LIBRARY_VERSION' and
+	`LIBRARY_SOVERSION'.
+
+	Also use the data to set `ft_version' field in `freetype2.pc'.
+	Also fix the needed minimum version of HarfBuzz in `freetype2.pc'.
+
+2019-09-03  Werner Lemberg  <wl@gnu.org>
+
+	* src/sfnt/sfwoff2.c (compute_ULong_sum): Fix undefined shift.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16933
+
+2019-09-01  Werner Lemberg  <wl@gnu.org>
+
+	* src/sfnt/sfwoff2.c (woff2_open_font): Add sanity check.
+
+	Don't trust `totalSfntSize' unconditionally.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16893
+
+2019-08-27  Dominik Röttsches  <drott@chromium.org>
+
+	[woff2] Don't use `FT_UInt64' (#56815).
+
+	* src/sfnt/sfwoff2.c (woff2_open_font): Use `FT_UInt32' for
+	`file_offset'.  This fixes builds on platforms where `FT_LONG64' is
+	not defined while still being sufficient to store a file offset.
+
+2019-08-27  Werner Lemberg  <wl@gnu.org>
+
+	[truetype] Prevent crash in `TT_Set_Named_Instance' (#56813).
+
+	* src/truetype/ttgxvar.c (TT_Set_Named_Instance): Fix error
+	handling.
+
+2019-08-27  Werner Lemberg  <wl@gnu.org>
+
+	[woff2] Fix compiler warnings.
+
+	* src/sfnt/sfwoff2.c (read_num_hmetrics): Remove unused argument
+	`table_len'.
+	Update caller.
+	(triplet_decode, compute_bbox, store_loca, reconstruct_glyf): Make
+	`i' variable unsigned.
+	(reconstruct_glyph): Remove condition which is always false.
+	(reconstruct_html): Removed unused argument `transformed_size'.
+	Update caller.
+
+	* src/sfnt/woff2tags.c (woff2_known_tags): Remove condition which is
+	always false.
+
+2019-08-27  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	[woff2] Check whether known tag is in array bounds.
+
+	If table tag is not 0x3f, we expect a value between 0 and 62.  If
+	this is not the case, exit with errors.
+
+	* src/sfnt/sfwoff2/c: Check whether table tag makes sense.
+
+	* src/sfnt/woff2tags.c: Return 0 if tag is out of bounds.
+
+2019-08-27  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	* src/sfnt/sfwoff2.c: Improve trace comments.
+
+	Adjust tracing levels for comments, and more formatting.
+
+2019-08-27  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	[woff2] Support `hmtx' reconstruction when `glyf' is untransformed.
+
+	`reconstruct_hmtx' requires `info->x_mins' and `info->num_glyphs' to
+	reconstruct the hmtx table.  In case glyf is not transformed, we
+	call `get_x_mins' which does the necessary work.
+
+	* src/sfnt/sfwoff2.c (get_x_mins): New function.
+	(reconstruct_font): Call get_x_mins.
+
+2019-08-27  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	[sfnt] Support `face->num_faces' for WOFF2 fonts.
+
+	Set correct value of `face->num_faces' for WOFF2 fonts.  This is
+	being handled separately because we only load the tables for the
+	requested font face in `woff2_open_font' and create a single-face
+	sfnt stream.
+
+	The full discussion is at:
+
+	  https://lists.gnu.org/archive/html/freetype-devel/2019-08/msg00000.html
+
+	* src/sfnt/sfobjs.c (sfnt_open_font): Add parameter
+	`woff2_num_faces'.
+	(sfnt_init_face): Introduce variable `woff2_num_faces', and change
+	`face->root.num_faces' if `woff2_num_faces' is set.
+
+	* src/sfnt/sfwoff2.c (woff2_open_font): Validate requested face
+	index and handle negative face indices.
+
+	* src/sfnt/sfwoff2.h (woff2_open_font): Add parameter `num_faces' to
+	declaration.
+
+2019-08-27  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	[woff2] Improve memory and error handling.
+
+	Free up memory after use, and improve error handling.
+
+	* src/sfnt/sfwoff2.c (reconstruct_font, woff2_open_font): Implement
+	changes.
+
+2019-08-27  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	[woff2] Avoid too many calls to `FT_REALLOC'.
+
+	We do this by using `totalSfntSize' as an initial reference, and
+	extending the buffer when required.  This reduces rendering time
+	considerably.
+
+	* include/freetype/internal/wofftypes.h (WOFF2_HeaderRec): Add
+	`totalSfntSize', rename `total_sfnt_size' to `actual_sfnt_size'.
+
+	* src/sfnt/sfwoff2.c (write_buf): Add parameter `dst_size' to keep
+	track of and update total size of stream.
+
+	(WRITE_SFNT_BUF, WRITE_SFNT_BUF_AT): Modify macros accordingly.
+
+	(pad4, store_loca, reconstruct_glyf, reconstruct_hmtx,
+	reconstruct_font): Update parameters to accept `sfnt_size'.
+
+	(woff2_open_font): Add variable `sfnt_size'.  Use WOFF2 header field
+	`totalSfntSize' as initial reference (if value makes sense) and
+	allocate `totalSfntSize' bytes for the sfnt stream.  `write_buf'
+	handles reallocation if and when required.  Also resize the stream
+	to `actual_sfnt_size' after reconstruction.
+
+2019-08-27  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	[woff2] Reconstruct `loca', `hmtx', and swap out stream.
+
+	Add necessary functions to reconstruct loca and hmtx tables (the two
+	remaining tables that can have a transform).  `woff2_open_font' is
+	now capable of loading a woff2 font face.  This code may still need
+	more refining and better memory management.
+
+	* include/freetype/internal/wofftypes.h (WOFF2_HeaderRec): Add total
+	(final) size of sfnt stream.
+
+	(WOFF2_InfoRec): Add header checksum value.
+
+	* src/sfnt/sfobjs.c (sfnt_open_font): Change `face_instance_index'
+	parameter to its pointer so its value can be modified by
+	`woff2_open_font'.
+
+	* src/sfnt/sfwoff2.c: (WRITE_SFNT_BUF_AT): New macro to write into
+	sfnt buffer at given position.
+
+	(write_buf): Add parameter `extend_buf' which allows caller to
+	specify whether buffer should be reallocated before copying data.
+
+	(WRITE_SFNT_BUF): Updated.
+
+	(pad4, store_loca, reconstruct_htmx): New functions.
+
+	(reconstruct_glyf): Calculate loca values and store them.
+
+	(reconstruct_font): Call `reconstruct_hmtx', write table record
+	entries, and calculate table checksums.  Also calculate font
+	checksum and update `checksumAdjustment' entry in head table.
+
+	(woff2_open_font): Open stream for sfnt buffer, swap out input
+	stream and return.
+
+	* src/sfnt/sfwoff2.h (woff2_open_font): Modify parameter to accept
+	pointer to `face_index'.
+
+2019-08-27  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	[woff2] Reconstruct transformed `glyf' table.
+
+	Reconstruct `glyf' table if it is transformed in the uncompressed
+	table stream.  Also add necessary structures, macros and functions.
+
+	* include/freetype/internal/wofftypes.h (WOFF2_InfoRec,
+	WOFF2_SubstreamRec, WOFF2_PointRec): New structures.
+	(WOFF2_TableRec): s/OrigLength/dst_length/.
+
+	* src/sfnt/sfwoff2.c (READ_255USHORT, READ_BASE128): Use
+	`FT_SET_ERROR' to set implicit `error' variable.
+
+	(WRITE_SHORT): New macro.
+
+	(N_CONTOUR_STREAM, N_POINTS_STREAM, FLAG_STREAM, GLYPH_STREAM,
+	COMPOSITE_STREAM, BBOX_STREAM, INSTRUCTION_STREAM): New macros to
+	refer to substreams of the transformed `glyf' tables.
+
+	(Read255UShort, ReadBase128): Return errors set by `FT_READ_XXX'
+	macros.
+
+	(with_sign, safe_int_addition): New functions to add sign to values
+	based on a flag and perform safe addition respectively.
+
+	(triplet_decode): Decode variable-length (flag, xCoordinate,
+	yCoordinate) triplet for a simple glyph.   See
+
+	  https://www.w3.org/TR/WOFF2/#triplet_decoding
+
+	(store_points, compute_bbox, composteGlyph_size, reconstruct_glyf):
+	New functions.
+
+	(reconstruct_font): Call `reconstruct_glyf'.
+
+	* src/sfnt/sfwoff2.h: Add required constants.
+
+	* src/sfnt/woff2tags.h: Move out constants to `sfwoff2.h'.
+
+2019-08-27  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	[woff2] Copy un-transformed tables to sfnt stream.
+
+	Copy un-transformed tables to the sfnt stream.
+
+	* src/sfnt/sfwoff2.c: (WRITE_SFNT_BUF): New macro.
+	(write_buf): New function.  Extend memory of `dst' buffer and copy
+	bytes from `src'.
+	(compute_ULong_sum): New function.  Calculate checksum of table.
+	(reconstruct_font): Change `FT_Byte* sfnt' to `FT_Byte**
+	sfnt_bytes'.  This has been done because we reallocate memory to
+	`sfnt' multiple times, which may change the pointer value of `sfnt'.
+	This new pointer must be propogated back to the caller.  Same reason
+	for using a double pointer in `write_buf'.
+
+	* src/sfnt/woff2tags.h (WOFF2_DEFAULT_MAX_SIZE): New macro used for
+	overflow checking.
+
+2019-08-27  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	[woff2] Create stream for uncompressed buffer.
+
+	Uncompressed buffer is now an `FT_Stream'.
+
+	Perform basic checks and start iterating over tables.
+
+	* src/sfnt/sfwoff2.c (stream_close, find_table, read_num_hmetrics):
+	New functions.
+	(reconstruct_font): Modify parameters and iterate over tables.
+	(woff2_open_font): Updated.
+
+2019-08-27  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	[woff2] Handle TTCs and start reconstructing font.
+
+	We `handle' TTCs by modifying the `indices' array to point to only
+	those tables that are part of the requested `face_index'.
+
+	Set and use `num_tables' in `WOFF2_TtcFont'.
+
+	* src/sfnt/sfwoff2.c (reconstruct_font): New function.
+	(woff2_open_font): Start reconstruction of font.
+
+2019-08-27  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	[woff2] Get known tags from function.
+
+	Change `KnownTags' to a function (`woff2_known_tags').  This avoids
+	introducing a global constant array.  This function returns the
+	specified index without *any* checks.  The caller must ensure that
+	`index' is within array limits.
+
+	* src/sfnt/sfwoff2.c (woff2_open_font): Change `KnownTags[...]'
+	notation to `woff2_known_tags( ...  )'.
+
+	* src/sfnt/woff2tags.c: Perform changes.
+
+	* src/sfnt/woff2tags.h: Update definitions.
+
+2019-08-27  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	[woff2] Minor.
+
+	* src/sfnt/sfwoff2.c (woff2_uncompress): Add error message
+	(woff2_open_font): Free `uncompressed_buf'.
+
+2019-08-27  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	[woff2] Uncompress Brotli streams and `face_index' support.
+
+	WOFF2 compressed stream is now uncompressed if Brotli is available.
+	This data is stored in a separate buffer (uncompressed_buf) because
+	it does not contain direct table data.  Certain tables have
+	transformations applied to them, and they must be reconstructed
+	before we can write those tables to the SFNT stream.
+
+	`face_index' is now being passed as a parameter to
+	`woff2_open_font'.
+
+	* src/sfnt/sfobjs.c (sfnt_open_font): Add parameter
+	`face_instance_index'.
+
+	* src/sfnt/sfwoff2.c (woff2_uncompress): New function.
+	(woff2_open_font): Call `woff2_uncompress'.
+	(compute_first_table_offset): Fix return type.
+
+	* src/sfnt/sfwoff2.h (woff2_open_font): Modify declaration.
+
+2019-08-27  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	* builds/unix/configure.raw: Change argument name to `brotli'.
+
+2019-08-27  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	Add Brotli dependency and required checks.
+
+	Brotli is required for decompressing WOFF2 font directory streams.
+	The library is thus being added as an optional dependency for
+	FreeType.
+
+	* builds/unix/configure.raw: Add checks for `libbrotlidec'.
+	(REQUIRES_PRIVATE, LIBS_PRIVATE, LIBSSTATIC_CONFIG): Updated.
+
+	* devel/ftoption.h, include/freetype/config/ftoption.h
+	(FT_CONFIG_OPTION_USE_BROTLI): New macro.
+
+2019-08-27  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	[woff2] Write SFNT Offset table.
+
+	* src/sfnt/sfwoff2.c (WRITE_USHORT, WRITE_ULONG): New macros.
+	(compare_tags): New function.
+	(woff2_open_font): Implement it.
+
+2019-08-27  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	* src/sfnt/sfwoff2.c: #undef macros.
+
+2019-08-27  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	[woff2] Read table and collection directory.
+
+	* include/freetype/internal/wofftypes.h (WOFF2_TtcFontRec): New
+	structure.
+	(WOFF2_HeaderRec): Add more fields.
+
+	* src/sfnt/sfwoff2.c (READ_255USHORT, READ_BASE128, ROUND4): New
+	macros.
+	(Read255UShort, CollectionHeaderSize, compute_first_table_offset):
+	New functions.
+	(ReadBase128): Use `FT_READ_BYTE'.
+	(woff2_open_font): Add functionality to read table directory and
+	collection directory (if present).
+
+2019-08-27  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	[sfnt] Include `woff2tags.c' for building.
+
+	* src/sfnt/rules.mk (SFNT_DRV_SRC): Add `woff2tags.c'.
+
+	* src/sfnt/sfnt.c: Include `woff2tags.c'.
+
+2019-08-27  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	[sfnt] Add WOFF2 constants.
+
+	Add constants required for WOFF2, and known table tags as defined in
+	the specification.  See
+
+	  https://www.w3.org/TR/WOFF2/#table_dir_format
+
+	for details.
+
+	* src/sfnt/woff2tags.c, src/sfnt/woff2tags.h: New files.
+
+2019-08-27  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	[sfnt] Read WOFF 2 header.
+
+	Check for WOFF2 tag, call `woff2_open_font', and implement it to read
+	header according to specification.
+
+	* include/freetype/internal/fttrace.h: Add `sfwoff2.c'.
+
+	* src/sfnt/rules.mk (SFNT_DRV_SRC): Add `sfwoff2.c'.
+
+	* src/sfnt/sfnt.c: Include `sfwoff2.c'.
+
+	* src/sfnt/sfobjs.c (sfnt_open_font): Check for `wOF2' tag and call
+	`woff2_open_font'.
+
+	* src/sfnt/sfwoff2.c, src/sfnt/sfwoff2.h: New files.
+
+2019-08-27  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
+
+	Add structures for WOFF2.
+
+	Add structures and macro for WOFF 2 header and table directory.
+
+	* include/freetype/internal/wofftypes.h (WOFF2_HeaderRec,
+	WOFF2_TableRec_): New structures.
+
+	* include/freetype/tttags.h (TTAG_wOF2): New macro.
+
+2019-08-26  Werner Lemberg  <wl@gnu.org>
+
+	* src/psaux/cffdecode.c (cff_operator_seac): Fix numeric overflow.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16470
+
+2019-08-26  Werner Lemberg  <wl@gnu.org>
+
+	[type1] Fix `FT_Get_Var_Axis_Flags' (#56804).
+
+	* src/type1/t1load.c (T1_Get_MM_Var): Allocate space for axis flags.
+	Also remove redundant assignment.
+
+2019-07-24  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	* src/base/ftbbox.c (cubic_peak): Sanitize left shift (#56586).
+
+2019-07-22  Weiyi Wu  <w1w2y3@gmail.com>
+
+	* src/cid/cidload.c (cid_hex_to_binary): Fix typo (#56653).
+
+2019-07-12  Werner Lemberg  <wl@gnu.org>
+
+	[sfnt, winfonts] Avoid memory leaks in case of error (#56587).
+
+	* src/sfnt/sfwoff.c (woff_open_font): Call `FT_FRAME_EXIT' in case
+	of error.
+
+	* src/winfonts/winfnt.c (fnt_face_get_dll_font): Ditto.
+
+2019-07-12  Ben Wagner  <bungeman@google.com>
+
+	Properly handle phantom points for variation fonts (#56601).
+
+	* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Scale phantom
+	points if HVAR and/or VVAR is present.
+
+2019-07-04  Werner Lemberg  <wl@gnu.org>
+
+	[psaux] (2/2) Handle fonts that use SEAC for ligatures (#56580).
+
+	The same as previous commit but for the old engine.
+
+	* src/psaux/t1decode.c (t1operator_seac): Implement it.
+
+2019-07-04  Chris Liddell <chris.liddell@artifex.com>
+
+	[psaux] (1/2) Handle fonts that use SEAC for ligatures (#56580).
+
+	As originally intended, a Type 1 SEAC charstring would be used for
+	an accented glyph (like `acaron' or `uumlaut'), where the advance
+	width of the SEAC glyph is the same as that of the `base' glyph
+	(like `a' or `u').  In this case it is not uncommon for the SEAC
+	glyph to not use an (H)SBW opcode of its own but to rely on the
+	value from the base glyph.
+
+	However, out-of-spec fonts also use SEAC glyphs for ligatures (like
+	`oe' or `fi'), and in those cases the overall advance width is
+	greater than that of the `base' glyph.  For this reason we have to
+	allow that the SEAC glyph can have an (H)SBW value of its own, and
+	if it has, retain this value, rather than the one from the base
+	glyph.
+
+	* src/psaux/psintrp.c (cf2_interpT2CharString) <cf2_escSEAC>:
+	Implement it.
+
 2019-07-01  Werner Lemberg  <wl@gnu.org>
 
 	* Version 2.10.1 released.
@@ -88,7 +2034,7 @@
 	* include/freetype/ftmodapi.h (FT_DebugHook_Func): Return error.
 
 	Fix a warning by adding a return value as in `TT_RunIns',
-	which should not be a compatibility issue. 
+	which should not be a compatibility issue.
 
 2019-06-11  Alexei Podtelezhnikov  <apodtele@gmail.com>
 
@@ -99,7 +2045,7 @@
 	[gzip] Add support for `gzip' encoded header.
 
 	* src/gzip/ftgzip.c (FT_Gzip_Uncompress): Modify the the call to
-	`inflateInit2' to enable support for `gzip' encoded headers. 
+	`inflateInit2' to enable support for `gzip' encoded headers.
 
 2019-06-10  Alexei Podtelezhnikov  <apodtele@gmail.com>
 
@@ -2912,7 +4858,7 @@
 2018-05-13  Shao Yu Zhang  <shaozhang@fb.com>
 	    Werner Lemberg  <wl@gnu.org>
 
-	[sfnt] Preliminary support of coloured layer outlines (#44689).
+	[sfnt] Preliminary support of colored layer outlines (#44689).
 
 	This commit enables OpenType's COLR/CPAL table handling; a typical
 	application are color emojis that can be scaled to any size.
@@ -3104,7 +5050,7 @@
 
 ----------------------------------------------------------------------------
 
-Copyright (C) 2018-2019 by
+Copyright (C) 2018-2020 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This file is part of the FreeType project, and may only be used, modified,
diff --git a/ChangeLog.20 b/ChangeLog.20
index a589e13..9f81914 100644
--- a/ChangeLog.20
+++ b/ChangeLog.20
@@ -2597,7 +2597,7 @@
 
 ----------------------------------------------------------------------------
 
-Copyright (C) 2000-2019 by
+Copyright (C) 2000-2020 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This file is part of the FreeType project, and may only be used, modified,
diff --git a/ChangeLog.21 b/ChangeLog.21
index ea889ee..f36f5b7 100644
--- a/ChangeLog.21
+++ b/ChangeLog.21
@@ -4799,11 +4799,11 @@
 	(chapter_inter, chapter_footer): Add <li> and use special <ul>
 	class.
 	Use double quotes around table widths given in percent.
-	(keyword_prefix, keyword_suffix): Don't change font colour directly
+	(keyword_prefix, keyword_suffix): Don't change font color directly
 	but use a new <span> class.
 	(section_synopsis_header, section_synopsis_footer): Don't change
-	colour.
-	(code_header, code_footer): Don't change font colour directly but
+	color.
+	(code_header, code_footer): Don't change font color directly but
 	use a special <pre> class.
 	(print_html_field): <tr> gets the `valign' attribute, not <table>.
 	(print_html_field_list): Ditto.
@@ -9422,7 +9422,7 @@
 
 ----------------------------------------------------------------------------
 
-Copyright (C) 2002-2019 by
+Copyright (C) 2002-2020 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This file is part of the FreeType project, and may only be used, modified,
diff --git a/ChangeLog.22 b/ChangeLog.22
index feaab86..86662f6 100644
--- a/ChangeLog.22
+++ b/ChangeLog.22
@@ -2821,7 +2821,7 @@
 
 ----------------------------------------------------------------------------
 
-Copyright (C) 2005-2019 by
+Copyright (C) 2005-2020 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This file is part of the FreeType project, and may only be used, modified,
diff --git a/ChangeLog.23 b/ChangeLog.23
index f137252..4c80504 100644
--- a/ChangeLog.23
+++ b/ChangeLog.23
@@ -7932,7 +7932,7 @@
 
 ----------------------------------------------------------------------------
 
-Copyright (C) 2006-2019 by
+Copyright (C) 2006-2020 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This file is part of the FreeType project, and may only be used, modified,
diff --git a/ChangeLog.24 b/ChangeLog.24
index 52004db..17e98c4 100644
--- a/ChangeLog.24
+++ b/ChangeLog.24
@@ -6344,7 +6344,7 @@
 
 ----------------------------------------------------------------------------
 
-Copyright (C) 2010-2019 by
+Copyright (C) 2010-2020 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This file is part of the FreeType project, and may only be used, modified,
diff --git a/ChangeLog.25 b/ChangeLog.25
index c4a3c53..6e04427 100644
--- a/ChangeLog.25
+++ b/ChangeLog.25
@@ -5145,7 +5145,7 @@
 
 ----------------------------------------------------------------------------
 
-Copyright (C) 2013-2019 by
+Copyright (C) 2013-2020 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This file is part of the FreeType project, and may only be used, modified,
diff --git a/ChangeLog.26 b/ChangeLog.26
index 5e0911c..a4fc060 100644
--- a/ChangeLog.26
+++ b/ChangeLog.26
@@ -5695,7 +5695,7 @@
 
 ----------------------------------------------------------------------------
 
-Copyright (C) 2015-2019 by
+Copyright (C) 2015-2020 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/ChangeLog.27 b/ChangeLog.27
index e9d1ec1..c59ed7b 100644
--- a/ChangeLog.27
+++ b/ChangeLog.27
@@ -2090,7 +2090,7 @@
 
 ----------------------------------------------------------------------------
 
-Copyright (C) 2016-2019 by
+Copyright (C) 2016-2020 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This file is part of the FreeType project, and may only be used, modified,
diff --git a/ChangeLog.28 b/ChangeLog.28
index c288bb9..b17a751 100644
--- a/ChangeLog.28
+++ b/ChangeLog.28
@@ -3120,7 +3120,7 @@
 
 ----------------------------------------------------------------------------
 
-Copyright (C) 2016-2019 by
+Copyright (C) 2016-2020 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This file is part of the FreeType project, and may only be used, modified,
diff --git a/ChangeLog.29 b/ChangeLog.29
index 2134071..251c056 100644
--- a/ChangeLog.29
+++ b/ChangeLog.29
@@ -2336,7 +2336,7 @@
 
 ----------------------------------------------------------------------------
 
-Copyright (C) 2017-2019 by
+Copyright (C) 2017-2020 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This file is part of the FreeType project, and may only be used, modified,
diff --git a/Jamfile b/Jamfile
deleted file mode 100644
index 37b4d58..0000000
--- a/Jamfile
+++ /dev/null
@@ -1,223 +0,0 @@
-# FreeType 2 top Jamfile.
-#
-# Copyright (C) 2001-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-
-# The HDRMACRO is already defined in FTJam and is used to add
-# the content of certain macros to the list of included header
-# files.
-#
-# We can compile FreeType 2 with classic Jam however thanks to
-# the following code
-#
-if ! $(JAM_TOOLSET)
-{
-  rule HDRMACRO
-  {
-    # nothing
-  }
-}
-
-
-# We need to invoke a SubDir rule if the FT2 source directory top is not the
-# current directory.  This allows us to build FreeType 2 as part of a larger
-# project easily.
-#
-if $(FT2_TOP) != $(DOT)
-{
-  SubDir  FT2_TOP ;
-}
-
-
-# The following macros define the include directory, the source directory,
-# and the final library name (without library extensions).  They can be
-# replaced by other definitions when the library is compiled as part of
-# a larger project.
-#
-
-# Name of FreeType include directory during compilation.
-# This is relative to FT2_TOP.
-#
-FT2_INCLUDE_DIR ?= include ;
-
-# Name of FreeType source directory during compilation.
-# This is relative to FT2_TOP.
-#
-FT2_SRC_DIR ?= src ;
-
-# Name of final library, without extension.
-#
-FT2_LIB ?= $(LIBPREFIX)freetype ;
-
-
-# Define FT2_BUILD_INCLUDE to point to your build-specific directory.
-# This is prepended to FT2_INCLUDE_DIR.  It can be used to specify
-# the location of a custom <ft2build.h> which will point to custom
-# versions of `ftmodule.h' and `ftoption.h', for example.
-#
-FT2_BUILD_INCLUDE ?= ;
-
-# The list of modules to compile on any given build of the library.
-# By default, this will contain _all_ modules defined in FT2_SRC_DIR.
-#
-# IMPORTANT: You'll need to change the content of `ftmodule.h' as well
-#            if you modify this list or provide your own.
-#
-FT2_COMPONENTS ?= autofit    # auto-fitter
-                  base       # base component (public APIs)
-                  bdf        # BDF font driver
-                  bzip2      # support for bzip2-compressed PCF font
-                  cache      # cache sub-system
-                  cff        # CFF/CEF font driver
-                  cid        # PostScript CID-keyed font driver
-                  gzip       # support for gzip-compressed PCF font
-                  lzw        # support for LZW-compressed PCF font
-                  pcf        # PCF font driver
-                  pfr        # PFR/TrueDoc font driver
-                  psaux      # common PostScript routines module
-                  pshinter   # PostScript hinter module
-                  psnames    # PostScript names handling
-                  raster     # monochrome rasterizer
-                  sfnt       # SFNT-based format support routines
-                  smooth     # anti-aliased rasterizer
-                  truetype   # TrueType font driver
-                  type1      # PostScript Type 1 font driver
-                  type42     # PostScript Type 42 (embedded TrueType) driver
-                  winfonts   # Windows FON/FNT font driver
-                  ;
-
-
-# Don't touch.
-#
-FT2_INCLUDE  = $(FT2_BUILD_INCLUDE)
-               [ FT2_SubDir $(FT2_INCLUDE_DIR) ] ;
-
-FT2_SRC      = [ FT2_SubDir $(FT2_SRC_DIR) ] ;
-
-# Location of API Reference Documentation
-#
-if $(DOC_DIR)
-{
-  DOC_DIR = $(DOCDIR:T) ;
-}
-else
-{
-  DOC_DIR = docs/reference ;
-}
-
-
-# Only used by FreeType developers.
-#
-if $(DEBUG_HINTER)
-{
-  CCFLAGS += -DDEBUG_HINTER ;
-}
-
-
-# We need `include' in the current include path in order to
-# compile any part of FreeType 2.
-#
-HDRS += $(FT2_INCLUDE) ;
-
-
-# We need to #define FT2_BUILD_LIBRARY so that our sources find the
-# internal headers
-#
-CCFLAGS += -DFT2_BUILD_LIBRARY ;
-
-# Uncomment the following line if you want to build individual source files
-# for each FreeType 2 module.  This is only useful during development, and
-# is better defined as an environment variable anyway!
-#
-# FT2_MULTI = true ;
-
-
-# The files `ftheader.h', `internal.h', and `ftserv.h' are used to define
-# macros that are later used in #include statements.  They need to be parsed
-# in order to record these definitions.
-#
-HDRMACRO  [ FT2_SubDir  $(FT2_INCLUDE_DIR) freetype config ftheader.h ] ;
-HDRMACRO  [ FT2_SubDir  $(FT2_INCLUDE_DIR) freetype internal internal.h ] ;
-HDRMACRO  [ FT2_SubDir  $(FT2_INCLUDE_DIR) freetype internal ftserv.h ] ;
-
-
-# Now include the Jamfile in `freetype2/src', used to drive the compilation
-# of each FreeType 2 component and/or module.
-#
-SubInclude  FT2_TOP $(FT2_SRC_DIR) ;
-
-# Handle the generation of the `ftexport.sym' file, which contains the list
-# of exported symbols.  This can be used on Unix by libtool.
-#
-SubInclude FT2_TOP $(FT2_SRC_DIR) tools ;
-
-rule GenExportSymbols
-{
-  local  apinames = apinames$(SUFEXE) ;
-  local  aheader ;
-  local  headers ;
-
-  for aheader in [ Glob $(2) : *.h ]
-  {
-    switch $(aheader)
-    {
-      case */ftmac.h :
-        if ( $(MAC) || $(OS) = MACOSX ) {
-          headers += $(aheader) ;
-        }
-      case *.h : headers += $(aheader) ;
-    }
-  }
-
-  LOCATE on $(1) = $(ALL_LOCATE_TARGET) ;
-
-  APINAMES on $(1) = apinames$(SUFEXE) ;
-
-  Depends            $(1) : $(apinames) $(headers) ;
-  GenExportSymbols1  $(1) : $(headers) ;
-  Clean              clean : $(1) ;
-}
-
-actions GenExportSymbols1 bind APINAMES
-{
-  $(APINAMES) $(2) > $(1)
-}
-
-GenExportSymbols  ftexport.sym : include/freetype ;
-
-# Test files (hinter debugging).  Only used by FreeType developers.
-#
-if $(DEBUG_HINTER)
-{
-  SubInclude FT2_TOP tests ;
-}
-
-rule RefDoc
-{
-  Depends  $1 : all ;
-  NotFile  $1 ;
-  Always   $1 ;
-}
-
-actions RefDoc
-{
-  python -m docwriter
-         --prefix=ft2
-         --title=FreeType-2.10.1
-         --output=$(DOC_DIR)
-         $(FT2_INCLUDE)/freetype/*.h
-         $(FT2_INCLUDE)/freetype/config/*.h
-         $(FT2_INCLUDE)/freetype/cache/*.h
-}
-
-RefDoc  refdoc ;
-
-
-# end of top Jamfile
diff --git a/Jamrules b/Jamrules
deleted file mode 100644
index aa2ef5b..0000000
--- a/Jamrules
+++ /dev/null
@@ -1,71 +0,0 @@
-# FreeType 2 JamRules.
-#
-# Copyright (C) 2001-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-
-# This file contains the Jam rules needed to build the FreeType 2 library.
-# It is shared by all Jamfiles and is included only once in the build
-# process.
-#
-
-
-# Call SubDirHdrs on a list of directories.
-#
-rule AddSubDirHdrs
-{
-  local x ;
-
-  for x in $(<)
-  {
-    SubDirHdrs $(x) ;
-  }
-}
-
-
-# Determine prefix of library file.  We must use "libxxxxx" on Unix systems,
-# while all other simply use the real name.
-#
-if $(UNIX)
-{
-  LIBPREFIX ?= lib ;
-}
-else
-{
-  LIBPREFIX ?= "" ;
-}
-
-# FT2_TOP contains the location of the FreeType source directory.  You can
-# set it to a specific value if you want to compile the library as part of a
-# larger project.
-#
-FT2_TOP ?= $(DOT) ;
-
-# Define a new rule used to declare a sub directory of the Nirvana source
-# tree.
-#
-rule FT2_SubDir
-{
-  if $(FT2_TOP) = $(DOT)
-  {
-    return [ FDirName  $(<) ] ;
-  }
-  else
-  {
-    return [ FDirName  $(FT2_TOP) $(<) ] ;
-  }
-}
-
-# We also set ALL_LOCATE_TARGET in order to place all object and library
-# files in "objs".
-#
-ALL_LOCATE_TARGET ?= [ FT2_SubDir  objs ] ;
-
-
-# end of Jamrules
diff --git a/METADATA b/METADATA
index caf325f..7fd0dc5 100644
--- a/METADATA
+++ b/METADATA
@@ -9,10 +9,11 @@
     type: GIT
     value: "git://git.sv.nongnu.org/freetype/freetype2.git"
   }
-  version: "VER-2-10-1"
+  version: "VER-2-10-4"
+  license_type: RESTRICTED
   last_upgrade_date {
-    year: 2019
-    month: 7
-    day: 9
+    year: 2020
+    month: 10
+    day: 22
   }
 }
diff --git a/Makefile b/Makefile
index 3f6a8be..e1d1469 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/README b/README
index 8f3e2bc..e4c8cf1 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-  FreeType 2.10.1
+  FreeType 2.10.4
   ===============
 
   Homepage: https://www.freetype.org
@@ -16,17 +16,20 @@
   the file `docs/LICENSE.TXT' for the available licenses.
 
   The FreeType  2 API  reference is located  in `docs/reference/site';
-  use  the  file `index.html'  as  the  top entry  point.   Additional
-  documentation is available as a separate package from our sites.  Go
-  to
+  use the file `index.html' as the top entry point.  [Please note that
+  currently the  search function  for locally  installed documentation
+  doesn't work due to cross-site scripting issues.]
+
+  Additional documentation is available as a separate package from our
+  sites.  Go to
 
     https://download.savannah.gnu.org/releases/freetype/
 
   and download one of the following files.
 
-    freetype-doc-2.10.1.tar.xz
-    freetype-doc-2.10.1.tar.gz
-    ftdoc2101.zip
+    freetype-doc-2.10.4.tar.xz
+    freetype-doc-2.10.4.tar.gz
+    ftdoc2104.zip
 
   To view the documentation online, go to
 
@@ -64,6 +67,18 @@
   a terse message that only says `it doesn't work'.
 
 
+  Patches
+  =======
+
+  Please  submit patches  to  the `freetype-devel@nongnu.org'  mailing
+  list  --  and thank  you  in  advance  for  your work  on  improving
+  FreeType!
+
+  Details on the process can be found here:
+
+    https://www.freetype.org/developer.html#patches
+
+
   Enjoy!
 
 
@@ -71,7 +86,7 @@
 
 ----------------------------------------------------------------------
 
-Copyright (C) 2006-2019 by
+Copyright (C) 2006-2020 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This  file is  part of  the FreeType  project, and  may only  be used,
diff --git a/README.android b/README.android
index a2f5020..adc7a2c 100644
--- a/README.android
+++ b/README.android
@@ -26,6 +26,7 @@
   ex: for 2.8.1: http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?h=VER-2-8-1&id=39ce3ac499d4cd7371031a062f410953c8ecce29
 * In <checkout_dir>, run git merge <commit_sha>
   i.e. git merge 39ce3ac499d4cd7371031a062f410953c8ecce29
+* Update version and last upgrade date in MEATADATA file.
 * Upload the changes.
   ex: git push origin HEAD:refs/for/master
 * Gerrit will run the text related tests.
diff --git a/README.git b/README.git
index 95f40e1..c4f0033 100644
--- a/README.git
+++ b/README.git
@@ -37,7 +37,7 @@
 
 ----------------------------------------------------------------------
 
-Copyright (C) 2005-2019 by
+Copyright (C) 2005-2020 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This  file is  part of  the FreeType  project, and  may only  be used,
diff --git a/autogen.sh b/autogen.sh
index af6cf34..79c4e4e 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Copyright (C) 2005-2019 by
+# Copyright (C) 2005-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/amiga/README b/builds/amiga/README
index ff5e652..c552527 100644
--- a/builds/amiga/README
+++ b/builds/amiga/README
@@ -1,7 +1,7 @@
 
 README for the builds/amiga subdirectory.
 
-Copyright (C) 2005-2019 by
+Copyright (C) 2005-2020 by
 Werner Lemberg and Detlef Würkner.
 
 This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/amiga/include/config/ftconfig.h b/builds/amiga/include/config/ftconfig.h
index 7c5fa02..4976c75 100644
--- a/builds/amiga/include/config/ftconfig.h
+++ b/builds/amiga/include/config/ftconfig.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Amiga-specific configuration file (specification only).              */
 /*                                                                         */
-/*  Copyright (C) 2005-2019 by                                             */
+/*  Copyright (C) 2005-2020 by                                             */
 /*  Werner Lemberg and Detlef Würkner.                                     */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
diff --git a/builds/amiga/include/config/ftmodule.h b/builds/amiga/include/config/ftmodule.h
index 9dc4631..6035bf0 100644
--- a/builds/amiga/include/config/ftmodule.h
+++ b/builds/amiga/include/config/ftmodule.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Amiga-specific FreeType module selection.                            */
 /*                                                                         */
-/*  Copyright (C) 2005-2019 by                                             */
+/*  Copyright (C) 2005-2020 by                                             */
 /*  Werner Lemberg and Detlef Würkner.                                     */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -137,8 +137,6 @@
 
 #ifdef FT_USE_SMOOTH
 FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
-FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )
-FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class )
 #endif
 
 #ifdef FT_USE_OTV
diff --git a/builds/amiga/makefile b/builds/amiga/makefile
index 92da26d..50315f3 100644
--- a/builds/amiga/makefile
+++ b/builds/amiga/makefile
@@ -5,7 +5,7 @@
 #
 
 
-# Copyright (C) 2005-2019 by
+# Copyright (C) 2005-2020 by
 # Werner Lemberg and Detlef Würkner.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/amiga/makefile.os4 b/builds/amiga/makefile.os4
index 823b9b5..cd5151c 100644
--- a/builds/amiga/makefile.os4
+++ b/builds/amiga/makefile.os4
@@ -4,7 +4,7 @@
 #
 
 
-# Copyright (C) 2005-2019 by
+# Copyright (C) 2005-2020 by
 # Werner Lemberg and Detlef Würkner.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/amiga/smakefile b/builds/amiga/smakefile
index ded76a0..fa41676 100644
--- a/builds/amiga/smakefile
+++ b/builds/amiga/smakefile
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 2005-2019 by
+# Copyright (C) 2005-2020 by
 # Werner Lemberg and Detlef Würkner.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/amiga/src/base/ftdebug.c b/builds/amiga/src/base/ftdebug.c
index 4a738d3..6510d20 100644
--- a/builds/amiga/src/base/ftdebug.c
+++ b/builds/amiga/src/base/ftdebug.c
@@ -4,7 +4,7 @@
  *
  *   Debugging and logging component for amiga (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, Werner Lemberg, and Detlef Wuerkner.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -68,8 +68,8 @@
 
 
 #include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/freetype.h>
+#include <freetype/internal/ftdebug.h>
 
 
 #ifdef FT_DEBUG_LEVEL_ERROR
@@ -152,7 +152,7 @@
 
   static const char*  ft_trace_toggles[trace_count + 1] =
   {
-#include FT_INTERNAL_TRACE_H
+#include <freetype/internal/fttrace.h>
     NULL
   };
 
diff --git a/builds/amiga/src/base/ftsystem.c b/builds/amiga/src/base/ftsystem.c
index 7e9dcb7..1dfbd66 100644
--- a/builds/amiga/src/base/ftsystem.c
+++ b/builds/amiga/src/base/ftsystem.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Amiga-specific FreeType low-level system interface (body).           */
 /*                                                                         */
-/*  Copyright (C) 1996-2019 by                                             */
+/*  Copyright (C) 1996-2020 by                                             */
 /*  David Turner, Robert Wilhelm, Werner Lemberg and Detlef Würkner.       */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -96,10 +96,10 @@
 
 #include <ft2build.h>
 #include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_SYSTEM_H
-#include FT_ERRORS_H
-#include FT_TYPES_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/ftsystem.h>
+#include <freetype/fterrors.h>
+#include <freetype/fttypes.h>
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/builds/ansi/ansi-def.mk b/builds/ansi/ansi-def.mk
index 9e1f57d..9642098 100644
--- a/builds/ansi/ansi-def.mk
+++ b/builds/ansi/ansi-def.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/ansi/ansi.mk b/builds/ansi/ansi.mk
index eb97df4..c244803 100644
--- a/builds/ansi/ansi.mk
+++ b/builds/ansi/ansi.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/beos/beos-def.mk b/builds/beos/beos-def.mk
index 7a9d91c..5ae7ed8 100644
--- a/builds/beos/beos-def.mk
+++ b/builds/beos/beos-def.mk
@@ -5,7 +5,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/beos/beos.mk b/builds/beos/beos.mk
index 180be58..1a082c1 100644
--- a/builds/beos/beos.mk
+++ b/builds/beos/beos.mk
@@ -2,7 +2,7 @@
 # FreeType 2 configuration rules for a BeOS system
 #
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/beos/detect.mk b/builds/beos/detect.mk
index 19205eb..5b92512 100644
--- a/builds/beos/detect.mk
+++ b/builds/beos/detect.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/cmake/FindBrotliDec.cmake b/builds/cmake/FindBrotliDec.cmake
new file mode 100644
index 0000000..7c484c7
--- /dev/null
+++ b/builds/cmake/FindBrotliDec.cmake
@@ -0,0 +1,51 @@
+# FindBrotliDec.cmake
+#
+# Copyright (C) 2019-2020 by
+# David Turner, Robert Wilhelm, and Werner Lemberg.
+#
+# Written by Werner Lemberg <wl@gnu.org>
+#
+# 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.
+#
+#
+# Try to find libbrotlidec include and library directories.
+#
+# If found, the following variables are set.
+#
+#   BROTLIDEC_INCLUDE_DIRS
+#   BROTLIDEC_LIBRARIES
+
+include(FindPkgConfig)
+pkg_check_modules(PC_BROTLIDEC QUIET libbrotlidec)
+
+if (PC_BROTLIDEC_VERSION)
+  set(BROTLIDEC_VERSION "${PC_BROTLIDEC_VERSION}")
+endif ()
+
+
+find_path(BROTLIDEC_INCLUDE_DIRS
+  NAMES brotli/decode.h
+  HINTS ${PC_BROTLIDEC_INCLUDEDIR}
+        ${PC_BROTLIDEC_INCLUDE_DIRS}
+  PATH_SUFFIXES brotli)
+
+find_library(BROTLIDEC_LIBRARIES
+  NAMES brotlidec
+  HINTS ${PC_BROTLIDEC_LIBDIR}
+        ${PC_BROTLIDEC_LIBRARY_DIRS})
+
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+  brotlidec
+  REQUIRED_VARS BROTLIDEC_INCLUDE_DIRS BROTLIDEC_LIBRARIES
+  FOUND_VAR BROTLIDEC_FOUND
+  VERSION_VAR BROTLIDEC_VERSION)
+
+mark_as_advanced(
+  BROTLIDEC_INCLUDE_DIRS
+  BROTLIDEC_LIBRARIES)
diff --git a/builds/cmake/FindHarfBuzz.cmake b/builds/cmake/FindHarfBuzz.cmake
index ee0d52e..d489613 100644
--- a/builds/cmake/FindHarfBuzz.cmake
+++ b/builds/cmake/FindHarfBuzz.cmake
@@ -23,59 +23,65 @@
 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
-#
-# Try to find Harfbuzz include and library directories.
+
+
+# Try to find HarfBuzz include and library directories.
 #
 # After successful discovery, this will set for inclusion where needed:
-# HARFBUZZ_INCLUDE_DIRS - containg the HarfBuzz headers
-# HARFBUZZ_LIBRARIES - containg the HarfBuzz library
+#
+#   HARFBUZZ_INCLUDE_DIRS - containg the HarfBuzz headers
+#   HARFBUZZ_LIBRARIES    - containg the HarfBuzz library
 
 include(FindPkgConfig)
 pkg_check_modules(PC_HARFBUZZ QUIET harfbuzz)
 
 find_path(HARFBUZZ_INCLUDE_DIRS
-    NAMES hb.h
-    HINTS ${PC_HARFBUZZ_INCLUDEDIR}
-          ${PC_HARFBUZZ_INCLUDE_DIRS}
-    PATH_SUFFIXES harfbuzz
-)
+  NAMES hb.h
+  HINTS ${PC_HARFBUZZ_INCLUDEDIR}
+        ${PC_HARFBUZZ_INCLUDE_DIRS}
+  PATH_SUFFIXES harfbuzz)
 
-find_library(HARFBUZZ_LIBRARIES NAMES harfbuzz
-    HINTS ${PC_HARFBUZZ_LIBDIR}
-          ${PC_HARFBUZZ_LIBRARY_DIRS}
-)
+find_library(HARFBUZZ_LIBRARIES
+  NAMES harfbuzz
+  HINTS ${PC_HARFBUZZ_LIBDIR}
+        ${PC_HARFBUZZ_LIBRARY_DIRS})
 
 if (HARFBUZZ_INCLUDE_DIRS)
-    if (EXISTS "${HARFBUZZ_INCLUDE_DIRS}/hb-version.h")
-        file(READ "${HARFBUZZ_INCLUDE_DIRS}/hb-version.h" _harfbuzz_version_content)
+  if (EXISTS "${HARFBUZZ_INCLUDE_DIRS}/hb-version.h")
+    file(READ "${HARFBUZZ_INCLUDE_DIRS}/hb-version.h" _harfbuzz_version_content)
 
-        string(REGEX MATCH "#define +HB_VERSION_STRING +\"([0-9]+\\.[0-9]+\\.[0-9]+)\"" _dummy "${_harfbuzz_version_content}")
-        set(HARFBUZZ_VERSION "${CMAKE_MATCH_1}")
-    endif ()
+    string(REGEX MATCH
+           "#define +HB_VERSION_STRING +\"([0-9]+\\.[0-9]+\\.[0-9]+)\""
+           _dummy "${_harfbuzz_version_content}")
+    set(HARFBUZZ_VERSION "${CMAKE_MATCH_1}")
+  endif ()
 endif ()
 
 if ("${harfbuzz_FIND_VERSION}" VERSION_GREATER "${HARFBUZZ_VERSION}")
-    message(FATAL_ERROR "Required version (" ${harfbuzz_FIND_VERSION} ") is higher than found version (" ${HARFBUZZ_VERSION} ")")
+  message(FATAL_ERROR
+    "Required version (" ${harfbuzz_FIND_VERSION} ")"
+    " is higher than found version (" ${HARFBUZZ_VERSION} ")")
 endif ()
 
 include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(
-    harfbuzz 
-        REQUIRED_VARS HARFBUZZ_INCLUDE_DIRS HARFBUZZ_LIBRARIES
-        VERSION_VAR HARFBUZZ_VERSION)
+find_package_handle_standard_args(
+  harfbuzz
+  REQUIRED_VARS HARFBUZZ_INCLUDE_DIRS HARFBUZZ_LIBRARIES
+  VERSION_VAR HARFBUZZ_VERSION)
 
 mark_as_advanced(
-    HARFBUZZ_INCLUDE_DIRS
-    HARFBUZZ_LIBRARIES
-)
+  HARFBUZZ_INCLUDE_DIRS
+  HARFBUZZ_LIBRARIES)
 
-# Allows easy linking as in 
+# Allow easy linking as in
+#
 #   target_link_libraries(freetype PRIVATE Harfbuzz::Harfbuzz)
+#
 if (NOT CMAKE_VERSION VERSION_LESS 3.1)
-    if (HARFBUZZ_FOUND AND NOT TARGET Harfbuzz::Harfbuzz)
-        add_library(Harfbuzz::Harfbuzz INTERFACE IMPORTED)
-        set_target_properties(
-            Harfbuzz::Harfbuzz PROPERTIES
-                INTERFACE_INCLUDE_DIRECTORIES "${HARFBUZZ_INCLUDE_DIRS}")
-    endif ()
+  if (HARFBUZZ_FOUND AND NOT TARGET Harfbuzz::Harfbuzz)
+    add_library(Harfbuzz::Harfbuzz INTERFACE IMPORTED)
+    set_target_properties(
+        Harfbuzz::Harfbuzz PROPERTIES
+          INTERFACE_INCLUDE_DIRECTORIES "${HARFBUZZ_INCLUDE_DIRS}")
+  endif ()
 endif ()
diff --git a/builds/cmake/iOS.cmake b/builds/cmake/iOS.cmake
index 3a350d2..6f46836 100644
--- a/builds/cmake/iOS.cmake
+++ b/builds/cmake/iOS.cmake
@@ -1,6 +1,6 @@
 # iOS.cmake
 #
-# Copyright (C) 2014-2019 by
+# Copyright (C) 2014-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # Written by David Wimsey <david@wimsey.us>
diff --git a/builds/cmake/testbuild.sh b/builds/cmake/testbuild.sh
index 65c481f..cc67abd 100755
--- a/builds/cmake/testbuild.sh
+++ b/builds/cmake/testbuild.sh
@@ -1,6 +1,6 @@
 #!/bin/sh -e
 
-# Copyright (C) 2015-2019 by
+# Copyright (C) 2015-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -93,7 +93,7 @@
 #include <stdlib.h>
 
 #include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 
 FT_Library library;
diff --git a/builds/compiler/ansi-cc.mk b/builds/compiler/ansi-cc.mk
index 3c3fd73..78b13a4 100644
--- a/builds/compiler/ansi-cc.mk
+++ b/builds/compiler/ansi-cc.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/compiler/bcc-dev.mk b/builds/compiler/bcc-dev.mk
index 62a51c4..5f6f161 100644
--- a/builds/compiler/bcc-dev.mk
+++ b/builds/compiler/bcc-dev.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/compiler/bcc.mk b/builds/compiler/bcc.mk
index 5ba6798..f5e2e8a 100644
--- a/builds/compiler/bcc.mk
+++ b/builds/compiler/bcc.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/compiler/emx.mk b/builds/compiler/emx.mk
index 0c2aa31..bbb7604 100644
--- a/builds/compiler/emx.mk
+++ b/builds/compiler/emx.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 2003-2019 by
+# Copyright (C) 2003-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/compiler/gcc-dev.mk b/builds/compiler/gcc-dev.mk
index 46dad39..95b5f50 100644
--- a/builds/compiler/gcc-dev.mk
+++ b/builds/compiler/gcc-dev.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/compiler/gcc.mk b/builds/compiler/gcc.mk
index b1ee409..63cd93b 100644
--- a/builds/compiler/gcc.mk
+++ b/builds/compiler/gcc.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/compiler/intelc.mk b/builds/compiler/intelc.mk
index 3a19702..b3c69b0 100644
--- a/builds/compiler/intelc.mk
+++ b/builds/compiler/intelc.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/compiler/unix-lcc.mk b/builds/compiler/unix-lcc.mk
index 9fe6753..26f8e7b 100644
--- a/builds/compiler/unix-lcc.mk
+++ b/builds/compiler/unix-lcc.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/compiler/visualage.mk b/builds/compiler/visualage.mk
index 26c99f7..4a8c8ac 100644
--- a/builds/compiler/visualage.mk
+++ b/builds/compiler/visualage.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/compiler/visualc.mk b/builds/compiler/visualc.mk
index 17c8e76..a9cf71d 100644
--- a/builds/compiler/visualc.mk
+++ b/builds/compiler/visualc.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/compiler/watcom.mk b/builds/compiler/watcom.mk
index 2ec24ef..43a9e06 100644
--- a/builds/compiler/watcom.mk
+++ b/builds/compiler/watcom.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/compiler/win-lcc.mk b/builds/compiler/win-lcc.mk
index fc1f23b..00d9d31 100644
--- a/builds/compiler/win-lcc.mk
+++ b/builds/compiler/win-lcc.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/detect.mk b/builds/detect.mk
index 93b2861..94627fc 100644
--- a/builds/detect.mk
+++ b/builds/detect.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -120,7 +120,7 @@
 	$(info `$(CONFIG_MK)' from this directory then read the INSTALL file for help.)
 	$(info )
 	$(info Otherwise, simply type `$(MAKE)' again to build the library,)
-	$(info or `$(MAKE) refdoc' to build the API reference (this needs python >= 2.6).)
+	$(info or `$(MAKE) refdoc' to build the API reference (this needs Python >= 3.5).)
 	$(info )
 	@$(COPY) $(subst /,$(SEP),$(CONFIG_RULES) $(CONFIG_MK))
 
diff --git a/builds/dos/detect.mk b/builds/dos/detect.mk
index 53c1caa..f598794 100644
--- a/builds/dos/detect.mk
+++ b/builds/dos/detect.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/dos/dos-def.mk b/builds/dos/dos-def.mk
index a5c56b6..067d1d4 100644
--- a/builds/dos/dos-def.mk
+++ b/builds/dos/dos-def.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/dos/dos-emx.mk b/builds/dos/dos-emx.mk
index dbba33e..5173208 100644
--- a/builds/dos/dos-emx.mk
+++ b/builds/dos/dos-emx.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 2003-2019 by
+# Copyright (C) 2003-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/dos/dos-gcc.mk b/builds/dos/dos-gcc.mk
index c281318..638892d 100644
--- a/builds/dos/dos-gcc.mk
+++ b/builds/dos/dos-gcc.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/dos/dos-wat.mk b/builds/dos/dos-wat.mk
index 8c5062d..4e39d21 100644
--- a/builds/dos/dos-wat.mk
+++ b/builds/dos/dos-wat.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 2003-2019 by
+# Copyright (C) 2003-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/exports.mk b/builds/exports.mk
index 9dc21e2..eba9668 100644
--- a/builds/exports.mk
+++ b/builds/exports.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 2005-2019 by
+# Copyright (C) 2005-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/freetype.mk b/builds/freetype.mk
index 2b0ffae..1d7eeb6 100644
--- a/builds/freetype.mk
+++ b/builds/freetype.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -104,7 +104,7 @@
 
 # The documentation directory.
 #
-DOC_DIR ?= $(TOP_DIR)/docs/reference
+DOC_DIR ?= $(TOP_DIR)/docs
 
 # The final name of the library file.
 #
@@ -126,12 +126,14 @@
 
 INCLUDE_FLAGS := $(INCLUDES:%=$I%)
 
+# For a development build, we assume that the external library dependencies
+# defined in `ftoption.h' are fulfilled, so we directly access the necessary
+# include directory information using `pkg-config'.
+#
 ifdef DEVEL_DIR
-  # We assume that all library dependencies for FreeType are fulfilled for a
-  # development build, so we directly access the necessary include directory
-  # information using `pkg-config'.
-  INCLUDE_FLAGS += $(shell pkg-config --cflags libpng \
-                                               harfbuzz )
+  INCLUDE_FLAGS += $(shell pkg-config --cflags libpng)
+  INCLUDE_FLAGS += $(shell pkg-config --cflags harfbuzz)
+  INCLUDE_FLAGS += $(shell pkg-config --cflags libbrotlidec)
 endif
 
 
@@ -146,25 +148,13 @@
 # FreeType.  This is required to let our sources include the internal
 # headers (something forbidden by clients).
 #
-# Finally, we define FT_CONFIG_MODULES_H so that the compiler uses the
-# generated version of `ftmodule.h' in $(OBJ_DIR).  If there is an
-# `ftoption.h' files in $(OBJ_DIR), define FT_CONFIG_OPTIONS_H too.
-#
-ifneq ($(wildcard $(OBJ_DIR)/ftoption.h),)
-  FTOPTION_H    := $(OBJ_DIR)/ftoption.h
-  FTOPTION_FLAG := $DFT_CONFIG_OPTIONS_H="<ftoption.h>"
-else ifneq ($(wildcard $(BUILD_DIR)/ftoption.h),)
-  FTOPTION_H    := $(BUILD_DIR)/ftoption.h
-  FTOPTION_FLAG := $DFT_CONFIG_OPTIONS_H="<ftoption.h>"
-endif
-
 # `CPPFLAGS' might be specified by the user in the environment.
 #
 FT_CFLAGS  = $(CPPFLAGS) \
              $(CFLAGS) \
-             $DFT2_BUILD_LIBRARY \
-             $DFT_CONFIG_MODULES_H="<ftmodule.h>" \
-             $(FTOPTION_FLAG)
+             $DFT2_BUILD_LIBRARY
+
+FT_COMPILE := $(CC) $(ANSIFLAGS) $(INCLUDE_FLAGS) $(FT_CFLAGS)
 
 
 # Include the `exports' rules file.
@@ -179,11 +169,17 @@
 
 # Define $(PUBLIC_H) as the list of all public header files located in
 # `$(TOP_DIR)/include/freetype'.  $(INTERNAL_H), and $(CONFIG_H) are defined
-# similarly.
+# similarly.  $(FTOPTION_H) is the option file used in the compilation.
 #
 # This is used to simplify the dependency rules -- if one of these files
 # changes, the whole library is recompiled.
 #
+ifneq ($(wildcard $(OBJ_DIR)/ftoption.h),)
+  FTOPTION_H    := $(OBJ_DIR)/ftoption.h
+else ifneq ($(wildcard $(BUILD_DIR)/ftoption.h),)
+  FTOPTION_H    := $(BUILD_DIR)/ftoption.h
+endif
+
 PUBLIC_H   := $(wildcard $(PUBLIC_DIR)/*.h)
 INTERNAL_H := $(wildcard $(INTERNAL_DIR)/*.h) \
               $(wildcard $(SERVICES_DIR)/*.h)
@@ -196,8 +192,6 @@
 FREETYPE_H := $(PUBLIC_H) $(INTERNAL_H) $(CONFIG_H) $(DEVEL_H)
 
 
-FT_COMPILE := $(CC) $(ANSIFLAGS) $(INCLUDE_FLAGS) $(FT_CFLAGS)
-
 # ftsystem component
 #
 FTSYS_SRC ?= $(BASE_DIR)/ftsystem.c
@@ -290,17 +284,15 @@
 library: $(PROJECT_LIBRARY)
 
 # Run `docwriter' in the current Python environment.
-# Option `-B' disables generation of .pyc files (available since python 2.6)
 #
-
 PYTHON ?= python
-PIP    ?= pip
 
 refdoc:
 	@echo Running docwriter...
 	$(PYTHON) -m docwriter \
                   --prefix=ft2 \
                   --title=FreeType-$(version) \
+                  --site=reference \
                   --output=$(DOC_DIR) \
                   $(PUBLIC_DIR)/*.h \
                   $(PUBLIC_DIR)/config/*.h \
@@ -318,17 +310,17 @@
 VENV_NAME  := env
 VENV_DIR   := $(DOC_DIR)$(SEP)$(VENV_NAME)
 ENV_PYTHON := $(VENV_DIR)$(SEP)$(BIN)$(SEP)$(PYTHON)
-ENV_PIP    := $(VENV_DIR)$(SEP)$(BIN)$(SEP)$(PIP)
 
 refdoc-venv:
 	@echo Setting up virtualenv for Python...
 	virtualenv --python=$(PYTHON) $(VENV_DIR)
 	@echo Installing docwriter...
-	$(ENV_PIP) install docwriter
+	$(ENV_PYTHON) -m pip install docwriter
 	@echo Running docwriter...
 	$(ENV_PYTHON) -m docwriter \
                       --prefix=ft2 \
                       --title=FreeType-$(version) \
+                      --site=reference \
                       --output=$(DOC_DIR) \
                       $(PUBLIC_DIR)/*.h \
                       $(PUBLIC_DIR)/config/*.h \
diff --git a/builds/link_dos.mk b/builds/link_dos.mk
index 4c9076a..c1ed150 100644
--- a/builds/link_dos.mk
+++ b/builds/link_dos.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/link_std.mk b/builds/link_std.mk
index 7eedf1e..940e674 100644
--- a/builds/link_std.mk
+++ b/builds/link_std.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/mac/ftmac.c b/builds/mac/ftmac.c
index 6adf800..2cb3046 100644
--- a/builds/mac/ftmac.c
+++ b/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-2019 by                                             */
+/*  Copyright (C) 1996-2020 by                                             */
 /*  Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.     */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -62,10 +62,9 @@
   */
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_INTERNAL_STREAM_H
+#include <freetype/freetype.h>
+#include <freetype/tttags.h>
+#include <freetype/internal/ftstream.h>
 #include "ftbase.h"
 
 #if defined( __GNUC__ ) || defined( __IBMC__ )
diff --git a/builds/meson/extract_freetype_version.py b/builds/meson/extract_freetype_version.py
new file mode 100644
index 0000000..15e87db
--- /dev/null
+++ b/builds/meson/extract_freetype_version.py
@@ -0,0 +1,107 @@
+#!/usr/bin/env python
+"""Extract the FreeType version numbers from `<freetype/freetype.h>`.
+
+This script parses the header to extract the version number defined there.
+By default, the full dotted version number is printed, but `--major`,
+`--minor` or `--patch` can be used to only print one of these values
+instead.
+"""
+
+from __future__ import print_function
+
+import argparse
+import os
+import re
+import sys
+
+# Expected input:
+#
+#  ...
+#  #define FREETYPE_MAJOR  2
+#  #define FREETYPE_MINOR  10
+#  #define FREETYPE_PATCH  2
+#  ...
+
+RE_MAJOR = re.compile(r"^ \#define \s+ FREETYPE_MAJOR \s+ (.*) $", re.X)
+RE_MINOR = re.compile(r"^ \#define \s+ FREETYPE_MINOR \s+ (.*) $", re.X)
+RE_PATCH = re.compile(r"^ \#define \s+ FREETYPE_PATCH \s+ (.*) $", re.X)
+
+
+def parse_freetype_header(header):
+    major = None
+    minor = None
+    patch = None
+
+    for line in header.splitlines():
+        line = line.rstrip()
+        m = RE_MAJOR.match(line)
+        if m:
+            assert major == None, "FREETYPE_MAJOR appears more than once!"
+            major = m.group(1)
+            continue
+
+        m = RE_MINOR.match(line)
+        if m:
+            assert minor == None, "FREETYPE_MINOR appears more than once!"
+            minor = m.group(1)
+            continue
+
+        m = RE_PATCH.match(line)
+        if m:
+            assert patch == None, "FREETYPE_PATCH appears more than once!"
+            patch = m.group(1)
+            continue
+
+    assert (
+        major and minor and patch
+    ), "This header is missing one of FREETYPE_MAJOR, FREETYPE_MINOR or FREETYPE_PATCH!"
+
+    return (major, minor, patch)
+
+
+def main():
+    parser = argparse.ArgumentParser(description=__doc__)
+
+    group = parser.add_mutually_exclusive_group()
+    group.add_argument(
+        "--major",
+        action="store_true",
+        help="Only print the major version number.",
+    )
+    group.add_argument(
+        "--minor",
+        action="store_true",
+        help="Only print the minor version number.",
+    )
+    group.add_argument(
+        "--patch",
+        action="store_true",
+        help="Only print the patch version number.",
+    )
+
+    parser.add_argument(
+        "input",
+        metavar="FREETYPE_H",
+        help="The input freetype.h header to parse.",
+    )
+
+    args = parser.parse_args()
+    with open(args.input) as f:
+        header = f.read()
+
+    version = parse_freetype_header(header)
+
+    if args.major:
+        print(version[0])
+    elif args.minor:
+        print(version[1])
+    elif args.patch:
+        print(version[2])
+    else:
+        print("%s.%s.%s" % version)
+
+    return 0
+
+
+if __name__ == "__main__":
+    sys.exit(main())
diff --git a/builds/meson/extract_libtool_version.py b/builds/meson/extract_libtool_version.py
new file mode 100644
index 0000000..0569481
--- /dev/null
+++ b/builds/meson/extract_libtool_version.py
@@ -0,0 +1,105 @@
+#!/usr/bin/env python
+"""Extract the libtool version from `configure.raw`.
+
+This script parses the `configure.raw` file to extract the libtool version
+number.  By default, the full dotted version number is printed, but
+`--major`, `--minor` or `--patch` can be used to only print one of these
+values instead.
+"""
+
+from __future__ import print_function
+
+import argparse
+import os
+import re
+import sys
+
+# Expected input:
+#
+#  ...
+#  version_info='23:2:17'
+#  ...
+
+RE_VERSION_INFO = re.compile(r"^version_info='(\d+):(\d+):(\d+)'")
+
+
+def parse_configure_raw(header):
+    major = None
+    minor = None
+    patch = None
+
+    for line in header.splitlines():
+        line = line.rstrip()
+        m = RE_VERSION_INFO.match(line)
+        if m:
+            assert major == None, "version_info appears more than once!"
+            major = m.group(1)
+            minor = m.group(2)
+            patch = m.group(3)
+            continue
+
+    assert (
+        major and minor and patch
+    ), "This input file is missing a version_info definition!"
+
+    return (major, minor, patch)
+
+
+def main():
+    parser = argparse.ArgumentParser(description=__doc__)
+
+    group = parser.add_mutually_exclusive_group()
+    group.add_argument(
+        "--major",
+        action="store_true",
+        help="Only print the major version number.",
+    )
+    group.add_argument(
+        "--minor",
+        action="store_true",
+        help="Only print the minor version number.",
+    )
+    group.add_argument(
+        "--patch",
+        action="store_true",
+        help="Only print the patch version number.",
+    )
+    group.add_argument(
+        "--soversion",
+        action="store_true",
+        help="Only print the libtool library suffix.",
+    )
+
+    parser.add_argument(
+        "input",
+        metavar="CONFIGURE_RAW",
+        help="The input configure.raw file to parse.",
+    )
+
+    args = parser.parse_args()
+    with open(args.input) as f:
+        raw_file = f.read()
+
+    version = parse_configure_raw(raw_file)
+
+    if args.major:
+        print(version[0])
+    elif args.minor:
+        print(version[1])
+    elif args.patch:
+        print(version[2])
+    elif args.soversion:
+        # Convert libtool version_info to the library suffix.
+        # (current,revision, age) -> (current - age, age, revision)
+        print(
+            "%d.%s.%s"
+            % (int(version[0]) - int(version[2]), version[2], version[1])
+        )
+    else:
+        print("%s.%s.%s" % version)
+
+    return 0
+
+
+if __name__ == "__main__":
+    sys.exit(main())
diff --git a/builds/meson/generate_reference_docs.py b/builds/meson/generate_reference_docs.py
new file mode 100644
index 0000000..219017c
--- /dev/null
+++ b/builds/meson/generate_reference_docs.py
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+"""Generate FreeType reference documentation."""
+
+from __future__ import print_function
+
+import argparse
+import glob
+import os
+import subprocess
+import sys
+
+
+def main():
+    parser = argparse.ArgumentParser(description=__doc__)
+
+    parser.add_argument(
+        "--input-dir",
+        required=True,
+        help="Top-level FreeType source directory.",
+    )
+
+    parser.add_argument(
+        "--version", required=True, help='FreeType version (e.g. "2.x.y").'
+    )
+
+    parser.add_argument(
+        "--output-dir", required=True, help="Output directory."
+    )
+
+    args = parser.parse_args()
+
+    # Get the list of input files of interest.
+    include_dir = os.path.join(args.input_dir, "include")
+    include_config_dir = os.path.join(include_dir, "config")
+    include_cache_dir = os.path.join(include_dir, "cache")
+
+    all_headers = (
+        glob.glob(os.path.join(args.input_dir, "include", "freetype", "*.h"))
+        + glob.glob(
+            os.path.join(
+                args.input_dir, "include", "freetype", "config", "*.h"
+            )
+        )
+        + glob.glob(
+            os.path.join(
+                args.input_dir, "include", "freetype", "cache", "*.h"
+            )
+        )
+    )
+
+    if not os.path.exists(args.output_dir):
+        os.makedirs(args.output_dir)
+    else:
+        assert os.path.isdir(args.output_dir), (
+            "Not a directory: " + args.output_dir
+        )
+
+    cmds = [
+        sys.executable,
+        "-m",
+        "docwriter",
+        "--prefix=ft2",
+        "--title=FreeType-" + args.version,
+        "--site=reference",
+        "--output=" + args.output_dir,
+    ] + all_headers
+
+    print("Running docwriter...")
+    subprocess.check_call(cmds)
+
+    print("Building static site...")
+    subprocess.check_call(
+        [sys.executable, "-m", "mkdocs", "build"], cwd=args.output_dir
+    )
+    return 0
+
+
+if __name__ == "__main__":
+    sys.exit(main())
diff --git a/builds/meson/parse_modules_cfg.py b/builds/meson/parse_modules_cfg.py
new file mode 100644
index 0000000..e0f7605
--- /dev/null
+++ b/builds/meson/parse_modules_cfg.py
@@ -0,0 +1,160 @@
+#!/usr/bin/env python
+"""Parse modules.cfg and dump its output either as ftmodule.h or a list of
+base extensions.
+"""
+
+from __future__ import print_function
+
+import argparse
+import os
+import re
+import sys
+
+# Expected input:
+#
+#  ...
+#  FONT_MODULES += <name>
+#  HINTING_MODULES += <name>
+#  RASTER_MODULES += <name>
+#  AUX_MODULES += <name>
+#  BASE_EXTENSIONS += <name>
+#  ...
+
+
+def parse_modules_cfg(input_file):
+
+    lists = {
+        "FONT_MODULES": [],
+        "HINTING_MODULES": [],
+        "RASTER_MODULES": [],
+        "AUX_MODULES": [],
+        "BASE_EXTENSIONS": [],
+    }
+
+    for line in input_file.splitlines():
+        line = line.rstrip()
+        # Ignore empty lines and those that start with a comment.
+        if not line or line[0] == "#":
+            continue
+
+        items = line.split()
+        assert len(items) == 3 and items[1] == "+=", (
+            "Unexpected input line [%s]" % line
+        )
+        assert items[0] in lists, (
+            "Unexpected configuration variable name " + items[0]
+        )
+
+        lists[items[0]].append(items[2])
+
+    return lists
+
+
+def generate_ftmodule(lists):
+    result = "/* This is a generated file. */\n"
+    for driver in lists["FONT_MODULES"]:
+        if driver == "sfnt":  # Special case for the sfnt 'driver'.
+            result += "FT_USE_MODULE( FT_Module_Class, sfnt_module_class )\n"
+            continue
+
+        name = {
+            "truetype": "tt",
+            "type1": "t1",
+            "cid": "t1cid",
+            "type42": "t42",
+            "winfonts": "winfnt",
+        }.get(driver, driver)
+        result += (
+            "FT_USE_MODULE( FT_Driver_ClassRec, %s_driver_class )\n" % name
+        )
+
+    for module in lists["HINTING_MODULES"]:
+        result += (
+            "FT_USE_MODULE( FT_Module_Class, %s_module_class )\n" % module
+        )
+
+    for module in lists["RASTER_MODULES"]:
+        name = {
+            "raster": "ft_raster1",
+            "smooth": "ft_smooth",
+        }.get(module)
+        result += (
+            "FT_USE_MODULE( FT_Renderer_Class, %s_renderer_class )\n" % name
+        )
+
+    for module in lists["AUX_MODULES"]:
+        if module in ("psaux", "psnames", "otvalid", "gxvalid"):
+            result += (
+                "FT_USE_MODULE( FT_Module_Class, %s_module_class )\n" % module
+            )
+
+    result += "/* EOF */\n"
+    return result
+
+
+def generate_main_modules(lists):
+    return "\n".join(
+        lists["FONT_MODULES"]
+        + lists["HINTING_MODULES"]
+        + lists["RASTER_MODULES"]
+    )
+
+
+def generate_aux_modules(lists):
+    return "\n".join(lists["AUX_MODULES"])
+
+
+def generate_base_extensions(lists):
+    return "\n".join(lists["BASE_EXTENSIONS"])
+
+
+def main():
+    parser = argparse.ArgumentParser(description=__doc__)
+
+    parser.add_argument(
+        "--format",
+        required=True,
+        choices=(
+            "ftmodule.h",
+            "main-modules",
+            "aux-modules",
+            "base-extensions-list",
+        ),
+        help="Select output format.",
+    )
+
+    parser.add_argument(
+        "input",
+        metavar="CONFIGURE_RAW",
+        help="The input configure.raw file to parse.",
+    )
+
+    parser.add_argument("--output", help="Output file (default is stdout).")
+
+    args = parser.parse_args()
+    with open(args.input) as f:
+        input_data = f.read()
+
+    lists = parse_modules_cfg(input_data)
+
+    if args.format == "ftmodule.h":
+        result = generate_ftmodule(lists)
+    elif args.format == "main-modules":
+        result = generate_main_modules(lists)
+    elif args.format == "aux-modules":
+        result = generate_aux_modules(lists)
+    elif args.format == "base-extensions-list":
+        result = generate_base_extensions(lists)
+    else:
+        assert False, "Invalid output format!"
+
+    if args.output:
+        with open(args.output, "w") as f:
+            f.write(result)
+    else:
+        print(result)
+    return 0
+
+
+if __name__ == "__main__":
+    sys.exit(main())
diff --git a/builds/meson/process_ftoption_h.py b/builds/meson/process_ftoption_h.py
new file mode 100644
index 0000000..b5f80c3
--- /dev/null
+++ b/builds/meson/process_ftoption_h.py
@@ -0,0 +1,105 @@
+#!/usr/bin/python
+"""Toggle settings in `ftoption.h` file based on command-line arguments.
+
+This script takes an `ftoption.h` file as input and rewrites
+`#define`/`#undef` lines in it based on `--enable=CONFIG_VARNAME` or
+`--disable=CONFIG_VARNAME` arguments passed to it, where `CONFIG_VARNAME` is
+configuration variable name, such as `FT_CONFIG_OPTION_USE_LZW`, that may
+appear in the file.
+
+Note that if one of `CONFIG_VARNAME` is not found in the input file, this
+script exits with an error message listing the missing variable names.
+"""
+
+import argparse
+import os
+import re
+import sys
+
+
+def main():
+    parser = argparse.ArgumentParser(description=__doc__)
+
+    parser.add_argument(
+        "input", metavar="FTOPTION_H", help="Path to input ftoption.h file."
+    )
+
+    parser.add_argument("--output", help="Output to file instead of stdout.")
+
+    parser.add_argument(
+        "--enable",
+        action="append",
+        default=[],
+        help="Enable a given build option (e.g. FT_CONFIG_OPTION_USE_LZW).",
+    )
+
+    parser.add_argument(
+        "--disable",
+        action="append",
+        default=[],
+        help="Disable a given build option.",
+    )
+
+    args = parser.parse_args()
+
+    common_options = set(args.enable) & set(args.disable)
+    if common_options:
+        parser.error(
+            "Options cannot be both enabled and disabled: %s"
+            % sorted(common_options)
+        )
+        return 1
+
+    with open(args.input) as f:
+        input_file = f.read()
+
+    options_seen = set()
+
+    new_lines = []
+    for line in input_file.splitlines():
+        # Expected formats:
+        #   #define <CONFIG_VAR>
+        #   /* #define <CONFIG_VAR> */
+        #   #undef <CONFIG_VAR>
+        line = line.rstrip()
+        if line.startswith("/* #define ") and line.endswith(" */"):
+            option_name = line[11:-3].strip()
+            option_enabled = False
+        elif line.startswith("#define "):
+            option_name = line[8:].strip()
+            option_enabled = True
+        elif line.startswith("#undef "):
+            option_name = line[7:].strip()
+            option_enabled = False
+        else:
+            new_lines.append(line)
+            continue
+
+        options_seen.add(option_name)
+        if option_enabled and option_name in args.disable:
+            line = "#undef " + option_name
+        elif not option_enabled and option_name in args.enable:
+            line = "#define " + option_name
+        new_lines.append(line)
+
+    result = "\n".join(new_lines)
+
+    # Sanity check that all command-line options were actually processed.
+    cmdline_options = set(args.enable) | set(args.disable)
+    assert cmdline_options.issubset(
+        options_seen
+    ), "Could not find options in input file: " + ", ".join(
+        sorted(cmdline_options - options_seen)
+    )
+
+    if args.output:
+        with open(args.output, "w") as f:
+            f.write(result)
+    else:
+        print(result)
+
+    return 0
+
+
+if __name__ == "__main__":
+    sys.exit(main())
diff --git a/builds/modules.mk b/builds/modules.mk
index 8886fb3..ae2e238 100644
--- a/builds/modules.mk
+++ b/builds/modules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/os2/detect.mk b/builds/os2/detect.mk
index 8e29450..659b6c4 100644
--- a/builds/os2/detect.mk
+++ b/builds/os2/detect.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/os2/os2-def.mk b/builds/os2/os2-def.mk
index 7a1699e..b097654 100644
--- a/builds/os2/os2-def.mk
+++ b/builds/os2/os2-def.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/os2/os2-dev.mk b/builds/os2/os2-dev.mk
index 1b83836..8e2a4eb 100644
--- a/builds/os2/os2-dev.mk
+++ b/builds/os2/os2-dev.mk
@@ -5,7 +5,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/os2/os2-gcc.mk b/builds/os2/os2-gcc.mk
index 63a3ed1..2bd39ae 100644
--- a/builds/os2/os2-gcc.mk
+++ b/builds/os2/os2-gcc.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/symbian/bld.inf b/builds/symbian/bld.inf
index 0fa16c3..9739da1 100644
--- a/builds/symbian/bld.inf
+++ b/builds/symbian/bld.inf
@@ -2,7 +2,7 @@
 // FreeType 2 project for the symbian platform
 //
 
-// Copyright (C) 2008-2019 by
+// Copyright (C) 2008-2020 by
 // David Turner, Robert Wilhelm, and Werner Lemberg.
 //
 // This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/symbian/freetype.mmp b/builds/symbian/freetype.mmp
index bfbbcaf..90fc6bb 100644
--- a/builds/symbian/freetype.mmp
+++ b/builds/symbian/freetype.mmp
@@ -2,7 +2,7 @@
 // FreeType 2 makefile for the symbian platform
 //
 
-// Copyright (C) 2008-2019 by
+// Copyright (C) 2008-2020 by
 // David Turner, Robert Wilhelm, and Werner Lemberg.
 //
 // This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/toplevel.mk b/builds/toplevel.mk
index 333b775..5de61c1 100644
--- a/builds/toplevel.mk
+++ b/builds/toplevel.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -268,7 +268,7 @@
 	cp $(CONFIG_SUB) builds/unix
 
 	@# Remove intermediate files created by the `refdoc' target.
-	rm -rf docs/reference/markdown
-	rm -f docs/reference/mkdocs.yml
+	rm -rf docs/markdown
+	rm -f docs/mkdocs.yml
 
 # EOF
diff --git a/builds/unix/ax_compare_version.m4 b/builds/unix/ax_compare_version.m4
new file mode 100644
index 0000000..ffb4997
--- /dev/null
+++ b/builds/unix/ax_compare_version.m4
@@ -0,0 +1,177 @@
+# ===========================================================================
+#    https://www.gnu.org/software/autoconf-archive/ax_compare_version.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
+#
+# DESCRIPTION
+#
+#   This macro compares two version strings. Due to the various number of
+#   minor-version numbers that can exist, and the fact that string
+#   comparisons are not compatible with numeric comparisons, this is not
+#   necessarily trivial to do in a autoconf script. This macro makes doing
+#   these comparisons easy.
+#
+#   The six basic comparisons are available, as well as checking equality
+#   limited to a certain number of minor-version levels.
+#
+#   The operator OP determines what type of comparison to do, and can be one
+#   of:
+#
+#    eq  - equal (test A == B)
+#    ne  - not equal (test A != B)
+#    le  - less than or equal (test A <= B)
+#    ge  - greater than or equal (test A >= B)
+#    lt  - less than (test A < B)
+#    gt  - greater than (test A > B)
+#
+#   Additionally, the eq and ne operator can have a number after it to limit
+#   the test to that number of minor versions.
+#
+#    eq0 - equal up to the length of the shorter version
+#    ne0 - not equal up to the length of the shorter version
+#    eqN - equal up to N sub-version levels
+#    neN - not equal up to N sub-version levels
+#
+#   When the condition is true, shell commands ACTION-IF-TRUE are run,
+#   otherwise shell commands ACTION-IF-FALSE are run. The environment
+#   variable 'ax_compare_version' is always set to either 'true' or 'false'
+#   as well.
+#
+#   Examples:
+#
+#     AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8])
+#     AX_COMPARE_VERSION([3.15],[lt],[3.15.8])
+#
+#   would both be true.
+#
+#     AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8])
+#     AX_COMPARE_VERSION([3.15],[gt],[3.15.8])
+#
+#   would both be false.
+#
+#     AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8])
+#
+#   would be true because it is only comparing two minor versions.
+#
+#     AX_COMPARE_VERSION([3.15.7],[eq0],[3.15])
+#
+#   would be true because it is only comparing the lesser number of minor
+#   versions of the two values.
+#
+#   Note: The characters that separate the version numbers do not matter. An
+#   empty string is the same as version 0. OP is evaluated by autoconf, not
+#   configure, so must be a string, not a variable.
+#
+#   The author would like to acknowledge Guido Draheim whose advice about
+#   the m4_case and m4_ifvaln functions make this macro only include the
+#   portions necessary to perform the specific comparison specified by the
+#   OP argument in the final configure script.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Tim Toolan <toolan@ele.uri.edu>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 13
+
+dnl #########################################################################
+AC_DEFUN([AX_COMPARE_VERSION], [
+  AC_REQUIRE([AC_PROG_AWK])
+
+  # Used to indicate true or false condition
+  ax_compare_version=false
+
+  # Convert the two version strings to be compared into a format that
+  # allows a simple string comparison.  The end result is that a version
+  # string of the form 1.12.5-r617 will be converted to the form
+  # 0001001200050617.  In other words, each number is zero padded to four
+  # digits, and non digits are removed.
+  AS_VAR_PUSHDEF([A],[ax_compare_version_A])
+  A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
+                     -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+                     -e 's/[[^0-9]]//g'`
+
+  AS_VAR_PUSHDEF([B],[ax_compare_version_B])
+  B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
+                     -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+                     -e 's/[[^0-9]]//g'`
+
+  dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary
+  dnl # then the first line is used to determine if the condition is true.
+  dnl # The sed right after the echo is to remove any indented white space.
+  m4_case(m4_tolower($2),
+  [lt],[
+    ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"`
+  ],
+  [gt],[
+    ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"`
+  ],
+  [le],[
+    ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"`
+  ],
+  [ge],[
+    ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"`
+  ],[
+    dnl Split the operator from the subversion count if present.
+    m4_bmatch(m4_substr($2,2),
+    [0],[
+      # A count of zero means use the length of the shorter version.
+      # Determine the number of characters in A and B.
+      ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'`
+      ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'`
+
+      # Set A to no more than B's length and B to no more than A's length.
+      A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"`
+      B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"`
+    ],
+    [[0-9]+],[
+      # A count greater than zero means use only that many subversions
+      A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
+      B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
+    ],
+    [.+],[
+      AC_WARNING(
+        [invalid OP numeric parameter: $2])
+    ],[])
+
+    # Pad zeros at end of numbers to make same length.
+    ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`"
+    B="$B`echo $A | sed 's/./0/g'`"
+    A="$ax_compare_version_tmp_A"
+
+    # Check for equality or inequality as necessary.
+    m4_case(m4_tolower(m4_substr($2,0,2)),
+    [eq],[
+      test "x$A" = "x$B" && ax_compare_version=true
+    ],
+    [ne],[
+      test "x$A" != "x$B" && ax_compare_version=true
+    ],[
+      AC_WARNING([invalid OP parameter: $2])
+    ])
+  ])
+
+  AS_VAR_POPDEF([A])dnl
+  AS_VAR_POPDEF([B])dnl
+
+  dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE.
+  if test "$ax_compare_version" = "true" ; then
+    m4_ifvaln([$4],[$4],[:])dnl
+    m4_ifvaln([$5],[else $5])dnl
+  fi
+]) dnl AX_COMPARE_VERSION
diff --git a/builds/unix/ax_prog_python_version.m4 b/builds/unix/ax_prog_python_version.m4
new file mode 100644
index 0000000..dbc3dbf
--- /dev/null
+++ b/builds/unix/ax_prog_python_version.m4
@@ -0,0 +1,66 @@
+# ===========================================================================
+#  https://www.gnu.org/software/autoconf-archive/ax_prog_python_version.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_PROG_PYTHON_VERSION([VERSION],[ACTION-IF-TRUE],[ACTION-IF-FALSE])
+#
+# DESCRIPTION
+#
+#   Makes sure that python supports the version indicated. If true the shell
+#   commands in ACTION-IF-TRUE are executed. If not the shell commands in
+#   ACTION-IF-FALSE are run. Note if $PYTHON is not set (for example by
+#   running AC_CHECK_PROG or AC_PATH_PROG) the macro will fail.
+#
+#   Example:
+#
+#     AC_PATH_PROG([PYTHON],[python])
+#     AX_PROG_PYTHON_VERSION([2.4.4],[ ... ],[ ... ])
+#
+#   This will check to make sure that the python you have supports at least
+#   version 2.4.4.
+#
+#   NOTE: This macro uses the $PYTHON variable to perform the check.
+#   AX_WITH_PYTHON can be used to set that variable prior to running this
+#   macro. The $PYTHON_VERSION variable will be valorized with the detected
+#   version.
+#
+# LICENSE
+#
+#   Copyright (c) 2009 Francesco Salvestrini <salvestrini@users.sourceforge.net>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 12
+
+AC_DEFUN([AX_PROG_PYTHON_VERSION],[
+    AC_REQUIRE([AC_PROG_SED])
+    AC_REQUIRE([AC_PROG_GREP])
+
+    AS_IF([test -n "$PYTHON"],[
+        ax_python_version="$1"
+
+        AC_MSG_CHECKING([for python version])
+        changequote(<<,>>)
+        python_version=`$PYTHON -V 2>&1 | $GREP "^Python " | $SED -e 's/^.* \([0-9]*\.[0-9]*\.[0-9]*\)/\1/'`
+        changequote([,])
+        AC_MSG_RESULT($python_version)
+
+	AC_SUBST([PYTHON_VERSION],[$python_version])
+
+        AX_COMPARE_VERSION([$ax_python_version],[le],[$python_version],[
+	    :
+            $2
+        ],[
+	    :
+            $3
+        ])
+    ],[
+        AC_MSG_WARN([could not find the python interpreter])
+        $3
+    ])
+])
diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw
index a1a6dbe..bc65e45 100644
--- a/builds/unix/configure.raw
+++ b/builds/unix/configure.raw
@@ -2,7 +2,7 @@
 #
 # Process this file with autoconf to produce a configure script.
 #
-# Copyright (C) 2001-2019 by
+# Copyright (C) 2001-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -12,12 +12,12 @@
 # fully.
 
 AC_INIT([FreeType], [@VERSION@], [freetype@nongnu.org], [freetype])
-AC_CONFIG_SRCDIR([ftconfig.in])
+AC_CONFIG_SRCDIR([ftconfig.h.in])
 
 
 # Don't forget to update `docs/VERSIONS.TXT'!
 
-version_info='23:1:17'
+version_info='23:4:17'
 AC_SUBST([version_info])
 ft_version=`echo $version_info | tr : .`
 AC_SUBST([ft_version])
@@ -109,11 +109,11 @@
 AC_TYPE_LONG_LONG_INT
 
 
-# check whether cpp computation of size of int and long in ftconfig.in works
+# check whether cpp computation of size of int and long in ftconfig.h.in works
 
-AC_MSG_CHECKING([whether cpp computation of bit length in ftconfig.in works])
+AC_MSG_CHECKING([whether cpp computation of bit length in ftconfig.h.in works])
 orig_CPPFLAGS="${CPPFLAGS}"
-CPPFLAGS="-I${srcdir} -I. -I${srcdir}/../../include/freetype/config ${CPPFLAGS}"
+CPPFLAGS="-I${srcdir} -I. -I${srcdir}/../../include ${CPPFLAGS}"
 
 ac_clean_files=
 if test ! -f ft2build.h; then
@@ -123,11 +123,11 @@
 
 cat > conftest.c <<\_ACEOF
 #include <limits.h>
-#define FT_CONFIG_OPTIONS_H "ftoption.h"
-#define FT_CONFIG_STANDARD_LIBRARY_H "ftstdlib.h"
+#define FT_CONFIG_OPTIONS_H <freetype/config/ftoption.h>
+#define FT_CONFIG_STANDARD_LIBRARY_H <freetype/config/ftstdlib.h>
 #define FT_UINT_MAX  UINT_MAX
 #define FT_ULONG_MAX ULONG_MAX
-#include "ftconfig.in"
+#include "ftconfig.h.in"
 _ACEOF
 echo >> conftest.c "#if FT_SIZEOF_INT == "${ac_cv_sizeof_int}
 echo >> conftest.c "ac_cpp_ft_sizeof_int="${ac_cv_sizeof_int}
@@ -478,7 +478,7 @@
       libpng_libsstaticconf="$LIBPNG_LIBS"
       have_libpng="yes (LIBPNG_CFLAGS and LIBPNG_LIBS)"
     else
-      # fall back to config script.
+      # fall back to config script
       AC_MSG_CHECKING([for libpng-config])
       if which libpng-config > /dev/null 2>&1; then
         LIBPNG_CFLAGS=`libpng-config --cflags`
@@ -508,7 +508,7 @@
 
 have_harfbuzz=no
 if test x"$with_harfbuzz" = xyes -o x"$with_harfbuzz" = xauto; then
-  harfbuzz_pkg="harfbuzz >= 1.3.0"
+  harfbuzz_pkg="harfbuzz >= 1.8.0"
   have_harfbuzz_pkg=no
 
   if test x"$HARFBUZZ_CFLAGS" = x -a x"$HARFBUZZ_LIBS" = x; then
@@ -543,6 +543,50 @@
 fi
 
 
+# check for system libbrotlidec
+
+AC_ARG_WITH([brotli],
+  [AS_HELP_STRING([--with-brotli=@<:@yes|no|auto@:>@],
+                  [support decompression of WOFF2 streams @<:@default=auto@:>@])],
+  [], [with_brotli=auto])
+
+have_brotli=no
+if test x"$with_brotli" = xyes -o x"$with_brotli" = xauto; then
+  brotli_pkg="libbrotlidec"
+  have_brotli_pkg=no
+
+  if test x"$BROTLI_CFLAGS" = x -a x"$BROTLI_LIBS" = x; then
+    PKG_CHECK_EXISTS([$brotli_pkg], [have_brotli_pkg=yes])
+  fi
+  PKG_CHECK_MODULES([BROTLI], [$brotli_pkg],
+                    [have_brotli="yes (pkg-config)"], [:])
+
+  if test $have_brotli_pkg = yes; then
+    # we have libbrotlidec.pc
+    brotli_reqpriv="$brotli_pkg"
+    brotli_libspriv=
+    brotli_libsstaticconf=`$PKG_CONFIG --static --libs "$brotli_pkg"`
+  else
+    brotli_reqpriv=
+
+    if test "$have_brotli" != no; then
+      # BROTLI_CFLAGS and BROTLI_LIBS are set by the user
+      brotli_libspriv="$BROTLI_LIBS"
+      brotli_libsstaticconf="$BROTLI_LIBS"
+      have_brotli="yes (BROTLI_CFLAGS and BROTLI_LIBS)"
+    else
+      # since Brotli is quite a new library we don't fall back to a
+      # different test
+      :
+    fi
+  fi
+fi
+
+if test x"$with_brotli" = xyes -a "$have_brotli" = no; then
+  AC_MSG_ERROR([brotli support requested but library not found])
+fi
+
+
 # check for librt
 #
 # We need `clock_gettime' for the `ftbench' demo program.
@@ -968,16 +1012,20 @@
     ;;
 esac
 
-# Check for python and docwriter
+# Check for Python and docwriter
 
-AC_CHECK_PROGS([PYTHON], [python3 python2 python], [missing])
+have_py3=no
 have_docwriter=no
-if test "x$PYTHON" != "xmissing"; then
-  AC_CHECK_PROGS([PIP], [pip3 pip2 pip], [missing])
+PIP=pip
 
-  if test "x$PIP" != "xmissing"; then
+AC_CHECK_PROGS([PYTHON], [python3 python], [missing])
+if test "x$PYTHON" != "xmissing"; then
+  AX_PROG_PYTHON_VERSION([3.5], [have_py3=yes], [])
+
+  if test "x$have_py3" = "xyes"; then
+    PIP="$PYTHON -m $PIP"
     AC_MSG_CHECKING([for \`docwriter' Python module])
-    $PIP show -q docwriter
+    $PYTHON -m docwriter -h > /dev/null 2>&1
     if test "x$?" = "x0"; then
       have_docwriter=yes
       AC_MSG_RESULT([yes])
@@ -988,11 +1036,12 @@
 fi
 
 
-# entries in Requires.private are separated by commas;
+# entries in Requires.private are separated by commas
 REQUIRES_PRIVATE="$zlib_reqpriv,     \
                   $bzip2_reqpriv,    \
                   $libpng_reqpriv,   \
-                  $harfbuzz_reqpriv"
+                  $harfbuzz_reqpriv, \
+                  $brotli_reqpriv"
 # beautify
 REQUIRES_PRIVATE=`echo "$REQUIRES_PRIVATE" \
                   | sed -e 's/^  *//'      \
@@ -1007,6 +1056,7 @@
               $bzip2_libspriv    \
               $libpng_libspriv   \
               $harfbuzz_libspriv \
+              $brotli_libspriv   \
               $ft2_extra_libs"
 # beautify
 LIBS_PRIVATE=`echo "$LIBS_PRIVATE"  \
@@ -1019,6 +1069,7 @@
                    $bzip2_libsstaticconf    \
                    $libpng_libsstaticconf   \
                    $harfbuzz_libsstaticconf \
+                   $brotli_libsstaticconf   \
                    $ft2_extra_libs"
 # remove -L/usr/lib and -L/usr/lib64 since `freetype-config' adds them later
 # on if necessary; also beautify
@@ -1083,6 +1134,13 @@
 else
   ftoption_unset FT_CONFIG_OPTION_USE_HARFBUZZ
 fi
+if test "$have_brotli" != no; then
+  CFLAGS="$CFLAGS $BROTLI_CFLAGS"
+  LDFLAGS="$LDFLAGS $BROTLI_LIBS"
+  ftoption_set FT_CONFIG_OPTION_USE_BROTLI
+else
+  ftoption_unset FT_CONFIG_OPTION_USE_BROTLI
+fi
 
 AC_SUBST([CFLAGS])
 AC_SUBST([LDFLAGS])
@@ -1100,15 +1158,7 @@
    rm ftoption.tmp],
   [FTOPTION_H_SED="$FTOPTION_H_SED"])
 
-# configuration file -- stay in 8.3 limit
-#
-# since #undef doesn't survive in configuration header files we replace
-# `/undef' with `#undef' after creating the output file
-
-AC_CONFIG_HEADERS([ftconfig.h:ftconfig.in],
-  [mv ftconfig.h ftconfig.tmp
-   sed 's|/undef|#undef|' < ftconfig.tmp > ftconfig.h
-   rm ftconfig.tmp])
+AC_CONFIG_HEADERS([ftconfig.h])
 
 # create the Unix-specific sub-Makefiles `builds/unix/unix-def.mk'
 # and `builds/unix/unix-cc.mk' that will be used by the build system
@@ -1116,10 +1166,6 @@
 AC_CONFIG_FILES([unix-cc.mk:unix-cc.in
                  unix-def.mk:unix-def.in])
 
-# re-generate the Jamfile to use libtool now
-#
-# AC_CONFIG_FILES([../../Jamfile:../../Jamfile.in])
-
 AC_OUTPUT
 
 AC_MSG_NOTICE([
@@ -1129,16 +1175,17 @@
   bzip2:         $have_bzip2
   libpng:        $have_libpng
   harfbuzz:      $have_harfbuzz
+  brotli:        $have_brotli
 ])
 
 # Warn if docwriter is not installed
 
 if test $have_docwriter = no; then
-  AC_MSG_NOTICE([
-  Warning: \`make refdoc' will fail since pip package \`docwriter' is not
-  installed.  To install, run \`$PIP install docwriter', or to use a python
+  AC_MSG_WARN([
+  \`make refdoc' will fail since pip package \`docwriter' is not installed.
+  To install, run \`$PIP install docwriter', or to use a Python
   virtual environment, run \`make refdoc-venv' (requires pip package
-  \`virtualenv').
+  \`virtualenv'). These operations require Python >= 3.5.
   ])
 fi
 
diff --git a/builds/unix/detect.mk b/builds/unix/detect.mk
index 7ce7d8a..c7e8408 100644
--- a/builds/unix/detect.mk
+++ b/builds/unix/detect.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/unix/freetype-config.in b/builds/unix/freetype-config.in
index 9e8d3c2..3918ddb 100644
--- a/builds/unix/freetype-config.in
+++ b/builds/unix/freetype-config.in
@@ -1,6 +1,6 @@
 #! /bin/sh
 #
-# Copyright (C) 2000-2019 by
+# Copyright (C) 2000-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/unix/freetype2.m4 b/builds/unix/freetype2.m4
index d68d15e..207c263 100644
--- a/builds/unix/freetype2.m4
+++ b/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-2019 by
+# Copyright (C) 2001-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -15,7 +15,7 @@
 # generated by Autoconf, under the same distribution terms as the rest of
 # that program.
 #
-# serial 4
+# serial 5
 
 # AC_CHECK_FT2([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
 # Test for FreeType 2, and define FT2_CFLAGS and FT2_LIBS.
@@ -116,7 +116,7 @@
              AC_LANG_SOURCE([[
 
 #include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 #include <stdio.h>
 #include <stdlib.h>
 
diff --git a/builds/unix/ft-munmap.m4 b/builds/unix/ft-munmap.m4
index 4384013..a1aea2b 100644
--- a/builds/unix/ft-munmap.m4
+++ b/builds/unix/ft-munmap.m4
@@ -1,6 +1,6 @@
 ## FreeType specific autoconf tests
 #
-# Copyright (C) 2002-2019 by
+# Copyright (C) 2002-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/unix/ftconfig.h.in b/builds/unix/ftconfig.h.in
new file mode 100644
index 0000000..00b5a82
--- /dev/null
+++ b/builds/unix/ftconfig.h.in
@@ -0,0 +1,62 @@
+/****************************************************************************
+ *
+ * ftconfig.h.in
+ *
+ *   UNIX-specific configuration file (specification only).
+ *
+ * Copyright (C) 1996-2020 by
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+ * 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.
+ *
+ */
+
+
+  /**************************************************************************
+   *
+   * This header file contains a number of macro definitions that are used by
+   * the rest of the engine.  Most of the macros here are automatically
+   * determined at compile time, and you should not need to change it to port
+   * FreeType, except to compile the library with a non-ANSI compiler.
+   *
+   * Note however that if some specific modifications are needed, we advise
+   * you to place a modified copy in your build directory.
+   *
+   * The build directory is usually `builds/<system>`, and contains
+   * system-specific files that are always included first when building the
+   * library.
+   *
+   */
+
+#ifndef FTCONFIG_H_
+#define FTCONFIG_H_
+
+#include <ft2build.h>
+#include FT_CONFIG_OPTIONS_H
+#include FT_CONFIG_STANDARD_LIBRARY_H
+
+#undef HAVE_UNISTD_H
+#undef HAVE_FCNTL_H
+
+#undef FT_USE_AUTOCONF_SIZEOF_TYPES
+#ifdef FT_USE_AUTOCONF_SIZEOF_TYPES
+
+#undef SIZEOF_INT
+#undef SIZEOF_LONG
+#define FT_SIZEOF_INT  SIZEOF_INT
+#define FT_SIZEOF_LONG SIZEOF_LONG
+
+#endif /* FT_USE_AUTOCONF_SIZEOF_TYPES */
+
+#include <freetype/config/integer-types.h>
+#include <freetype/config/public-macros.h>
+#include <freetype/config/mac-support.h>
+
+#endif /* FTCONFIG_H_ */
+
+
+/* END */
diff --git a/builds/unix/ftconfig.in b/builds/unix/ftconfig.in
deleted file mode 100644
index 019793e..0000000
--- a/builds/unix/ftconfig.in
+++ /dev/null
@@ -1,603 +0,0 @@
-/****************************************************************************
- *
- * ftconfig.in
- *
- *   UNIX-specific configuration file (specification only).
- *
- * Copyright (C) 1996-2019 by
- * David Turner, Robert Wilhelm, and Werner Lemberg.
- *
- * This file is part of the FreeType project, and may only be used,
- * modified, and distributed under the terms of the FreeType project
- * license, LICENSE.TXT.  By continuing to use, modify, or distribute
- * this file you indicate that you have read the license and
- * understand and accept it fully.
- *
- */
-
-
-  /**************************************************************************
-   *
-   * This header file contains a number of macro definitions that are used by
-   * the rest of the engine.  Most of the macros here are automatically
-   * determined at compile time, and you should not need to change it to port
-   * FreeType, except to compile the library with a non-ANSI compiler.
-   *
-   * Note however that if some specific modifications are needed, we advise
-   * you to place a modified copy in your build directory.
-   *
-   * The build directory is usually `builds/<system>`, and contains
-   * system-specific files that are always included first when building the
-   * library.
-   *
-   */
-
-#ifndef FTCONFIG_H_
-#define FTCONFIG_H_
-
-#include <ft2build.h>
-#include FT_CONFIG_OPTIONS_H
-#include FT_CONFIG_STANDARD_LIBRARY_H
-
-
-FT_BEGIN_HEADER
-
-
-  /**************************************************************************
-   *
-   *              PLATFORM-SPECIFIC CONFIGURATION MACROS
-   *
-   * These macros can be toggled to suit a specific system.  The current ones
-   * are defaults used to compile FreeType in an ANSI C environment (16bit
-   * compilers are also supported).  Copy this file to your own
-   * `builds/<system>` directory, and edit it to port the engine.
-   *
-   */
-
-#undef HAVE_UNISTD_H
-#undef HAVE_FCNTL_H
-#undef HAVE_STDINT_H
-
-  /* There are systems (like the Texas Instruments 'C54x) where a `char`  */
-  /* has 16~bits.  ANSI~C says that `sizeof(char)` is always~1.  Since an */
-  /* `int` has 16~bits also for this system, `sizeof(int)` gives~1 which  */
-  /* is probably unexpected.                                              */
-  /*                                                                      */
-  /* `CHAR_BIT` (defined in `limits.h`) gives the number of bits in a     */
-  /* `char` type.                                                         */
-
-#ifndef FT_CHAR_BIT
-#define FT_CHAR_BIT  CHAR_BIT
-#endif
-
-
-#undef FT_USE_AUTOCONF_SIZEOF_TYPES
-#ifdef FT_USE_AUTOCONF_SIZEOF_TYPES
-
-#undef SIZEOF_INT
-#undef SIZEOF_LONG
-#define FT_SIZEOF_INT  SIZEOF_INT
-#define FT_SIZEOF_LONG SIZEOF_LONG
-
-#else /* !FT_USE_AUTOCONF_SIZEOF_TYPES */
-
-  /* Following cpp computation of the bit length of `int` and `long` */
-  /* is copied from default `include/freetype/config/ftconfig.h`.    */
-  /* If any improvement is required for this file, it should be      */
-  /* applied to the original header file for the builders that do    */
-  /* not use configure script.                                       */
-
-  /* The size of an `int` type. */
-#if                                 FT_UINT_MAX == 0xFFFFUL
-#define FT_SIZEOF_INT  ( 16 / FT_CHAR_BIT )
-#elif                               FT_UINT_MAX == 0xFFFFFFFFUL
-#define FT_SIZEOF_INT  ( 32 / FT_CHAR_BIT )
-#elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL
-#define FT_SIZEOF_INT  ( 64 / FT_CHAR_BIT )
-#else
-#error "Unsupported size of `int' type!"
-#endif
-
-  /* The size of a `long` type.  A five-byte `long` (as used e.g. on the */
-  /* DM642) is recognized but avoided.                                   */
-#if                                  FT_ULONG_MAX == 0xFFFFFFFFUL
-#define FT_SIZEOF_LONG  ( 32 / FT_CHAR_BIT )
-#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL
-#define FT_SIZEOF_LONG  ( 32 / FT_CHAR_BIT )
-#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL
-#define FT_SIZEOF_LONG  ( 64 / FT_CHAR_BIT )
-#else
-#error "Unsupported size of `long' type!"
-#endif
-
-#endif /* !FT_USE_AUTOCONF_SIZEOF_TYPES */
-
-  /* `FT_UNUSED` indicates that a given parameter is not used --   */
-  /* this is only used to get rid of unpleasant compiler warnings. */
-#ifndef FT_UNUSED
-#define FT_UNUSED( arg )  ( (arg) = (arg) )
-#endif
-
-
-  /**************************************************************************
-   *
-   *                    AUTOMATIC CONFIGURATION MACROS
-   *
-   * These macros are computed from the ones defined above.  Don't touch
-   * their definition, unless you know precisely what you are doing.  No
-   * porter should need to mess with them.
-   *
-   */
-
-
-  /**************************************************************************
-   *
-   * Mac support
-   *
-   *   This is the only necessary change, so it is defined here instead
-   *   providing a new configuration file.
-   */
-#if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) )
-  /* No Carbon frameworks for 64bit 10.4.x.                         */
-  /* `AvailabilityMacros.h` is available since Mac OS X 10.2,       */
-  /* so guess the system version by maximum errno before inclusion. */
-#include <errno.h>
-#ifdef ECANCELED /* defined since 10.2 */
-#include "AvailabilityMacros.h"
-#endif
-#if defined( __LP64__ ) && \
-    ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 )
-/undef FT_MACINTOSH
-#endif
-
-#elif defined( __SC__ ) || defined( __MRC__ )
-  /* Classic MacOS compilers */
-#include "ConditionalMacros.h"
-#if TARGET_OS_MAC
-#define FT_MACINTOSH 1
-#endif
-
-#endif
-
-
-  /* Fix compiler warning with sgi compiler. */
-#if defined( __sgi ) && !defined( __GNUC__ )
-#if defined( _COMPILER_VERSION ) && ( _COMPILER_VERSION >= 730 )
-#pragma set woff 3505
-#endif
-#endif
-
-
-  /**************************************************************************
-   *
-   * @section:
-   *   basic_types
-   *
-   */
-
-
-  /**************************************************************************
-   *
-   * @type:
-   *   FT_Int16
-   *
-   * @description:
-   *   A typedef for a 16bit signed integer type.
-   */
-  typedef signed short  FT_Int16;
-
-
-  /**************************************************************************
-   *
-   * @type:
-   *   FT_UInt16
-   *
-   * @description:
-   *   A typedef for a 16bit unsigned integer type.
-   */
-  typedef unsigned short  FT_UInt16;
-
-  /* */
-
-
-  /* this #if 0 ... #endif clause is for documentation purposes */
-#if 0
-
-  /**************************************************************************
-   *
-   * @type:
-   *   FT_Int32
-   *
-   * @description:
-   *   A typedef for a 32bit signed integer type.  The size depends on the
-   *   configuration.
-   */
-  typedef signed XXX  FT_Int32;
-
-
-  /**************************************************************************
-   *
-   * @type:
-   *   FT_UInt32
-   *
-   *   A typedef for a 32bit unsigned integer type.  The size depends on the
-   *   configuration.
-   */
-  typedef unsigned XXX  FT_UInt32;
-
-
-  /**************************************************************************
-   *
-   * @type:
-   *   FT_Int64
-   *
-   *   A typedef for a 64bit signed integer type.  The size depends on the
-   *   configuration.  Only defined if there is real 64bit support;
-   *   otherwise, it gets emulated with a structure (if necessary).
-   */
-  typedef signed XXX  FT_Int64;
-
-
-  /**************************************************************************
-   *
-   * @type:
-   *   FT_UInt64
-   *
-   *   A typedef for a 64bit unsigned integer type.  The size depends on the
-   *   configuration.  Only defined if there is real 64bit support;
-   *   otherwise, it gets emulated with a structure (if necessary).
-   */
-  typedef unsigned XXX  FT_UInt64;
-
-  /* */
-
-#endif
-
-#if FT_SIZEOF_INT == 4
-
-  typedef signed int      FT_Int32;
-  typedef unsigned int    FT_UInt32;
-
-#elif FT_SIZEOF_LONG == 4
-
-  typedef signed long     FT_Int32;
-  typedef unsigned long   FT_UInt32;
-
-#else
-#error "no 32bit type found -- please check your configuration files"
-#endif
-
-
-  /* look up an integer type that is at least 32~bits */
-#if FT_SIZEOF_INT >= 4
-
-  typedef int            FT_Fast;
-  typedef unsigned int   FT_UFast;
-
-#elif FT_SIZEOF_LONG >= 4
-
-  typedef long           FT_Fast;
-  typedef unsigned long  FT_UFast;
-
-#endif
-
-
-  /* determine whether we have a 64-bit `int` type for platforms without */
-  /* Autoconf                                                            */
-#if FT_SIZEOF_LONG == 8
-
-  /* `FT_LONG64` must be defined if a 64-bit type is available */
-#define FT_LONG64
-#define FT_INT64   long
-#define FT_UINT64  unsigned long
-
-  /* we handle the LLP64 scheme separately for GCC and clang, */
-  /* suppressing the `long long` warning                      */
-#elif ( FT_SIZEOF_LONG == 4 )       && \
-      defined( HAVE_LONG_LONG_INT ) && \
-      defined( __GNUC__ )
-#pragma GCC diagnostic ignored "-Wlong-long"
-#define FT_LONG64
-#define FT_INT64   long long int
-#define FT_UINT64  unsigned long long int
-
-  /**************************************************************************
-   *
-   * A 64-bit data type may create compilation problems if you compile in
-   * strict ANSI mode.  To avoid them, we disable other 64-bit data types if
-   * `__STDC__` is defined.  You can however ignore this rule by defining the
-   * `FT_CONFIG_OPTION_FORCE_INT64` configuration macro.
-   */
-#elif !defined( __STDC__ ) || defined( FT_CONFIG_OPTION_FORCE_INT64 )
-
-#if defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 199901L
-
-#define FT_LONG64
-#define FT_INT64   long long int
-#define FT_UINT64  unsigned long long int
-
-#elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */
-
-  /* this compiler provides the `__int64` type */
-#define FT_LONG64
-#define FT_INT64   __int64
-#define FT_UINT64  unsigned __int64
-
-#elif defined( __BORLANDC__ )  /* Borland C++ */
-
-  /* XXXX: We should probably check the value of `__BORLANDC__` in order */
-  /*       to test the compiler version.                                 */
-
-  /* this compiler provides the `__int64` type */
-#define FT_LONG64
-#define FT_INT64   __int64
-#define FT_UINT64  unsigned __int64
-
-#elif defined( __WATCOMC__ )   /* Watcom C++ */
-
-  /* Watcom doesn't provide 64-bit data types */
-
-#elif defined( __MWERKS__ )    /* Metrowerks CodeWarrior */
-
-#define FT_LONG64
-#define FT_INT64   long long int
-#define FT_UINT64  unsigned long long int
-
-#elif defined( __GNUC__ )
-
-  /* GCC provides the `long long` type */
-#define FT_LONG64
-#define FT_INT64   long long int
-#define FT_UINT64  unsigned long long int
-
-#endif /* __STDC_VERSION__ >= 199901L */
-
-#endif /* FT_SIZEOF_LONG == 8 */
-
-#ifdef FT_LONG64
-  typedef FT_INT64   FT_Int64;
-  typedef FT_UINT64  FT_UInt64;
-#endif
-
-
-#ifdef _WIN64
-  /* only 64bit Windows uses the LLP64 data model, i.e., */
-  /* 32bit integers, 64bit pointers                      */
-#define FT_UINT_TO_POINTER( x ) (void*)(unsigned __int64)(x)
-#else
-#define FT_UINT_TO_POINTER( x ) (void*)(unsigned long)(x)
-#endif
-
-
-  /**************************************************************************
-   *
-   * miscellaneous
-   *
-   */
-
-
-#define FT_BEGIN_STMNT  do {
-#define FT_END_STMNT    } while ( 0 )
-#define FT_DUMMY_STMNT  FT_BEGIN_STMNT FT_END_STMNT
-
-
-  /* `typeof` condition taken from gnulib's `intprops.h` header file */
-#if ( ( defined( __GNUC__ ) && __GNUC__ >= 2 )                       || \
-      ( defined( __IBMC__ ) && __IBMC__ >= 1210 &&                      \
-        defined( __IBM__TYPEOF__ ) )                                 || \
-      ( defined( __SUNPRO_C ) && __SUNPRO_C >= 0x5110 && !__STDC__ ) )
-#define FT_TYPEOF( type )  ( __typeof__ ( type ) )
-#else
-#define FT_TYPEOF( type )  /* empty */
-#endif
-
-
-  /* Use `FT_LOCAL` and `FT_LOCAL_DEF` to declare and define,            */
-  /* respectively, a function that gets used only within the scope of a  */
-  /* module.  Normally, both the header and source code files for such a */
-  /* function are within a single module directory.                      */
-  /*                                                                     */
-  /* Intra-module arrays should be tagged with `FT_LOCAL_ARRAY` and      */
-  /* `FT_LOCAL_ARRAY_DEF`.                                               */
-  /*                                                                     */
-#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
-
-#define FT_LOCAL( x )      static  x
-#define FT_LOCAL_DEF( x )  static  x
-
-#else
-
-#ifdef __cplusplus
-#define FT_LOCAL( x )      extern "C"  x
-#define FT_LOCAL_DEF( x )  extern "C"  x
-#else
-#define FT_LOCAL( x )      extern  x
-#define FT_LOCAL_DEF( x )  x
-#endif
-
-#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
-
-#define FT_LOCAL_ARRAY( x )      extern const  x
-#define FT_LOCAL_ARRAY_DEF( x )  const  x
-
-
-  /* Use `FT_BASE` and `FT_BASE_DEF` to declare and define, respectively, */
-  /* functions that are used in more than a single module.  In the        */
-  /* current setup this implies that the declaration is in a header file  */
-  /* in the `include/freetype/internal` directory, and the function body  */
-  /* is in a file in `src/base`.                                          */
-  /*                                                                      */
-#ifndef FT_BASE
-
-#ifdef __cplusplus
-#define FT_BASE( x )  extern "C"  x
-#else
-#define FT_BASE( x )  extern  x
-#endif
-
-#endif /* !FT_BASE */
-
-
-#ifndef FT_BASE_DEF
-
-#ifdef __cplusplus
-#define FT_BASE_DEF( x )  x
-#else
-#define FT_BASE_DEF( x )  x
-#endif
-
-#endif /* !FT_BASE_DEF */
-
-
-  /* When compiling FreeType as a DLL or DSO with hidden visibility    */
-  /* some systems/compilers need a special attribute in front OR after */
-  /* the return type of function declarations.                         */
-  /*                                                                   */
-  /* Two macros are used within the FreeType source code to define     */
-  /* exported library functions: `FT_EXPORT` and `FT_EXPORT_DEF`.      */
-  /*                                                                   */
-  /* - `FT_EXPORT( return_type )`                                      */
-  /*                                                                   */
-  /*   is used in a function declaration, as in                        */
-  /*                                                                   */
-  /*   ```                                                             */
-  /*     FT_EXPORT( FT_Error )                                         */
-  /*     FT_Init_FreeType( FT_Library*  alibrary );                    */
-  /*   ```                                                             */
-  /*                                                                   */
-  /* - `FT_EXPORT_DEF( return_type )`                                  */
-  /*                                                                   */
-  /*   is used in a function definition, as in                         */
-  /*                                                                   */
-  /*   ```                                                             */
-  /*     FT_EXPORT_DEF( FT_Error )                                     */
-  /*     FT_Init_FreeType( FT_Library*  alibrary )                     */
-  /*     {                                                             */
-  /*       ... some code ...                                           */
-  /*       return FT_Err_Ok;                                           */
-  /*     }                                                             */
-  /*   ```                                                             */
-  /*                                                                   */
-  /* You can provide your own implementation of `FT_EXPORT` and        */
-  /* `FT_EXPORT_DEF` here if you want.                                 */
-  /*                                                                   */
-  /* To export a variable, use `FT_EXPORT_VAR`.                        */
-  /*                                                                   */
-#ifndef FT_EXPORT
-
-#ifdef FT2_BUILD_LIBRARY
-
-#if defined( _WIN32 ) && defined( DLL_EXPORT )
-#define FT_EXPORT( x )  __declspec( dllexport )  x
-#elif defined( __GNUC__ ) && __GNUC__ >= 4
-#define FT_EXPORT( x )  __attribute__(( visibility( "default" ) ))  x
-#elif defined( __SUNPRO_C ) && __SUNPRO_C >= 0x550
-#define FT_EXPORT( x )  __global  x
-#elif defined( __cplusplus )
-#define FT_EXPORT( x )  extern "C"  x
-#else
-#define FT_EXPORT( x )  extern  x
-#endif
-
-#else
-
-#if defined( _WIN32 ) && defined( DLL_IMPORT )
-#define FT_EXPORT( x )  __declspec( dllimport )  x
-#elif defined( __cplusplus )
-#define FT_EXPORT( x )  extern "C"  x
-#else
-#define FT_EXPORT( x )  extern  x
-#endif
-
-#endif
-
-#endif /* !FT_EXPORT */
-
-
-#ifndef FT_EXPORT_DEF
-
-#ifdef __cplusplus
-#define FT_EXPORT_DEF( x )  extern "C"  x
-#else
-#define FT_EXPORT_DEF( x )  extern  x
-#endif
-
-#endif /* !FT_EXPORT_DEF */
-
-
-#ifndef FT_EXPORT_VAR
-
-#ifdef __cplusplus
-#define FT_EXPORT_VAR( x )  extern "C"  x
-#else
-#define FT_EXPORT_VAR( x )  extern  x
-#endif
-
-#endif /* !FT_EXPORT_VAR */
-
-
-  /* The following macros are needed to compile the library with a   */
-  /* C++ compiler and with 16bit compilers.                          */
-  /*                                                                 */
-
-  /* This is special.  Within C++, you must specify `extern "C"` for */
-  /* functions which are used via function pointers, and you also    */
-  /* must do that for structures which contain function pointers to  */
-  /* assure C linkage -- it's not possible to have (local) anonymous */
-  /* functions which are accessed by (global) function pointers.     */
-  /*                                                                 */
-  /*                                                                 */
-  /* FT_CALLBACK_DEF is used to _define_ a callback function,        */
-  /* located in the same source code file as the structure that uses */
-  /* it.                                                             */
-  /*                                                                 */
-  /* FT_BASE_CALLBACK and FT_BASE_CALLBACK_DEF are used to declare   */
-  /* and define a callback function, respectively, in a similar way  */
-  /* as FT_BASE and FT_BASE_DEF work.                                */
-  /*                                                                 */
-  /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */
-  /* contains pointers to callback functions.                        */
-  /*                                                                 */
-  /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable   */
-  /* that contains pointers to callback functions.                   */
-  /*                                                                 */
-  /*                                                                 */
-  /* Some 16bit compilers have to redefine these macros to insert    */
-  /* the infamous `_cdecl` or `__fastcall` declarations.             */
-  /*                                                                 */
-#ifndef FT_CALLBACK_DEF
-#ifdef __cplusplus
-#define FT_CALLBACK_DEF( x )  extern "C"  x
-#else
-#define FT_CALLBACK_DEF( x )  static  x
-#endif
-#endif /* FT_CALLBACK_DEF */
-
-#ifndef FT_BASE_CALLBACK
-#ifdef __cplusplus
-#define FT_BASE_CALLBACK( x )      extern "C"  x
-#define FT_BASE_CALLBACK_DEF( x )  extern "C"  x
-#else
-#define FT_BASE_CALLBACK( x )      extern  x
-#define FT_BASE_CALLBACK_DEF( x )  x
-#endif
-#endif /* FT_BASE_CALLBACK */
-
-#ifndef FT_CALLBACK_TABLE
-#ifdef __cplusplus
-#define FT_CALLBACK_TABLE      extern "C"
-#define FT_CALLBACK_TABLE_DEF  extern "C"
-#else
-#define FT_CALLBACK_TABLE      extern
-#define FT_CALLBACK_TABLE_DEF  /* nothing */
-#endif
-#endif /* FT_CALLBACK_TABLE */
-
-
-FT_END_HEADER
-
-
-#endif /* FTCONFIG_H_ */
-
-
-/* END */
diff --git a/builds/unix/ftsystem.c b/builds/unix/ftsystem.c
index 826713f..b4d71d4 100644
--- a/builds/unix/ftsystem.c
+++ b/builds/unix/ftsystem.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Unix-specific FreeType low-level system interface (body).            */
 /*                                                                         */
-/*  Copyright (C) 1996-2019 by                                             */
+/*  Copyright (C) 1996-2020 by                                             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -18,12 +18,12 @@
 
 #include <ft2build.h>
   /* we use our special ftconfig.h file, not the standard one */
-#include <ftconfig.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_SYSTEM_H
-#include FT_ERRORS_H
-#include FT_TYPES_H
-#include FT_INTERNAL_STREAM_H
+#include FT_CONFIG_CONFIG_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/ftsystem.h>
+#include <freetype/fterrors.h>
+#include <freetype/fttypes.h>
+#include <freetype/internal/ftstream.h>
 
   /* memory-mapping includes and definitions */
 #ifdef HAVE_UNISTD_H
@@ -351,7 +351,7 @@
     stream->read = 0;
 
     FT_TRACE1(( "FT_Stream_Open:" ));
-    FT_TRACE1(( " opened `%s' (%d bytes) successfully\n",
+    FT_TRACE1(( " opened `%s' (%ld bytes) successfully\n",
                 filepathname, stream->size ));
 
     return FT_Err_Ok;
diff --git a/builds/unix/install.mk b/builds/unix/install.mk
index 2287dfc..aa25187 100644
--- a/builds/unix/install.mk
+++ b/builds/unix/install.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/unix/unix-cc.in b/builds/unix/unix-cc.in
index ed51fde..30d097b 100644
--- a/builds/unix/unix-cc.in
+++ b/builds/unix/unix-cc.in
@@ -2,7 +2,7 @@
 # FreeType 2 template for Unix-specific compiler definitions
 #
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -76,10 +76,13 @@
 #   Use the ANSIFLAGS variable to define the compiler flags used to enfore
 #   ANSI compliance.
 #
-#   We use our own FreeType configuration file.
+#   We use our own FreeType configuration files overriding defaults.
 #
 CPPFLAGS := @CPPFLAGS@
-CFLAGS   := -c @XX_CFLAGS@ @CFLAGS@ -DFT_CONFIG_CONFIG_H="<ftconfig.h>"
+CFLAGS   := -c @XX_CFLAGS@ @CFLAGS@ \
+            $DFT_CONFIG_CONFIG_H="<ftconfig.h>" \
+            $DFT_CONFIG_MODULES_H="<ftmodule.h>" \
+            $DFT_CONFIG_OPTIONS_H="<ftoption.h>"
 
 # ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
 #
@@ -87,8 +90,12 @@
 
 # C compiler to use -- we use libtool!
 #
-CCraw := $(CC)
-CC    := $(LIBTOOL) --mode=compile $(CCraw)
+# CC might be set on the command line; we store this value in `CCraw'.
+# Consequently, we use the `override' directive to ensure that the
+# libtool call is always prepended.
+#
+CCraw       := $(CC)
+override CC := $(LIBTOOL) --mode=compile $(CCraw)
 
 # Resource compiler to use on Cygwin/MinGW, usually windres.
 #
diff --git a/builds/unix/unix-def.in b/builds/unix/unix-def.in
index e74844d..5e04f1c 100644
--- a/builds/unix/unix-def.in
+++ b/builds/unix/unix-def.in
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -24,7 +24,6 @@
 # This is used for `make refdoc' and `make refdoc-venv'
 #
 PYTHON := @PYTHON@
-PIP    := @PIP@
 BIN    := bin
 
 # this is used for `make distclean' and `make install'
diff --git a/builds/unix/unix-dev.mk b/builds/unix/unix-dev.mk
index 3cb171a..1352575 100644
--- a/builds/unix/unix-dev.mk
+++ b/builds/unix/unix-dev.mk
@@ -6,7 +6,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/unix/unix-lcc.mk b/builds/unix/unix-lcc.mk
index e632e9a..a6579db 100644
--- a/builds/unix/unix-lcc.mk
+++ b/builds/unix/unix-lcc.mk
@@ -6,7 +6,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/unix/unix.mk b/builds/unix/unix.mk
index 2d04eef..e08727d 100644
--- a/builds/unix/unix.mk
+++ b/builds/unix/unix.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/unix/unixddef.mk b/builds/unix/unixddef.mk
index 9aad35c..b8e3217 100644
--- a/builds/unix/unixddef.mk
+++ b/builds/unix/unixddef.mk
@@ -4,7 +4,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/vms/ftconfig.h b/builds/vms/ftconfig.h
index 7825db0..07e5f83 100644
--- a/builds/vms/ftconfig.h
+++ b/builds/vms/ftconfig.h
@@ -4,7 +4,7 @@
  *
  *   VMS-specific configuration file (specification only).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -39,21 +39,6 @@
 #include FT_CONFIG_OPTIONS_H
 #include FT_CONFIG_STANDARD_LIBRARY_H
 
-
-FT_BEGIN_HEADER
-
-
-  /**************************************************************************
-   *
-   *              PLATFORM-SPECIFIC CONFIGURATION MACROS
-   *
-   * These macros can be toggled to suit a specific system.  The current ones
-   * are defaults used to compile FreeType in an ANSI C environment (16bit
-   * compilers are also supported).  Copy this file to your own
-   * `builds/<system>` directory, and edit it to port the engine.
-   *
-   */
-
 #define HAVE_UNISTD_H  1
 #define HAVE_FCNTL_H   1
 
@@ -63,491 +48,9 @@
 #define FT_SIZEOF_INT   4
 #define FT_SIZEOF_LONG  4
 
-
-  /* `FT_UNUSED` indicates that a given parameter is not used --   */
-  /* this is only used to get rid of unpleasant compiler warnings. */
-#ifndef FT_UNUSED
-#define FT_UNUSED( arg )  ( (arg) = (arg) )
-#endif
-
-
-  /**************************************************************************
-   *
-   *                    AUTOMATIC CONFIGURATION MACROS
-   *
-   * These macros are computed from the ones defined above.  Don't touch
-   * their definition, unless you know precisely what you are doing.  No
-   * porter should need to mess with them.
-   *
-   */
-
-
-  /**************************************************************************
-   *
-   * Mac support
-   *
-   *   This is the only necessary change, so it is defined here instead
-   *   providing a new configuration file.
-   */
-#if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) )
-  /* No Carbon frameworks for 64bit 10.4.x.                         */
-  /* `AvailabilityMacros.h` is available since Mac OS X 10.2,       */
-  /* so guess the system version by maximum errno before inclusion. */
-#include <errno.h>
-#ifdef ECANCELED /* defined since 10.2 */
-#include "AvailabilityMacros.h"
-#endif
-#if defined( __LP64__ ) && \
-    ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 )
-#undef FT_MACINTOSH
-#endif
-
-#elif defined( __SC__ ) || defined( __MRC__ )
-  /* Classic MacOS compilers */
-#include "ConditionalMacros.h"
-#if TARGET_OS_MAC
-#define FT_MACINTOSH 1
-#endif
-
-#endif
-
-
-  /* Fix compiler warning with sgi compiler. */
-#if defined( __sgi ) && !defined( __GNUC__ )
-#if defined( _COMPILER_VERSION ) && ( _COMPILER_VERSION >= 730 )
-#pragma set woff 3505
-#endif
-#endif
-
-
-  /**************************************************************************
-   *
-   * @section:
-   *   basic_types
-   *
-   */
-
-
-  /**************************************************************************
-   *
-   * @type:
-   *   FT_Int16
-   *
-   * @description:
-   *   A typedef for a 16bit signed integer type.
-   */
-  typedef signed short  FT_Int16;
-
-
-  /**************************************************************************
-   *
-   * @type:
-   *   FT_UInt16
-   *
-   * @description:
-   *   A typedef for a 16bit unsigned integer type.
-   */
-  typedef unsigned short  FT_UInt16;
-
-  /* */
-
-
-  /* this #if 0 ... #endif clause is for documentation purposes */
-#if 0
-
-  /**************************************************************************
-   *
-   * @type:
-   *   FT_Int32
-   *
-   * @description:
-   *   A typedef for a 32bit signed integer type.  The size depends on the
-   *   configuration.
-   */
-  typedef signed XXX  FT_Int32;
-
-
-  /**************************************************************************
-   *
-   * @type:
-   *   FT_UInt32
-   *
-   *   A typedef for a 32bit unsigned integer type.  The size depends on the
-   *   configuration.
-   */
-  typedef unsigned XXX  FT_UInt32;
-
-
-  /**************************************************************************
-   *
-   * @type:
-   *   FT_Int64
-   *
-   *   A typedef for a 64bit signed integer type.  The size depends on the
-   *   configuration.  Only defined if there is real 64bit support;
-   *   otherwise, it gets emulated with a structure (if necessary).
-   */
-  typedef signed XXX  FT_Int64;
-
-
-  /**************************************************************************
-   *
-   * @type:
-   *   FT_UInt64
-   *
-   *   A typedef for a 64bit unsigned integer type.  The size depends on the
-   *   configuration.  Only defined if there is real 64bit support;
-   *   otherwise, it gets emulated with a structure (if necessary).
-   */
-  typedef unsigned XXX  FT_UInt64;
-
-  /* */
-
-#endif
-
-#if FT_SIZEOF_INT == 4
-
-  typedef signed int      FT_Int32;
-  typedef unsigned int    FT_UInt32;
-
-#elif FT_SIZEOF_LONG == 4
-
-  typedef signed long     FT_Int32;
-  typedef unsigned long   FT_UInt32;
-
-#else
-#error "no 32bit type found -- please check your configuration files"
-#endif
-
-
-  /* look up an integer type that is at least 32~bits */
-#if FT_SIZEOF_INT >= 4
-
-  typedef int            FT_Fast;
-  typedef unsigned int   FT_UFast;
-
-#elif FT_SIZEOF_LONG >= 4
-
-  typedef long           FT_Fast;
-  typedef unsigned long  FT_UFast;
-
-#endif
-
-
-  /* determine whether we have a 64-bit `int` type for platforms without */
-  /* Autoconf                                                            */
-#if FT_SIZEOF_LONG == 8
-
-  /* `FT_LONG64` must be defined if a 64-bit type is available */
-#define FT_LONG64
-#define FT_INT64   long
-#define FT_UINT64  unsigned long
-
-  /* we handle the LLP64 scheme separately for GCC and clang, */
-  /* suppressing the `long long` warning                      */
-#elif ( FT_SIZEOF_LONG == 4 )       && \
-      defined( HAVE_LONG_LONG_INT ) && \
-      defined( __GNUC__ )
-#pragma GCC diagnostic ignored "-Wlong-long"
-#define FT_LONG64
-#define FT_INT64   long long int
-#define FT_UINT64  unsigned long long int
-
-  /**************************************************************************
-   *
-   * A 64-bit data type may create compilation problems if you compile in
-   * strict ANSI mode.  To avoid them, we disable other 64-bit data types if
-   * `__STDC__` is defined.  You can however ignore this rule by defining the
-   * `FT_CONFIG_OPTION_FORCE_INT64` configuration macro.
-   */
-#elif !defined( __STDC__ ) || defined( FT_CONFIG_OPTION_FORCE_INT64 )
-
-#if defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 199901L
-
-#define FT_LONG64
-#define FT_INT64   long long int
-#define FT_UINT64  unsigned long long int
-
-#elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */
-
-  /* this compiler provides the `__int64` type */
-#define FT_LONG64
-#define FT_INT64   __int64
-#define FT_UINT64  unsigned __int64
-
-#elif defined( __BORLANDC__ )  /* Borland C++ */
-
-  /* XXXX: We should probably check the value of `__BORLANDC__` in order */
-  /*       to test the compiler version.                                 */
-
-  /* this compiler provides the `__int64` type */
-#define FT_LONG64
-#define FT_INT64   __int64
-#define FT_UINT64  unsigned __int64
-
-#elif defined( __WATCOMC__ )   /* Watcom C++ */
-
-  /* Watcom doesn't provide 64-bit data types */
-
-#elif defined( __MWERKS__ )    /* Metrowerks CodeWarrior */
-
-#define FT_LONG64
-#define FT_INT64   long long int
-#define FT_UINT64  unsigned long long int
-
-#elif defined( __GNUC__ )
-
-  /* GCC provides the `long long` type */
-#define FT_LONG64
-#define FT_INT64   long long int
-#define FT_UINT64  unsigned long long int
-
-#endif /* __STDC_VERSION__ >= 199901L */
-
-#endif /* FT_SIZEOF_LONG == 8 */
-
-#ifdef FT_LONG64
-  typedef FT_INT64   FT_Int64;
-  typedef FT_UINT64  FT_UInt64;
-#endif
-
-
-#ifdef _WIN64
-  /* only 64bit Windows uses the LLP64 data model, i.e., */
-  /* 32bit integers, 64bit pointers                      */
-#define FT_UINT_TO_POINTER( x ) (void*)(unsigned __int64)(x)
-#else
-#define FT_UINT_TO_POINTER( x ) (void*)(unsigned long)(x)
-#endif
-
-
-  /**************************************************************************
-   *
-   * miscellaneous
-   *
-   */
-
-
-#define FT_BEGIN_STMNT  do {
-#define FT_END_STMNT    } while ( 0 )
-#define FT_DUMMY_STMNT  FT_BEGIN_STMNT FT_END_STMNT
-
-
-  /* `typeof` condition taken from gnulib's `intprops.h` header file */
-#if ( ( defined( __GNUC__ ) && __GNUC__ >= 2 )                       || \
-      ( defined( __IBMC__ ) && __IBMC__ >= 1210 &&                      \
-        defined( __IBM__TYPEOF__ ) )                                 || \
-      ( defined( __SUNPRO_C ) && __SUNPRO_C >= 0x5110 && !__STDC__ ) )
-#define FT_TYPEOF( type )  ( __typeof__ ( type ) )
-#else
-#define FT_TYPEOF( type )  /* empty */
-#endif
-
-
-  /* Use `FT_LOCAL` and `FT_LOCAL_DEF` to declare and define,            */
-  /* respectively, a function that gets used only within the scope of a  */
-  /* module.  Normally, both the header and source code files for such a */
-  /* function are within a single module directory.                      */
-  /*                                                                     */
-  /* Intra-module arrays should be tagged with `FT_LOCAL_ARRAY` and      */
-  /* `FT_LOCAL_ARRAY_DEF`.                                               */
-  /*                                                                     */
-#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
-
-#define FT_LOCAL( x )      static  x
-#define FT_LOCAL_DEF( x )  static  x
-
-#else
-
-#ifdef __cplusplus
-#define FT_LOCAL( x )      extern "C"  x
-#define FT_LOCAL_DEF( x )  extern "C"  x
-#else
-#define FT_LOCAL( x )      extern  x
-#define FT_LOCAL_DEF( x )  x
-#endif
-
-#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
-
-#define FT_LOCAL_ARRAY( x )      extern const  x
-#define FT_LOCAL_ARRAY_DEF( x )  const  x
-
-
-  /* Use `FT_BASE` and `FT_BASE_DEF` to declare and define, respectively, */
-  /* functions that are used in more than a single module.  In the        */
-  /* current setup this implies that the declaration is in a header file  */
-  /* in the `include/freetype/internal` directory, and the function body  */
-  /* is in a file in `src/base`.                                          */
-  /*                                                                      */
-#ifndef FT_BASE
-
-#ifdef __cplusplus
-#define FT_BASE( x )  extern "C"  x
-#else
-#define FT_BASE( x )  extern  x
-#endif
-
-#endif /* !FT_BASE */
-
-
-#ifndef FT_BASE_DEF
-
-#ifdef __cplusplus
-#define FT_BASE_DEF( x )  x
-#else
-#define FT_BASE_DEF( x )  x
-#endif
-
-#endif /* !FT_BASE_DEF */
-
-
-  /* When compiling FreeType as a DLL or DSO with hidden visibility    */
-  /* some systems/compilers need a special attribute in front OR after */
-  /* the return type of function declarations.                         */
-  /*                                                                   */
-  /* Two macros are used within the FreeType source code to define     */
-  /* exported library functions: `FT_EXPORT` and `FT_EXPORT_DEF`.      */
-  /*                                                                   */
-  /* - `FT_EXPORT( return_type )`                                      */
-  /*                                                                   */
-  /*   is used in a function declaration, as in                        */
-  /*                                                                   */
-  /*   ```                                                             */
-  /*     FT_EXPORT( FT_Error )                                         */
-  /*     FT_Init_FreeType( FT_Library*  alibrary );                    */
-  /*   ```                                                             */
-  /*                                                                   */
-  /* - `FT_EXPORT_DEF( return_type )`                                  */
-  /*                                                                   */
-  /*   is used in a function definition, as in                         */
-  /*                                                                   */
-  /*   ```                                                             */
-  /*     FT_EXPORT_DEF( FT_Error )                                     */
-  /*     FT_Init_FreeType( FT_Library*  alibrary )                     */
-  /*     {                                                             */
-  /*       ... some code ...                                           */
-  /*       return FT_Err_Ok;                                           */
-  /*     }                                                             */
-  /*   ```                                                             */
-  /*                                                                   */
-  /* You can provide your own implementation of `FT_EXPORT` and        */
-  /* `FT_EXPORT_DEF` here if you want.                                 */
-  /*                                                                   */
-  /* To export a variable, use `FT_EXPORT_VAR`.                        */
-  /*                                                                   */
-#ifndef FT_EXPORT
-
-#ifdef FT2_BUILD_LIBRARY
-
-#if defined( _WIN32 ) && defined( DLL_EXPORT )
-#define FT_EXPORT( x )  __declspec( dllexport )  x
-#elif defined( __GNUC__ ) && __GNUC__ >= 4
-#define FT_EXPORT( x )  __attribute__(( visibility( "default" ) ))  x
-#elif defined( __SUNPRO_C ) && __SUNPRO_C >= 0x550
-#define FT_EXPORT( x )  __global  x
-#elif defined( __cplusplus )
-#define FT_EXPORT( x )  extern "C"  x
-#else
-#define FT_EXPORT( x )  extern  x
-#endif
-
-#else
-
-#if defined( _WIN32 ) && defined( DLL_IMPORT )
-#define FT_EXPORT( x )  __declspec( dllimport )  x
-#elif defined( __cplusplus )
-#define FT_EXPORT( x )  extern "C"  x
-#else
-#define FT_EXPORT( x )  extern  x
-#endif
-
-#endif
-
-#endif /* !FT_EXPORT */
-
-
-#ifndef FT_EXPORT_DEF
-
-#ifdef __cplusplus
-#define FT_EXPORT_DEF( x )  extern "C"  x
-#else
-#define FT_EXPORT_DEF( x )  extern  x
-#endif
-
-#endif /* !FT_EXPORT_DEF */
-
-
-#ifndef FT_EXPORT_VAR
-
-#ifdef __cplusplus
-#define FT_EXPORT_VAR( x )  extern "C"  x
-#else
-#define FT_EXPORT_VAR( x )  extern  x
-#endif
-
-#endif /* !FT_EXPORT_VAR */
-
-
-  /* The following macros are needed to compile the library with a   */
-  /* C++ compiler and with 16bit compilers.                          */
-  /*                                                                 */
-
-  /* This is special.  Within C++, you must specify `extern "C"` for */
-  /* functions which are used via function pointers, and you also    */
-  /* must do that for structures which contain function pointers to  */
-  /* assure C linkage -- it's not possible to have (local) anonymous */
-  /* functions which are accessed by (global) function pointers.     */
-  /*                                                                 */
-  /*                                                                 */
-  /* FT_CALLBACK_DEF is used to _define_ a callback function,        */
-  /* located in the same source code file as the structure that uses */
-  /* it.                                                             */
-  /*                                                                 */
-  /* FT_BASE_CALLBACK and FT_BASE_CALLBACK_DEF are used to declare   */
-  /* and define a callback function, respectively, in a similar way  */
-  /* as FT_BASE and FT_BASE_DEF work.                                */
-  /*                                                                 */
-  /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */
-  /* contains pointers to callback functions.                        */
-  /*                                                                 */
-  /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable   */
-  /* that contains pointers to callback functions.                   */
-  /*                                                                 */
-  /*                                                                 */
-  /* Some 16bit compilers have to redefine these macros to insert    */
-  /* the infamous `_cdecl` or `__fastcall` declarations.             */
-  /*                                                                 */
-#ifndef FT_CALLBACK_DEF
-#ifdef __cplusplus
-#define FT_CALLBACK_DEF( x )  extern "C"  x
-#else
-#define FT_CALLBACK_DEF( x )  static  x
-#endif
-#endif /* FT_CALLBACK_DEF */
-
-#ifndef FT_BASE_CALLBACK
-#ifdef __cplusplus
-#define FT_BASE_CALLBACK( x )      extern "C"  x
-#define FT_BASE_CALLBACK_DEF( x )  extern "C"  x
-#else
-#define FT_BASE_CALLBACK( x )      extern  x
-#define FT_BASE_CALLBACK_DEF( x )  x
-#endif
-#endif /* FT_BASE_CALLBACK */
-
-#ifndef FT_CALLBACK_TABLE
-#ifdef __cplusplus
-#define FT_CALLBACK_TABLE      extern "C"
-#define FT_CALLBACK_TABLE_DEF  extern "C"
-#else
-#define FT_CALLBACK_TABLE      extern
-#define FT_CALLBACK_TABLE_DEF  /* nothing */
-#endif
-#endif /* FT_CALLBACK_TABLE */
-
-
-FT_END_HEADER
-
+#include <freetype/config/integer-types.h>
+#include <freetype/config/public-macros.h>
+#include <freetype/config/mac-support.h>
 
 #endif /* FTCONFIG_H_ */
 
diff --git a/builds/vms/ftsystem.c b/builds/vms/ftsystem.c
index af6fe46..177481a 100644
--- a/builds/vms/ftsystem.c
+++ b/builds/vms/ftsystem.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    VMS-specific FreeType low-level system interface (body).             */
 /*                                                                         */
-/*  Copyright (C) 1996-2019 by                                             */
+/*  Copyright (C) 1996-2020 by                                             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -19,11 +19,11 @@
 #include <ft2build.h>
   /* we use our special ftconfig.h file, not the standard one */
 #include <ftconfig.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_SYSTEM_H
-#include FT_ERRORS_H
-#include FT_TYPES_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/ftsystem.h>
+#include <freetype/fterrors.h>
+#include <freetype/fttypes.h>
+#include <freetype/internal/ftobjs.h>
 
   /* memory-mapping includes and definitions */
 #ifdef HAVE_UNISTD_H
diff --git a/builds/wince/ftdebug.c b/builds/wince/ftdebug.c
index d0ca999..734c4f0 100644
--- a/builds/wince/ftdebug.c
+++ b/builds/wince/ftdebug.c
@@ -4,7 +4,7 @@
  *
  *   Debugging and logging component for WinCE (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -41,9 +41,8 @@
    */
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/freetype.h>
+#include <freetype/internal/ftdebug.h>
 
 
 #ifdef FT_DEBUG_LEVEL_ERROR
@@ -154,7 +153,7 @@
 
   static const char*  ft_trace_toggles[trace_count + 1] =
   {
-#include FT_INTERNAL_TRACE_H
+#include <freetype/internal/fttrace.h>
     NULL
   };
 
diff --git a/builds/wince/vc2005-ce/freetype.vcproj b/builds/wince/vc2005-ce/freetype.vcproj
index de556aa..efdb587 100644
--- a/builds/wince/vc2005-ce/freetype.vcproj
+++ b/builds/wince/vc2005-ce/freetype.vcproj
@@ -21,7 +21,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -41,7 +41,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -61,7 +61,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -81,7 +81,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -101,7 +101,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -121,7 +121,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -141,7 +141,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101MT.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeMT.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -161,7 +161,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101MT.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeMT.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -181,7 +181,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101MT.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeMT.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -201,7 +201,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101MT.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeMT.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -221,7 +221,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101MT.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeMT.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -241,7 +241,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101MT.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeMT.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -261,7 +261,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101ST.lib" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeST.lib" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -281,7 +281,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101ST.lib" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeST.lib" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -301,7 +301,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101ST.lib" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeST.lib" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -321,7 +321,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101ST.lib" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeST.lib" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -341,7 +341,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101ST.lib" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeST.lib" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -361,7 +361,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101ST.lib" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeST.lib" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -381,7 +381,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101_D.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype_D.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -401,7 +401,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101_D.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype_D.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -421,7 +421,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101_D.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype_D.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -441,7 +441,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101_D.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype_D.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -461,7 +461,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101_D.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype_D.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -481,7 +481,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101_D.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype_D.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -501,7 +501,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101ST_D.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeST_D.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -521,7 +521,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101ST_D.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeST_D.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -541,7 +541,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101ST_D.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeST_D.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -561,7 +561,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101ST_D.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeST_D.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -581,7 +581,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101ST_D.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeST_D.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -601,7 +601,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101ST_D.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeST_D.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -621,7 +621,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101MT_D.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeMT_D.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -641,7 +641,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101MT_D.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeMT_D.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -661,7 +661,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101MT_D.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeMT_D.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -681,7 +681,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101MT_D.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeMT_D.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -701,7 +701,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101MT_D.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeMT_D.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -721,7 +721,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101MT_D.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeMT_D.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -741,7 +741,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101MT.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeMT.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -758,7 +758,7 @@
       <Tool Name="VCManagedResourceCompilerTool" />

       <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />

       <Tool Name="VCPreLinkEventTool" />

-      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2101MT_D.lib" SuppressStartupBanner="true" />

+      <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetypeMT_D.lib" SuppressStartupBanner="true" />

       <Tool Name="VCALinkTool" />

       <Tool Name="VCXDCMakeTool" />

       <Tool Name="VCBscMakeTool" />

@@ -868,6 +868,10 @@
       <File RelativePath="..\..\..\include\freetype\config\ftstdlib.h">

       </File>

     </Filter>

+    <Filter Name="Resource Files" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx">

+      <File RelativePath="..\..\..\src\base\ftver.rc">

+      </File>

+    </Filter>

   </Files>

   <Globals>

   </Globals>

diff --git a/builds/wince/vc2005-ce/index.html b/builds/wince/vc2005-ce/index.html
index 16a1062..6936a89 100644
--- a/builds/wince/vc2005-ce/index.html
+++ b/builds/wince/vc2005-ce/index.html
@@ -21,14 +21,14 @@
   <li>PPC/SP WM6 (Windows Mobile 6)</li>
 </ul>
 
-It compiles the following libraries from the FreeType 2.10.1 sources:</p>
+It compiles the following libraries from the FreeType 2.10.4 sources:</p>
 
 <ul>
   <pre>
-    freetype2101.lib     - release build; single threaded
-    freetype2101_D.lib   - debug build;   single threaded
-    freetype2101MT.lib   - release build; multi-threaded
-    freetype2101MT_D.lib - debug build;   multi-threaded</pre>
+    freetype.lib     - release build; single threaded
+    freetype_D.lib   - debug build;   single threaded
+    freetypeMT.lib   - release build; multi-threaded
+    freetypeMT_D.lib - debug build;   multi-threaded</pre>
 </ul>
 
 <p>Be sure to extract the files with the Windows (CR+LF) line endings.  ZIP
diff --git a/builds/wince/vc2008-ce/freetype.vcproj b/builds/wince/vc2008-ce/freetype.vcproj
index f9479da..d01c5b5 100644
--- a/builds/wince/vc2008-ce/freetype.vcproj
+++ b/builds/wince/vc2008-ce/freetype.vcproj
@@ -88,7 +88,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -177,7 +177,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -266,7 +266,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -355,7 +355,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -444,7 +444,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -533,7 +533,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -621,7 +621,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101MT.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeMT.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -709,7 +709,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101MT.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeMT.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -797,7 +797,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101MT.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeMT.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -885,7 +885,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101MT.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeMT.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -973,7 +973,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101MT.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeMT.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -1061,7 +1061,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101MT.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeMT.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -1149,7 +1149,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101ST.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeST.lib"

 			/>

 			<Tool

 				Name="VCALinkTool"

@@ -1236,7 +1236,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101ST.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeST.lib"

 			/>

 			<Tool

 				Name="VCALinkTool"

@@ -1323,7 +1323,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101ST.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeST.lib"

 			/>

 			<Tool

 				Name="VCALinkTool"

@@ -1410,7 +1410,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101ST.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeST.lib"

 			/>

 			<Tool

 				Name="VCALinkTool"

@@ -1497,7 +1497,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101ST.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeST.lib"

 			/>

 			<Tool

 				Name="VCALinkTool"

@@ -1584,7 +1584,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101ST.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeST.lib"

 			/>

 			<Tool

 				Name="VCALinkTool"

@@ -1668,7 +1668,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101_D.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -1753,7 +1753,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101_D.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -1838,7 +1838,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101_D.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -1923,7 +1923,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101_D.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -2008,7 +2008,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101_D.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -2093,7 +2093,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101_D.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -2178,7 +2178,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101ST_D.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeST_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -2263,7 +2263,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101ST_D.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeST_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -2348,7 +2348,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101ST_D.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeST_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -2433,7 +2433,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101ST_D.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeST_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -2518,7 +2518,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101ST_D.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeST_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -2603,7 +2603,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101ST_D.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeST_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -2689,7 +2689,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101MT_D.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeMT_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -2775,7 +2775,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101MT_D.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeMT_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -2861,7 +2861,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101MT_D.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeMT_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -2947,7 +2947,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101MT_D.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeMT_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -3033,7 +3033,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101MT_D.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeMT_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -3119,7 +3119,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101MT_D.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeMT_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -3205,7 +3205,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101MT.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeMT.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -3279,7 +3279,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2101MT_D.lib"

+				OutputFile="..\..\..\objs\wince\vc2008-ce\freetypeMT_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -3502,6 +3502,15 @@
 				>

 			</File>

 		</Filter>

+		<Filter

+			Name="Resource Files"

+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"

+			>

+			<File

+				RelativePath="..\..\..\src\base\ftver.rc"

+				>

+			</File>

+		</Filter>

 	</Files>

 	<Globals>

 	</Globals>

diff --git a/builds/wince/vc2008-ce/index.html b/builds/wince/vc2008-ce/index.html
index 9d71b09..ee385af 100644
--- a/builds/wince/vc2008-ce/index.html
+++ b/builds/wince/vc2008-ce/index.html
@@ -21,14 +21,14 @@
   <li>PPC/SP WM6 (Windows Mobile 6)</li>
 </ul>
 
-It compiles the following libraries from the FreeType 2.10.1 sources:</p>
+It compiles the following libraries from the FreeType 2.10.4 sources:</p>
 
 <ul>
   <pre>
-    freetype2101.lib     - release build; single threaded
-    freetype2101_D.lib   - debug build;   single threaded
-    freetype2101MT.lib   - release build; multi-threaded
-    freetype2101MT_D.lib - debug build;   multi-threaded</pre>
+    freetype.lib     - release build; single threaded
+    freetype_D.lib   - debug build;   single threaded
+    freetypeMT.lib   - release build; multi-threaded
+    freetypeMT_D.lib - debug build;   multi-threaded</pre>
 </ul>
 
 <p>Be sure to extract the files with the Windows (CR+LF) line endings.  ZIP
diff --git a/builds/windows/detect.mk b/builds/windows/detect.mk
index 351e256..303dc8b 100644
--- a/builds/windows/detect.mk
+++ b/builds/windows/detect.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/windows/ftdebug.c b/builds/windows/ftdebug.c
index 7c47fb5..d589490 100644
--- a/builds/windows/ftdebug.c
+++ b/builds/windows/ftdebug.c
@@ -4,7 +4,7 @@
  *
  *   Debugging and logging component for Win32 (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -41,9 +41,8 @@
    */
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/freetype.h>
+#include <freetype/internal/ftdebug.h>
 
 
 #ifdef FT_DEBUG_LEVEL_ERROR
@@ -138,7 +137,7 @@
 
   static const char*  ft_trace_toggles[trace_count + 1] =
   {
-#include FT_INTERNAL_TRACE_H
+#include <freetype/internal/fttrace.h>
     NULL
   };
 
diff --git a/builds/windows/vc2010/index.html b/builds/windows/vc2010/index.html
index eed4dd3..3b60c5f 100644
--- a/builds/windows/vc2010/index.html
+++ b/builds/windows/vc2010/index.html
@@ -12,7 +12,7 @@
 <p>This directory contains solution and project files for
 Visual&nbsp;C++&nbsp;2010 or newer, named <tt>freetype.sln</tt>,
 and <tt>freetype.vcxproj</tt>.  It compiles the following libraries
-from the FreeType 2.10.1 sources:</p>
+from the FreeType 2.10.4 sources:</p>
 
 <ul>
   <li>freetype.dll using 'Release' or 'Debug' configurations</li>
diff --git a/builds/windows/visualc/index.html b/builds/windows/visualc/index.html
index 423244a..cec26d2 100644
--- a/builds/windows/visualc/index.html
+++ b/builds/windows/visualc/index.html
@@ -12,7 +12,7 @@
 <p>This directory contains project files <tt>freetype.dsp</tt> for
 Visual C++ 6.0, and <tt>freetype.vcproj</tt> for Visual C++ 2002
 through 2008, which you might need to upgrade automatically.
-It compiles the following libraries from the FreeType 2.10.1 sources:</p>
+It compiles the following libraries from the FreeType 2.10.4 sources:</p>
 
 <ul>
   <li>freetype.dll using 'Release' or 'Debug' configurations</li>
diff --git a/builds/windows/visualce/freetype.dsp b/builds/windows/visualce/freetype.dsp
index cb1205d..714c422 100644
--- a/builds/windows/visualce/freetype.dsp
+++ b/builds/windows/visualce/freetype.dsp
@@ -54,7 +54,7 @@
 # ADD BSC32 /nologo

 LIB32=link.exe -lib

 # ADD BASE LIB32 /nologo

-# ADD LIB32 /nologo /out:"..\..\..\objs\freetype2101.lib"

+# ADD LIB32 /nologo /out:"..\..\..\objs\freetype.lib"

 

 !ELSEIF  "$(CFG)" == "freetype - Win32 Debug"

 

@@ -78,7 +78,7 @@
 # ADD BSC32 /nologo

 LIB32=link.exe -lib

 # ADD BASE LIB32 /nologo

-# ADD LIB32 /nologo /out:"..\..\..\objs\freetype2101_D.lib"

+# ADD LIB32 /nologo /out:"..\..\..\objs\freetype_D.lib"

 

 !ELSEIF  "$(CFG)" == "freetype - Win32 Debug Multithreaded"

 

@@ -102,8 +102,8 @@
 # ADD BASE BSC32 /nologo

 # ADD BSC32 /nologo

 LIB32=link.exe -lib

-# ADD BASE LIB32 /nologo /out:"lib\freetype2101_D.lib"

-# ADD LIB32 /nologo /out:"..\..\..\objs\freetype2101MT_D.lib"

+# ADD BASE LIB32 /nologo /out:"lib\freetype_D.lib"

+# ADD LIB32 /nologo /out:"..\..\..\objs\freetypeMT_D.lib"

 

 !ELSEIF  "$(CFG)" == "freetype - Win32 Release Multithreaded"

 

@@ -126,8 +126,8 @@
 # ADD BASE BSC32 /nologo

 # ADD BSC32 /nologo

 LIB32=link.exe -lib

-# ADD BASE LIB32 /nologo /out:"lib\freetype2101.lib"

-# ADD LIB32 /nologo /out:"..\..\..\objs\freetype2101MT.lib"

+# ADD BASE LIB32 /nologo /out:"lib\freetype.lib"

+# ADD LIB32 /nologo /out:"..\..\..\objs\freetypeMT.lib"

 

 !ELSEIF  "$(CFG)" == "freetype - Win32 Release Singlethreaded"

 

@@ -151,8 +151,8 @@
 # ADD BASE BSC32 /nologo

 # ADD BSC32 /nologo

 LIB32=link.exe -lib

-# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype2101.lib"

-# ADD LIB32 /out:"..\..\..\objs\freetype2101ST.lib"

+# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype.lib"

+# ADD LIB32 /out:"..\..\..\objs\freetypeST.lib"

 # SUBTRACT LIB32 /nologo

 

 !ELSEIF  "$(CFG)" == "freetype - Win32 Debug Singlethreaded"

@@ -177,8 +177,8 @@
 # ADD BASE BSC32 /nologo

 # ADD BSC32 /nologo

 LIB32=link.exe -lib

-# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype2101_D.lib"

-# ADD LIB32 /nologo /out:"..\..\..\objs\freetype2101ST_D.lib"

+# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype_D.lib"

+# ADD LIB32 /nologo /out:"..\..\..\objs\freetypeST_D.lib"

 

 !ENDIF

 

@@ -379,5 +379,13 @@
 SOURCE=..\..\..\include\freetype\config\ftstdlib.h

 # End Source File

 # End Group

+# Begin Group "Resource Files"

+

+# PROP Default_Filter "rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"

+# Begin Source File

+

+SOURCE=..\..\..\src\base\ftver.rc

+# End Source File

+# End Group

 # End Target

 # End Project

diff --git a/builds/windows/visualce/freetype.vcproj b/builds/windows/visualce/freetype.vcproj
index 96b51e9..e271462 100644
--- a/builds/windows/visualce/freetype.vcproj
+++ b/builds/windows/visualce/freetype.vcproj
@@ -87,7 +87,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101.lib"

+				OutputFile="..\..\..\objs\freetype.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -162,7 +162,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101MT.lib"

+				OutputFile="..\..\..\objs\freetypeMT.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -237,7 +237,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101ST.lib"

+				OutputFile="..\..\..\objs\freetypeST.lib"

 			/>

 			<Tool

 				Name="VCALinkTool"

@@ -309,7 +309,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101_D.lib"

+				OutputFile="..\..\..\objs\freetype_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -382,7 +382,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101ST_D.lib"

+				OutputFile="..\..\..\objs\freetypeST_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -456,7 +456,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101MT_D.lib"

+				OutputFile="..\..\..\objs\freetypeMT_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -534,7 +534,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101.lib"

+				OutputFile="..\..\..\objs\freetype.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -619,7 +619,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101MT.lib"

+				OutputFile="..\..\..\objs\freetypeMT.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -704,7 +704,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101ST.lib"

+				OutputFile="..\..\..\objs\freetypeST.lib"

 			/>

 			<Tool

 				Name="VCALinkTool"

@@ -785,7 +785,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101_D.lib"

+				OutputFile="..\..\..\objs\freetype_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -867,7 +867,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101ST_D.lib"

+				OutputFile="..\..\..\objs\freetypeST_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -950,7 +950,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101MT_D.lib"

+				OutputFile="..\..\..\objs\freetypeMT_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -1036,7 +1036,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101.lib"

+				OutputFile="..\..\..\objs\freetype.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -1121,7 +1121,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101MT.lib"

+				OutputFile="..\..\..\objs\freetypeMT.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -1206,7 +1206,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101ST.lib"

+				OutputFile="..\..\..\objs\freetypeST.lib"

 			/>

 			<Tool

 				Name="VCALinkTool"

@@ -1287,7 +1287,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101_D.lib"

+				OutputFile="..\..\..\objs\freetype_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -1369,7 +1369,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101ST_D.lib"

+				OutputFile="..\..\..\objs\freetypeST_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -1452,7 +1452,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101MT_D.lib"

+				OutputFile="..\..\..\objs\freetypeMT_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -1538,7 +1538,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101.lib"

+				OutputFile="..\..\..\objs\freetype.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -1623,7 +1623,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101MT.lib"

+				OutputFile="..\..\..\objs\freetypeMT.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -1708,7 +1708,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101ST.lib"

+				OutputFile="..\..\..\objs\freetypeST.lib"

 			/>

 			<Tool

 				Name="VCALinkTool"

@@ -1789,7 +1789,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101_D.lib"

+				OutputFile="..\..\..\objs\freetype_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -1871,7 +1871,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101ST_D.lib"

+				OutputFile="..\..\..\objs\freetypeST_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -1954,7 +1954,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101MT_D.lib"

+				OutputFile="..\..\..\objs\freetypeMT_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -2040,7 +2040,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101.lib"

+				OutputFile="..\..\..\objs\freetype.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -2125,7 +2125,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101MT.lib"

+				OutputFile="..\..\..\objs\freetypeMT.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -2210,7 +2210,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101ST.lib"

+				OutputFile="..\..\..\objs\freetypeST.lib"

 			/>

 			<Tool

 				Name="VCALinkTool"

@@ -2291,7 +2291,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101_D.lib"

+				OutputFile="..\..\..\objs\freetype_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -2373,7 +2373,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101ST_D.lib"

+				OutputFile="..\..\..\objs\freetypeST_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -2456,7 +2456,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101MT_D.lib"

+				OutputFile="..\..\..\objs\freetypeMT_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -2542,7 +2542,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101.lib"

+				OutputFile="..\..\..\objs\freetype.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -2627,7 +2627,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101MT.lib"

+				OutputFile="..\..\..\objs\freetypeMT.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -2712,7 +2712,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101ST.lib"

+				OutputFile="..\..\..\objs\freetypeST.lib"

 			/>

 			<Tool

 				Name="VCALinkTool"

@@ -2793,7 +2793,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101_D.lib"

+				OutputFile="..\..\..\objs\freetype_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -2875,7 +2875,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101ST_D.lib"

+				OutputFile="..\..\..\objs\freetypeST_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -2958,7 +2958,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101MT_D.lib"

+				OutputFile="..\..\..\objs\freetypeMT_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -3044,7 +3044,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101.lib"

+				OutputFile="..\..\..\objs\freetype.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -3129,7 +3129,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101MT.lib"

+				OutputFile="..\..\..\objs\freetypeMT.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -3214,7 +3214,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101ST.lib"

+				OutputFile="..\..\..\objs\freetypeST.lib"

 			/>

 			<Tool

 				Name="VCALinkTool"

@@ -3295,7 +3295,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101_D.lib"

+				OutputFile="..\..\..\objs\freetype_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -3377,7 +3377,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101ST_D.lib"

+				OutputFile="..\..\..\objs\freetypeST_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -3460,7 +3460,7 @@
 			/>

 			<Tool

 				Name="VCLibrarianTool"

-				OutputFile="..\..\..\objs\freetype2101MT_D.lib"

+				OutputFile="..\..\..\objs\freetypeMT_D.lib"

 				SuppressStartupBanner="true"

 			/>

 			<Tool

@@ -3691,6 +3691,15 @@
 				>

 			</File>

 		</Filter>

+		<Filter

+			Name="Resource Files"

+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"

+			>

+			<File

+				RelativePath="..\..\..\src\base\ftver.rc"

+				>

+			</File>

+		</Filter>

 	</Files>

 	<Globals>

 	</Globals>

diff --git a/builds/windows/visualce/index.html b/builds/windows/visualce/index.html
index 95e61fc..474e85c 100644
--- a/builds/windows/visualce/index.html
+++ b/builds/windows/visualce/index.html
@@ -21,14 +21,14 @@
   <li>PPC/SP WM6 (Windows Mobile 6)</li>
 </ul>
 
-It compiles the following libraries from the FreeType 2.10.1 sources:</p>
+It compiles the following libraries from the FreeType 2.10.4 sources:</p>
 
 <ul>
   <pre>
-    freetype2101.lib     - release build; single threaded
-    freetype2101_D.lib   - debug build;   single threaded
-    freetype2101MT.lib   - release build; multi-threaded
-    freetype2101MT_D.lib - debug build;   multi-threaded</pre>
+    freetype.lib     - release build; single threaded
+    freetype_D.lib   - debug build;   single threaded
+    freetypeMT.lib   - release build; multi-threaded
+    freetypeMT_D.lib - debug build;   multi-threaded</pre>
 </ul>
 
 <p>Be sure to extract the files with the Windows (CR+LF) line endings.  ZIP
diff --git a/builds/windows/w32-bcc.mk b/builds/windows/w32-bcc.mk
index 39262ff..c80710e 100644
--- a/builds/windows/w32-bcc.mk
+++ b/builds/windows/w32-bcc.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/windows/w32-bccd.mk b/builds/windows/w32-bccd.mk
index 20e272f..966bdb5 100644
--- a/builds/windows/w32-bccd.mk
+++ b/builds/windows/w32-bccd.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/windows/w32-dev.mk b/builds/windows/w32-dev.mk
index 30c5a8f..b2af667 100644
--- a/builds/windows/w32-dev.mk
+++ b/builds/windows/w32-dev.mk
@@ -5,7 +5,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/windows/w32-gcc.mk b/builds/windows/w32-gcc.mk
index 4a07bb0..f27e6b1 100644
--- a/builds/windows/w32-gcc.mk
+++ b/builds/windows/w32-gcc.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/windows/w32-icc.mk b/builds/windows/w32-icc.mk
index fb1fc1a..2e69609 100644
--- a/builds/windows/w32-icc.mk
+++ b/builds/windows/w32-icc.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/windows/w32-intl.mk b/builds/windows/w32-intl.mk
index 252eae2..88e6269 100644
--- a/builds/windows/w32-intl.mk
+++ b/builds/windows/w32-intl.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/windows/w32-lcc.mk b/builds/windows/w32-lcc.mk
index aa40e56..6cf6460 100644
--- a/builds/windows/w32-lcc.mk
+++ b/builds/windows/w32-lcc.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/windows/w32-mingw32.mk b/builds/windows/w32-mingw32.mk
index 3913dac..f2eb021 100644
--- a/builds/windows/w32-mingw32.mk
+++ b/builds/windows/w32-mingw32.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/windows/w32-vcc.mk b/builds/windows/w32-vcc.mk
index cc38a45..e800d27 100644
--- a/builds/windows/w32-vcc.mk
+++ b/builds/windows/w32-vcc.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/windows/w32-wat.mk b/builds/windows/w32-wat.mk
index 842fbce..a0de4bb 100644
--- a/builds/windows/w32-wat.mk
+++ b/builds/windows/w32-wat.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/builds/windows/win32-def.mk b/builds/windows/win32-def.mk
index 23ba80a..f759853 100644
--- a/builds/windows/win32-def.mk
+++ b/builds/windows/win32-def.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/configure b/configure
index 9a64f69..ac91a8e 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright (C) 2002-2019 by
+# Copyright (C) 2002-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -94,10 +94,10 @@
 inode_dst=`ls -id $abs_curr_dir | awk '{print $1}'`
 
 if test $inode_src -ne $inode_dst; then
-  if test ! -d reference; then
-    mkdir reference
+  if test ! -d docs; then
+    mkdir docs
     echo "Copying documentation assets"
-    cp -R $abs_ft2_dir/docs/reference/markdown $abs_curr_dir/reference
+    cp -R $abs_ft2_dir/docs/markdown $abs_curr_dir/docs
   fi
   if test ! -r $abs_curr_dir/modules.cfg; then
     echo "Copying \`modules.cfg'"
@@ -107,7 +107,7 @@
   echo "TOP_DIR        := $abs_ft2_dir"           > Makefile
   echo "OBJ_DIR        := $abs_curr_dir"         >> Makefile
   echo "OBJ_BUILD      := \$(OBJ_DIR)"           >> Makefile
-  echo "DOC_DIR        := \$(OBJ_DIR)/reference" >> Makefile
+  echo "DOC_DIR        := \$(OBJ_DIR)/docs"      >> Makefile
   echo "FT_LIBTOOL_DIR := \$(OBJ_DIR)"           >> Makefile
   echo "ifndef FT2DEMOS"                         >> Makefile
   echo "  include \$(TOP_DIR)/Makefile"          >> Makefile
diff --git a/devel-teeui/ftmodule.h b/devel-teeui/ftmodule.h
index b55161c..912d253 100644
--- a/devel-teeui/ftmodule.h
+++ b/devel-teeui/ftmodule.h
@@ -4,7 +4,5 @@
 FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )
 FT_USE_MODULE( FT_Module_Class, sfnt_module_class )
 FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
-FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )
-FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class )
 
 /* EOF */
diff --git a/devel/ft2build.h b/devel/ft2build.h
index 42fd39f..0ab8ba0 100644
--- a/devel/ft2build.h
+++ b/devel/ft2build.h
@@ -4,7 +4,7 @@
  *
  *   FreeType 2 build and setup macros (development version).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -30,6 +30,7 @@
 #ifndef FT2BUILD_H_
 #define FT2BUILD_H_
 
+#define FT_CONFIG_MODULES_H  <ftmodule.h>
 #define FT_CONFIG_OPTIONS_H  <ftoption.h>
 
 #include <freetype/config/ftheader.h>
diff --git a/devel/ftoption.h b/devel/ftoption.h
index 16cf4e1..307d1a3 100644
--- a/devel/ftoption.h
+++ b/devel/ftoption.h
@@ -4,7 +4,7 @@
  *
  *   User-selectable configuration macros (specification only).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -42,7 +42,7 @@
    *   the name of a directory that is included _before_ the FreeType include
    *   path during compilation.
    *
-   *   The default FreeType Makefiles and Jamfiles use the build directory
+   *   The default FreeType Makefiles use the build directory
    *   `builds/<system>` by default, but you can easily change that for your
    *   own projects.
    *
@@ -121,10 +121,8 @@
    * mitigate color fringes inherent to this technology, you also need to
    * explicitly set up LCD filtering.
    *
-   * Note that this feature is covered by several Microsoft patents and
-   * should not be activated in any default build of the library.  When this
-   * macro is not defined, FreeType offers alternative LCD rendering
-   * technology that produces excellent output without LCD filtering.
+   * When this macro is not defined, FreeType offers alternative LCD
+   * rendering technology that produces excellent output.
    */
 /* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
 
@@ -294,6 +292,22 @@
 
   /**************************************************************************
    *
+   * Brotli support.
+   *
+   *   FreeType uses the Brotli library to provide support for decompressing
+   *   WOFF2 streams.
+   *
+   *   Define this macro if you want to enable this 'feature'.
+   *
+   *   If you use a build system like cmake or the `configure` script,
+   *   options set by those programs have precedence, overwriting the value
+   *   here with the configured one.
+   */
+#define FT_CONFIG_OPTION_USE_BROTLI
+
+
+  /**************************************************************************
+   *
    * Glyph Postscript Names handling
    *
    *   By default, FreeType 2 is compiled with the 'psnames' module.  This
@@ -526,7 +540,7 @@
 
   /**************************************************************************
    *
-   * Define `TT_CONFIG_OPTION_COLOR_LAYERS` if you want to support coloured
+   * Define `TT_CONFIG_OPTION_COLOR_LAYERS` if you want to support colored
    * outlines (from the 'COLR'/'CPAL' tables) in all formats using the 'sfnt'
    * module (namely TrueType~& OpenType).
    */
@@ -871,9 +885,11 @@
    *
    * Compile 'autofit' module with fallback Indic script support, covering
    * some scripts that the 'latin' submodule of the 'autofit' module doesn't
-   * (yet) handle.
+   * (yet) handle.  Currently, this needs option `AF_CONFIG_OPTION_CJK`.
    */
+#ifdef AF_CONFIG_OPTION_CJK
 #define AF_CONFIG_OPTION_INDIC
+#endif
 
 
   /**************************************************************************
diff --git a/docs/reference/.gitignore b/docs/.gitignore
similarity index 91%
rename from docs/reference/.gitignore
rename to docs/.gitignore
index e245bdc..b8d05d1 100644
--- a/docs/reference/.gitignore
+++ b/docs/.gitignore
@@ -1,5 +1,5 @@
 # Static site folder
-site/
+reference/
 
 # HTML and Markdown files
 *.html
diff --git a/docs/CHANGES b/docs/CHANGES
index f36cb19..3bd5291 100644
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -1,3 +1,104 @@
+CHANGES BETWEEN 2.10.3 and 2.10.4
+
+  I. IMPORTANT BUG FIXES
+
+  - A heap buffer overflow has been found  in the handling of embedded
+    PNG bitmaps, introduced in FreeType version 2.6.
+
+      https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15999
+
+    If you  use option  FT_CONFIG_OPTION_USE_PNG  you  should  upgrade
+    immediately.
+
+
+======================================================================
+
+CHANGES BETWEEN 2.10.2 and 2.10.3
+
+  I. IMPORTANT CHANGES
+
+  - New flag `FT_OUTLINE_OVERLAP'.  If set, make the smooth rasterizer
+    do  4x4 oversampling  to  mitigate artifacts  in pixels  partially
+    covered  by  overlapping  contours.    Note  that  this  at  least
+    quadruples the rendering time.
+
+    If  a  glyph  in  a  TrueType font  has  the  `OVERLAP_SIMPLE'  or
+    `OVERLAP_COMPOUND'  bit set,  FreeType automatically  selects this
+    rendering mode.
+
+
+  II. MISCELLANEOUS
+
+  - Using the  arcane method of  including FreeType header  files with
+    macros like  `FT_FREETYPE_H' is no longer  mandatory (but retained
+    as an optional feature for backward compatibility).
+
+  - Support for  building the library  with Meson.  Building  the demo
+    programs with Meson will follow in a forthcoming release.
+
+  - Minor improvements to the B/W rasterizer.
+
+  - Auto-hinter support for Medefaidrin script.
+
+  - Fix various  memory leaks (mainly  for CFF) and other  issues that
+    might cause crashes in rare circumstances.
+
+  - Jam support has been removed.
+
+  - In  `ftview', custom  LCD  filter values  are  now normalized  and
+    balanced.  Unorthodox filters are still available through the `-L'
+    command line option.
+
+  - The GUI demo programs can now be resized.
+
+  - Demo programs that accept command  line option `-k' can now handle
+    function keys, too.  The  corresponding character codes start with
+    0xF1.  As  an example, the  POSIX shell syntax (accepted  by bash,
+    ksh, and zsh)
+
+      -k $'\xF3q'
+
+    emulates the pressing of function key `F3' followed by key `q'.
+
+
+======================================================================
+
+CHANGES BETWEEN 2.10.1 and 2.10.2
+
+  I. IMPORTANT CHANGES
+
+  - Support  of  WOFF2  fonts.   This  code  contribution  was  Nikhil
+    Ramakrishnan's GSoC 2019 project.
+
+
+  II. MISCELLANEOUS
+
+  - Function  `FT_Get_Var_Axis_Flags' returned random data for  Type 1
+    MM fonts.
+
+  - Type 1 fonts with non-integer metrics are now supported by the new
+    (CFF) engine introduced in FreeType 2.9.
+
+  - Drop  support  for Python 2 in Freetype's API reference  generator
+    `docwriter'  (Python >= 3.5 is required for targets  `make refdoc'
+    and `make refdoc-venv').
+
+  - Auto-hinter support for Hanifi Rohingya.
+
+  - Document the `FT2_KEEP_ALIVE' debugging environment variable.
+
+  - The Visual C++ (and Visual C)  project files for Windows builds no
+    longer generate libraries that contain the FreeType version in its
+    filenames.   Instead,  a  resource  file gets  used  to  make  the
+    libraries contain the corresponding information.
+
+  - The next release will remove Jam build support.
+
+  - The  `ftbench'  demo  program  has  a new  test  for  testing  the
+    `FT_Glyph_Stroke' functionality.
+
+
+======================================================================
 
 CHANGES BETWEEN 2.10.0 and 2.10.1
 
@@ -209,7 +310,7 @@
       use the `pkg-config' interface.
 
       The `configure'  script no longer installs  `freetype-config' by
-      default.  For  backwards compatibility,  a new  configure option
+      default.  For  backward  compatibility,  a new  configure option
       `--enable-freetype-config'   is  provided   that  reverts   this
       decision.
 
@@ -5198,7 +5299,7 @@
 
 ------------------------------------------------------------------------
 
-Copyright (C) 2000-2019 by
+Copyright (C) 2000-2020 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This  file  is  part  of the  FreeType  project, and may  only be  used,
diff --git a/docs/CUSTOMIZE b/docs/CUSTOMIZE
index f3f9f8e..0f92e70 100644
--- a/docs/CUSTOMIZE
+++ b/docs/CUSTOMIZE
@@ -139,7 +139,7 @@
 
 ----------------------------------------------------------------------
 
-Copyright (C) 2003-2019 by
+Copyright (C) 2003-2020 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This  file is  part of  the FreeType  project, and  may only  be used,
diff --git a/docs/DEBUG b/docs/DEBUG
index 828f294..a96b5e2 100644
--- a/docs/DEBUG
+++ b/docs/DEBUG
@@ -11,20 +11,20 @@
 
   FT_DEBUG_LEVEL_ERROR
 
-    #define this macro if you want to compile the FT_ERROR macro calls
-    to print error  messages during program execution.   This will not
-    stop  the  program.  Very  useful  to  spot invalid  fonts  during
+    #define this  macro if  you want to  compile the  `FT_ERROR' macro
+    calls to print error messages during program execution.  This does
+    not stop  the program.  Very  useful to spot invalid  fonts during
     development and to code workarounds for them.
 
   FT_DEBUG_LEVEL_TRACE
 
-    #define this macro if you want to compile both macros FT_ERROR and
-    FT_TRACE.  This  also includes the variants  FT_TRACE0, FT_TRACE1,
-    FT_TRACE2, ..., FT_TRACE7.
+    #define this macro  if you want to compile  both macros `FT_ERROR'
+    and  `FT_TRACE'.  This  also  includes  the variants  `FT_TRACE0',
+    `FT_TRACE1', `FT_TRACE2', ..., `FT_TRACE7'.
 
     The  trace macros  are used  to  send debugging  messages when  an
     appropriate  `debug level'  is configured  at runtime  through the
-    FT2_DEBUG environment variable (more on this later).
+    `FT2_DEBUG' environment variable (more on this later).
 
   FT_DEBUG_MEMORY
 
@@ -32,16 +32,16 @@
     small  but  effective debugging  memory  manager  that tracks  all
     allocations and frees that are performed within the font engine.
 
-    When  the  FT2_DEBUG_MEMORY  environment variable  is  defined  at
-    runtime, a  call to FT_Done_FreeType will  dump memory statistics,
-    including  the  list  of  leaked memory  blocks  with  the  source
-    locations where  these were allocated.   It is always a  very good
-    idea to define this in  development builds.  This works with _any_
-    program linked to FreeType, but requires a big deal of memory (the
-    debugging memory  manager never  frees the blocks  to the  heap in
-    order to detect double frees).
+    When  the `FT2_DEBUG_MEMORY'  environment variable  is defined  at
+    runtime,  a call  to `FT_Done_FreeType'  dumps memory  statistics,
+    including the list of leaked memory blocks and optionally with the
+    source locations where these were  allocated.  It is always a very
+    good idea to  define this in development builds.   This works with
+    _any_  program linked  to FreeType,  but  requires a  big deal  of
+    memory (the debugging memory manager never frees the blocks to the
+    heap in order to detect double frees).
 
-    When  FT2_DEBUG_MEMORY isn't  defined  at  runtime, the  debugging
+    When `FT2_DEBUG_MEMORY'  isn't defined  at runtime,  the debugging
     memory manager is ignored, and performance is unaffected.
 
 
@@ -55,10 +55,10 @@
   1. FT_ERROR(( ... ))
 
     This macro is used to send debug messages that indicate relatively
-    serious errors  (like broken  font files), but  will not  stop the
+    serious  errors  (like broken  font  files)  without stopping  the
     execution of the running program.   Its code is compiled only when
-    either FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE are defined in
-    `ftoption.h'.
+    either   `FT_DEBUG_LEVEL_ERROR'   or  `FT_DEBUG_LEVEL_TRACE'   are
+    defined in `ftoption.h'.
 
     Note that you have to use a printf-like signature, but with double
     parentheses, like in
@@ -69,53 +69,53 @@
   2. FT_ASSERT( condition )
 
     This macro is used to check  strong assertions at runtime.  If its
-    condition isn't TRUE, the program will abort with a panic message.
-    Its  code   is  compiled   when  either   FT_DEBUG_LEVEL_ERROR  or
-    FT_DEBUG_LEVEL_TRACE   are  defined.    You   don't  need   double
-    parentheses here.  For example
+    condition isn't  TRUE, the  program aborts  with a  panic message.
+    Its  code  is  compiled   when  either  `FT_DEBUG_LEVEL_ERROR'  or
+    `FT_DEBUG_LEVEL_TRACE'  are   defined.   You  don't   need  double
+    parentheses here.  Example:
 
       FT_ASSERT( ptr != NULL );
 
 
   3. FT_TRACE( level, (message...) )
 
-    The  FT_TRACE  macro is  used  to  send general-purpose  debugging
+    The  `FT_TRACE' macro  is used  to send  general-purpose debugging
     messages during program execution.   This macro uses an *implicit*
-    macro  named  FT_COMPONENT  used  to  name  the  current  FreeType
+    macro  named  `FT_COMPONENT',  which names  the  current  FreeType
     component being run.
 
-    The developer  should always  define FT_COMPONENT  as appropriate,
+    The developer should always  define `FT_COMPONENT' as appropriate,
     for example as in
 
       #undef  FT_COMPONENT
       #define FT_COMPONENT  io
 
-    The  value  of the  FT_COMPONENT  macro  is  one  of the component
-    names  defined in the internal  file `internal/fttrace.h'.  If you
-    modify FreeType source and insert new FT_COMPONENT macro, you must
-    register it  in `fttrace.h'.  If  you insert or  remove many trace
-    macros, you can check the undefined or the unused trace  macro  by
-    `src/tools/chktrcmp.py'.
+    The  value of  the `FT_COMPONENT'  macro is  one of  the component
+    names defined  in the internal file  `internal/fttrace.h'.  If you
+    modify the  FreeType source code  and insert a  new `FT_COMPONENT'
+    macro,  you must  register it  in `fttrace.h'.   If you  insert or
+    remove many  trace macros,  you can test  for undefined  or unused
+    trace macros with the script `src/tools/chktrcmp.py'.
 
-    Each such component is assigned a `debug level', ranging from 0 to
-    7,  through   the  use  of  the   FT2_DEBUG  environment  variable
-    (described below) when a program linked with FreeType starts.
+    Each  such component  is assigned  a `debug  level', ranging  from
+    value  0 to  7, through  the  use of  the `FT2_DEBUG'  environment
+    variable  (described below)  when a  program linked  with FreeType
+    starts.
 
-    When FT_TRACE is  called, its level is compared to  the one of the
+    When `FT_TRACE' is called, its level is compared to the one of the
     corresponding component.  Messages with trace levels *higher* than
-    the corresponding component level are filtered and never printed.
+    the  corresponding  component level  are  filtered  out and  never
+    printed.  This means  that trace messages with level  0 are always
+    printed, those  with level 2  are only printed when  the component
+    level is *at least* 2, etc.
 
-    This means  that trace messages  with level 0 are  always printed,
-    those with  level 2 are only  printed when the component  level is
-    *at least* 2.
-
-    The  second parameter  to  FT_TRACE must  contain parentheses  and
-    correspond to a printf-like call, as in
+    The second  parameter to  `FT_TRACE' must contain  parentheses and
+    corresponds to a printf-like call, as in
 
       FT_TRACE( 2, ( "your %s is not %s\n", "foo", "bar" ) )
 
-    The   shortcut  macros   FT_TRACE0,  FT_TRACE1,   FT_TRACE2,  ...,
-    FT_TRACE7 can  be used with  constant level indices, and  are much
+    The  shortcut macros  `FT_TRACE0', `FT_TRACE1',  `FT_TRACE2', ...,
+    `FT_TRACE7' can be used with  constant level indices, and are much
     cleaner to use, as in
 
       FT_TRACE2(( "your %s is not %s\n", "foo", "bar" ));
@@ -131,7 +131,7 @@
   FT2_DEBUG
 
     This  variable   is  only  used   when  FreeType  is   built  with
-    FT_DEBUG_LEVEL_TRACE  defined.  It  contains a  list of  component
+    `FT_DEBUG_LEVEL_TRACE' defined.   It contains a list  of component
     level definitions, following this format:
 
       component1:level1 component2:level2 component3:level3 ...
@@ -140,57 +140,70 @@
     in `fttrace.h'.  `levelX' is  the corresponding level  to  use  at
     runtime.
 
-    `any'  is a  special component  name that  will be  interpreted as
-    `any/all components'.  For example, the following definitions
+    `any' is a special component  name that is interpreted as `any/all
+    components'.  For example, the following definitions
 
       set FT2_DEBUG=any:2 memory:5 io:4        (on Windows)
       export FT2_DEBUG="any:2 memory:5 io:4"   (on Linux with bash)
 
     both stipulate that all components should have level 2, except for
-    the memory and  io components which will be set  to trace levels 5
+    the memory and io components, which  are set to the trace levels 5
     and 4, respectively.
 
 
   FT2_DEBUG_MEMORY
 
     This environment variable,  when defined, tells FreeType  to use a
-    debugging memory manager that will  track leaking memory blocks as
-    well as other common errors like double frees.  It is also capable
-    of  reporting _where_  the  leaking blocks  were allocated,  which
+    debugging memory manager that tracks leaking memory blocks as well
+    as other common  errors like double frees.  It is  also capable of
+    reporting  _where_  the  leaking   blocks  were  allocated,  which
     considerably  saves  time  when  debugging new  additions  to  the
     library.
 
     This  code  is only  compiled  when  FreeType  is built  with  the
-    FT_DEBUG_MEMORY macro #defined in  `ftoption.h' though, it will be
+    `FT_DEBUG_MEMORY'  macro #defined  in `ftoption.h'  though, it  is
     ignored in other builds.
 
 
   FT2_ALLOC_TOTAL_MAX
 
-    This variable is  ignored if FT2_DEBUG_MEMORY is  not defined.  It
+    This variable is ignored if `FT2_DEBUG_MEMORY' is not defined.  It
     allows  you  to  specify  a  maximum  heap  size  for  all  memory
     allocations performed  by FreeType.  This  is very useful  to test
     the robustness  of the  font engine  and programs  that use  it in
     tight memory conditions.
 
-    If it is undefined, or if its value is not strictly positive, then
-    no allocation bounds are checked at runtime.
+    If it is  undefined, or if its value is  not strictly positive, no
+    allocation bounds are checked at runtime.
 
 
   FT2_ALLOC_COUNT_MAX
 
-    This variable is  ignored if FT2_DEBUG_MEMORY is  not defined.  It
+    This variable is ignored if `FT2_DEBUG_MEMORY' is not defined.  It
     allows  you to  specify  a maximum  number  of memory  allocations
     performed    by    FreeType    before    returning    the    error
-    FT_Err_Out_Of_Memory.  This  is useful  for debugging  and testing
+    `FT_Err_Out_Of_Memory'.  This is useful  for debugging and testing
     the engine's robustness.
 
-    If it is undefined, or if its value is not strictly positive, then
-    no allocation bounds are checked at runtime.
+    If it is  undefined, or if its value is  not strictly positive, no
+    allocation bounds are checked at runtime.
+
+
+  FT2_KEEP_ALIVE
+
+    This  variable is  ignored if  `FT2_DEBUG_MEMORY' is  not defined.
+    `Keep alive' means that freed  blocks aren't released to the heap.
+    This is  useful to detect  double-frees or weird  heap corruption,
+    reporting the source code location  of the original allocation and
+    deallocation  in case  of a  problem.   It uses  large amounts  of
+    memory, however.
+
+    If it  is undefined,  or if  its value  is not  strictly positive,
+    freed blocks are released at runtime.
 
 ------------------------------------------------------------------------
 
-Copyright (C) 2002-2019 by
+Copyright (C) 2002-2020 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This  file is  part  of the  FreeType  project, and  may  only be  used,
diff --git a/docs/DOCGUIDE b/docs/DOCGUIDE
index da76c88..89617b4 100644
--- a/docs/DOCGUIDE
+++ b/docs/DOCGUIDE
@@ -285,7 +285,7 @@
 
 ----------------------------------------------------------------------
 
-Copyright (C) 2018-2019 by
+Copyright (C) 2018-2020 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/docs/INSTALL b/docs/INSTALL
index 6105025..814fc7b 100644
--- a/docs/INSTALL
+++ b/docs/INSTALL
@@ -77,7 +77,7 @@
 
 ----------------------------------------------------------------------
 
-Copyright (C) 2000-2019 by
+Copyright (C) 2000-2020 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This  file is  part of  the FreeType  project, and  may only  be used,
diff --git a/docs/INSTALL.ANY b/docs/INSTALL.ANY
index 4d5fd8d..879dddb 100644
--- a/docs/INSTALL.ANY
+++ b/docs/INSTALL.ANY
@@ -8,13 +8,15 @@
 I. Standard procedure
 ---------------------
 
-  * DISABLE PRE-COMPILED  HEADERS!  This is very  important for Visual
-    C++, because FreeType uses lines like:
+  * If you use macro names  for FreeType header files (while mandatory
+    in earlier versions,  this is now optional  since FreeType version
+    2.10.3) it  is necessary to disable pre-compiled headers.  This is
+    very important for Visual C++, because lines like
 
       #include FT_FREETYPE_H
 
-    which are not correctly supported by this compiler while being ISO
-    C compliant!
+    are not  correctly supported  by this compiler  while being  ISO C
+    compliant!
 
   * You need to add the directory `include' to your  include path when
     compiling the library.
@@ -141,7 +143,7 @@
 
 ----------------------------------------------------------------------
 
-Copyright (C) 2003-2019 by
+Copyright (C) 2003-2020 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This  file is  part of  the FreeType  project, and  may only  be used,
diff --git a/docs/INSTALL.CROSS b/docs/INSTALL.CROSS
index 8f4cf6e..8511805 100644
--- a/docs/INSTALL.CROSS
+++ b/docs/INSTALL.CROSS
@@ -163,7 +163,7 @@
 
 ----------------------------------------------------------------------
 
-Copyright (C) 2006-2019 by
+Copyright (C) 2006-2020 by
 suzuki toshiya, David Turner, Robert Wilhelm, and Werner Lemberg.
 
 
diff --git a/docs/INSTALL.GNU b/docs/INSTALL.GNU
index 6f37a0f..8fdbb82 100644
--- a/docs/INSTALL.GNU
+++ b/docs/INSTALL.GNU
@@ -63,7 +63,7 @@
 
       Otherwise, simply type 'make' again to build the library
       or 'make refdoc' to build the API reference (the latter needs
-      python).
+      Python >= 3.5).
       =============================================================
 
 
@@ -148,7 +148,7 @@
 
 ----------------------------------------------------------------------
 
-Copyright (C) 2003-2019 by
+Copyright (C) 2003-2020 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This  file is  part of  the FreeType  project, and  may only  be used,
diff --git a/docs/INSTALL.UNIX b/docs/INSTALL.UNIX
index 602744d..f8d220a 100644
--- a/docs/INSTALL.UNIX
+++ b/docs/INSTALL.UNIX
@@ -105,7 +105,7 @@
 
 ----------------------------------------------------------------------
 
-Copyright (C) 2003-2019 by
+Copyright (C) 2003-2020 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This  file is  part of  the FreeType  project, and  may only  be used,
diff --git a/docs/INSTALL.VMS b/docs/INSTALL.VMS
index 54fa2f8..e1817ec 100644
--- a/docs/INSTALL.VMS
+++ b/docs/INSTALL.VMS
@@ -49,7 +49,7 @@
 
 ------------------------------------------------------------------------
 
-Copyright (C) 2000-2019 by
+Copyright (C) 2000-2020 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This  file  is  part  of the  FreeType  project, and may  only be  used,
diff --git a/docs/reference/README b/docs/README
similarity index 65%
rename from docs/reference/README
rename to docs/README
index 3ffcfc0..d71fd37 100644
--- a/docs/reference/README
+++ b/docs/README
@@ -1,6 +1,6 @@
-After saying `make refdoc' or `make refdoc-venv' the `site/' directory
-contains the FreeType API reference.  You need python and pip to make this
-target.
+After saying `make refdoc' or `make refdoc-venv' the `reference/' directory
+contains the FreeType API reference.  You need Python >= 3.5 and pip to make
+this target.
 
 There are two ways to generate the documentation:
 
@@ -13,7 +13,7 @@
 
 2. Using `make refdoc-venv' (requires internet access):
 
-    - Ensure `python', `pip' and python package `virtualenv' are available.
+    - Ensure `python', `pip' and Python package `virtualenv' are available.
     - Make target with `make refdoc-venv'.
     - This may or may not require internet access every time depending on
     pip and system caching.
@@ -25,11 +25,11 @@
 * Regularly run `pip install --upgrade docwriter' to check for updates which
 may include bug fixes.
 
-* Ensure that `docwriter' is installed in the same python target that
-`make refdoc' uses (python3/python2/python).
+* `Docwriter' does not support Python 2.  Ensure that Python >= 3.5 is
+installed and available as `python3'/`python'.
 
-* `pip' and `python' may point to different versions of Python.  Check using
-`python --version' and `pip --version'.
+* Ensure that `docwriter' is installed in the same Python target that
+`make refdoc' uses (python3/python).
 
 * If none of this works, send a mail to `freetype-devel@nongnu.org' or file
 an issue at `https://github.com/freetype/docwriter/issues'.
diff --git a/docs/TODO b/docs/TODO
index 1efccc6..8b27e26 100644
--- a/docs/TODO
+++ b/docs/TODO
@@ -27,7 +27,7 @@
 
 ------------------------------------------------------------------------
 
-Copyright (C) 2001-2019 by
+Copyright (C) 2001-2020 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This  file  is  part  of the  FreeType  project, and may  only be  used,
diff --git a/docs/VERSIONS.TXT b/docs/VERSIONS.TXT
index 5cdf378..4e281a7 100644
--- a/docs/VERSIONS.TXT
+++ b/docs/VERSIONS.TXT
@@ -1,36 +1,44 @@
-Due  to our  use of  `libtool' to  generate and  install the  FreeType 2
-libraries on  Unix systems, as  well as  other historical events,  it is
-generally very  difficult to  know precisely which  release of  the font
+Due to  our use of  `libtool' to generate  and install the  FreeType 2
+libraries on Unix  systems, as well as other historical  events, it is
+generally very difficult  to know precisely which release  of the font
 engine is installed on a given system.
 
-This file tries  to explain why and to document  ways to properly detect
+This file tries to explain why and to document ways to properly detect
 FreeType on Unix.
 
 
 1. Version and Release numbers
 ------------------------------
 
-For each new  public release of FreeType 2, there  are generally *three*
+For each new public release of FreeType 2, there are generally *three*
 distinct `version' numbers to consider:
 
-  * The official FreeType 2 release number, like 2.3.1 or 2.4.10.
+  * The official FreeType 2 release number, like 2.7.0 or 2.10.2.
 
-  * The libtool (and  Unix) specific version number,  like 13.0.7.  This
-    is what `freetype-config --version' returns.
+  * The  libtool (and  Unix)  specific version  number, like  23.2.17.
+    This is what
 
-  * The platform-specific  shared object  number, used for  example when
-    the library is installed as `/usr/lib/libfreetype.so.6.7.1'.
+      pkg-config freetype2 --modversion
 
-The platform-specific  number is, unsurprisingly,  platform-specific and
-varies  with the  operating system  you are  using (several  variants of
-Linux, FreeBSD,  Solaris, etc.).  You  should thus _never_ use  it, even
+    or
+
+      freetype-config --version
+
+    returns.
+
+  * The platform-specific shared object  number, used for example when
+    the library is installed as `/usr/lib/libfreetype.so.6.17.2'.
+
+The platform-specific number is, unsurprisingly, platform-specific and
+varies with  the operating system  you are using (several  variants of
+Linux, FreeBSD, Solaris, etc.).  You  should thus _never_ use it, even
 for simple tests.
 
-The libtool-specific  number does  not equal the  release number  but is
+The libtool-specific number  does not equal the release  number but is
 tied to it.
 
-The release number is available  at *compile* time through the following
-macros defined in FT_FREETYPE_H:
+The  release  number  is  available  at  *compile*  time  through  the
+following macros defined in `freetype.h':
 
   - FREETYPE_MAJOR: major release number
   - FREETYPE_MINOR: minor release number
@@ -38,20 +46,23 @@
 
 See below for a small autoconf fragment.
 
-The  release  number   is  also  available  at   *runtime*  through  the
+The  release  number  is  also  available  at  *runtime*  through  the
 `FT_Library_Version' API.
 
 
 2. History
 ----------
 
-The  following   table  gives,  for   all  releases  since   2.4.0,  the
-corresponding libtool number, as well  as the shared object number found
-on _most_ systems, but not all of them:
+The  following  table  gives,  for   all  releases  since  2.5.0,  the
+corresponding  libtool number,  as well  as the  shared object  number
+found on _most_ systems, but not all of them:
 
 
     release     libtool     so
   -------------------------------
+     2.10.4     23.4.17   6.17.4
+     2.10.3     23.3.17   6.17.3
+     2.10.2     23.2.17   6.17.2
      2.10.1     23.1.17   6.17.1
      2.10.0     23.0.17   6.17.0
      2.9.1      22.1.16   6.16.1
@@ -72,58 +83,48 @@
      2.5.2      17.1.11   6.11.1
      2.5.1      17.0.11   6.11.0
      2.5.0      16.2.10   6.10.2
-     2.4.12     16.1.10   6.10.1
-     2.4.11     16.0.10   6.10.0
-     2.4.10     15.0.9    6.9.0
-     2.4.9      14.1.8    6.8.1
-     2.4.8      14.0.8    6.8.0
-     2.4.7      13.2.7    6.7.2
-     2.4.6      13.1.7    6.7.1
-     2.4.5      13.0.7    6.7.0
-     2.4.4      12.2.6    6.6.2
-     2.4.3      12.1.6    6.6.1
-     2.4.2      12.0.6    6.6.0
-     2.4.1      11.1.5    6.5.1
-     2.4.0      11.0.5    6.5.0
 
 
 3. Autoconf Code Fragment
 -------------------------
 
-Lars Clausen contributed the following autoconf fragment to detect which
-version of  FreeType is  installed on  a system.  This  one tests  for a
-version that  is at least 2.0.9;  you should change it  to check against
+Lars  Clausen contributed  the  following autoconf  fragment to  check
+which version of FreeType is installed on a system (now updated to use
+`pkg-config'  instead of  `freetype-config').   This one  tests for  a
+version that is at least 2.10.2; you should change it to check against
 other release numbers.
 
 
-  AC_MSG_CHECKING([whether FreeType version is 2.0.9 or higher])
+  AC_MSG_CHECKING([whether FreeType version is 2.10.2 or higher])
   old_CPPFLAGS="$CPPFLAGS"
-  CPPFLAGS=`freetype-config --cflags`
+  CPPFLAGS=`pkg-config freetype2 --cflags`
   AC_TRY_CPP([
 
 #include <ft2build.h>
-#include FT_FREETYPE_H
-#if (FREETYPE_MAJOR*1000 + FREETYPE_MINOR)*1000 + FREETYPE_PATCH < 2000009
-#error FreeType version too low.
+#include <freetype/freetype.h>
+
+#if FREETYPE_MAJOR*10000 + FREETYPE_MINOR*100 + FREETYPE_PATCH < 21002
+#  error FreeType version too low.
 #endif
+
   ],
   [AC_MSG_RESULT(yes)
-   FREETYPE_LIBS=`freetype-config --libs`
+   FREETYPE_LIBS=`pkg-config freetype2 --libs`
    AC_SUBST(FREETYPE_LIBS)
    AC_DEFINE(HAVE_FREETYPE,1,[Define if you have the FreeType2 library])
    CPPFLAGS="$old_CPPFLAGS"],
-  [AC_MSG_ERROR([Need FreeType library version 2.0.9 or higher])])
+  [AC_MSG_ERROR([Need FreeType library version 2.10.2 or higher])])
 
-------------------------------------------------------------------------
+----------------------------------------------------------------------
 
-Copyright (C) 2002-2019 by
+Copyright (C) 2002-2020 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
-This  file is  part  of the  FreeType  project, and  may  only be  used,
-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.
+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.
 
 
 --- end of VERSIONS.TXT ---
diff --git a/docs/formats.txt b/docs/formats.txt
index 5ec5442..e640fab 100644
--- a/docs/formats.txt
+++ b/docs/formats.txt
@@ -191,7 +191,7 @@
 
 ------------------------------------------------------------------------
 
-Copyright (C) 2004-2019 by
+Copyright (C) 2004-2020 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This  file is  part  of the  FreeType  project, and  may  only be  used,
diff --git a/docs/freetype-config.1 b/docs/freetype-config.1
index 96ff0f2..7dea66a 100644
--- a/docs/freetype-config.1
+++ b/docs/freetype-config.1
@@ -1,4 +1,4 @@
-.TH FREETYPE-CONFIG 1 "July 2019" "FreeType 2.10.1"
+.TH FREETYPE-CONFIG 1 "October 2020" "FreeType 2.10.4"
 .
 .
 .SH NAME
diff --git a/docs/reference/markdown/images/favico.ico b/docs/markdown/images/favico.ico
similarity index 100%
rename from docs/reference/markdown/images/favico.ico
rename to docs/markdown/images/favico.ico
Binary files differ
diff --git a/docs/reference/markdown/javascripts/extra.js b/docs/markdown/javascripts/extra.js
similarity index 100%
rename from docs/reference/markdown/javascripts/extra.js
rename to docs/markdown/javascripts/extra.js
diff --git a/docs/reference/markdown/stylesheets/extra.css b/docs/markdown/stylesheets/extra.css
similarity index 76%
rename from docs/reference/markdown/stylesheets/extra.css
rename to docs/markdown/stylesheets/extra.css
index cd6a1ee..a99e77f 100644
--- a/docs/reference/markdown/stylesheets/extra.css
+++ b/docs/markdown/stylesheets/extra.css
@@ -10,18 +10,13 @@
 }
 p {
     text-align: justify;
-   /* margin: 1.5ex 0 1.5ex 0;
-    */
 }
-/* .md-typeset p{
-    margin: 1em 1em 0 1em;
-}
-*/
+
 /* code blocks */
 pre.colored {
     color: blue;
 }
-pre {
+pre>code {
     font-family: monospace;
     background-color: #D6E8FF;
     padding: 2ex 0 2ex 1%;
@@ -33,7 +28,7 @@
     white-space: pre;
     color: #d73a49;
 }
-.md-typeset code {
+.md-typeset pre>code {
     white-space: pre;
 }
 /* H4 Heading */
@@ -42,10 +37,9 @@
     font-size: medium;
     font-style: oblique;
     font-weight: bold;
-   /* margin: 3ex 0 1.5ex 9%;
-    */
     padding: 0.3em 0 0.3em 1%;
 }
+
 /* Fields table */
 table.fields {
     width: 90%;
@@ -70,7 +64,7 @@
     margin: 1.5ex 0 0 0;
 }
 
-/* START EXPERIMENTAL CODE */
+/* Define 'long' tables */
 table.long {
     display: block;
     width: 93%;
@@ -115,42 +109,8 @@
     padding-right: 10px;
     white-space: nowrap;
 }
-/* END EXPERIMENTAL CODE */
+/* End 'long' table definition */
 
-/* Index table */
-table.index {
-    width: 100%;
-    border-collapse: collapse;
-    border: 0;
-    border-spacing: 1em 0.3ex;
-}
-table.index tr {
-    padding: 0;
-}
-table.index td {
-    padding: 0;
-}
-table.index-toc-link {
-    width: 100%;
-    border: 0;
-    border-spacing: 0;
-    margin: 1ex 0 1ex 0;
-}
-table.index-toc-link td.left {
-    padding: 0 0.5em 0 0.5em;
-    font-size: 83%;
-    text-align: left;
-}
-table.index-toc-link td.middle {
-    padding: 0 0.5em 0 0.5em;
-    font-size: 83%;
-    text-align: center;
-}
-table.index-toc-link td.right {
-    padding: 0 0.5em 0 0.5em;
-    font-size: 83%;
-    text-align: right;
-}
 /* toc table */
 table.toc {
     width: 95%;
@@ -178,7 +138,9 @@
 div.timestamp {
     font-size: small;
 }
-/* Max width before this PARTICULAR table gets nasty This query will take effect for any screen smaller than 760px and also iPads specifically. */
+
+/* Change table layout for smaller screens. This query will take effect for any screen smaller than
+   760px and also iPads specifically. */
 @media only screen and (max-width: 760px), (min-device-width: 768px) and (max-device-width: 1024px) {
    /* Force table to not be like tables anymore */
     table, thead, tbody, th, td, tr {
diff --git a/docs/raster.txt b/docs/raster.txt
index 3aa3822..1bf4f67 100644
--- a/docs/raster.txt
+++ b/docs/raster.txt
@@ -618,7 +618,7 @@
 
 ------------------------------------------------------------------------
 
-Copyright (C) 2003-2019 by
+Copyright (C) 2003-2020 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This  file  is  part  of the  FreeType  project, and may  only be  used,
diff --git a/docs/release b/docs/release
index 1b0c1ee..628dded 100644
--- a/docs/release
+++ b/docs/release
@@ -189,7 +189,7 @@
 
 ----------------------------------------------------------------------
 
-Copyright (C) 2003-2019 by
+Copyright (C) 2003-2020 by
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
 This  file is  part of  the FreeType  project, and  may only  be used,
diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h
index 9466603..b464e0b 100644
--- a/include/freetype/config/ftconfig.h
+++ b/include/freetype/config/ftconfig.h
@@ -4,7 +4,7 @@
  *
  *   ANSI-specific configuration file (specification only).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -41,533 +41,9 @@
 #include FT_CONFIG_OPTIONS_H
 #include FT_CONFIG_STANDARD_LIBRARY_H
 
-
-FT_BEGIN_HEADER
-
-
-  /**************************************************************************
-   *
-   *              PLATFORM-SPECIFIC CONFIGURATION MACROS
-   *
-   * These macros can be toggled to suit a specific system.  The current ones
-   * are defaults used to compile FreeType in an ANSI C environment (16bit
-   * compilers are also supported).  Copy this file to your own
-   * `builds/<system>` directory, and edit it to port the engine.
-   *
-   */
-
-
-  /* There are systems (like the Texas Instruments 'C54x) where a `char`  */
-  /* has 16~bits.  ANSI~C says that `sizeof(char)` is always~1.  Since an */
-  /* `int` has 16~bits also for this system, `sizeof(int)` gives~1 which  */
-  /* is probably unexpected.                                              */
-  /*                                                                      */
-  /* `CHAR_BIT` (defined in `limits.h`) gives the number of bits in a     */
-  /* `char` type.                                                         */
-
-#ifndef FT_CHAR_BIT
-#define FT_CHAR_BIT  CHAR_BIT
-#endif
-
-
-  /* The size of an `int` type. */
-#if                                 FT_UINT_MAX == 0xFFFFUL
-#define FT_SIZEOF_INT  ( 16 / FT_CHAR_BIT )
-#elif                               FT_UINT_MAX == 0xFFFFFFFFUL
-#define FT_SIZEOF_INT  ( 32 / FT_CHAR_BIT )
-#elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL
-#define FT_SIZEOF_INT  ( 64 / FT_CHAR_BIT )
-#else
-#error "Unsupported size of `int' type!"
-#endif
-
-  /* The size of a `long` type.  A five-byte `long` (as used e.g. on the */
-  /* DM642) is recognized but avoided.                                   */
-#if                                  FT_ULONG_MAX == 0xFFFFFFFFUL
-#define FT_SIZEOF_LONG  ( 32 / FT_CHAR_BIT )
-#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL
-#define FT_SIZEOF_LONG  ( 32 / FT_CHAR_BIT )
-#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL
-#define FT_SIZEOF_LONG  ( 64 / FT_CHAR_BIT )
-#else
-#error "Unsupported size of `long' type!"
-#endif
-
-
-  /* `FT_UNUSED` indicates that a given parameter is not used --   */
-  /* this is only used to get rid of unpleasant compiler warnings. */
-#ifndef FT_UNUSED
-#define FT_UNUSED( arg )  ( (arg) = (arg) )
-#endif
-
-
-  /**************************************************************************
-   *
-   *                    AUTOMATIC CONFIGURATION MACROS
-   *
-   * These macros are computed from the ones defined above.  Don't touch
-   * their definition, unless you know precisely what you are doing.  No
-   * porter should need to mess with them.
-   *
-   */
-
-
-  /**************************************************************************
-   *
-   * Mac support
-   *
-   *   This is the only necessary change, so it is defined here instead
-   *   providing a new configuration file.
-   */
-#if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) )
-  /* No Carbon frameworks for 64bit 10.4.x.                         */
-  /* `AvailabilityMacros.h` is available since Mac OS X 10.2,       */
-  /* so guess the system version by maximum errno before inclusion. */
-#include <errno.h>
-#ifdef ECANCELED /* defined since 10.2 */
-#include "AvailabilityMacros.h"
-#endif
-#if defined( __LP64__ ) && \
-    ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 )
-#undef FT_MACINTOSH
-#endif
-
-#elif defined( __SC__ ) || defined( __MRC__ )
-  /* Classic MacOS compilers */
-#include "ConditionalMacros.h"
-#if TARGET_OS_MAC
-#define FT_MACINTOSH 1
-#endif
-
-#endif
-
-
-  /* Fix compiler warning with sgi compiler. */
-#if defined( __sgi ) && !defined( __GNUC__ )
-#if defined( _COMPILER_VERSION ) && ( _COMPILER_VERSION >= 730 )
-#pragma set woff 3505
-#endif
-#endif
-
-
-  /**************************************************************************
-   *
-   * @section:
-   *   basic_types
-   *
-   */
-
-
-  /**************************************************************************
-   *
-   * @type:
-   *   FT_Int16
-   *
-   * @description:
-   *   A typedef for a 16bit signed integer type.
-   */
-  typedef signed short  FT_Int16;
-
-
-  /**************************************************************************
-   *
-   * @type:
-   *   FT_UInt16
-   *
-   * @description:
-   *   A typedef for a 16bit unsigned integer type.
-   */
-  typedef unsigned short  FT_UInt16;
-
-  /* */
-
-
-  /* this #if 0 ... #endif clause is for documentation purposes */
-#if 0
-
-  /**************************************************************************
-   *
-   * @type:
-   *   FT_Int32
-   *
-   * @description:
-   *   A typedef for a 32bit signed integer type.  The size depends on the
-   *   configuration.
-   */
-  typedef signed XXX  FT_Int32;
-
-
-  /**************************************************************************
-   *
-   * @type:
-   *   FT_UInt32
-   *
-   *   A typedef for a 32bit unsigned integer type.  The size depends on the
-   *   configuration.
-   */
-  typedef unsigned XXX  FT_UInt32;
-
-
-  /**************************************************************************
-   *
-   * @type:
-   *   FT_Int64
-   *
-   *   A typedef for a 64bit signed integer type.  The size depends on the
-   *   configuration.  Only defined if there is real 64bit support;
-   *   otherwise, it gets emulated with a structure (if necessary).
-   */
-  typedef signed XXX  FT_Int64;
-
-
-  /**************************************************************************
-   *
-   * @type:
-   *   FT_UInt64
-   *
-   *   A typedef for a 64bit unsigned integer type.  The size depends on the
-   *   configuration.  Only defined if there is real 64bit support;
-   *   otherwise, it gets emulated with a structure (if necessary).
-   */
-  typedef unsigned XXX  FT_UInt64;
-
-  /* */
-
-#endif
-
-#if FT_SIZEOF_INT == ( 32 / FT_CHAR_BIT )
-
-  typedef signed int      FT_Int32;
-  typedef unsigned int    FT_UInt32;
-
-#elif FT_SIZEOF_LONG == ( 32 / FT_CHAR_BIT )
-
-  typedef signed long     FT_Int32;
-  typedef unsigned long   FT_UInt32;
-
-#else
-#error "no 32bit type found -- please check your configuration files"
-#endif
-
-
-  /* look up an integer type that is at least 32~bits */
-#if FT_SIZEOF_INT >= ( 32 / FT_CHAR_BIT )
-
-  typedef int            FT_Fast;
-  typedef unsigned int   FT_UFast;
-
-#elif FT_SIZEOF_LONG >= ( 32 / FT_CHAR_BIT )
-
-  typedef long           FT_Fast;
-  typedef unsigned long  FT_UFast;
-
-#endif
-
-
-  /* determine whether we have a 64-bit `int` type for platforms without */
-  /* Autoconf                                                            */
-#if FT_SIZEOF_LONG == ( 64 / FT_CHAR_BIT )
-
-  /* `FT_LONG64` must be defined if a 64-bit type is available */
-#define FT_LONG64
-#define FT_INT64   long
-#define FT_UINT64  unsigned long
-
-  /**************************************************************************
-   *
-   * A 64-bit data type may create compilation problems if you compile in
-   * strict ANSI mode.  To avoid them, we disable other 64-bit data types if
-   * `__STDC__` is defined.  You can however ignore this rule by defining the
-   * `FT_CONFIG_OPTION_FORCE_INT64` configuration macro.
-   */
-#elif !defined( __STDC__ ) || defined( FT_CONFIG_OPTION_FORCE_INT64 )
-
-#if defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 199901L
-
-#define FT_LONG64
-#define FT_INT64   long long int
-#define FT_UINT64  unsigned long long int
-
-#elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */
-
-  /* this compiler provides the `__int64` type */
-#define FT_LONG64
-#define FT_INT64   __int64
-#define FT_UINT64  unsigned __int64
-
-#elif defined( __BORLANDC__ )  /* Borland C++ */
-
-  /* XXXX: We should probably check the value of `__BORLANDC__` in order */
-  /*       to test the compiler version.                                 */
-
-  /* this compiler provides the `__int64` type */
-#define FT_LONG64
-#define FT_INT64   __int64
-#define FT_UINT64  unsigned __int64
-
-#elif defined( __WATCOMC__ )   /* Watcom C++ */
-
-  /* Watcom doesn't provide 64-bit data types */
-
-#elif defined( __MWERKS__ )    /* Metrowerks CodeWarrior */
-
-#define FT_LONG64
-#define FT_INT64   long long int
-#define FT_UINT64  unsigned long long int
-
-#elif defined( __GNUC__ )
-
-  /* GCC provides the `long long` type */
-#define FT_LONG64
-#define FT_INT64   long long int
-#define FT_UINT64  unsigned long long int
-
-#endif /* __STDC_VERSION__ >= 199901L */
-
-#endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */
-
-#ifdef FT_LONG64
-  typedef FT_INT64   FT_Int64;
-  typedef FT_UINT64  FT_UInt64;
-#endif
-
-
-#ifdef _WIN64
-  /* only 64bit Windows uses the LLP64 data model, i.e., */
-  /* 32bit integers, 64bit pointers                      */
-#define FT_UINT_TO_POINTER( x ) (void*)(unsigned __int64)(x)
-#else
-#define FT_UINT_TO_POINTER( x ) (void*)(unsigned long)(x)
-#endif
-
-
-  /**************************************************************************
-   *
-   * miscellaneous
-   *
-   */
-
-
-#define FT_BEGIN_STMNT  do {
-#define FT_END_STMNT    } while ( 0 )
-#define FT_DUMMY_STMNT  FT_BEGIN_STMNT FT_END_STMNT
-
-
-  /* `typeof` condition taken from gnulib's `intprops.h` header file */
-#if ( ( defined( __GNUC__ ) && __GNUC__ >= 2 )                       || \
-      ( defined( __IBMC__ ) && __IBMC__ >= 1210 &&                      \
-        defined( __IBM__TYPEOF__ ) )                                 || \
-      ( defined( __SUNPRO_C ) && __SUNPRO_C >= 0x5110 && !__STDC__ ) )
-#define FT_TYPEOF( type )  ( __typeof__ ( type ) )
-#else
-#define FT_TYPEOF( type )  /* empty */
-#endif
-
-
-  /* Use `FT_LOCAL` and `FT_LOCAL_DEF` to declare and define,            */
-  /* respectively, a function that gets used only within the scope of a  */
-  /* module.  Normally, both the header and source code files for such a */
-  /* function are within a single module directory.                      */
-  /*                                                                     */
-  /* Intra-module arrays should be tagged with `FT_LOCAL_ARRAY` and      */
-  /* `FT_LOCAL_ARRAY_DEF`.                                               */
-  /*                                                                     */
-#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
-
-#define FT_LOCAL( x )      static  x
-#define FT_LOCAL_DEF( x )  static  x
-
-#else
-
-#ifdef __cplusplus
-#define FT_LOCAL( x )      extern "C"  x
-#define FT_LOCAL_DEF( x )  extern "C"  x
-#else
-#define FT_LOCAL( x )      extern  x
-#define FT_LOCAL_DEF( x )  x
-#endif
-
-#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
-
-#define FT_LOCAL_ARRAY( x )      extern const  x
-#define FT_LOCAL_ARRAY_DEF( x )  const  x
-
-
-  /* Use `FT_BASE` and `FT_BASE_DEF` to declare and define, respectively, */
-  /* functions that are used in more than a single module.  In the        */
-  /* current setup this implies that the declaration is in a header file  */
-  /* in the `include/freetype/internal` directory, and the function body  */
-  /* is in a file in `src/base`.                                          */
-  /*                                                                      */
-#ifndef FT_BASE
-
-#ifdef __cplusplus
-#define FT_BASE( x )  extern "C"  x
-#else
-#define FT_BASE( x )  extern  x
-#endif
-
-#endif /* !FT_BASE */
-
-
-#ifndef FT_BASE_DEF
-
-#ifdef __cplusplus
-#define FT_BASE_DEF( x )  x
-#else
-#define FT_BASE_DEF( x )  x
-#endif
-
-#endif /* !FT_BASE_DEF */
-
-
-  /* When compiling FreeType as a DLL or DSO with hidden visibility    */
-  /* some systems/compilers need a special attribute in front OR after */
-  /* the return type of function declarations.                         */
-  /*                                                                   */
-  /* Two macros are used within the FreeType source code to define     */
-  /* exported library functions: `FT_EXPORT` and `FT_EXPORT_DEF`.      */
-  /*                                                                   */
-  /* - `FT_EXPORT( return_type )`                                      */
-  /*                                                                   */
-  /*   is used in a function declaration, as in                        */
-  /*                                                                   */
-  /*   ```                                                             */
-  /*     FT_EXPORT( FT_Error )                                         */
-  /*     FT_Init_FreeType( FT_Library*  alibrary );                    */
-  /*   ```                                                             */
-  /*                                                                   */
-  /* - `FT_EXPORT_DEF( return_type )`                                  */
-  /*                                                                   */
-  /*   is used in a function definition, as in                         */
-  /*                                                                   */
-  /*   ```                                                             */
-  /*     FT_EXPORT_DEF( FT_Error )                                     */
-  /*     FT_Init_FreeType( FT_Library*  alibrary )                     */
-  /*     {                                                             */
-  /*       ... some code ...                                           */
-  /*       return FT_Err_Ok;                                           */
-  /*     }                                                             */
-  /*   ```                                                             */
-  /*                                                                   */
-  /* You can provide your own implementation of `FT_EXPORT` and        */
-  /* `FT_EXPORT_DEF` here if you want.                                 */
-  /*                                                                   */
-  /* To export a variable, use `FT_EXPORT_VAR`.                        */
-  /*                                                                   */
-#ifndef FT_EXPORT
-
-#ifdef FT2_BUILD_LIBRARY
-
-#if defined( _WIN32 ) && defined( DLL_EXPORT )
-#define FT_EXPORT( x )  __declspec( dllexport )  x
-#elif defined( __GNUC__ ) && __GNUC__ >= 4
-#define FT_EXPORT( x )  __attribute__(( visibility( "default" ) ))  x
-#elif defined( __SUNPRO_C ) && __SUNPRO_C >= 0x550
-#define FT_EXPORT( x )  __global  x
-#elif defined( __cplusplus )
-#define FT_EXPORT( x )  extern "C"  x
-#else
-#define FT_EXPORT( x )  extern  x
-#endif
-
-#else
-
-#if defined( _WIN32 ) && defined( DLL_IMPORT )
-#define FT_EXPORT( x )  __declspec( dllimport )  x
-#elif defined( __cplusplus )
-#define FT_EXPORT( x )  extern "C"  x
-#else
-#define FT_EXPORT( x )  extern  x
-#endif
-
-#endif
-
-#endif /* !FT_EXPORT */
-
-
-#ifndef FT_EXPORT_DEF
-
-#ifdef __cplusplus
-#define FT_EXPORT_DEF( x )  extern "C"  x
-#else
-#define FT_EXPORT_DEF( x )  extern  x
-#endif
-
-#endif /* !FT_EXPORT_DEF */
-
-
-#ifndef FT_EXPORT_VAR
-
-#ifdef __cplusplus
-#define FT_EXPORT_VAR( x )  extern "C"  x
-#else
-#define FT_EXPORT_VAR( x )  extern  x
-#endif
-
-#endif /* !FT_EXPORT_VAR */
-
-
-  /* The following macros are needed to compile the library with a   */
-  /* C++ compiler and with 16bit compilers.                          */
-  /*                                                                 */
-
-  /* This is special.  Within C++, you must specify `extern "C"` for */
-  /* functions which are used via function pointers, and you also    */
-  /* must do that for structures which contain function pointers to  */
-  /* assure C linkage -- it's not possible to have (local) anonymous */
-  /* functions which are accessed by (global) function pointers.     */
-  /*                                                                 */
-  /*                                                                 */
-  /* FT_CALLBACK_DEF is used to _define_ a callback function,        */
-  /* located in the same source code file as the structure that uses */
-  /* it.                                                             */
-  /*                                                                 */
-  /* FT_BASE_CALLBACK and FT_BASE_CALLBACK_DEF are used to declare   */
-  /* and define a callback function, respectively, in a similar way  */
-  /* as FT_BASE and FT_BASE_DEF work.                                */
-  /*                                                                 */
-  /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */
-  /* contains pointers to callback functions.                        */
-  /*                                                                 */
-  /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable   */
-  /* that contains pointers to callback functions.                   */
-  /*                                                                 */
-  /*                                                                 */
-  /* Some 16bit compilers have to redefine these macros to insert    */
-  /* the infamous `_cdecl` or `__fastcall` declarations.             */
-  /*                                                                 */
-#ifndef FT_CALLBACK_DEF
-#ifdef __cplusplus
-#define FT_CALLBACK_DEF( x )  extern "C"  x
-#else
-#define FT_CALLBACK_DEF( x )  static  x
-#endif
-#endif /* FT_CALLBACK_DEF */
-
-#ifndef FT_BASE_CALLBACK
-#ifdef __cplusplus
-#define FT_BASE_CALLBACK( x )      extern "C"  x
-#define FT_BASE_CALLBACK_DEF( x )  extern "C"  x
-#else
-#define FT_BASE_CALLBACK( x )      extern  x
-#define FT_BASE_CALLBACK_DEF( x )  x
-#endif
-#endif /* FT_BASE_CALLBACK */
-
-#ifndef FT_CALLBACK_TABLE
-#ifdef __cplusplus
-#define FT_CALLBACK_TABLE      extern "C"
-#define FT_CALLBACK_TABLE_DEF  extern "C"
-#else
-#define FT_CALLBACK_TABLE      extern
-#define FT_CALLBACK_TABLE_DEF  /* nothing */
-#endif
-#endif /* FT_CALLBACK_TABLE */
-
-
-FT_END_HEADER
-
+#include <freetype/config/integer-types.h>
+#include <freetype/config/public-macros.h>
+#include <freetype/config/mac-support.h>
 
 #endif /* FTCONFIG_H_ */
 
diff --git a/include/freetype/config/ftheader.h b/include/freetype/config/ftheader.h
index 696d6ba..28b5cc6 100644
--- a/include/freetype/config/ftheader.h
+++ b/include/freetype/config/ftheader.h
@@ -4,7 +4,7 @@
  *
  *   Build macros of the FreeType 2 library.
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -30,10 +30,12 @@
   /*    encapsulated in an `extern "C" { .. }` block when included from a  */
   /*    C++ compiler.                                                      */
   /*                                                                       */
-#ifdef __cplusplus
-#define FT_BEGIN_HEADER  extern "C" {
-#else
-#define FT_BEGIN_HEADER  /* nothing */
+#ifndef FT_BEGIN_HEADER
+#  ifdef __cplusplus
+#    define FT_BEGIN_HEADER  extern "C" {
+#  else
+#  define FT_BEGIN_HEADER  /* nothing */
+#  endif
 #endif
 
 
@@ -48,10 +50,12 @@
   /*    encapsulated in an `extern "C" { .. }` block when included from a  */
   /*    C++ compiler.                                                      */
   /*                                                                       */
-#ifdef __cplusplus
-#define FT_END_HEADER  }
-#else
-#define FT_END_HEADER  /* nothing */
+#ifndef FT_END_HEADER
+#  ifdef __cplusplus
+#    define FT_END_HEADER  }
+#  else
+#   define FT_END_HEADER  /* nothing */
+#  endif
 #endif
 
 
@@ -73,9 +77,16 @@
    *   Macro definitions used to `#include` specific header files.
    *
    * @description:
-   *   The following macros are defined to the name of specific FreeType~2
-   *   header files.  They can be used directly in `#include` statements as
-   *   in:
+   *   In addition to the normal scheme of including header files like
+   *
+   *   ```
+   *     #include <freetype/freetype.h>
+   *     #include <freetype/ftmm.h>
+   *     #include <freetype/ftglyph.h>
+   *   ```
+   *
+   *   it is possible to used named macros instead.  They can be used
+   *   directly in `#include` statements as in
    *
    *   ```
    *     #include FT_FREETYPE_H
@@ -83,13 +94,9 @@
    *     #include FT_GLYPH_H
    *   ```
    *
-   *   There are several reasons why we are now using macros to name public
-   *   header files.  The first one is that such macros are not limited to
-   *   the infamous 8.3~naming rule required by DOS (and
-   *   `FT_MULTIPLE_MASTERS_H` is a lot more meaningful than `ftmm.h`).
-   *
-   *   The second reason is that it allows for more flexibility in the way
-   *   FreeType~2 is installed on a given system.
+   *   These macros were introduced to overcome the infamous 8.3~naming rule
+   *   required by DOS (and `FT_MULTIPLE_MASTERS_H` is a lot more meaningful
+   *   than `ftmm.h`).
    *
    */
 
@@ -797,16 +804,19 @@
 #define FT_CACHE_INTERNAL_IMAGE_H    FT_CACHE_H
 #define FT_CACHE_INTERNAL_SBITS_H    FT_CACHE_H
 
-
-  /*
-   * Include internal headers definitions from `<internal/...>` only when
-   * building the library.
-   */
+/* TODO(david): Move this section below to a different header */
 #ifdef FT2_BUILD_LIBRARY
-#define  FT_INTERNAL_INTERNAL_H  <freetype/internal/internal.h>
-#include FT_INTERNAL_INTERNAL_H
-#endif /* FT2_BUILD_LIBRARY */
+#if defined( _MSC_VER )      /* Visual C++ (and Intel C++) */
 
+  /* We disable the warning `conditional expression is constant' here */
+  /* in order to compile cleanly with the maximum level of warnings.  */
+  /* In particular, the warning complains about stuff like `while(0)' */
+  /* which is very useful in macro definitions.  There is no benefit  */
+  /* in having it enabled.                                            */
+#pragma warning( disable : 4127 )
+
+#endif /* _MSC_VER */
+#endif /* FT2_BUILD_LIBRARY */
 
 #endif /* FTHEADER_H_ */
 
diff --git a/include/freetype/config/ftmodule.h b/include/freetype/config/ftmodule.h
index 5ac08c1..d604afb 100644
--- a/include/freetype/config/ftmodule.h
+++ b/include/freetype/config/ftmodule.h
@@ -25,8 +25,6 @@
 FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )
 FT_USE_MODULE( FT_Module_Class, sfnt_module_class )
 FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
-FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )
-FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class )
 //FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )
 
 /* EOF */
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index 8abd741..3c7b71b 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -4,7 +4,7 @@
  *
  *   User-selectable configuration macros (specification only).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -42,7 +42,7 @@
    *   the name of a directory that is included _before_ the FreeType include
    *   path during compilation.
    *
-   *   The default FreeType Makefiles and Jamfiles use the build directory
+   *   The default FreeType Makefiles use the build directory
    *   `builds/<system>` by default, but you can easily change that for your
    *   own projects.
    *
@@ -122,10 +122,8 @@
    * mitigate color fringes inherent to this technology, you also need to
    * explicitly set up LCD filtering.
    *
-   * Note that this feature is covered by several Microsoft patents and
-   * should not be activated in any default build of the library.  When this
-   * macro is not defined, FreeType offers alternative LCD rendering
-   * technology that produces excellent output without LCD filtering.
+   * When this macro is not defined, FreeType offers alternative LCD
+   * rendering technology that produces excellent output.
    */
 /* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
 
@@ -296,6 +294,22 @@
 
   /**************************************************************************
    *
+   * Brotli support.
+   *
+   *   FreeType uses the Brotli library to provide support for decompressing
+   *   WOFF2 streams.
+   *
+   *   Define this macro if you want to enable this 'feature'.
+   *
+   *   If you use a build system like cmake or the `configure` script,
+   *   options set by those programs have precedence, overwriting the value
+   *   here with the configured one.
+   */
+/* #define FT_CONFIG_OPTION_USE_BROTLI */
+
+
+  /**************************************************************************
+   *
    * Glyph Postscript Names handling
    *
    *   By default, FreeType 2 is compiled with the 'psnames' module.  This
@@ -529,7 +543,7 @@
 
   /**************************************************************************
    *
-   * Define `TT_CONFIG_OPTION_COLOR_LAYERS` if you want to support coloured
+   * Define `TT_CONFIG_OPTION_COLOR_LAYERS` if you want to support colored
    * outlines (from the 'COLR'/'CPAL' tables) in all formats using the 'sfnt'
    * module (namely TrueType~& OpenType).
    */
@@ -877,9 +891,11 @@
    *
    * Compile 'autofit' module with fallback Indic script support, covering
    * some scripts that the 'latin' submodule of the 'autofit' module doesn't
-   * (yet) handle.
+   * (yet) handle.  Currently, this needs option `AF_CONFIG_OPTION_CJK`.
    */
+#ifdef AF_CONFIG_OPTION_CJK
 #define AF_CONFIG_OPTION_INDIC
+#endif
 
 
   /**************************************************************************
diff --git a/include/freetype/config/ftstdlib.h b/include/freetype/config/ftstdlib.h
index 438b614..d6091f8 100644
--- a/include/freetype/config/ftstdlib.h
+++ b/include/freetype/config/ftstdlib.h
@@ -5,7 +5,7 @@
  *   ANSI-specific library and header configuration file (specification
  *   only).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/include/freetype/config/integer-types.h b/include/freetype/config/integer-types.h
new file mode 100644
index 0000000..a0ca0c9
--- /dev/null
+++ b/include/freetype/config/integer-types.h
@@ -0,0 +1,245 @@
+/****************************************************************************
+ *
+ * config/integer-types.h
+ *
+ *   FreeType integer types definitions.
+ *
+ * Copyright (C) 1996-2020 by
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+ * 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 FREETYPE_CONFIG_INTEGER_TYPES_H_
+#define FREETYPE_CONFIG_INTEGER_TYPES_H_
+
+  /* There are systems (like the Texas Instruments 'C54x) where a `char`  */
+  /* has 16~bits.  ANSI~C says that `sizeof(char)` is always~1.  Since an */
+  /* `int` has 16~bits also for this system, `sizeof(int)` gives~1 which  */
+  /* is probably unexpected.                                              */
+  /*                                                                      */
+  /* `CHAR_BIT` (defined in `limits.h`) gives the number of bits in a     */
+  /* `char` type.                                                         */
+
+#ifndef FT_CHAR_BIT
+#define FT_CHAR_BIT  CHAR_BIT
+#endif
+
+#ifndef FT_SIZEOF_INT
+
+  /* The size of an `int` type. */
+#if                                 FT_UINT_MAX == 0xFFFFUL
+#define FT_SIZEOF_INT  ( 16 / FT_CHAR_BIT )
+#elif                               FT_UINT_MAX == 0xFFFFFFFFUL
+#define FT_SIZEOF_INT  ( 32 / FT_CHAR_BIT )
+#elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL
+#define FT_SIZEOF_INT  ( 64 / FT_CHAR_BIT )
+#else
+#error "Unsupported size of `int' type!"
+#endif
+
+#endif  /* !defined(FT_SIZEOF_INT) */
+
+#ifndef FT_SIZEOF_LONG
+
+  /* The size of a `long` type.  A five-byte `long` (as used e.g. on the */
+  /* DM642) is recognized but avoided.                                   */
+#if                                  FT_ULONG_MAX == 0xFFFFFFFFUL
+#define FT_SIZEOF_LONG  ( 32 / FT_CHAR_BIT )
+#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL
+#define FT_SIZEOF_LONG  ( 32 / FT_CHAR_BIT )
+#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL
+#define FT_SIZEOF_LONG  ( 64 / FT_CHAR_BIT )
+#else
+#error "Unsupported size of `long' type!"
+#endif
+
+#endif /* !defined(FT_SIZEOF_LONG) */
+
+  /**************************************************************************
+   *
+   * @section:
+   *   basic_types
+   *
+   */
+
+
+  /**************************************************************************
+   *
+   * @type:
+   *   FT_Int16
+   *
+   * @description:
+   *   A typedef for a 16bit signed integer type.
+   */
+  typedef signed short  FT_Int16;
+
+
+  /**************************************************************************
+   *
+   * @type:
+   *   FT_UInt16
+   *
+   * @description:
+   *   A typedef for a 16bit unsigned integer type.
+   */
+  typedef unsigned short  FT_UInt16;
+
+  /* */
+
+
+  /* this #if 0 ... #endif clause is for documentation purposes */
+#if 0
+
+  /**************************************************************************
+   *
+   * @type:
+   *   FT_Int32
+   *
+   * @description:
+   *   A typedef for a 32bit signed integer type.  The size depends on the
+   *   configuration.
+   */
+  typedef signed XXX  FT_Int32;
+
+
+  /**************************************************************************
+   *
+   * @type:
+   *   FT_UInt32
+   *
+   *   A typedef for a 32bit unsigned integer type.  The size depends on the
+   *   configuration.
+   */
+  typedef unsigned XXX  FT_UInt32;
+
+
+  /**************************************************************************
+   *
+   * @type:
+   *   FT_Int64
+   *
+   *   A typedef for a 64bit signed integer type.  The size depends on the
+   *   configuration.  Only defined if there is real 64bit support;
+   *   otherwise, it gets emulated with a structure (if necessary).
+   */
+  typedef signed XXX  FT_Int64;
+
+
+  /**************************************************************************
+   *
+   * @type:
+   *   FT_UInt64
+   *
+   *   A typedef for a 64bit unsigned integer type.  The size depends on the
+   *   configuration.  Only defined if there is real 64bit support;
+   *   otherwise, it gets emulated with a structure (if necessary).
+   */
+  typedef unsigned XXX  FT_UInt64;
+
+  /* */
+
+#endif
+
+#if FT_SIZEOF_INT == ( 32 / FT_CHAR_BIT )
+
+  typedef signed int      FT_Int32;
+  typedef unsigned int    FT_UInt32;
+
+#elif FT_SIZEOF_LONG == ( 32 / FT_CHAR_BIT )
+
+  typedef signed long     FT_Int32;
+  typedef unsigned long   FT_UInt32;
+
+#else
+#error "no 32bit type found -- please check your configuration files"
+#endif
+
+
+  /* look up an integer type that is at least 32~bits */
+#if FT_SIZEOF_INT >= ( 32 / FT_CHAR_BIT )
+
+  typedef int            FT_Fast;
+  typedef unsigned int   FT_UFast;
+
+#elif FT_SIZEOF_LONG >= ( 32 / FT_CHAR_BIT )
+
+  typedef long           FT_Fast;
+  typedef unsigned long  FT_UFast;
+
+#endif
+
+
+  /* determine whether we have a 64-bit `int` type for platforms without */
+  /* Autoconf                                                            */
+#if FT_SIZEOF_LONG == ( 64 / FT_CHAR_BIT )
+
+  /* `FT_LONG64` must be defined if a 64-bit type is available */
+#define FT_LONG64
+#define FT_INT64   long
+#define FT_UINT64  unsigned long
+
+  /**************************************************************************
+   *
+   * A 64-bit data type may create compilation problems if you compile in
+   * strict ANSI mode.  To avoid them, we disable other 64-bit data types if
+   * `__STDC__` is defined.  You can however ignore this rule by defining the
+   * `FT_CONFIG_OPTION_FORCE_INT64` configuration macro.
+   */
+#elif !defined( __STDC__ ) || defined( FT_CONFIG_OPTION_FORCE_INT64 )
+
+#if defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 199901L
+
+#define FT_LONG64
+#define FT_INT64   long long int
+#define FT_UINT64  unsigned long long int
+
+#elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */
+
+  /* this compiler provides the `__int64` type */
+#define FT_LONG64
+#define FT_INT64   __int64
+#define FT_UINT64  unsigned __int64
+
+#elif defined( __BORLANDC__ )  /* Borland C++ */
+
+  /* XXXX: We should probably check the value of `__BORLANDC__` in order */
+  /*       to test the compiler version.                                 */
+
+  /* this compiler provides the `__int64` type */
+#define FT_LONG64
+#define FT_INT64   __int64
+#define FT_UINT64  unsigned __int64
+
+#elif defined( __WATCOMC__ )   /* Watcom C++ */
+
+  /* Watcom doesn't provide 64-bit data types */
+
+#elif defined( __MWERKS__ )    /* Metrowerks CodeWarrior */
+
+#define FT_LONG64
+#define FT_INT64   long long int
+#define FT_UINT64  unsigned long long int
+
+#elif defined( __GNUC__ )
+
+  /* GCC provides the `long long` type */
+#define FT_LONG64
+#define FT_INT64   long long int
+#define FT_UINT64  unsigned long long int
+
+#endif /* __STDC_VERSION__ >= 199901L */
+
+#endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */
+
+#ifdef FT_LONG64
+  typedef FT_INT64   FT_Int64;
+  typedef FT_UINT64  FT_UInt64;
+#endif
+
+
+#endif  /* FREETYPE_CONFIG_INTEGER_TYPES_H_ */
diff --git a/include/freetype/config/mac-support.h b/include/freetype/config/mac-support.h
new file mode 100644
index 0000000..9486708
--- /dev/null
+++ b/include/freetype/config/mac-support.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+ *
+ * config/mac-support.h
+ *
+ *   Mac/OS X support configuration header.
+ *
+ * Copyright (C) 1996-2020 by
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+ * 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 FREETYPE_CONFIG_MAC_SUPPORT_H_
+#define FREETYPE_CONFIG_MAC_SUPPORT_H_
+
+  /**************************************************************************
+   *
+   * Mac support
+   *
+   *   This is the only necessary change, so it is defined here instead
+   *   providing a new configuration file.
+   */
+#if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) )
+  /* No Carbon frameworks for 64bit 10.4.x.                         */
+  /* `AvailabilityMacros.h` is available since Mac OS X 10.2,       */
+  /* so guess the system version by maximum errno before inclusion. */
+#include <errno.h>
+#ifdef ECANCELED /* defined since 10.2 */
+#include "AvailabilityMacros.h"
+#endif
+#if defined( __LP64__ ) && \
+    ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 )
+#undef FT_MACINTOSH
+#endif
+
+#elif defined( __SC__ ) || defined( __MRC__ )
+  /* Classic MacOS compilers */
+#include "ConditionalMacros.h"
+#if TARGET_OS_MAC
+#define FT_MACINTOSH 1
+#endif
+
+#endif  /* Mac support */
+
+#endif  /* FREETYPE_CONFIG_MAC_SUPPORT_H_ */
diff --git a/include/freetype/config/public-macros.h b/include/freetype/config/public-macros.h
new file mode 100644
index 0000000..6aa673e
--- /dev/null
+++ b/include/freetype/config/public-macros.h
@@ -0,0 +1,120 @@
+/****************************************************************************
+ *
+ * config/public-macros.h
+ *
+ *   Define a set of compiler macros used in public FreeType headers.
+ *
+ * Copyright (C) 2020 by
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+ * modified, and distributed under the terms of the FreeType project
+ * license, LICENSE.TXT.  By continuing to use, modify, or distribute
+ * this file you indicate that you have read the license and
+ * understand and accept it fully.
+ *
+ */
+
+  /*
+   * The definitions in this file are used by the public FreeType headers
+   * and thus should be considered part of the public API.
+   *
+   * Other compiler-specific macro definitions that are not exposed by the
+   * FreeType API should go into
+   * `include/freetype/internal/compiler-macros.h` instead.
+   */
+#ifndef FREETYPE_CONFIG_PUBLIC_MACROS_H_
+#define FREETYPE_CONFIG_PUBLIC_MACROS_H_
+
+  /*
+   * `FT_BEGIN_HEADER` and `FT_END_HEADER` might have already been defined
+   * by `freetype/config/ftheader.h`, but we don't want to include this
+   * header here, so redefine the macros here only when needed.  Their
+   * definition is very stable, so keeping them in sync with the ones in the
+   * header should not be a maintenance issue.
+   */
+#ifndef FT_BEGIN_HEADER
+#ifdef __cplusplus
+#define FT_BEGIN_HEADER  extern "C" {
+#else
+#define FT_BEGIN_HEADER  /* empty */
+#endif
+#endif  /* FT_BEGIN_HEADER */
+
+#ifndef FT_END_HEADER
+#ifdef __cplusplus
+#define FT_END_HEADER  }
+#else
+#define FT_END_HEADER  /* empty */
+#endif
+#endif  /* FT_END_HEADER */
+
+
+FT_BEGIN_HEADER
+
+  /*
+   * Mark a function declaration as public.  This ensures it will be
+   * properly exported to client code.  Place this before a function
+   * declaration.
+   *
+   * NOTE: This macro should be considered an internal implementation
+   * detail, and not part of the FreeType API.  It is only defined here
+   * because it is needed by `FT_EXPORT`.
+   */
+
+  /* Visual C, mingw */
+#if defined( _WIN32 )
+
+#if defined( FT2_BUILD_LIBRARY ) && defined( DLL_EXPORT )
+#define FT_PUBLIC_FUNCTION_ATTRIBUTE  __declspec( dllexport )
+#elif defined( DLL_IMPORT )
+#define FT_PUBLIC_FUNCTION_ATTRIBUTE  __declspec( dllimport )
+#endif
+
+  /* gcc, clang */
+#elif ( defined( __GNUC__ ) && __GNUC__ >= 4 ) || defined( __clang__ )
+#define FT_PUBLIC_FUNCTION_ATTRIBUTE \
+          __attribute__(( visibility( "default" ) ))
+
+  /* Sun */
+#elif defined( __SUNPRO_C ) && __SUNPRO_C >= 0x550
+#define FT_PUBLIC_FUNCTION_ATTRIBUTE  __global
+#endif
+
+
+#ifndef FT_PUBLIC_FUNCTION_ATTRIBUTE
+#define FT_PUBLIC_FUNCTION_ATTRIBUTE  /* empty */
+#endif
+
+
+  /*
+   * Define a public FreeType API function.  This ensures it is properly
+   * exported or imported at build time.  The macro parameter is the
+   * function's return type as in:
+   *
+   *   FT_EXPORT( FT_Bool )
+   *   FT_Object_Method( FT_Object  obj,
+   *                     ... );
+   *
+   * NOTE: This requires that all `FT_EXPORT` uses are inside
+   * `FT_BEGIN_HEADER ... FT_END_HEADER` blocks.  This guarantees that the
+   * functions are exported with C linkage, even when the header is included
+   * by a C++ source file.
+   */
+#define FT_EXPORT( x )  FT_PUBLIC_FUNCTION_ATTRIBUTE extern x
+
+  /*
+   * `FT_UNUSED` indicates that a given parameter is not used -- this is
+   * only used to get rid of unpleasant compiler warnings.
+   *
+   * Technically, this was not meant to be part of the public API, but some
+   * third-party code depends on it.
+   */
+#ifndef FT_UNUSED
+#define FT_UNUSED( arg )  ( (arg) = (arg) )
+#endif
+
+
+FT_END_HEADER
+
+#endif  /* FREETYPE_CONFIG_PUBLIC_MACROS_H_ */
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index a6bb667..be191f5 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -4,7 +4,7 @@
  *
  *   FreeType high-level API and common types (specification only).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,19 +20,10 @@
 #define FREETYPE_H_
 
 
-#ifndef FT_FREETYPE_H
-#error "`ft2build.h' hasn't been included yet!"
-#error "Please always use macros to include FreeType header files."
-#error "Example:"
-#error "  #include <ft2build.h>"
-#error "  #include FT_FREETYPE_H"
-#endif
-
-
 #include <ft2build.h>
 #include FT_CONFIG_CONFIG_H
-#include FT_TYPES_H
-#include FT_ERRORS_H
+#include <freetype/fttypes.h>
+#include <freetype/fterrors.h>
 
 
 FT_BEGIN_HEADER
@@ -51,22 +42,15 @@
    *   How client applications should include FreeType header files.
    *
    * @description:
-   *   To be as flexible as possible (and for historical reasons), FreeType
-   *   uses a very special inclusion scheme to load header files, for example
+   *   To be as flexible as possible (and for historical reasons), you must
+   *   load file `ft2build.h` first before other header files, for example
    *
    *   ```
    *     #include <ft2build.h>
    *
-   *     #include FT_FREETYPE_H
-   *     #include FT_OUTLINE_H
+   *     #include <freetype/freetype.h>
+   *     #include <freetype/ftoutln.h>
    *   ```
-   *
-   *   A compiler and its preprocessor only needs an include path to find the
-   *   file `ft2build.h`; the exact locations and names of the other FreeType
-   *   header files are hidden by @header_file_macros, loaded by
-   *   `ft2build.h`.  The API documentation always gives the header macro
-   *   name needed for a particular function.
-   *
    */
 
 
@@ -974,6 +958,9 @@
    *     Note that the bounding box might be off by (at least) one pixel for
    *     hinted fonts.  See @FT_Size_Metrics for further discussion.
    *
+   *     Note that the bounding box does not vary in OpenType variable fonts
+   *     and should only be used in relation to the default instance.
+   *
    *   units_per_EM ::
    *     The number of font units per EM square for this face.  This is
    *     typically 2048 for TrueType fonts, and 1000 for Type~1 fonts.  Only
@@ -1239,7 +1226,7 @@
    *
    */
 #define FT_HAS_HORIZONTAL( face ) \
-          ( (face)->face_flags & FT_FACE_FLAG_HORIZONTAL )
+          ( !!( (face)->face_flags & FT_FACE_FLAG_HORIZONTAL ) )
 
 
   /**************************************************************************
@@ -1253,7 +1240,7 @@
    *
    */
 #define FT_HAS_VERTICAL( face ) \
-          ( (face)->face_flags & FT_FACE_FLAG_VERTICAL )
+          ( !!( (face)->face_flags & FT_FACE_FLAG_VERTICAL ) )
 
 
   /**************************************************************************
@@ -1267,7 +1254,7 @@
    *
    */
 #define FT_HAS_KERNING( face ) \
-          ( (face)->face_flags & FT_FACE_FLAG_KERNING )
+          ( !!( (face)->face_flags & FT_FACE_FLAG_KERNING ) )
 
 
   /**************************************************************************
@@ -1282,7 +1269,7 @@
    *
    */
 #define FT_IS_SCALABLE( face ) \
-          ( (face)->face_flags & FT_FACE_FLAG_SCALABLE )
+          ( !!( (face)->face_flags & FT_FACE_FLAG_SCALABLE ) )
 
 
   /**************************************************************************
@@ -1301,7 +1288,7 @@
    *
    */
 #define FT_IS_SFNT( face ) \
-          ( (face)->face_flags & FT_FACE_FLAG_SFNT )
+          ( !!( (face)->face_flags & FT_FACE_FLAG_SFNT ) )
 
 
   /**************************************************************************
@@ -1316,7 +1303,7 @@
    *
    */
 #define FT_IS_FIXED_WIDTH( face ) \
-          ( (face)->face_flags & FT_FACE_FLAG_FIXED_WIDTH )
+          ( !!( (face)->face_flags & FT_FACE_FLAG_FIXED_WIDTH ) )
 
 
   /**************************************************************************
@@ -1331,7 +1318,7 @@
    *
    */
 #define FT_HAS_FIXED_SIZES( face ) \
-          ( (face)->face_flags & FT_FACE_FLAG_FIXED_SIZES )
+          ( !!( (face)->face_flags & FT_FACE_FLAG_FIXED_SIZES ) )
 
 
   /**************************************************************************
@@ -1357,7 +1344,7 @@
    *
    */
 #define FT_HAS_GLYPH_NAMES( face ) \
-          ( (face)->face_flags & FT_FACE_FLAG_GLYPH_NAMES )
+          ( !!( (face)->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) )
 
 
   /**************************************************************************
@@ -1372,7 +1359,7 @@
    *
    */
 #define FT_HAS_MULTIPLE_MASTERS( face ) \
-          ( (face)->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )
+          ( !!( (face)->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS ) )
 
 
   /**************************************************************************
@@ -1394,7 +1381,7 @@
    *
    */
 #define FT_IS_NAMED_INSTANCE( face ) \
-          ( (face)->face_index & 0x7FFF0000L )
+          ( !!( (face)->face_index & 0x7FFF0000L ) )
 
 
   /**************************************************************************
@@ -1412,7 +1399,7 @@
    *
    */
 #define FT_IS_VARIATION( face ) \
-          ( (face)->face_flags & FT_FACE_FLAG_VARIATION )
+          ( !!( (face)->face_flags & FT_FACE_FLAG_VARIATION ) )
 
 
   /**************************************************************************
@@ -1429,7 +1416,7 @@
    *
    */
 #define FT_IS_CID_KEYED( face ) \
-          ( (face)->face_flags & FT_FACE_FLAG_CID_KEYED )
+          ( !!( (face)->face_flags & FT_FACE_FLAG_CID_KEYED ) )
 
 
   /**************************************************************************
@@ -1443,7 +1430,7 @@
    *
    */
 #define FT_IS_TRICKY( face ) \
-          ( (face)->face_flags & FT_FACE_FLAG_TRICKY )
+          ( !!( (face)->face_flags & FT_FACE_FLAG_TRICKY ) )
 
 
   /**************************************************************************
@@ -1460,7 +1447,7 @@
    *
    */
 #define FT_HAS_COLOR( face ) \
-          ( (face)->face_flags & FT_FACE_FLAG_COLOR )
+          ( !!( (face)->face_flags & FT_FACE_FLAG_COLOR ) )
 
 
   /**************************************************************************
@@ -2078,7 +2065,8 @@
    *     The size in bytes of the file in memory.
    *
    *   pathname ::
-   *     A pointer to an 8-bit file pathname.
+   *     A pointer to an 8-bit file pathname.  The pointer is not owned by
+   *     FreeType.
    *
    *   stream ::
    *     A handle to a source stream object.
@@ -3187,6 +3175,12 @@
    *     A pointer to the translation vector.  Use `NULL` for the null vector.
    *
    * @note:
+   *   This function is provided as a convenience, but keep in mind that
+   *   @FT_Matrix coefficients are only 16.16 fixed point values, which can
+   *   limit the accuracy of the results.  Using floating-point computations
+   *   to perform the transform directly in client code instead will always
+   *   yield better numbers.
+   *
    *   The transformation is only applied to scalable image formats after the
    *   glyph has been loaded.  It means that hinting is unaltered by the
    *   transformation and is performed on the character size given in the
@@ -3245,14 +3239,6 @@
    *     pixels and use the @FT_PIXEL_MODE_LCD_V mode.
    *
    * @note:
-   *   Should you define `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` in your
-   *   `ftoption.h`, which enables patented ClearType-style rendering, the
-   *   LCD-optimized glyph bitmaps should be filtered to reduce color fringes
-   *   inherent to this technology.  You can either set up LCD filtering with
-   *   @FT_Library_SetLcdFilter or @FT_Face_Properties, or do the filtering
-   *   yourself.  The default FreeType LCD rendering technology does not
-   *   require filtering.
-   *
    *   The selected render mode only affects vector glyphs of a font.
    *   Embedded bitmaps often have a different pixel mode like
    *   @FT_PIXEL_MODE_MONO.  You can use @FT_Bitmap_Convert to transform them
@@ -4088,7 +4074,7 @@
    *     https://docs.microsoft.com/en-us/typography/opentype/spec/colr
    *
    *   The glyph layer data for a given glyph index, if present, provides an
-   *   alternative, multi-colour glyph representation: Instead of rendering
+   *   alternative, multi-color glyph representation: Instead of rendering
    *   the outline or bitmap with the given glyph index, glyphs with the
    *   indices and colors returned by this function are rendered layer by
    *   layer.
@@ -4781,7 +4767,7 @@
    */
 #define FREETYPE_MAJOR  2
 #define FREETYPE_MINOR  10
-#define FREETYPE_PATCH  1
+#define FREETYPE_PATCH  4
 
 
   /**************************************************************************
diff --git a/include/freetype/ftadvanc.h b/include/freetype/ftadvanc.h
index 95c38f9..f166bc6 100644
--- a/include/freetype/ftadvanc.h
+++ b/include/freetype/ftadvanc.h
@@ -4,7 +4,7 @@
  *
  *   Quick computation of advance widths (specification only).
  *
- * Copyright (C) 2008-2019 by
+ * Copyright (C) 2008-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
 #define FTADVANC_H_
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
@@ -96,6 +95,7 @@
    *   load_flags ::
    *     A set of bit flags similar to those used when calling
    *     @FT_Load_Glyph, used to determine what kind of advances you need.
+   *
    * @output:
    *   padvance ::
    *     The advance value.  If scaling is performed (based on the value of
diff --git a/include/freetype/ftbbox.h b/include/freetype/ftbbox.h
index 22da70c..fda1ad9 100644
--- a/include/freetype/ftbbox.h
+++ b/include/freetype/ftbbox.h
@@ -4,7 +4,7 @@
  *
  *   FreeType exact bbox computation (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -31,8 +31,7 @@
 #define FTBBOX_H_
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
diff --git a/include/freetype/ftbdf.h b/include/freetype/ftbdf.h
index 1c46da5..2e1daee 100644
--- a/include/freetype/ftbdf.h
+++ b/include/freetype/ftbdf.h
@@ -4,7 +4,7 @@
  *
  *   FreeType API for accessing BDF-specific strings (specification).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,8 +19,7 @@
 #ifndef FTBDF_H_
 #define FTBDF_H_
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
diff --git a/include/freetype/ftbitmap.h b/include/freetype/ftbitmap.h
index a6acdb9..282c22e 100644
--- a/include/freetype/ftbitmap.h
+++ b/include/freetype/ftbitmap.h
@@ -4,7 +4,7 @@
  *
  *   FreeType utility functions for bitmaps (specification).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,9 +20,8 @@
 #define FTBITMAP_H_
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_COLOR_H
+#include <freetype/freetype.h>
+#include <freetype/ftcolor.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
diff --git a/include/freetype/ftbzip2.h b/include/freetype/ftbzip2.h
index ae88cfd..eb6a5a5 100644
--- a/include/freetype/ftbzip2.h
+++ b/include/freetype/ftbzip2.h
@@ -4,7 +4,7 @@
  *
  *   Bzip2-compressed stream support.
  *
- * Copyright (C) 2010-2019 by
+ * Copyright (C) 2010-2020 by
  * Joel Klinghed.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,8 +19,7 @@
 #ifndef FTBZIP2_H_
 #define FTBZIP2_H_
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
@@ -43,6 +42,16 @@
    *   Using bzip2-compressed font files.
    *
    * @description:
+   *   In certain builds of the library, bzip2 compression recognition is
+   *   automatically handled when calling @FT_New_Face or @FT_Open_Face.
+   *   This means that if no font driver is capable of handling the raw
+   *   compressed file, the library will try to open a bzip2 compressed
+   *   stream from it and re-open the face with it.
+   *
+   *   The stream implementation is very basic and resets the decompression
+   *   process each time seeking backwards is needed within the stream,
+   *   which significantly undermines the performance.
+   *
    *   This section contains the declaration of Bzip2-specific functions.
    *
    */
@@ -75,15 +84,6 @@
    *   **not** call `FT_Stream_Close` on the source stream.  None of the
    *   stream objects will be released to the heap.
    *
-   *   The stream implementation is very basic and resets the decompression
-   *   process each time seeking backwards is needed within the stream.
-   *
-   *   In certain builds of the library, bzip2 compression recognition is
-   *   automatically handled when calling @FT_New_Face or @FT_Open_Face.
-   *   This means that if no font driver is capable of handling the raw
-   *   compressed file, the library will try to open a bzip2 compressed
-   *   stream from it and re-open the face with it.
-   *
    *   This function may return `FT_Err_Unimplemented_Feature` if your build
    *   of FreeType was not compiled with bzip2 support.
    */
diff --git a/include/freetype/ftcache.h b/include/freetype/ftcache.h
index 0d589d0..6047275 100644
--- a/include/freetype/ftcache.h
+++ b/include/freetype/ftcache.h
@@ -4,7 +4,7 @@
  *
  *   FreeType Cache subsystem (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
 #define FTCACHE_H_
 
 
-#include <ft2build.h>
-#include FT_GLYPH_H
+#include <freetype/ftglyph.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/ftcid.h b/include/freetype/ftcid.h
index 8eafc1c..a29fb33 100644
--- a/include/freetype/ftcid.h
+++ b/include/freetype/ftcid.h
@@ -4,7 +4,7 @@
  *
  *   FreeType API for accessing CID font information (specification).
  *
- * Copyright (C) 2007-2019 by
+ * Copyright (C) 2007-2020 by
  * Dereg Clegg and Michael Toftdal.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,8 +19,7 @@
 #ifndef FTCID_H_
 #define FTCID_H_
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
diff --git a/include/freetype/ftcolor.h b/include/freetype/ftcolor.h
index cf18021..ecc6485 100644
--- a/include/freetype/ftcolor.h
+++ b/include/freetype/ftcolor.h
@@ -4,7 +4,7 @@
  *
  *   FreeType's glyph color management (specification).
  *
- * Copyright (C) 2018-2019 by
+ * Copyright (C) 2018-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,8 +19,7 @@
 #ifndef FTCOLOR_H_
 #define FTCOLOR_H_
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
@@ -125,9 +124,9 @@
    *     The number of palettes.
    *
    *   palette_name_ids ::
-   *     A read-only array of palette name IDs with `num_palettes` elements,
-   *     corresponding to entries like 'dark' or 'light' in the font's 'name'
-   *     table.
+   *     An optional read-only array of palette name IDs with `num_palettes`
+   *     elements, corresponding to entries like 'dark' or 'light' in the
+   *     font's 'name' table.
    *
    *     An empty name ID in the 'CPAL' table gets represented as value
    *     0xFFFF.
@@ -135,8 +134,8 @@
    *     `NULL` if the font's 'CPAL' table doesn't contain appropriate data.
    *
    *   palette_flags ::
-   *     A read-only array of palette flags with `num_palettes` elements.
-   *     Possible values are an ORed combination of
+   *     An optional read-only array of palette flags with `num_palettes`
+   *     elements.  Possible values are an ORed combination of
    *     @FT_PALETTE_FOR_LIGHT_BACKGROUND and
    *     @FT_PALETTE_FOR_DARK_BACKGROUND.
    *
@@ -147,7 +146,7 @@
    *     same size.
    *
    *   palette_entry_name_ids ::
-   *     A read-only array of palette entry name IDs with
+   *     An optional read-only array of palette entry name IDs with
    *     `num_palette_entries`.  In each palette, entries with the same index
    *     have the same function.  For example, index~0 might correspond to
    *     string 'outline' in the font's 'name' table to indicate that this
@@ -163,6 +162,9 @@
    *   Use function @FT_Get_Sfnt_Name to map name IDs and entry name IDs to
    *   name strings.
    *
+   *   Use function @FT_Palette_Select to get the colors associated with a
+   *   palette entry.
+   *
    * @since:
    *   2.10
    */
diff --git a/include/freetype/ftdriver.h b/include/freetype/ftdriver.h
index 497bde9..804ec34 100644
--- a/include/freetype/ftdriver.h
+++ b/include/freetype/ftdriver.h
@@ -4,7 +4,7 @@
  *
  *   FreeType API for controlling driver modules (specification only).
  *
- * Copyright (C) 2017-2019 by
+ * Copyright (C) 2017-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,9 +19,8 @@
 #ifndef FTDRIVER_H_
 #define FTDRIVER_H_
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_PARAMETER_TAGS_H
+#include <freetype/freetype.h>
+#include <freetype/ftparams.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
@@ -427,10 +426,6 @@
    *   counteracts the 'thinning out' of glyphs, making text remain readable
    *   at smaller sizes.
    *
-   *   By default, the Adobe engines for CFF, Type~1, and CID fonts darken
-   *   stems at smaller sizes, regardless of hinting, to enhance contrast.
-   *   Setting this property, stem darkening gets switched off.
-   *
    *   For the auto-hinter, stem-darkening is experimental currently and thus
    *   switched off by default (this is, `no-stem-darkening` is set to TRUE
    *   by default).  Total consistency with the CFF driver is not achieved
diff --git a/include/freetype/fterrdef.h b/include/freetype/fterrdef.h
index 9bc7dc6..895d2d4 100644
--- a/include/freetype/fterrdef.h
+++ b/include/freetype/fterrdef.h
@@ -4,7 +4,7 @@
  *
  *   FreeType error codes (specification).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/include/freetype/fterrors.h b/include/freetype/fterrors.h
index 2b47eb2..60a637c 100644
--- a/include/freetype/fterrors.h
+++ b/include/freetype/fterrors.h
@@ -4,7 +4,7 @@
  *
  *   FreeType error code handling (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -89,7 +89,7 @@
    *       const char*  err_msg;
    *     } ft_errors[] =
    *
-   *     #include FT_ERRORS_H
+   *     #include <freetype/fterrors.h>
    *   ```
    *
    *   An alternative to using an array is a switch statement.
@@ -124,7 +124,7 @@
 
 
   /* include module base error codes */
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
 
 
   /*******************************************************************/
@@ -197,7 +197,7 @@
 
 
   /* now include the error codes */
-#include FT_ERROR_DEFINITIONS_H
+#include <freetype/fterrdef.h>
 
 
 #ifdef FT_ERROR_END_LIST
@@ -232,11 +232,16 @@
 #undef FT_ERR_PREFIX
 #endif
 
-  /* FT_INCLUDE_ERR_PROTOS:  Control if function prototypes should be       */
-  /*                         included with `#include FT_ERRORS_H'.  This is */
-  /*                         only true where `FT_ERRORDEF` is undefined.    */
-  /* FT_ERR_PROTOS_DEFINED:  Actual multiple-inclusion protection of        */
-  /*                         `fterrors.h`.                                  */
+  /* FT_INCLUDE_ERR_PROTOS: Control whether function prototypes should be */
+  /*                        included with                                 */
+  /*                                                                      */
+  /*                          #include <freetype/fterrors.h>              */
+  /*                                                                      */
+  /*                        This is only true where `FT_ERRORDEF` is      */
+  /*                        undefined.                                    */
+  /*                                                                      */
+  /* FT_ERR_PROTOS_DEFINED: Actual multiple-inclusion protection of       */
+  /*                        `fterrors.h`.                                 */
 #ifdef FT_INCLUDE_ERR_PROTOS
 #undef FT_INCLUDE_ERR_PROTOS
 
diff --git a/include/freetype/ftfntfmt.h b/include/freetype/ftfntfmt.h
index aae0b13..f803349 100644
--- a/include/freetype/ftfntfmt.h
+++ b/include/freetype/ftfntfmt.h
@@ -4,7 +4,7 @@
  *
  *   Support functions for font formats.
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,8 +19,7 @@
 #ifndef FTFNTFMT_H_
 #define FTFNTFMT_H_
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
diff --git a/include/freetype/ftgasp.h b/include/freetype/ftgasp.h
index 24673d8..6b76882 100644
--- a/include/freetype/ftgasp.h
+++ b/include/freetype/ftgasp.h
@@ -4,7 +4,7 @@
  *
  *   Access of TrueType's 'gasp' table (specification).
  *
- * Copyright (C) 2007-2019 by
+ * Copyright (C) 2007-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,8 +19,7 @@
 #ifndef FTGASP_H_
 #define FTGASP_H_
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
diff --git a/include/freetype/ftglyph.h b/include/freetype/ftglyph.h
index fedab84..704619e 100644
--- a/include/freetype/ftglyph.h
+++ b/include/freetype/ftglyph.h
@@ -4,7 +4,7 @@
  *
  *   FreeType convenience functions to handle glyphs (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -33,8 +33,7 @@
 #define FTGLYPH_H_
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
diff --git a/include/freetype/ftgxval.h b/include/freetype/ftgxval.h
index b14f637..354460a 100644
--- a/include/freetype/ftgxval.h
+++ b/include/freetype/ftgxval.h
@@ -4,7 +4,7 @@
  *
  *   FreeType API for validating TrueTypeGX/AAT tables (specification).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * Masatake YAMATO, Redhat K.K,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
@@ -28,8 +28,7 @@
 #ifndef FTGXVAL_H_
 #define FTGXVAL_H_
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
diff --git a/include/freetype/ftgzip.h b/include/freetype/ftgzip.h
index 418c612..ec5939a 100644
--- a/include/freetype/ftgzip.h
+++ b/include/freetype/ftgzip.h
@@ -4,7 +4,7 @@
  *
  *   Gzip-compressed stream support.
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,8 +19,7 @@
 #ifndef FTGZIP_H_
 #define FTGZIP_H_
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
@@ -43,6 +42,16 @@
    *   Using gzip-compressed font files.
    *
    * @description:
+   *   In certain builds of the library, gzip compression recognition is
+   *   automatically handled when calling @FT_New_Face or @FT_Open_Face.
+   *   This means that if no font driver is capable of handling the raw
+   *   compressed file, the library will try to open a gzipped stream from it
+   *   and re-open the face with it.
+   *
+   *   The stream implementation is very basic and resets the decompression
+   *   process each time seeking backwards is needed within the stream,
+   *   which significantly undermines the performance.
+   *
    *   This section contains the declaration of Gzip-specific functions.
    *
    */
@@ -75,15 +84,6 @@
    *   **not** call `FT_Stream_Close` on the source stream.  None of the
    *   stream objects will be released to the heap.
    *
-   *   The stream implementation is very basic and resets the decompression
-   *   process each time seeking backwards is needed within the stream.
-   *
-   *   In certain builds of the library, gzip compression recognition is
-   *   automatically handled when calling @FT_New_Face or @FT_Open_Face.
-   *   This means that if no font driver is capable of handling the raw
-   *   compressed file, the library will try to open a gzipped stream from it
-   *   and re-open the face with it.
-   *
    *   This function may return `FT_Err_Unimplemented_Feature` if your build
    *   of FreeType was not compiled with zlib support.
    */
diff --git a/include/freetype/ftimage.h b/include/freetype/ftimage.h
index face34f..7491162 100644
--- a/include/freetype/ftimage.h
+++ b/include/freetype/ftimage.h
@@ -5,7 +5,7 @@
  *   FreeType glyph image formats and default raster interface
  *   (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -30,7 +30,6 @@
 
   /* STANDALONE_ is from ftgrays.c */
 #ifndef STANDALONE_
-#include <ft2build.h>
 #endif
 
 
@@ -401,6 +400,13 @@
    *     if @FT_OUTLINE_IGNORE_DROPOUTS is set.  See below for more
    *     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.
+   *
    *   FT_OUTLINE_HIGH_PRECISION ::
    *     This flag indicates that the scan-line converter should try to
    *     convert this outline to bitmaps with the highest possible quality.
@@ -432,6 +438,7 @@
 #define FT_OUTLINE_IGNORE_DROPOUTS  0x8
 #define FT_OUTLINE_SMART_DROPOUTS   0x10
 #define FT_OUTLINE_INCLUDE_STUBS    0x20
+#define FT_OUTLINE_OVERLAP          0x40
 
 #define FT_OUTLINE_HIGH_PRECISION   0x100
 #define FT_OUTLINE_SINGLE_PASS      0x200
@@ -1004,20 +1011,26 @@
    *     User-supplied data that is passed to each drawing callback.
    *
    *   clip_box ::
-   *     An optional clipping box.  It is only used in direct rendering mode.
-   *     Note that coordinates here should be expressed in _integer_ pixels
-   *     (and not in 26.6 fixed-point units).
+   *     An optional span clipping box expressed in _integer_ pixels
+   *     (not in 26.6 fixed-point units).
    *
    * @note:
-   *   An anti-aliased glyph bitmap is drawn if the @FT_RASTER_FLAG_AA bit
-   *   flag is set in the `flags` field, otherwise a monochrome bitmap is
-   *   generated.
+   *   The @FT_RASTER_FLAG_AA bit flag must be set in the `flags` to
+   *   generate an anti-aliased glyph bitmap, otherwise a monochrome bitmap
+   *   is generated.  The `target` should have appropriate pixel mode and its
+   *   dimensions define the clipping region.
    *
-   *   If the @FT_RASTER_FLAG_DIRECT bit flag is set in `flags`, the raster
-   *   will call the `gray_spans` callback to draw gray pixel spans.  This
-   *   allows direct composition over a pre-existing bitmap through
-   *   user-provided callbacks to perform the span drawing and composition.
-   *   Not supported by the monochrome rasterizer.
+   *   If both @FT_RASTER_FLAG_AA and @FT_RASTER_FLAG_DIRECT bit flags
+   *   are set in `flags`, the raster calls an @FT_SpanFunc callback
+   *   `gray_spans` with `user` data as an argument ignoring `target`.  This
+   *   allows direct composition over a pre-existing user surface to perform
+   *   the span drawing and composition.  To optionally clip the spans, set
+   *   the @FT_RASTER_FLAG_CLIP flag and `clip_box`.  The monochrome raster
+   *   does not support the direct mode.
+   *
+   *   The gray-level rasterizer always uses 256 gray levels.  If you want
+   *   fewer gray levels, you have to use @FT_RASTER_FLAG_DIRECT and reduce
+   *   the levels in the callback function.
    */
   typedef struct  FT_Raster_Params_
   {
diff --git a/include/freetype/ftincrem.h b/include/freetype/ftincrem.h
index a4db02b..f67655e 100644
--- a/include/freetype/ftincrem.h
+++ b/include/freetype/ftincrem.h
@@ -4,7 +4,7 @@
  *
  *   FreeType incremental loading (specification).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,9 +19,8 @@
 #ifndef FTINCREM_H_
 #define FTINCREM_H_
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_PARAMETER_TAGS_H
+#include <freetype/freetype.h>
+#include <freetype/ftparams.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
diff --git a/include/freetype/ftlcdfil.h b/include/freetype/ftlcdfil.h
index 3a19d04..c6995f2 100644
--- a/include/freetype/ftlcdfil.h
+++ b/include/freetype/ftlcdfil.h
@@ -5,7 +5,7 @@
  *   FreeType API for color filtering of subpixel bitmap glyphs
  *   (specification).
  *
- * Copyright (C) 2006-2019 by
+ * Copyright (C) 2006-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,9 +20,8 @@
 #ifndef FTLCDFIL_H_
 #define FTLCDFIL_H_
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_PARAMETER_TAGS_H
+#include <freetype/freetype.h>
+#include <freetype/ftparams.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
@@ -47,7 +46,7 @@
    * @description:
    *   FreeType provides two alternative subpixel rendering technologies. 
    *   Should you define `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` in your
-   *   `ftoption.h` file, this enables patented ClearType-style rendering. 
+   *   `ftoption.h` file, this enables ClearType-style rendering.
    *   Otherwise, Harmony LCD rendering is enabled.  These technologies are
    *   controlled differently and API described below, although always
    *   available, performs its function when appropriate method is enabled
@@ -177,7 +176,7 @@
    *   FT_Library_SetLcdFilter
    *
    * @description:
-   *   This function is used to apply color filtering to LCD decimated
+   *   This function is used to change filter applied to LCD decimated
    *   bitmaps, like the ones used when calling @FT_Render_Glyph with
    *   @FT_RENDER_MODE_LCD or @FT_RENDER_MODE_LCD_V.
    *
@@ -196,15 +195,14 @@
    *   FreeType error code.  0~means success.
    *
    * @note:
-   *   This feature is always disabled by default.  Clients must make an
-   *   explicit call to this function with a `filter` value other than
-   *   @FT_LCD_FILTER_NONE in order to enable it.
+   *   Since 2.10.3 the LCD filtering is enabled with @FT_LCD_FILTER_DEFAULT.
+   *   It is no longer necessary to call this function explicitly except
+   *   to choose a different filter or disable filtering altogether with
+   *   @FT_LCD_FILTER_NONE.
    *
-   *   Due to **PATENTS** covering subpixel rendering, this function doesn't
-   *   do anything except returning `FT_Err_Unimplemented_Feature` if the
-   *   configuration macro `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` is not
-   *   defined in your build of the library, which should correspond to all
-   *   default builds of FreeType.
+   *   This function does nothing but returns `FT_Err_Unimplemented_Feature`
+   *   if the configuration macro `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` is
+   *   not defined in your build of the library.
    *
    * @since:
    *   2.3.0
@@ -235,11 +233,9 @@
    *   FreeType error code.  0~means success.
    *
    * @note:
-   *   Due to **PATENTS** covering subpixel rendering, this function doesn't
-   *   do anything except returning `FT_Err_Unimplemented_Feature` if the
-   *   configuration macro `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` is not
-   *   defined in your build of the library, which should correspond to all
-   *   default builds of FreeType.
+   *   This function does nothing but returns `FT_Err_Unimplemented_Feature`
+   *   if the configuration macro `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` is
+   *   not defined in your build of the library.
    *
    *   LCD filter weights can also be set per face using @FT_Face_Properties
    *   with @FT_PARAM_TAG_LCD_FILTER_WEIGHTS.
diff --git a/include/freetype/ftlist.h b/include/freetype/ftlist.h
index 4782892..4588922 100644
--- a/include/freetype/ftlist.h
+++ b/include/freetype/ftlist.h
@@ -4,7 +4,7 @@
  *
  *   Generic list support for FreeType (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -28,8 +28,7 @@
 #define FTLIST_H_
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
diff --git a/include/freetype/ftlzw.h b/include/freetype/ftlzw.h
index fd22968..ae46ad6 100644
--- a/include/freetype/ftlzw.h
+++ b/include/freetype/ftlzw.h
@@ -4,7 +4,7 @@
  *
  *   LZW-compressed stream support.
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,8 +19,7 @@
 #ifndef FTLZW_H_
 #define FTLZW_H_
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
@@ -43,6 +42,16 @@
    *   Using LZW-compressed font files.
    *
    * @description:
+   *   In certain builds of the library, LZW compression recognition is
+   *   automatically handled when calling @FT_New_Face or @FT_Open_Face.
+   *   This means that if no font driver is capable of handling the raw
+   *   compressed file, the library will try to open a LZW stream from it and
+   *   re-open the face with it.
+   *
+   *   The stream implementation is very basic and resets the decompression
+   *   process each time seeking backwards is needed within the stream,
+   *   which significantly undermines the performance.
+   *
    *   This section contains the declaration of LZW-specific functions.
    *
    */
@@ -73,15 +82,6 @@
    *   **not** call `FT_Stream_Close` on the source stream.  None of the
    *   stream objects will be released to the heap.
    *
-   *   The stream implementation is very basic and resets the decompression
-   *   process each time seeking backwards is needed within the stream
-   *
-   *   In certain builds of the library, LZW compression recognition is
-   *   automatically handled when calling @FT_New_Face or @FT_Open_Face.
-   *   This means that if no font driver is capable of handling the raw
-   *   compressed file, the library will try to open a LZW stream from it and
-   *   re-open the face with it.
-   *
    *   This function may return `FT_Err_Unimplemented_Feature` if your build
    *   of FreeType was not compiled with LZW support.
    */
diff --git a/include/freetype/ftmac.h b/include/freetype/ftmac.h
index 92b9f3d..c9de981 100644
--- a/include/freetype/ftmac.h
+++ b/include/freetype/ftmac.h
@@ -4,7 +4,7 @@
  *
  *   Additional Mac-specific API.
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -29,7 +29,6 @@
 #define FTMAC_H_
 
 
-#include <ft2build.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/ftmm.h b/include/freetype/ftmm.h
index f2e16b6..d8781a8 100644
--- a/include/freetype/ftmm.h
+++ b/include/freetype/ftmm.h
@@ -4,7 +4,7 @@
  *
  *   FreeType Multiple Master font interface (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
 #define FTMM_H_
 
 
-#include <ft2build.h>
-#include FT_TYPE1_TABLES_H
+#include <freetype/t1tables.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/ftmodapi.h b/include/freetype/ftmodapi.h
index 8d039c4..3f7ae82 100644
--- a/include/freetype/ftmodapi.h
+++ b/include/freetype/ftmodapi.h
@@ -4,7 +4,7 @@
  *
  *   FreeType modules public interface (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
 #define FTMODAPI_H_
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
@@ -65,7 +64,7 @@
    *     psnames
    *     raster1
    *     sfnt
-   *     smooth, smooth-lcd, smooth-lcdv
+   *     smooth
    *     truetype
    *     type1
    *     type42
@@ -486,7 +485,7 @@
    *
    *   ```
    *     FREETYPE_PROPERTIES=truetype:interpreter-version=35 \
-   *                         cff:no-stem-darkening=1 \
+   *                         cff:no-stem-darkening=0 \
    *                         autofitter:warping=1
    *   ```
    *
diff --git a/include/freetype/ftmoderr.h b/include/freetype/ftmoderr.h
index e169935..f05fc53 100644
--- a/include/freetype/ftmoderr.h
+++ b/include/freetype/ftmoderr.h
@@ -4,7 +4,7 @@
  *
  *   FreeType module error offsets (specification).
  *
- * Copyright (C) 2001-2019 by
+ * Copyright (C) 2001-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -94,7 +94,7 @@
    *     const char*  mod_err_msg
    *   } ft_mod_errors[] =
    *
-   *   #include FT_MODULE_ERRORS_H
+   *   #include <freetype/ftmoderr.h>
    * ```
    *
    */
diff --git a/include/freetype/ftotval.h b/include/freetype/ftotval.h
index c034f48..9c00ad3 100644
--- a/include/freetype/ftotval.h
+++ b/include/freetype/ftotval.h
@@ -4,7 +4,7 @@
  *
  *   FreeType API for validating OpenType tables (specification).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -30,8 +30,7 @@
 #ifndef FTOTVAL_H_
 #define FTOTVAL_H_
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
diff --git a/include/freetype/ftoutln.h b/include/freetype/ftoutln.h
index b72327b..84e9b14 100644
--- a/include/freetype/ftoutln.h
+++ b/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-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -21,8 +21,7 @@
 #define FTOUTLN_H_
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
@@ -483,19 +482,13 @@
    *   FreeType error code.  0~means success.
    *
    * @note:
-   *   This advanced function uses @FT_Raster_Params as an argument,
-   *   allowing FreeType rasterizer to be used for direct composition,
-   *   translucency, etc.  You should know how to set up @FT_Raster_Params
-   *   for this function to work.
-   *
+   *   This advanced function uses @FT_Raster_Params as an argument.
    *   The field `params.source` will be set to `outline` before the scan
    *   converter is called, which means that the value you give to it is
-   *   actually ignored.
-   *
-   *   The gray-level rasterizer always uses 256 gray levels.  If you want
-   *   less gray levels, you have to provide your own span callback.  See the
-   *   @FT_RASTER_FLAG_DIRECT value of the `flags` field in the
-   *   @FT_Raster_Params structure for more details.
+   *   actually ignored.  Either `params.target` must point to preallocated
+   *   bitmap, or @FT_RASTER_FLAG_DIRECT must be set in `params.flags`
+   *   allowing FreeType rasterizer to be used for direct composition,
+   *   translucency, etc.  See @FT_Raster_Params for more details.
    */
   FT_EXPORT( FT_Error )
   FT_Outline_Render( FT_Library         library,
diff --git a/include/freetype/ftparams.h b/include/freetype/ftparams.h
index c374ee2..55ea2a3 100644
--- a/include/freetype/ftparams.h
+++ b/include/freetype/ftparams.h
@@ -4,7 +4,7 @@
  *
  *   FreeType API for possible FT_Parameter tags (specification only).
  *
- * Copyright (C) 2017-2019 by
+ * Copyright (C) 2017-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,8 +19,7 @@
 #ifndef FTPARAMS_H_
 #define FTPARAMS_H_
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
diff --git a/include/freetype/ftpfr.h b/include/freetype/ftpfr.h
index b4eca76..9a5383f 100644
--- a/include/freetype/ftpfr.h
+++ b/include/freetype/ftpfr.h
@@ -4,7 +4,7 @@
  *
  *   FreeType API for accessing PFR-specific data (specification only).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,8 +19,7 @@
 #ifndef FTPFR_H_
 #define FTPFR_H_
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
diff --git a/include/freetype/ftrender.h b/include/freetype/ftrender.h
index a01c774..8007951 100644
--- a/include/freetype/ftrender.h
+++ b/include/freetype/ftrender.h
@@ -4,7 +4,7 @@
  *
  *   FreeType renderer modules public interface (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,9 +20,8 @@
 #define FTRENDER_H_
 
 
-#include <ft2build.h>
-#include FT_MODULE_H
-#include FT_GLYPH_H
+#include <freetype/ftmodapi.h>
+#include <freetype/ftglyph.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/ftsizes.h b/include/freetype/ftsizes.h
index 6c63cef..a8682a3 100644
--- a/include/freetype/ftsizes.h
+++ b/include/freetype/ftsizes.h
@@ -4,7 +4,7 @@
  *
  *   FreeType size objects management (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -29,8 +29,7 @@
 #define FTSIZES_H_
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
diff --git a/include/freetype/ftsnames.h b/include/freetype/ftsnames.h
index 4d43602..729e6ab 100644
--- a/include/freetype/ftsnames.h
+++ b/include/freetype/ftsnames.h
@@ -7,7 +7,7 @@
  *
  *   This is _not_ used to retrieve glyph names!
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -23,9 +23,8 @@
 #define FTSNAMES_H_
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_PARAMETER_TAGS_H
+#include <freetype/freetype.h>
+#include <freetype/ftparams.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
diff --git a/include/freetype/ftstroke.h b/include/freetype/ftstroke.h
index 01a9c18..a759c94 100644
--- a/include/freetype/ftstroke.h
+++ b/include/freetype/ftstroke.h
@@ -4,7 +4,7 @@
  *
  *   FreeType path stroker (specification).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,9 +19,8 @@
 #ifndef FTSTROKE_H_
 #define FTSTROKE_H_
 
-#include <ft2build.h>
-#include FT_OUTLINE_H
-#include FT_GLYPH_H
+#include <freetype/ftoutln.h>
+#include <freetype/ftglyph.h>
 
 
 FT_BEGIN_HEADER
@@ -44,7 +43,7 @@
    *    borders of the stroke.
    *
    *    This can be useful to generate 'bordered' glyph, i.e., glyphs
-   *    displayed with a coloured (and anti-aliased) border around their
+   *    displayed with a colored (and anti-aliased) border around their
    *    shape.
    *
    * @order:
@@ -114,22 +113,19 @@
    *   FT_STROKER_LINEJOIN_MITER_FIXED ::
    *     Used to render mitered line joins, with fixed bevels if the miter
    *     limit is exceeded.  The outer edges of the strokes for the two
-   *     segments are extended until they meet at an angle.  If the segments
-   *     meet at too sharp an angle (such that the miter would extend from
-   *     the intersection of the segments a distance greater than the product
-   *     of the miter limit value and the border radius), then a bevel join
-   *     (see above) is used instead.  This prevents long spikes being
-   *     created.  `FT_STROKER_LINEJOIN_MITER_FIXED` generates a miter line
-   *     join as used in PostScript and PDF.
+   *     segments are extended until they meet at an angle.  A bevel join
+   *     (see above) is used if the segments meet at too sharp an angle and
+   *     the outer edges meet beyond a distance corresponding to the meter
+   *     limit.  This prevents long spikes being created.
+   *     `FT_STROKER_LINEJOIN_MITER_FIXED` generates a miter line join as
+   *     used in PostScript and PDF.
    *
    *   FT_STROKER_LINEJOIN_MITER_VARIABLE ::
    *   FT_STROKER_LINEJOIN_MITER ::
    *     Used to render mitered line joins, with variable bevels if the miter
-   *     limit is exceeded.  The intersection of the strokes is clipped at a
-   *     line perpendicular to the bisector of the angle between the strokes,
-   *     at the distance from the intersection of the segments equal to the
-   *     product of the miter limit value and the border radius.  This
-   *     prevents long spikes being created. 
+   *     limit is exceeded.  The intersection of the strokes is clipped
+   *     perpendicularly to the bisector, at a distance corresponding to
+   *     the miter limit. This prevents long spikes being created.
    *     `FT_STROKER_LINEJOIN_MITER_VARIABLE` generates a mitered line join
    *     as used in XPS.  `FT_STROKER_LINEJOIN_MITER` is an alias for
    *     `FT_STROKER_LINEJOIN_MITER_VARIABLE`, retained for backward
@@ -296,12 +292,17 @@
    *     The line join style.
    *
    *   miter_limit ::
-   *     The miter limit for the `FT_STROKER_LINEJOIN_MITER_FIXED` and
-   *     `FT_STROKER_LINEJOIN_MITER_VARIABLE` line join styles, expressed as
-   *     16.16 fixed-point value.
+   *     The maximum reciprocal sine of half-angle at the miter join,
+   *     expressed as 16.16 fixed point value.
    *
    * @note:
-   *   The radius is expressed in the same units as the outline coordinates.
+   *   The `radius` is expressed in the same units as the outline
+   *   coordinates.
+   *
+   *   The `miter_limit` multiplied by the `radius` gives the maximum size
+   *   of a miter spike, at which it is clipped for
+   *   @FT_STROKER_LINEJOIN_MITER_VARIABLE or replaced with a bevel join for
+   *   @FT_STROKER_LINEJOIN_MITER_FIXED.
    *
    *   This function calls @FT_Stroker_Rewind automatically.
    */
diff --git a/include/freetype/ftsynth.h b/include/freetype/ftsynth.h
index 8754f97..bdb4c57 100644
--- a/include/freetype/ftsynth.h
+++ b/include/freetype/ftsynth.h
@@ -5,7 +5,7 @@
  *   FreeType synthesizing code for emboldening and slanting
  *   (specification).
  *
- * Copyright (C) 2000-2019 by
+ * Copyright (C) 2000-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -45,8 +45,7 @@
 #define FTSYNTH_H_
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
diff --git a/include/freetype/ftsystem.h b/include/freetype/ftsystem.h
index 889a6ba..22aead7 100644
--- a/include/freetype/ftsystem.h
+++ b/include/freetype/ftsystem.h
@@ -4,7 +4,7 @@
  *
  *   FreeType low-level system interface definition (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,7 +20,6 @@
 #define FTSYSTEM_H_
 
 
-#include <ft2build.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/fttrigon.h b/include/freetype/fttrigon.h
index 37e1412..2ce6b32 100644
--- a/include/freetype/fttrigon.h
+++ b/include/freetype/fttrigon.h
@@ -4,7 +4,7 @@
  *
  *   FreeType trigonometric functions (specification).
  *
- * Copyright (C) 2001-2019 by
+ * Copyright (C) 2001-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,7 +19,7 @@
 #ifndef FTTRIGON_H_
 #define FTTRIGON_H_
 
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
diff --git a/include/freetype/fttypes.h b/include/freetype/fttypes.h
index 1057150..aaeb9e8 100644
--- a/include/freetype/fttypes.h
+++ b/include/freetype/fttypes.h
@@ -4,7 +4,7 @@
  *
  *   FreeType simple types definitions (specification only).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -22,8 +22,8 @@
 
 #include <ft2build.h>
 #include FT_CONFIG_CONFIG_H
-#include FT_SYSTEM_H
-#include FT_IMAGE_H
+#include <freetype/ftsystem.h>
+#include <freetype/ftimage.h>
 
 #include <stddef.h>
 
diff --git a/include/freetype/ftwinfnt.h b/include/freetype/ftwinfnt.h
index a2fba90..786528c 100644
--- a/include/freetype/ftwinfnt.h
+++ b/include/freetype/ftwinfnt.h
@@ -4,7 +4,7 @@
  *
  *   FreeType API for accessing Windows fnt-specific data.
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,8 +19,7 @@
 #ifndef FTWINFNT_H_
 #define FTWINFNT_H_
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
diff --git a/include/freetype/internal/autohint.h b/include/freetype/internal/autohint.h
index f64c28b..2a472e2 100644
--- a/include/freetype/internal/autohint.h
+++ b/include/freetype/internal/autohint.h
@@ -4,7 +4,7 @@
  *
  *   High-level 'autohint' module-specific interface (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -70,8 +70,7 @@
    */
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 
 FT_BEGIN_HEADER
@@ -208,6 +207,9 @@
   } FT_AutoHinter_InterfaceRec, *FT_AutoHinter_Interface;
 
 
+#define FT_DECLARE_AUTOHINTER_INTERFACE( class_ )            \
+  FT_CALLBACK_TABLE const FT_AutoHinter_InterfaceRec  class_;
+
 #define FT_DEFINE_AUTOHINTER_INTERFACE(       \
           class_,                             \
           reset_face_,                        \
diff --git a/include/freetype/internal/cffotypes.h b/include/freetype/internal/cffotypes.h
index b26893e..a316fd1 100644
--- a/include/freetype/internal/cffotypes.h
+++ b/include/freetype/internal/cffotypes.h
@@ -4,7 +4,7 @@
  *
  *   Basic OpenType/CFF object type definitions (specification).
  *
- * Copyright (C) 2017-2019 by
+ * Copyright (C) 2017-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,12 +19,11 @@
 #ifndef CFFOTYPES_H_
 #define CFFOTYPES_H_
 
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_CFF_TYPES_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/cfftypes.h>
+#include <freetype/internal/tttypes.h>
+#include <freetype/internal/services/svpscmap.h>
+#include <freetype/internal/pshints.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/internal/cfftypes.h b/include/freetype/internal/cfftypes.h
index 2fc905e..f21167b 100644
--- a/include/freetype/internal/cfftypes.h
+++ b/include/freetype/internal/cfftypes.h
@@ -5,7 +5,7 @@
  *   Basic OpenType/CFF type definitions and interface (specification
  *   only).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -21,13 +21,12 @@
 #define CFFTYPES_H_
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_TYPE1_TABLES_H
-#include FT_INTERNAL_SERVICE_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
-#include FT_INTERNAL_TYPE1_TYPES_H
+#include <freetype/freetype.h>
+#include <freetype/t1tables.h>
+#include <freetype/internal/ftserv.h>
+#include <freetype/internal/services/svpscmap.h>
+#include <freetype/internal/pshints.h>
+#include <freetype/internal/t1types.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/internal/compiler-macros.h b/include/freetype/internal/compiler-macros.h
new file mode 100644
index 0000000..97c18d3
--- /dev/null
+++ b/include/freetype/internal/compiler-macros.h
@@ -0,0 +1,307 @@
+/****************************************************************************
+ *
+ * internal/compiler-macros.h
+ *
+ *   Compiler-specific macro definitions used internally by FreeType.
+ *
+ * Copyright (C) 2020 by
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+ * modified, and distributed under the terms of the FreeType project
+ * license, LICENSE.TXT.  By continuing to use, modify, or distribute
+ * this file you indicate that you have read the license and
+ * understand and accept it fully.
+ *
+ */
+
+#ifndef INTERNAL_COMPILER_MACROS_H_
+#define INTERNAL_COMPILER_MACROS_H_
+
+#include <freetype/config/public-macros.h>
+
+FT_BEGIN_HEADER
+
+  /* Fix compiler warning with sgi compiler. */
+#if defined( __sgi ) && !defined( __GNUC__ )
+#  if defined( _COMPILER_VERSION ) && ( _COMPILER_VERSION >= 730 )
+#    pragma set woff 3505
+#  endif
+#endif
+
+  /* Fix compiler warning with sgi compiler. */
+#if defined( __sgi ) && !defined( __GNUC__ )
+#  if defined( _COMPILER_VERSION ) && ( _COMPILER_VERSION >= 730 )
+#    pragma set woff 3505
+#  endif
+#endif
+
+  /*
+   * When defining a macro that expands to a non-trivial C statement, use
+   * FT_BEGIN_STMNT and FT_END_STMNT to enclose the macro's body.  This
+   * ensures there are no surprises when the macro is invoked in conditional
+   * branches.
+   *
+   * Example:
+   *
+   *   #define  LOG( ... )        \
+   *     FT_BEGIN_STMNT           \
+   *       if ( logging_enabled ) \
+   *         log( __VA_ARGS__ );  \
+   *     FT_END_STMNT
+   */
+#define FT_BEGIN_STMNT  do {
+#define FT_END_STMNT    } while ( 0 )
+
+  /*
+   * FT_DUMMY_STMNT expands to an empty C statement.  Useful for
+   * conditionally defined statement macros.
+   *
+   * Example:
+   *
+   *   #ifdef BUILD_CONFIG_LOGGING
+   *   #define  LOG( ... )         \
+   *      FT_BEGIN_STMNT           \
+   *        if ( logging_enabled ) \
+   *          log( __VA_ARGS__ );  \
+   *      FT_END_STMNT
+   *   #else
+   *   #  define LOG( ... )  FT_DUMMY_STMNT
+   *   #endif
+   */
+#define FT_DUMMY_STMNT  FT_BEGIN_STMNT FT_END_STMNT
+
+#ifdef _WIN64
+  /* only 64bit Windows uses the LLP64 data model, i.e., */
+  /* 32-bit integers, 64-bit pointers.                   */
+#define FT_UINT_TO_POINTER( x )  (void *)(unsigned __int64)(x)
+#else
+#define FT_UINT_TO_POINTER( x )  (void *)(unsigned long)(x)
+#endif
+
+  /*
+   * Use `FT_TYPEOF( type )` to cast a value to `type`.  This is useful to
+   * suppress signedness compilation warnings in macros.
+   *
+   * Example:
+   *
+   *   #define PAD_( x, n )  ( (x) & ~FT_TYPEOF( x )( (n) - 1 ) )
+   *
+   * (The `typeof` condition is taken from gnulib's `intprops.h` header
+   * file.)
+   */
+#if ( ( defined( __GNUC__ ) && __GNUC__ >= 2 )                       || \
+      ( defined( __IBMC__ ) && __IBMC__ >= 1210 &&                      \
+        defined( __IBM__TYPEOF__ ) )                                 || \
+      ( defined( __SUNPRO_C ) && __SUNPRO_C >= 0x5110 && !__STDC__ ) )
+#define FT_TYPEOF( type )  ( __typeof__ ( type ) )
+#else
+#define FT_TYPEOF( type )  /* empty */
+#endif
+
+  /*
+   * Mark a function declaration as internal to the library.  This ensures
+   * that it will not be exposed by default to client code, and helps
+   * generate smaller and faster code on ELF-based platforms.  Place this
+   * before a function declaration.
+   */
+
+  /* Visual C, mingw */
+#if defined( _WIN32 )
+#define FT_INTERNAL_FUNCTION_ATTRIBUTE  /* empty */
+
+  /* gcc, clang */
+#elif ( defined( __GNUC__ ) && __GNUC__ >= 4 ) || defined( __clang__ )
+#define FT_INTERNAL_FUNCTION_ATTRIBUTE  \
+          __attribute__(( visibility( "hidden" ) ))
+
+  /* Sun */
+#elif defined( __SUNPRO_C ) && __SUNPRO_C >= 0x550
+#define FT_INTERNAL_FUNCTION_ATTRIBUTE  __hidden
+
+#else
+#define FT_INTERNAL_FUNCTION_ATTRIBUTE  /* empty */
+#endif
+
+  /*
+   * FreeType supports compilation of its C sources with a C++ compiler (in
+   * C++ mode); this introduces a number of subtle issues.
+   *
+   * The main one is that a C++ function declaration and its definition must
+   * have the same 'linkage'.  Because all FreeType headers declare their
+   * functions with C linkage (i.e., within an `extern "C" { ... }` block
+   * due to the magic of FT_BEGIN_HEADER and FT_END_HEADER), their
+   * definition in FreeType sources should also be prefixed with `extern
+   * "C"` when compiled in C++ mode.
+   *
+   * The `FT_FUNCTION_DECLARATION` and `FT_FUNCTION_DEFINITION` macros are
+   * provided to deal with this case, as well as `FT_CALLBACK_DEF` and its
+   * siblings below.
+   */
+
+  /*
+   * `FT_FUNCTION_DECLARATION( type )` can be used to write a C function
+   * declaration to ensure it will have C linkage when the library is built
+   * with a C++ compiler.  The parameter is the function's return type, so a
+   * declaration would look like
+   *
+   *    FT_FUNCTION_DECLARATION( int )
+   *    foo( int x );
+   *
+   * NOTE: This requires that all uses are inside of `FT_BEGIN_HEADER ...
+   * FT_END_HEADER` blocks, which guarantees that the declarations have C
+   * linkage when the headers are included by C++ sources.
+   *
+   * NOTE: Do not use directly.  Use `FT_LOCAL`, `FT_BASE`, and `FT_EXPORT`
+   * instead.
+   */
+#define FT_FUNCTION_DECLARATION( x )  extern x
+
+  /*
+   * Same as `FT_FUNCTION_DECLARATION`, but for function definitions instead.
+   *
+   * NOTE: Do not use directly.  Use `FT_LOCAL_DEF`, `FT_BASE_DEF`, and
+   * `FT_EXPORT_DEF` instead.
+   */
+#ifdef __cplusplus
+#define FT_FUNCTION_DEFINITION( x )  extern "C" x
+#else
+#define FT_FUNCTION_DEFINITION( x )  x
+#endif
+
+  /*
+   * Use `FT_LOCAL` and `FT_LOCAL_DEF` to declare and define, respectively,
+   * an internal FreeType function that is only used by the sources of a
+   * single `src/module/` directory.  This ensures that the functions are
+   * turned into static ones at build time, resulting in smaller and faster
+   * code.
+   */
+#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
+
+#define FT_LOCAL( x )      static x
+#define FT_LOCAL_DEF( x )  static x
+
+#else
+
+#define FT_LOCAL( x )      FT_INTERNAL_FUNCTION_ATTRIBUTE \
+                           FT_FUNCTION_DECLARATION( x )
+#define FT_LOCAL_DEF( x )  FT_FUNCTION_DEFINITION( x )
+
+#endif  /* FT_MAKE_OPTION_SINGLE_OBJECT */
+
+  /*
+   * Use `FT_LOCAL_ARRAY` and `FT_LOCAL_ARRAY_DEF` to declare and define,
+   * respectively, a constant array that must be accessed from several
+   * sources in the same `src/module/` sub-directory, and which are internal
+   * to the library.
+   */
+#define FT_LOCAL_ARRAY( x )      FT_INTERNAL_FUNCTION_ATTRIBUTE \
+                                 extern const x
+#define FT_LOCAL_ARRAY_DEF( x )  FT_FUNCTION_DEFINITION( const x )
+
+  /*
+   * `Use FT_BASE` and `FT_BASE_DEF` to declare and define, respectively, an
+   * internal library function that is used by more than a single module.
+   */
+#define FT_BASE( x )      FT_INTERNAL_FUNCTION_ATTRIBUTE \
+                          FT_FUNCTION_DECLARATION( x )
+#define FT_BASE_DEF( x )  FT_FUNCTION_DEFINITION( x )
+
+
+  /*
+   * NOTE: Conditionally define `FT_EXPORT_VAR` due to its definition in
+   * `src/smooth/ftgrays.h` to make the header more portable.
+   */
+#ifndef FT_EXPORT_VAR
+#define FT_EXPORT_VAR( x )  FT_FUNCTION_DECLARATION( x )
+#endif
+
+  /* When compiling FreeType as a DLL or DSO with hidden visibility,   */
+  /* some systems/compilers need a special attribute in front OR after */
+  /* the return type of function declarations.                         */
+  /*                                                                   */
+  /* Two macros are used within the FreeType source code to define     */
+  /* exported library functions: `FT_EXPORT` and `FT_EXPORT_DEF`.      */
+  /*                                                                   */
+  /* - `FT_EXPORT( return_type )`                                      */
+  /*                                                                   */
+  /*   is used in a function declaration, as in                        */
+  /*                                                                   */
+  /*   ```                                                             */
+  /*     FT_EXPORT( FT_Error )                                         */
+  /*     FT_Init_FreeType( FT_Library*  alibrary );                    */
+  /*   ```                                                             */
+  /*                                                                   */
+  /* - `FT_EXPORT_DEF( return_type )`                                  */
+  /*                                                                   */
+  /*   is used in a function definition, as in                         */
+  /*                                                                   */
+  /*   ```                                                             */
+  /*     FT_EXPORT_DEF( FT_Error )                                     */
+  /*     FT_Init_FreeType( FT_Library*  alibrary )                     */
+  /*     {                                                             */
+  /*       ... some code ...                                           */
+  /*       return FT_Err_Ok;                                           */
+  /*     }                                                             */
+  /*   ```                                                             */
+  /*                                                                   */
+  /* You can provide your own implementation of `FT_EXPORT` and        */
+  /* `FT_EXPORT_DEF` here if you want.                                 */
+  /*                                                                   */
+  /* To export a variable, use `FT_EXPORT_VAR`.                        */
+  /*                                                                   */
+
+  /* See `freetype/config/compiler_macros.h` for the `FT_EXPORT` definition */
+#define FT_EXPORT_DEF( x )  FT_FUNCTION_DEFINITION( x )
+
+  /* The following macros are needed to compile the library with a   */
+  /* C++ compiler and with 16bit compilers.                          */
+  /*                                                                 */
+
+  /* This is special.  Within C++, you must specify `extern "C"` for */
+  /* functions which are used via function pointers, and you also    */
+  /* must do that for structures which contain function pointers to  */
+  /* assure C linkage -- it's not possible to have (local) anonymous */
+  /* functions which are accessed by (global) function pointers.     */
+  /*                                                                 */
+  /*                                                                 */
+  /* FT_CALLBACK_DEF is used to _define_ a callback function,        */
+  /* located in the same source code file as the structure that uses */
+  /* it.                                                             */
+  /*                                                                 */
+  /* FT_BASE_CALLBACK and FT_BASE_CALLBACK_DEF are used to declare   */
+  /* and define a callback function, respectively, in a similar way  */
+  /* as FT_BASE and FT_BASE_DEF work.                                */
+  /*                                                                 */
+  /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */
+  /* contains pointers to callback functions.                        */
+  /*                                                                 */
+  /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable   */
+  /* that contains pointers to callback functions.                   */
+  /*                                                                 */
+  /*                                                                 */
+  /* Some 16bit compilers have to redefine these macros to insert    */
+  /* the infamous `_cdecl` or `__fastcall` declarations.             */
+  /*                                                                 */
+#ifdef __cplusplus
+#define FT_CALLBACK_DEF( x )  extern "C"  x
+#else
+#define FT_CALLBACK_DEF( x )  static  x
+#endif
+
+#define FT_BASE_CALLBACK( x )      FT_FUNCTION_DECLARATION( x )
+#define FT_BASE_CALLBACK_DEF( x )  FT_FUNCTION_DEFINITION( x )
+
+#ifndef FT_CALLBACK_TABLE
+#ifdef __cplusplus
+#define FT_CALLBACK_TABLE      extern "C"
+#define FT_CALLBACK_TABLE_DEF  extern "C"
+#else
+#define FT_CALLBACK_TABLE      extern
+#define FT_CALLBACK_TABLE_DEF  /* nothing */
+#endif
+#endif /* FT_CALLBACK_TABLE */
+
+FT_END_HEADER
+
+#endif  /* INTERNAL_COMPILER_MACROS_H_ */
diff --git a/include/freetype/internal/ftcalc.h b/include/freetype/internal/ftcalc.h
index 1811fcd..c653074 100644
--- a/include/freetype/internal/ftcalc.h
+++ b/include/freetype/internal/ftcalc.h
@@ -4,7 +4,7 @@
  *
  *   Arithmetic computations (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,9 +20,9 @@
 #define FTCALC_H_
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
+#include "compiler-macros.h"
 
 FT_BEGIN_HEADER
 
@@ -449,8 +449,7 @@
 #define F2DOT14_TO_FIXED( x )  ( (FT_Long)(x) * 4 )      /* << 2  */
 #define FIXED_TO_INT( x )      ( FT_RoundFix( x ) >> 16 )
 
-#define ROUND_F26DOT6( x )     ( x >= 0 ? (    ( (x) + 32 ) & -64 )     \
-                                        : ( -( ( 32 - (x) ) & -64 ) ) )
+#define ROUND_F26DOT6( x )     ( ( (x) + 32 - ( x < 0 ) ) & -64 )
 
   /*
    * The following macros have two purposes.
diff --git a/include/freetype/internal/ftdebug.h b/include/freetype/internal/ftdebug.h
index 54a9673..df5357a 100644
--- a/include/freetype/internal/ftdebug.h
+++ b/include/freetype/internal/ftdebug.h
@@ -4,7 +4,7 @@
  *
  *   Debugging and logging component (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -27,7 +27,9 @@
 
 #include <ft2build.h>
 #include FT_CONFIG_CONFIG_H
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
+
+#include "compiler-macros.h"
 
 
 FT_BEGIN_HEADER
@@ -56,7 +58,7 @@
   /* defining the enumeration */
   typedef enum  FT_Trace_
   {
-#include FT_INTERNAL_TRACE_H
+#include <freetype/internal/fttrace.h>
     trace_count
 
   } FT_Trace;
diff --git a/include/freetype/internal/ftdrv.h b/include/freetype/internal/ftdrv.h
index 09e846e..7f22710 100644
--- a/include/freetype/internal/ftdrv.h
+++ b/include/freetype/internal/ftdrv.h
@@ -4,7 +4,7 @@
  *
  *   FreeType internal font driver interface (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,9 +20,9 @@
 #define FTDRV_H_
 
 
-#include <ft2build.h>
-#include FT_MODULE_H
+#include <freetype/ftmodapi.h>
 
+#include "compiler-macros.h"
 
 FT_BEGIN_HEADER
 
diff --git a/include/freetype/internal/ftgloadr.h b/include/freetype/internal/ftgloadr.h
index 770871d..27b8659 100644
--- a/include/freetype/internal/ftgloadr.h
+++ b/include/freetype/internal/ftgloadr.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType glyph loader (specification).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
 #define FTGLOADR_H_
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 
 FT_BEGIN_HEADER
@@ -138,8 +137,6 @@
   FT_BASE( void )
   FT_GlyphLoader_Add( FT_GlyphLoader  loader );
 
- /* */
-
 
 FT_END_HEADER
 
diff --git a/include/freetype/internal/fthash.h b/include/freetype/internal/fthash.h
index 2491880..622ec76 100644
--- a/include/freetype/internal/fthash.h
+++ b/include/freetype/internal/fthash.h
@@ -43,8 +43,7 @@
 #define FTHASH_H_
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/internal/ftmemory.h b/include/freetype/internal/ftmemory.h
index 78bd3bc..ddb18b0 100644
--- a/include/freetype/internal/ftmemory.h
+++ b/include/freetype/internal/ftmemory.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType memory management macros (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg
  *
  * This file is part of the FreeType project, and may only be used,
@@ -22,8 +22,9 @@
 
 #include <ft2build.h>
 #include FT_CONFIG_CONFIG_H
-#include FT_TYPES_H
+#include <freetype/fttypes.h>
 
+#include "compiler-macros.h"
 
 FT_BEGIN_HEADER
 
@@ -57,6 +58,14 @@
   /*************************************************************************/
 
 
+  /* The calculation `NULL + n' is undefined in C.  Even if the resulting */
+  /* pointer doesn't get dereferenced, this causes warnings with          */
+  /* sanitizers.                                                          */
+  /*                                                                      */
+  /* We thus provide a macro that should be used if `base' can be NULL.   */
+#define FT_OFFSET( base, count )  ( (base) ? (base) + (count) : NULL )
+
+
   /*
    * C++ refuses to handle statements like p = (void*)anything, with `p' a
    * typed pointer.  Since we don't have a `typeof' operator in standard C++,
@@ -153,10 +162,10 @@
                                                (FT_Long)(size), \
                                                &error ) )
 
-#define FT_MEM_FREE( ptr )                \
-          FT_BEGIN_STMNT                  \
-            ft_mem_free( memory, (ptr) ); \
-            (ptr) = NULL;                 \
+#define FT_MEM_FREE( ptr )                                  \
+          FT_BEGIN_STMNT                                    \
+            FT_DEBUG_INNER( ft_mem_free( memory, (ptr) ) ); \
+            (ptr) = NULL;                                   \
           FT_END_STMNT
 
 #define FT_MEM_NEW( ptr )                        \
@@ -381,8 +390,6 @@
 #define FT_STRCPYN( dst, src, size )                                         \
           ft_mem_strcpyn( (char*)dst, (const char*)(src), (FT_ULong)(size) )
 
- /* */
-
 
 FT_END_HEADER
 
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index 0c1d3e5..25db2c4 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType private base classes (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -26,21 +26,21 @@
 #ifndef FTOBJS_H_
 #define FTOBJS_H_
 
-#include <ft2build.h>
-#include FT_RENDER_H
-#include FT_SIZES_H
-#include FT_LCD_FILTER_H
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_GLYPH_LOADER_H
-#include FT_INTERNAL_DRIVER_H
-#include FT_INTERNAL_AUTOHINT_H
-#include FT_INTERNAL_SERVICE_H
-#include FT_INTERNAL_CALC_H
+#include <freetype/ftrender.h>
+#include <freetype/ftsizes.h>
+#include <freetype/ftlcdfil.h>
+#include <freetype/internal/ftmemory.h>
+#include <freetype/internal/ftgloadr.h>
+#include <freetype/internal/ftdrv.h>
+#include <freetype/internal/autohint.h>
+#include <freetype/internal/ftserv.h>
+#include <freetype/internal/ftcalc.h>
 
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
-#include FT_INCREMENTAL_H
+#include <freetype/ftincrem.h>
 #endif
 
+#include "compiler-macros.h"
 
 FT_BEGIN_HEADER
 
@@ -226,8 +226,8 @@
   } FT_CMap_ClassRec;
 
 
-#define FT_DECLARE_CMAP_CLASS( class_ )              \
-  FT_CALLBACK_TABLE const  FT_CMap_ClassRec class_;
+#define FT_DECLARE_CMAP_CLASS( class_ )            \
+  FT_CALLBACK_TABLE const FT_CMap_ClassRec  class_;
 
 #define FT_DEFINE_CMAP_CLASS(       \
           class_,                   \
@@ -653,7 +653,7 @@
   FT_BASE( void )
   FT_Done_GlyphSlot( FT_GlyphSlot  slot );
 
- /* */
+  /* */
 
 #define FT_REQUEST_WIDTH( req )                                            \
           ( (req)->horiResolution                                          \
@@ -1057,6 +1057,9 @@
    *   The struct will be allocated in the global scope (or the scope where
    *   the macro is used).
    */
+#define FT_DECLARE_GLYPH( class_ )                \
+  FT_CALLBACK_TABLE const FT_Glyph_Class  class_;
+
 #define FT_DEFINE_GLYPH(          \
           class_,                 \
           size_,                  \
diff --git a/include/freetype/internal/ftpsprop.h b/include/freetype/internal/ftpsprop.h
index 574837f..81ec291 100644
--- a/include/freetype/internal/ftpsprop.h
+++ b/include/freetype/internal/ftpsprop.h
@@ -4,7 +4,7 @@
  *
  *   Get and set properties of PostScript drivers (specification).
  *
- * Copyright (C) 2017-2019 by
+ * Copyright (C) 2017-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
 #define FTPSPROP_H_
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/internal/ftrfork.h b/include/freetype/internal/ftrfork.h
index 75b3e53..1b7b25a 100644
--- a/include/freetype/internal/ftrfork.h
+++ b/include/freetype/internal/ftrfork.h
@@ -4,7 +4,7 @@
  *
  *   Embedded resource forks accessor (specification).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * Masatake YAMATO and Redhat K.K.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -25,8 +25,7 @@
 #define FTRFORK_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/ftobjs.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/internal/ftserv.h b/include/freetype/internal/ftserv.h
index 8836cf3..6e1a947 100644
--- a/include/freetype/internal/ftserv.h
+++ b/include/freetype/internal/ftserv.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType services (specification only).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -31,6 +31,7 @@
 #ifndef FTSERV_H_
 #define FTSERV_H_
 
+#include "compiler-macros.h"
 
 FT_BEGIN_HEADER
 
@@ -486,33 +487,6 @@
 
   /* */
 
-  /*
-   * The header files containing the services.
-   */
-
-#define FT_SERVICE_BDF_H                <freetype/internal/services/svbdf.h>
-#define FT_SERVICE_CFF_TABLE_LOAD_H     <freetype/internal/services/svcfftl.h>
-#define FT_SERVICE_CID_H                <freetype/internal/services/svcid.h>
-#define FT_SERVICE_FONT_FORMAT_H        <freetype/internal/services/svfntfmt.h>
-#define FT_SERVICE_GLYPH_DICT_H         <freetype/internal/services/svgldict.h>
-#define FT_SERVICE_GX_VALIDATE_H        <freetype/internal/services/svgxval.h>
-#define FT_SERVICE_KERNING_H            <freetype/internal/services/svkern.h>
-#define FT_SERVICE_METRICS_VARIATIONS_H <freetype/internal/services/svmetric.h>
-#define FT_SERVICE_MULTIPLE_MASTERS_H   <freetype/internal/services/svmm.h>
-#define FT_SERVICE_OPENTYPE_VALIDATE_H  <freetype/internal/services/svotval.h>
-#define FT_SERVICE_PFR_H                <freetype/internal/services/svpfr.h>
-#define FT_SERVICE_POSTSCRIPT_CMAPS_H   <freetype/internal/services/svpscmap.h>
-#define FT_SERVICE_POSTSCRIPT_INFO_H    <freetype/internal/services/svpsinfo.h>
-#define FT_SERVICE_POSTSCRIPT_NAME_H    <freetype/internal/services/svpostnm.h>
-#define FT_SERVICE_PROPERTIES_H         <freetype/internal/services/svprop.h>
-#define FT_SERVICE_SFNT_H               <freetype/internal/services/svsfnt.h>
-#define FT_SERVICE_TRUETYPE_ENGINE_H    <freetype/internal/services/svtteng.h>
-#define FT_SERVICE_TRUETYPE_GLYF_H      <freetype/internal/services/svttglyf.h>
-#define FT_SERVICE_TT_CMAP_H            <freetype/internal/services/svttcmap.h>
-#define FT_SERVICE_WINFNT_H             <freetype/internal/services/svwinfnt.h>
-
- /* */
-
 FT_END_HEADER
 
 #endif /* FTSERV_H_ */
diff --git a/include/freetype/internal/ftstream.h b/include/freetype/internal/ftstream.h
index a579a03..e7d9222 100644
--- a/include/freetype/internal/ftstream.h
+++ b/include/freetype/internal/ftstream.h
@@ -4,7 +4,7 @@
  *
  *   Stream handling (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -21,8 +21,8 @@
 
 
 #include <ft2build.h>
-#include FT_SYSTEM_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/ftsystem.h>
+#include <freetype/internal/ftobjs.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/internal/fttrace.h b/include/freetype/internal/fttrace.h
index f5f9598..58bd774 100644
--- a/include/freetype/internal/fttrace.h
+++ b/include/freetype/internal/fttrace.h
@@ -4,7 +4,7 @@
  *
  *   Tracing handling (specification only).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -49,6 +49,7 @@
 FT_TRACE_DEF( sfdriver )  /* SFNT font driver        (sfdriver.c) */
 FT_TRACE_DEF( sfobjs )    /* SFNT object handler     (sfobjs.c)   */
 FT_TRACE_DEF( sfwoff )    /* WOFF format handler     (sfwoff.c)   */
+FT_TRACE_DEF( sfwoff2 )   /* WOFF2 format handler    (sfwoff2.c)  */
 FT_TRACE_DEF( ttbdf )     /* TrueType embedded BDF   (ttbdf.c)    */
 FT_TRACE_DEF( ttcmap )    /* charmap handler         (ttcmap.c)   */
 FT_TRACE_DEF( ttcolr )    /* glyph layer table       (ttcolr.c)   */
diff --git a/include/freetype/internal/ftvalid.h b/include/freetype/internal/ftvalid.h
index 38aa06c..a5bc6c9 100644
--- a/include/freetype/internal/ftvalid.h
+++ b/include/freetype/internal/ftvalid.h
@@ -4,7 +4,7 @@
  *
  *   FreeType validation support (specification).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,9 @@
 #define FTVALID_H_
 
 #include <ft2build.h>
-#include FT_CONFIG_STANDARD_LIBRARY_H   /* for ft_setjmp and ft_longjmp */
+#include FT_CONFIG_STANDARD_LIBRARY_H   /* for ft_jmpbuf */
 
+#include "compiler-macros.h"
 
 FT_BEGIN_HEADER
 
diff --git a/include/freetype/internal/internal.h b/include/freetype/internal/internal.h
deleted file mode 100644
index 3c8830f..0000000
--- a/include/freetype/internal/internal.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
- *
- * internal.h
- *
- *   Internal header files (specification only).
- *
- * Copyright (C) 1996-2019 by
- * David Turner, Robert Wilhelm, and Werner Lemberg.
- *
- * This file is part of the FreeType project, and may only be used,
- * modified, and distributed under the terms of the FreeType project
- * license, LICENSE.TXT.  By continuing to use, modify, or distribute
- * this file you indicate that you have read the license and
- * understand and accept it fully.
- *
- */
-
-
-  /**************************************************************************
-   *
-   * This file is automatically included by `ft2build.h`.  Do not include it
-   * manually!
-   *
-   */
-
-
-#define FT_INTERNAL_OBJECTS_H             <freetype/internal/ftobjs.h>
-#define FT_INTERNAL_STREAM_H              <freetype/internal/ftstream.h>
-#define FT_INTERNAL_MEMORY_H              <freetype/internal/ftmemory.h>
-#define FT_INTERNAL_DEBUG_H               <freetype/internal/ftdebug.h>
-#define FT_INTERNAL_CALC_H                <freetype/internal/ftcalc.h>
-#define FT_INTERNAL_HASH_H                <freetype/internal/fthash.h>
-#define FT_INTERNAL_DRIVER_H              <freetype/internal/ftdrv.h>
-#define FT_INTERNAL_TRACE_H               <freetype/internal/fttrace.h>
-#define FT_INTERNAL_GLYPH_LOADER_H        <freetype/internal/ftgloadr.h>
-#define FT_INTERNAL_SFNT_H                <freetype/internal/sfnt.h>
-#define FT_INTERNAL_SERVICE_H             <freetype/internal/ftserv.h>
-#define FT_INTERNAL_RFORK_H               <freetype/internal/ftrfork.h>
-#define FT_INTERNAL_VALIDATE_H            <freetype/internal/ftvalid.h>
-
-#define FT_INTERNAL_TRUETYPE_TYPES_H      <freetype/internal/tttypes.h>
-#define FT_INTERNAL_TYPE1_TYPES_H         <freetype/internal/t1types.h>
-#define FT_INTERNAL_WOFF_TYPES_H          <freetype/internal/wofftypes.h>
-
-#define FT_INTERNAL_POSTSCRIPT_AUX_H      <freetype/internal/psaux.h>
-#define FT_INTERNAL_POSTSCRIPT_HINTS_H    <freetype/internal/pshints.h>
-#define FT_INTERNAL_POSTSCRIPT_PROPS_H    <freetype/internal/ftpsprop.h>
-
-#define FT_INTERNAL_AUTOHINT_H            <freetype/internal/autohint.h>
-
-#define FT_INTERNAL_CFF_TYPES_H           <freetype/internal/cfftypes.h>
-#define FT_INTERNAL_CFF_OBJECTS_TYPES_H   <freetype/internal/cffotypes.h>
-
-
-#if defined( _MSC_VER )      /* Visual C++ (and Intel C++) */
-
-  /* We disable the warning `conditional expression is constant' here */
-  /* in order to compile cleanly with the maximum level of warnings.  */
-  /* In particular, the warning complains about stuff like `while(0)' */
-  /* which is very useful in macro definitions.  There is no benefit  */
-  /* in having it enabled.                                            */
-#pragma warning( disable : 4127 )
-
-#endif /* _MSC_VER */
-
-
-/* END */
diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h
index f962a97..8e0a262 100644
--- a/include/freetype/internal/psaux.h
+++ b/include/freetype/internal/psaux.h
@@ -5,7 +5,7 @@
  *   Auxiliary functions and data structures related to PostScript fonts
  *   (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -21,14 +21,13 @@
 #define PSAUX_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_TYPE1_TYPES_H
-#include FT_INTERNAL_HASH_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-#include FT_INTERNAL_CFF_TYPES_H
-#include FT_INTERNAL_CFF_OBJECTS_TYPES_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/t1types.h>
+#include <freetype/internal/fthash.h>
+#include <freetype/internal/tttypes.h>
+#include <freetype/internal/services/svpscmap.h>
+#include <freetype/internal/cfftypes.h>
+#include <freetype/internal/cffotypes.h>
 
 
 
diff --git a/include/freetype/internal/pshints.h b/include/freetype/internal/pshints.h
index 699acea..663e9d3 100644
--- a/include/freetype/internal/pshints.h
+++ b/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-2019 by
+ * Copyright (C) 2001-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -22,9 +22,8 @@
 #define PSHINTS_H_
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_TYPE1_TABLES_H
+#include <freetype/freetype.h>
+#include <freetype/t1tables.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/internal/services/svbdf.h b/include/freetype/internal/services/svbdf.h
index e4786ed..81f5a06 100644
--- a/include/freetype/internal/services/svbdf.h
+++ b/include/freetype/internal/services/svbdf.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType BDF services (specification).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,8 +19,8 @@
 #ifndef SVBDF_H_
 #define SVBDF_H_
 
-#include FT_BDF_H
-#include FT_INTERNAL_SERVICE_H
+#include <freetype/ftbdf.h>
+#include <freetype/internal/ftserv.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/internal/services/svcfftl.h b/include/freetype/internal/services/svcfftl.h
index 6c62173..1d2dbb6 100644
--- a/include/freetype/internal/services/svcfftl.h
+++ b/include/freetype/internal/services/svcfftl.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType CFF tables loader service (specification).
  *
- * Copyright (C) 2017-2019 by
+ * Copyright (C) 2017-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,8 +19,8 @@
 #ifndef SVCFFTL_H_
 #define SVCFFTL_H_
 
-#include FT_INTERNAL_SERVICE_H
-#include FT_INTERNAL_CFF_TYPES_H
+#include <freetype/internal/ftserv.h>
+#include <freetype/internal/cfftypes.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/internal/services/svcid.h b/include/freetype/internal/services/svcid.h
index 555a5af..bd49f32 100644
--- a/include/freetype/internal/services/svcid.h
+++ b/include/freetype/internal/services/svcid.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType CID font services (specification).
  *
- * Copyright (C) 2007-2019 by
+ * Copyright (C) 2007-2020 by
  * Derek Clegg and Michael Toftdal.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,7 +19,7 @@
 #ifndef SVCID_H_
 #define SVCID_H_
 
-#include FT_INTERNAL_SERVICE_H
+#include <freetype/internal/ftserv.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/internal/services/svfntfmt.h b/include/freetype/internal/services/svfntfmt.h
index 6f4285e..6114d63 100644
--- a/include/freetype/internal/services/svfntfmt.h
+++ b/include/freetype/internal/services/svfntfmt.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType font format service (specification only).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,7 +19,7 @@
 #ifndef SVFNTFMT_H_
 #define SVFNTFMT_H_
 
-#include FT_INTERNAL_SERVICE_H
+#include <freetype/internal/ftserv.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/internal/services/svgldict.h b/include/freetype/internal/services/svgldict.h
index 0949621..f9443e4 100644
--- a/include/freetype/internal/services/svgldict.h
+++ b/include/freetype/internal/services/svgldict.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType glyph dictionary services (specification).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,7 +19,7 @@
 #ifndef SVGLDICT_H_
 #define SVGLDICT_H_
 
-#include FT_INTERNAL_SERVICE_H
+#include <freetype/internal/ftserv.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/internal/services/svgxval.h b/include/freetype/internal/services/svgxval.h
index 0bb76f3..83c2f26 100644
--- a/include/freetype/internal/services/svgxval.h
+++ b/include/freetype/internal/services/svgxval.h
@@ -4,7 +4,7 @@
  *
  *   FreeType API for validating TrueTypeGX/AAT tables (specification).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
@@ -28,8 +28,8 @@
 #ifndef SVGXVAL_H_
 #define SVGXVAL_H_
 
-#include FT_GX_VALIDATE_H
-#include FT_INTERNAL_VALIDATE_H
+#include <freetype/ftgxval.h>
+#include <freetype/internal/ftvalid.h>
 
 FT_BEGIN_HEADER
 
diff --git a/include/freetype/internal/services/svkern.h b/include/freetype/internal/services/svkern.h
index f992a32..13cfb32 100644
--- a/include/freetype/internal/services/svkern.h
+++ b/include/freetype/internal/services/svkern.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType Kerning service (specification).
  *
- * Copyright (C) 2006-2019 by
+ * Copyright (C) 2006-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,8 +19,8 @@
 #ifndef SVKERN_H_
 #define SVKERN_H_
 
-#include FT_INTERNAL_SERVICE_H
-#include FT_TRUETYPE_TABLES_H
+#include <freetype/internal/ftserv.h>
+#include <freetype/tttables.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/internal/services/svmetric.h b/include/freetype/internal/services/svmetric.h
index d688bc7..2b30eda 100644
--- a/include/freetype/internal/services/svmetric.h
+++ b/include/freetype/internal/services/svmetric.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType services for metrics variations (specification).
  *
- * Copyright (C) 2016-2019 by
+ * Copyright (C) 2016-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,7 +19,7 @@
 #ifndef SVMETRIC_H_
 #define SVMETRIC_H_
 
-#include FT_INTERNAL_SERVICE_H
+#include <freetype/internal/ftserv.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/internal/services/svmm.h b/include/freetype/internal/services/svmm.h
index 3652f20..5a80763 100644
--- a/include/freetype/internal/services/svmm.h
+++ b/include/freetype/internal/services/svmm.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType Multiple Masters and GX var services (specification).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,7 +19,7 @@
 #ifndef SVMM_H_
 #define SVMM_H_
 
-#include FT_INTERNAL_SERVICE_H
+#include <freetype/internal/ftserv.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/internal/services/svotval.h b/include/freetype/internal/services/svotval.h
index cab4c6e..763fb2e 100644
--- a/include/freetype/internal/services/svotval.h
+++ b/include/freetype/internal/services/svotval.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType OpenType validation service (specification).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,8 +19,8 @@
 #ifndef SVOTVAL_H_
 #define SVOTVAL_H_
 
-#include FT_OPENTYPE_VALIDATE_H
-#include FT_INTERNAL_VALIDATE_H
+#include <freetype/ftotval.h>
+#include <freetype/internal/ftvalid.h>
 
 FT_BEGIN_HEADER
 
diff --git a/include/freetype/internal/services/svpfr.h b/include/freetype/internal/services/svpfr.h
index fd01d61..bdeba07 100644
--- a/include/freetype/internal/services/svpfr.h
+++ b/include/freetype/internal/services/svpfr.h
@@ -4,7 +4,7 @@
  *
  *   Internal PFR service functions (specification).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,8 +19,8 @@
 #ifndef SVPFR_H_
 #define SVPFR_H_
 
-#include FT_PFR_H
-#include FT_INTERNAL_SERVICE_H
+#include <freetype/ftpfr.h>
+#include <freetype/internal/ftserv.h>
 
 
 FT_BEGIN_HEADER
@@ -56,7 +56,6 @@
 
   };
 
- /* */
 
 FT_END_HEADER
 
diff --git a/include/freetype/internal/services/svpostnm.h b/include/freetype/internal/services/svpostnm.h
index 18e3843..8ef62c5 100644
--- a/include/freetype/internal/services/svpostnm.h
+++ b/include/freetype/internal/services/svpostnm.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType PostScript name services (specification).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,7 +19,7 @@
 #ifndef SVPOSTNM_H_
 #define SVPOSTNM_H_
 
-#include FT_INTERNAL_SERVICE_H
+#include <freetype/internal/ftserv.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/internal/services/svprop.h b/include/freetype/internal/services/svprop.h
index e48d015..8f75543 100644
--- a/include/freetype/internal/services/svprop.h
+++ b/include/freetype/internal/services/svprop.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType property service (specification).
  *
- * Copyright (C) 2012-2019 by
+ * Copyright (C) 2012-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/include/freetype/internal/services/svpscmap.h b/include/freetype/internal/services/svpscmap.h
index dfac3ba..b4dcd80 100644
--- a/include/freetype/internal/services/svpscmap.h
+++ b/include/freetype/internal/services/svpscmap.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType PostScript charmap service (specification).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,7 +19,7 @@
 #ifndef SVPSCMAP_H_
 #define SVPSCMAP_H_
 
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/ftobjs.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/internal/services/svpsinfo.h b/include/freetype/internal/services/svpsinfo.h
index fb4e0e3..1e7276f 100644
--- a/include/freetype/internal/services/svpsinfo.h
+++ b/include/freetype/internal/services/svpsinfo.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType PostScript info service (specification).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,8 +19,8 @@
 #ifndef SVPSINFO_H_
 #define SVPSINFO_H_
 
-#include FT_INTERNAL_SERVICE_H
-#include FT_INTERNAL_TYPE1_TYPES_H
+#include <freetype/internal/ftserv.h>
+#include <freetype/internal/t1types.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/internal/services/svsfnt.h b/include/freetype/internal/services/svsfnt.h
index 464aa20..39c8b5e 100644
--- a/include/freetype/internal/services/svsfnt.h
+++ b/include/freetype/internal/services/svsfnt.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType SFNT table loading service (specification).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,8 +19,8 @@
 #ifndef SVSFNT_H_
 #define SVSFNT_H_
 
-#include FT_INTERNAL_SERVICE_H
-#include FT_TRUETYPE_TABLES_H
+#include <freetype/internal/ftserv.h>
+#include <freetype/tttables.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/internal/services/svttcmap.h b/include/freetype/internal/services/svttcmap.h
index 0fcb813..c18bb23 100644
--- a/include/freetype/internal/services/svttcmap.h
+++ b/include/freetype/internal/services/svttcmap.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType TrueType/sfnt cmap extra information service.
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * Masatake YAMATO, Redhat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
@@ -22,8 +22,8 @@
 #ifndef SVTTCMAP_H_
 #define SVTTCMAP_H_
 
-#include FT_INTERNAL_SERVICE_H
-#include FT_TRUETYPE_TABLES_H
+#include <freetype/internal/ftserv.h>
+#include <freetype/tttables.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/internal/services/svtteng.h b/include/freetype/internal/services/svtteng.h
index a852f5c..7a17e4a 100644
--- a/include/freetype/internal/services/svtteng.h
+++ b/include/freetype/internal/services/svtteng.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType TrueType engine query service (specification).
  *
- * Copyright (C) 2006-2019 by
+ * Copyright (C) 2006-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,8 +19,8 @@
 #ifndef SVTTENG_H_
 #define SVTTENG_H_
 
-#include FT_INTERNAL_SERVICE_H
-#include FT_MODULE_H
+#include <freetype/internal/ftserv.h>
+#include <freetype/ftmodapi.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/internal/services/svttglyf.h b/include/freetype/internal/services/svttglyf.h
index c879877..90a81dd 100644
--- a/include/freetype/internal/services/svttglyf.h
+++ b/include/freetype/internal/services/svttglyf.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType TrueType glyph service.
  *
- * Copyright (C) 2007-2019 by
+ * Copyright (C) 2007-2020 by
  * David Turner.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -18,8 +18,8 @@
 #ifndef SVTTGLYF_H_
 #define SVTTGLYF_H_
 
-#include FT_INTERNAL_SERVICE_H
-#include FT_TRUETYPE_TABLES_H
+#include <freetype/internal/ftserv.h>
+#include <freetype/tttables.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/internal/services/svwinfnt.h b/include/freetype/internal/services/svwinfnt.h
index 38ee020..8c915f5 100644
--- a/include/freetype/internal/services/svwinfnt.h
+++ b/include/freetype/internal/services/svwinfnt.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType Windows FNT/FONT service (specification).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,8 +19,8 @@
 #ifndef SVWINFNT_H_
 #define SVWINFNT_H_
 
-#include FT_INTERNAL_SERVICE_H
-#include FT_WINFONTS_H
+#include <freetype/internal/ftserv.h>
+#include <freetype/ftwinfnt.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/internal/sfnt.h b/include/freetype/internal/sfnt.h
index b19241c..b4c12db 100644
--- a/include/freetype/internal/sfnt.h
+++ b/include/freetype/internal/sfnt.h
@@ -4,7 +4,7 @@
  *
  *   High-level 'sfnt' driver interface (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,10 +20,9 @@
 #define SFNT_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
-#include FT_INTERNAL_WOFF_TYPES_H
+#include <freetype/internal/ftdrv.h>
+#include <freetype/internal/tttypes.h>
+#include <freetype/internal/wofftypes.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/internal/t1types.h b/include/freetype/internal/t1types.h
index d94c8c1..6a0fe5e 100644
--- a/include/freetype/internal/t1types.h
+++ b/include/freetype/internal/t1types.h
@@ -5,7 +5,7 @@
  *   Basic Type1/Type2 type definitions and interface (specification
  *   only).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -21,12 +21,11 @@
 #define T1TYPES_H_
 
 
-#include <ft2build.h>
-#include FT_TYPE1_TABLES_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
-#include FT_INTERNAL_SERVICE_H
-#include FT_INTERNAL_HASH_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
+#include <freetype/t1tables.h>
+#include <freetype/internal/pshints.h>
+#include <freetype/internal/ftserv.h>
+#include <freetype/internal/fthash.h>
+#include <freetype/internal/services/svpscmap.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h
index 23db240..c36342c 100644
--- a/include/freetype/internal/tttypes.h
+++ b/include/freetype/internal/tttypes.h
@@ -5,7 +5,7 @@
  *   Basic SFNT/TrueType type definitions and interface (specification
  *   only).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -21,13 +21,12 @@
 #define TTTYPES_H_
 
 
-#include <ft2build.h>
-#include FT_TRUETYPE_TABLES_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_COLOR_H
+#include <freetype/tttables.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/ftcolor.h>
 
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include FT_MULTIPLE_MASTERS_H
+#include <freetype/ftmm.h>
 #endif
 
 
diff --git a/include/freetype/internal/wofftypes.h b/include/freetype/internal/wofftypes.h
index ba55bf8..1874a13 100644
--- a/include/freetype/internal/wofftypes.h
+++ b/include/freetype/internal/wofftypes.h
@@ -5,7 +5,7 @@
  *   Basic WOFF/WOFF2 type definitions and interface (specification
  *   only).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -21,9 +21,8 @@
 #define WOFFTYPES_H_
 
 
-#include <ft2build.h>
-#include FT_TRUETYPE_TABLES_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/tttables.h>
+#include <freetype/internal/ftobjs.h>
 
 
 FT_BEGIN_HEADER
@@ -104,6 +103,207 @@
   } WOFF_TableRec, *WOFF_Table;
 
 
+  /**************************************************************************
+   *
+   * @struct:
+   *   WOFF2_TtcFontRec
+   *
+   * @description:
+   *   Metadata for a TTC font entry in WOFF2.
+   *
+   * @fields:
+   *   flavor ::
+   *     TTC font flavor.
+   *
+   *   num_tables ::
+   *     Number of tables in TTC, indicating number of elements in
+   *     `table_indices`.
+   *
+   *   table_indices ::
+   *     Array of table indices for each TTC font.
+   */
+  typedef struct  WOFF2_TtcFontRec_
+  {
+    FT_ULong    flavor;
+    FT_UShort   num_tables;
+    FT_UShort*  table_indices;
+
+  } WOFF2_TtcFontRec, *WOFF2_TtcFont;
+
+
+  /**************************************************************************
+   *
+   * @struct:
+   *   WOFF2_HeaderRec
+   *
+   * @description:
+   *   WOFF2 file format header.
+   *
+   * @fields:
+   *   See
+   *
+   *     https://www.w3.org/TR/WOFF2/#woff20Header
+   *
+   * @note:
+   *   We don't care about the fields `reserved`, `majorVersion` and
+   *   `minorVersion`, so they are not included.  The `totalSfntSize` field
+   *   does not necessarily represent the actual size of the uncompressed
+   *   SFNT font stream, so that is used as a reference value instead.
+   */
+  typedef struct  WOFF2_HeaderRec_
+  {
+    FT_ULong   signature;
+    FT_ULong   flavor;
+    FT_ULong   length;
+    FT_UShort  num_tables;
+    FT_ULong   totalSfntSize;
+    FT_ULong   totalCompressedSize;
+    FT_ULong   metaOffset;
+    FT_ULong   metaLength;
+    FT_ULong   metaOrigLength;
+    FT_ULong   privOffset;
+    FT_ULong   privLength;
+
+    FT_ULong   uncompressed_size;    /* uncompressed brotli stream size */
+    FT_ULong   compressed_offset;    /* compressed stream offset        */
+    FT_ULong   header_version;       /* version of original TTC Header  */
+    FT_UShort  num_fonts;            /* number of fonts in TTC          */
+    FT_ULong   actual_sfnt_size;     /* actual size of sfnt stream      */
+
+    WOFF2_TtcFont  ttc_fonts;        /* metadata for fonts in a TTC     */
+
+  } WOFF2_HeaderRec, *WOFF2_Header;
+
+
+  /**************************************************************************
+   *
+   * @struct:
+   *   WOFF2_TableRec
+   *
+   * @description:
+   *   This structure describes a given table of a WOFF2 font.
+   *
+   * @fields:
+   *   See
+   *
+   *     https://www.w3.org/TR/WOFF2/#table_dir_format
+   */
+  typedef struct  WOFF2_TableRec_
+  {
+    FT_Byte   FlagByte;           /* table type and flags      */
+    FT_ULong  Tag;                /* table file offset         */
+    FT_ULong  dst_length;         /* uncompressed table length */
+    FT_ULong  TransformLength;    /* transformed length        */
+
+    FT_ULong  flags;              /* calculated flags          */
+    FT_ULong  src_offset;         /* compressed table offset   */
+    FT_ULong  src_length;         /* compressed table length   */
+    FT_ULong  dst_offset;         /* uncompressed table offset */
+
+  } WOFF2_TableRec, *WOFF2_Table;
+
+
+  /**************************************************************************
+   *
+   * @struct:
+   *   WOFF2_InfoRec
+   *
+   * @description:
+   *   Metadata for WOFF2 font that may be required for reconstruction of
+   *   sfnt tables.
+   *
+   * @fields:
+   *   header_checksum ::
+   *     Checksum of SFNT offset table.
+   *
+   *   num_glyphs ::
+   *     Number of glyphs in the font.
+   *
+   *   num_hmetrics ::
+   *     `numberOfHMetrics` field in the 'hhea' table.
+   *
+   *   x_mins ::
+   *     `xMin` values of glyph bounding box.
+   *
+   *   glyf_table ::
+   *     A pointer to the `glyf' table record.
+   *
+   *   loca_table ::
+   *     A pointer to the `loca' table record.
+   *
+   *   head_table ::
+   *     A pointer to the `head' table record.
+   */
+  typedef struct  WOFF2_InfoRec_
+  {
+    FT_ULong   header_checksum;
+    FT_UShort  num_glyphs;
+    FT_UShort  num_hmetrics;
+    FT_Short*  x_mins;
+
+    WOFF2_Table  glyf_table;
+    WOFF2_Table  loca_table;
+    WOFF2_Table  head_table;
+
+  } WOFF2_InfoRec, *WOFF2_Info;
+
+
+  /**************************************************************************
+   *
+   * @struct:
+   *   WOFF2_SubstreamRec
+   *
+   * @description:
+   *   This structure stores information about a substream in the transformed
+   *   'glyf' table in a WOFF2 stream.
+   *
+   * @fields:
+   *   start ::
+   *     Beginning of the substream relative to uncompressed table stream.
+   *
+   *   offset ::
+   *     Offset of the substream relative to uncompressed table stream.
+   *
+   *   size ::
+   *     Size of the substream.
+   */
+  typedef struct  WOFF2_SubstreamRec_
+  {
+    FT_ULong  start;
+    FT_ULong  offset;
+    FT_ULong  size;
+
+  } WOFF2_SubstreamRec, *WOFF2_Substream;
+
+
+  /**************************************************************************
+   *
+   * @struct:
+   *   WOFF2_PointRec
+   *
+   * @description:
+   *   This structure stores information about a point in the transformed
+   *   'glyf' table in a WOFF2 stream.
+   *
+   * @fields:
+   *   x ::
+   *     x-coordinate of point.
+   *
+   *   y ::
+   *     y-coordinate of point.
+   *
+   *   on_curve ::
+   *     Set if point is on-curve.
+   */
+  typedef struct  WOFF2_PointRec_
+  {
+    FT_Int   x;
+    FT_Int   y;
+    FT_Bool  on_curve;
+
+  } WOFF2_PointRec, *WOFF2_Point;
+
+
 FT_END_HEADER
 
 #endif /* WOFFTYPES_H_ */
diff --git a/include/freetype/t1tables.h b/include/freetype/t1tables.h
index 645e645..426e140 100644
--- a/include/freetype/t1tables.h
+++ b/include/freetype/t1tables.h
@@ -5,7 +5,7 @@
  *   Basic Type 1/Type 2 tables definitions and interface (specification
  *   only).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -21,8 +21,7 @@
 #define T1TABLES_H_
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
diff --git a/include/freetype/ttnameid.h b/include/freetype/ttnameid.h
index cc677de..2b2ed4c 100644
--- a/include/freetype/ttnameid.h
+++ b/include/freetype/ttnameid.h
@@ -4,7 +4,7 @@
  *
  *   TrueType name ID definitions (specification only).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,7 +20,6 @@
 #define TTNAMEID_H_
 
 
-#include <ft2build.h>
 
 
 FT_BEGIN_HEADER
diff --git a/include/freetype/tttables.h b/include/freetype/tttables.h
index d04f810..c8fa35e 100644
--- a/include/freetype/tttables.h
+++ b/include/freetype/tttables.h
@@ -5,7 +5,7 @@
  *   Basic SFNT/TrueType tables definitions and interface
  *   (specification only).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -21,8 +21,7 @@
 #define TTTABLES_H_
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
diff --git a/include/freetype/tttags.h b/include/freetype/tttags.h
index bd0986e..3c9fbd5 100644
--- a/include/freetype/tttags.h
+++ b/include/freetype/tttags.h
@@ -4,7 +4,7 @@
  *
  *   Tags for TrueType and OpenType tables (specification only).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
 #define TTAGS_H_
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
@@ -107,6 +106,7 @@
 #define TTAG_vmtx  FT_MAKE_TAG( 'v', 'm', 't', 'x' )
 #define TTAG_VVAR  FT_MAKE_TAG( 'V', 'V', 'A', 'R' )
 #define TTAG_wOFF  FT_MAKE_TAG( 'w', 'O', 'F', 'F' )
+#define TTAG_wOF2  FT_MAKE_TAG( 'w', 'O', 'F', '2' )
 
 /* used by "Keyboard.dfont" on legacy Mac OS X */
 #define TTAG_0xA5kbd  FT_MAKE_TAG( 0xA5, 'k', 'b', 'd' )
diff --git a/include/ft2build.h b/include/ft2build.h
index e3f4887..b4fd1f8 100644
--- a/include/ft2build.h
+++ b/include/ft2build.h
@@ -4,7 +4,7 @@
  *
  *   FreeType 2 build and setup macros.
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -18,16 +18,14 @@
 
   /**************************************************************************
    *
-   * This is the 'entry point' for FreeType header file inclusions.  It is
-   * the only header file which should be included directly; all other
-   * FreeType header files should be accessed with macro names (after
-   * including `ft2build.h`).
+   * This is the 'entry point' for FreeType header file inclusions, to be
+   * loaded before all other header files.
    *
    * A typical example is
    *
    * ```
    *   #include <ft2build.h>
-   *   #include FT_FREETYPE_H
+   *   #include <freetype/freetype.h>
    * ```
    *
    */
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..ea30495
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,368 @@
+#
+# Meson project file for FreeType 2
+#
+
+# Copyright (C) 2020 by
+# David Turner, Robert Wilhelm, and Werner Lemberg.
+#
+# This file is part of the FreeType project, and may only be used, modified,
+# and distributed under the terms of the FreeType project license,
+# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
+# indicate that you have read the license and understand and accept it
+# fully.
+
+
+project('freetype2', 'c',
+  meson_version: '>= 0.55.0',
+  default_options: ['default_library=both'],
+)
+
+#
+# Rules to compile the FreeType 2 library itself
+#
+
+
+# Apparently meson doesn't provide a read_file() function, so instead
+# running an external command is required.
+
+python = import('python')
+python_exe = python.find_installation(required: true)
+
+ft2_version = run_command(python_exe,
+  files('builds/meson/extract_freetype_version.py'),
+  files('include/freetype/freetype.h')).stdout().strip()
+
+ft2_libtool_version = run_command(python_exe,
+  files('builds/meson/extract_libtool_version.py'),
+  '--soversion',
+  files('builds/unix/configure.raw')).stdout().strip()
+
+ft2_includes = include_directories('include')
+
+
+# Generate a custom `ftmodule.h` version based on the content of
+# `modules.cfg`.
+
+ftmodule_h = custom_target('ftmodule.h',
+  output: 'ftmodule.h',
+  input: 'modules.cfg',
+  command: [python_exe, files('builds/meson/parse_modules_cfg.py'),
+            '--format=ftmodule.h', '@INPUT@', '--output', '@OUTPUT@'],
+  install: true,
+  install_dir: 'include/freetype2/freetype/config',
+)
+ft2_sources = [ftmodule_h]
+
+
+# FreeType 2 modules.
+
+ft_main_modules = run_command(python_exe,
+  files('builds/meson/parse_modules_cfg.py'),
+  '--format=main-modules',
+  files('modules.cfg')).stdout().strip().split()
+
+ft2_sources += files([
+  'src/base/ftbase.c',
+  'src/base/ftinit.c',
+])
+
+foreach mod: ft_main_modules
+  source = mod
+  if mod == 'winfonts'
+    source = 'winfnt'
+  elif mod == 'cid'
+    source = 'type1cid'
+  endif
+  ft2_sources += 'src/@0@/@1@.c'.format(mod, source)
+endforeach
+
+# NOTE: The `gzip` and `bzip2` aux modules are handled through options.
+ft_aux_modules = run_command(python_exe,
+  files('builds/meson/parse_modules_cfg.py'),
+  '--format=aux-modules',
+  files('modules.cfg')).stdout().strip().split()
+
+foreach auxmod: ft_aux_modules
+  source = auxmod
+  # Most sources are named `src/<module>/<module>.c`, but there are a few
+  # exceptions handled here.
+  if auxmod == 'cache'
+    source = 'ftcache'
+  elif auxmod == 'lzw'
+    source = 'ftlzw'
+  elif auxmod == 'gzip' or auxmod == 'bzip2'
+    # Handled through options instead, see below.
+    continue
+  endif
+  ft2_sources += 'src/@0@/@1@.c'.format(auxmod, source)
+endforeach
+
+
+# FreeType 2 base extensions.
+# Normally configured through `modules.cfg`.
+
+base_extensions = run_command(python_exe,
+  files('builds/meson/parse_modules_cfg.py'),
+  '--format=base-extensions-list',
+  files('modules.cfg')).stdout().split()
+
+foreach ext: base_extensions
+  ft2_sources += files('src/base/' + ext)
+endforeach
+
+
+# Header files.
+
+ft2_public_headers = files([
+  'include/freetype/freetype.h',
+  'include/freetype/ftadvanc.h',
+  'include/freetype/ftbbox.h',
+  'include/freetype/ftbdf.h',
+  'include/freetype/ftbitmap.h',
+  'include/freetype/ftbzip2.h',
+  'include/freetype/ftcache.h',
+  'include/freetype/ftchapters.h',
+  'include/freetype/ftcolor.h',
+  'include/freetype/ftdriver.h',
+  'include/freetype/fterrdef.h',
+  'include/freetype/fterrors.h',
+  'include/freetype/ftfntfmt.h',
+  'include/freetype/ftgasp.h',
+  'include/freetype/ftglyph.h',
+  'include/freetype/ftgxval.h',
+  'include/freetype/ftgzip.h',
+  'include/freetype/ftimage.h',
+  'include/freetype/ftincrem.h',
+  'include/freetype/ftlcdfil.h',
+  'include/freetype/ftlist.h',
+  'include/freetype/ftlzw.h',
+  'include/freetype/ftmac.h',
+  'include/freetype/ftmm.h',
+  'include/freetype/ftmodapi.h',
+  'include/freetype/ftmoderr.h',
+  'include/freetype/ftotval.h',
+  'include/freetype/ftoutln.h',
+  'include/freetype/ftparams.h',
+  'include/freetype/ftpfr.h',
+  'include/freetype/ftrender.h',
+  'include/freetype/ftsizes.h',
+  'include/freetype/ftsnames.h',
+  'include/freetype/ftstroke.h',
+  'include/freetype/ftsynth.h',
+  'include/freetype/ftsystem.h',
+  'include/freetype/fttrigon.h',
+  'include/freetype/fttypes.h',
+  'include/freetype/ftwinfnt.h',
+  'include/freetype/t1tables.h',
+  'include/freetype/ttnameid.h',
+  'include/freetype/tttables.h',
+  'include/freetype/tttags.h',
+])
+
+ft2_config_headers = files([
+  'include/freetype/config/ftconfig.h',
+  'include/freetype/config/ftheader.h',
+  'include/freetype/config/ftstdlib.h',
+  'include/freetype/config/integer-types.h',
+  'include/freetype/config/mac-support.h',
+  'include/freetype/config/public-macros.h',
+])
+
+ft2_defines = []
+
+
+# System support file.
+
+cc = meson.get_compiler('c')
+
+# NOTE: msys2 on Windows has `unistd.h` and `fcntl.h` but not `sys/mman.h`!
+has_unistd_h = cc.has_header('unistd.h')
+has_fcntl_h = cc.has_header('fcntl.h')
+has_sys_mman_h = cc.has_header('sys/mman.h')
+
+if has_unistd_h
+  ft2_defines += ['-DHAVE_UNISTD_H=1']
+endif
+if has_fcntl_h
+  ft2_defines += ['-DHAVE_FCNTL_H']
+endif
+
+mmap_option = get_option('mmap')
+if mmap_option.auto()
+  use_mmap = has_unistd_h and has_fcntl_h and has_sys_mman_h
+else
+  use_mmap = mmap_option.enabled()
+endif
+if use_mmap
+  # This version of ftsystem.c uses mmap() to read input font files.
+  ft2_sources += files(['builds/unix/ftsystem.c',])
+else
+  ft2_sources += files(['src/base/ftsystem.c',])
+endif
+
+
+# Debug support file
+#
+# NOTE: Some specialized versions exist for other platforms not supported by
+# Meson.  Most implementation differences are extremely minor, i.e., in the
+# implementation of FT_Message() and FT_Panic(), and getting the `FT2_DEBUG`
+# value from the environment, when this is supported.  A smaller refactor
+# might make these platform-specific files much smaller, and could be moved
+# into `ftsystem.c` as well.
+#
+if host_machine.system() == 'windows'
+  ft2_debug_src = 'builds/windows/ftdebug.c'
+else
+  ft2_debug_src = 'src/base/ftdebug.c'
+endif
+ft2_sources += files([ft2_debug_src])
+
+ft2_deps = []
+
+
+# Generate `ftoption.h` based on available dependencies.
+
+ftoption_command = [python_exe,
+  files('builds/meson/process_ftoption_h.py'),
+  '@INPUT@', '--output=@OUTPUT@']
+
+# GZip support
+zlib_option = get_option('zlib')
+if zlib_option == 'disabled'
+  ftoption_command += ['--disable=FT_CONFIG_OPTION_USE_ZLIB']
+else
+  ftoption_command += ['--enable=FT_CONFIG_OPTION_USE_ZLIB']
+  if zlib_option == 'builtin'
+    ftoption_command += ['--disable=FT_CONFIG_OPTION_SYSTEM_ZLIB']
+  else
+    # Probe for the system version.
+    zlib_system = dependency('zlib', required: zlib_option == 'system')
+    ft2_deps += [zlib_system]
+    ftoption_command += ['--enable=FT_CONFIG_OPTION_SYSTEM_ZLIB']
+  endif
+  ft2_sources += files(['src/gzip/ftgzip.c',])
+endif
+
+# BZip2 support
+#
+# IMPORTANT NOTE: Without `static: false` here, Meson will find both the
+# static library version and the shared library version when they are
+# installed on the system, and will try to link them *both* to the final
+# library!
+bzip2_dep = meson.get_compiler('c').find_library('bz2',
+              static: false,
+              required: get_option('bzip2'))
+if bzip2_dep.found()
+  ftoption_command += ['--enable=FT_CONFIG_OPTION_USE_BZIP2']
+  ft2_sources += files(['src/bzip2/ftbzip2.c',])
+  ft2_deps += [bzip2_dep]
+endif
+
+# PNG support
+libpng_dep = dependency('libpng', required: get_option('png'))
+ftoption_command += ['--enable=FT_CONFIG_OPTION_USE_PNG']
+ft2_deps += [libpng_dep]
+
+# Harfbuzz support
+harfbuzz_dep = dependency('harfbuzz',
+                 version: '>= 1.8.0',
+                 required: get_option('harfbuzz'))
+ftoption_command += ['--enable=FT_CONFIG_OPTION_USE_HARFBUZZ']
+ft2_deps += [harfbuzz_dep]
+
+# Brotli decompression support
+brotli_dep = dependency('libbrotlidec', required: get_option('brotli'))
+ftoption_command += ['--enable=FT_CONFIG_OPTION_USE_BROTLI']
+ft2_deps += [brotli_dep]
+
+# We can now generate `ftoption.h`.
+ftoption_h = custom_target('ftoption.h',
+  input: 'include/freetype/config/ftoption.h',
+  output: 'ftoption.h',
+  command: ftoption_command,
+  install: true,
+  install_dir: 'include/freetype2/freetype/config',
+)
+ft2_sources += ftoption_h
+
+
+# QUESTION: What if the compiler doesn't support `-D` but uses `/D` instead
+# as on Windows?
+#
+# Other build systems have something like c_defines to list defines in a
+# more portable way.  For now assume the compiler supports `-D` (hint: Visual
+# Studio does).
+ft2_defines += ['-DFT2_BUILD_LIBRARY=1']
+
+
+# Ensure that the `ftoption.h` file generated above will be used to build
+# FreeType.  Unfortunately, and very surprisingly, configure_file() does not
+# support putting the output file in a sub-directory, so we have to override
+# the default which is `<freetype/config/ftoption.h>`.
+#
+# It would be cleaner to generate the file directly into
+# `${MESON_BUILD_DIR}/freetype/config/ftoption.h`.  See
+# 'https://github.com/mesonbuild/meson/issues/2320' for details.
+ft2_defines += ['-DFT_CONFIG_OPTIONS_H=<ftoption.h>']
+
+ft2_c_args = ft2_defines
+if cc.has_function_attribute('visibility:hidden')
+  ft2_c_args += ['-fvisibility=hidden']
+endif
+
+ft2_lib = library('freetype',
+  sources: ft2_sources + [ftmodule_h],
+  c_args: ft2_c_args,
+  include_directories: ft2_includes,
+  dependencies: ft2_deps,
+  install: true,
+  version: ft2_libtool_version,
+)
+
+
+# To be used by other projects including this one through subproject().
+freetype2_dep = declare_dependency(
+  include_directories: ft2_includes,
+  link_with: ft2_lib,
+  version: ft2_libtool_version)
+
+
+# NOTE: Using both `install_dir` and `subdir` doesn't seem to work below,
+# i.e., the subdir value seems to be ignored, contrary to examples in the
+# Meson documentation.
+install_headers('include/ft2build.h',
+   install_dir: 'include/freetype2')
+install_headers(ft2_public_headers,
+  install_dir: 'include/freetype2/freetype')
+install_headers(ft2_config_headers,
+  install_dir: 'include/freetype2/freetype/config')
+
+
+# TODO(david): Declare_dependency() for using this in a Meson subproject
+#
+pkgconfig = import('pkgconfig')
+pkgconfig.generate(ft2_lib,
+  filebase: 'freetype2',
+  name: 'FreeType 2',
+  description: 'A free, high-quality, and portable font engine.',
+  url: 'https://freetype.org',
+  subdirs: 'freetype2',
+  version: ft2_libtool_version,
+)
+
+
+# NOTE: Unlike the old `make refdoc` command, this generates the
+# documentation under `$BUILD/docs/` since Meson doesn't support modifying
+# the source root directory (which is a good thing).
+gen_docs = custom_target('freetype2 reference documentation',
+  output: 'docs',
+  input: ft2_public_headers + ft2_config_headers,
+  command: [python_exe,
+    files('builds/meson/generate_reference_docs.py'),
+    '--version=' + ft2_version,
+    '--input-dir=' + meson.source_root(),
+    '--output-dir=@OUTPUT@'
+  ],
+)
+
+# EOF
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..74ed16b
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,47 @@
+#
+# meson_options.txt
+#
+
+# Copyright (C) 2020 by
+# David Turner, Robert Wilhelm, and Werner Lemberg.
+#
+# This file is part of the FreeType project, and may only be used, modified,
+# and distributed under the terms of the FreeType project license,
+# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
+# indicate that you have read the license and understand and accept it
+# fully.
+
+
+option('zlib',
+  type: 'combo',
+  choices: ['disabled', 'auto', 'builtin', 'system'],
+  value: 'auto',
+  description: 'Support reading gzip-compressed font files.')
+
+option('bzip2',
+  type: 'feature',
+  value: 'auto',
+  description: 'Support reading bzip2-compressed font files.')
+
+option('png',
+  type: 'feature',
+  value: 'auto',
+  description: 'Support color bitmap glyph formats in the PNG format.'
+               + 'Requires libpng.')
+
+option('harfbuzz',
+  type: 'feature',
+  value: 'auto',
+  description: 'Use Harfbuzz library to improve auto-hinting.'
+               + ' If available, many glyphs not directly addressable'
+               + ' by a font\'s character map will be hinted also.')
+
+option('brotli',
+  type: 'feature',
+  value: 'auto',
+  description: 'Use Brotli library to support decompressing WOFF2 fonts.')
+
+option('mmap',
+  type: 'feature',
+  value: 'auto',
+  description: 'Use mmap() to open font files for faster parsing.')
diff --git a/modules.cfg b/modules.cfg
index dc6c8d4..d6cdbe5 100644
--- a/modules.cfg
+++ b/modules.cfg
@@ -1,6 +1,6 @@
 # modules.cfg
 #
-# Copyright (C) 2005-2019 by
+# Copyright (C) 2005-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/Jamfile b/src/Jamfile
deleted file mode 100644
index 3ad2d5c..0000000
--- a/src/Jamfile
+++ /dev/null
@@ -1,19 +0,0 @@
-# FreeType 2 src Jamfile
-#
-# Copyright (C) 2001-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) ;
-
-for xx in $(FT2_COMPONENTS)
-{
-  SubInclude FT2_TOP $(FT2_SRC_DIR) $(xx) ;
-}
-
-# end of src Jamfile
diff --git a/src/autofit/Jamfile b/src/autofit/Jamfile
deleted file mode 100644
index ea69dee..0000000
--- a/src/autofit/Jamfile
+++ /dev/null
@@ -1,53 +0,0 @@
-# FreeType 2 src/autofit Jamfile
-#
-# Copyright (C) 2003-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir FT2_TOP src autofit ;
-
-{
-  local  _sources ;
-
-  # define FT2_AUTOFIT2 to enable experimental latin hinter replacement
-  if $(FT2_AUTOFIT2)
-  {
-    CCFLAGS += FT_OPTION_AUTOFIT2 ;
-  }
-  if $(FT2_MULTI)
-  {
-    _sources = afangles
-               afblue
-               afcjk
-               afdummy
-               afglobal
-               afhints
-               afindic
-               aflatin
-               afloader
-               afmodule
-               afpic
-               afranges
-               afshaper
-               afwarp
-               ;
-
-    if $(FT2_AUTOFIT2)
-    {
-      _sources += aflatin2 ;
-    }
-  }
-  else
-  {
-    _sources = autofit ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/autofit Jamfile
diff --git a/src/autofit/afangles.c b/src/autofit/afangles.c
index 9e1f7a2..a2d45eb 100644
--- a/src/autofit/afangles.c
+++ b/src/autofit/afangles.c
@@ -5,7 +5,7 @@
  *   Routines used to compute vector angles with limited accuracy
  *   and very high speed.  It also contains sorting routines (body).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/autofit/afblue.c b/src/autofit/afblue.c
index b99dbeb..9ebffdd 100644
--- a/src/autofit/afblue.c
+++ b/src/autofit/afblue.c
@@ -7,7 +7,7 @@
  *
  *   Auto-fitter data for blue strings (body).
  *
- * Copyright (C) 2013-2019 by
+ * Copyright (C) 2013-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -134,7 +134,7 @@
     '\0',
     '\xF0', '\x90', '\x90', '\xA8', ' ', '\xF0', '\x90', '\x90', '\xAA', ' ', '\xF0', '\x90', '\x90', '\xAC', ' ', '\xF0', '\x90', '\x90', '\xBF', ' ', '\xF0', '\x90', '\x91', '\x83',  /* 𐐨 𐐪 𐐬 𐐿 𐑃 */
     '\0',
-    '\xE0', '\xA4', '\x95', ' ', '\xE0', '\xA4', '\xAE', ' ', '\xE0', '\xA4', '\x85', ' ', '\xE0', '\xA4', '\x86', ' ', '\xE0', '\xA4', '\xA5', ' ', '\xE0', '\xA4', '\xA7', ' ', '\xE0', '\xA4', '\xAD', ' ', '\xE0', '\xA4', '\xB6',  /* क म अ आ थ ध भ श */
+    '\xE0', '\xA4', '\x95', ' ', '\xE0', '\xA4', '\xA8', ' ', '\xE0', '\xA4', '\xAE', ' ', '\xE0', '\xA4', '\x89', ' ', '\xE0', '\xA4', '\x9B', ' ', '\xE0', '\xA4', '\x9F', ' ', '\xE0', '\xA4', '\xA0', ' ', '\xE0', '\xA4', '\xA1',  /* क न म उ छ ट ठ ड */
     '\0',
     '\xE0', '\xA4', '\x88', ' ', '\xE0', '\xA4', '\x90', ' ', '\xE0', '\xA4', '\x93', ' ', '\xE0', '\xA4', '\x94', ' ', '\xE0', '\xA4', '\xBF', ' ', '\xE0', '\xA5', '\x80', ' ', '\xE0', '\xA5', '\x8B', ' ', '\xE0', '\xA5', '\x8C',  /* ई ऐ ओ औ ि ी ो ौ */
     '\0',
@@ -296,6 +296,20 @@
     '\0',
     '\xE0', '\xB4', '\x9F', ' ', '\xE0', '\xB4', '\xA0', ' ', '\xE0', '\xB4', '\xA7', ' ', '\xE0', '\xB4', '\xB6', ' ', '\xE0', '\xB4', '\x98', ' ', '\xE0', '\xB4', '\x9A', ' ', '\xE0', '\xB4', '\xA5', ' ', '\xE0', '\xB4', '\xB2',  /* ട ഠ ധ ശ ഘ ച ഥ ല */
     '\0',
+    '\xF0', '\x96', '\xB9', '\x80', ' ', '\xF0', '\x96', '\xB9', '\x81', ' ', '\xF0', '\x96', '\xB9', '\x82', ' ', '\xF0', '\x96', '\xB9', '\x83', ' ', '\xF0', '\x96', '\xB9', '\x8F', ' ', '\xF0', '\x96', '\xB9', '\x9A', ' ', '\xF0', '\x96', '\xB9', '\x9F',  /* 𖹀 𖹁 𖹂 𖹃 𖹏 𖹚 𖹟 */
+    '\0',
+    '\xF0', '\x96', '\xB9', '\x80', ' ', '\xF0', '\x96', '\xB9', '\x81', ' ', '\xF0', '\x96', '\xB9', '\x82', ' ', '\xF0', '\x96', '\xB9', '\x83', ' ', '\xF0', '\x96', '\xB9', '\x8F', ' ', '\xF0', '\x96', '\xB9', '\x9A', ' ', '\xF0', '\x96', '\xB9', '\x92', ' ', '\xF0', '\x96', '\xB9', '\x93',  /* 𖹀 𖹁 𖹂 𖹃 𖹏 𖹚 𖹒 𖹓 */
+    '\0',
+    '\xF0', '\x96', '\xB9', '\xA4', ' ', '\xF0', '\x96', '\xB9', '\xAC', ' ', '\xF0', '\x96', '\xB9', '\xA7', ' ', '\xF0', '\x96', '\xB9', '\xB4', ' ', '\xF0', '\x96', '\xB9', '\xB6', ' ', '\xF0', '\x96', '\xB9', '\xBE',  /* 𖹤 𖹬 𖹧 𖹴 𖹶 𖹾 */
+    '\0',
+    '\xF0', '\x96', '\xB9', '\xA0', ' ', '\xF0', '\x96', '\xB9', '\xA1', ' ', '\xF0', '\x96', '\xB9', '\xA2', ' ', '\xF0', '\x96', '\xB9', '\xB9', ' ', '\xF0', '\x96', '\xB9', '\xB3', ' ', '\xF0', '\x96', '\xB9', '\xAE',  /* 𖹠 𖹡 𖹢 𖹹 𖹳 𖹮 */
+    '\0',
+    '\xF0', '\x96', '\xB9', '\xA0', ' ', '\xF0', '\x96', '\xB9', '\xA1', ' ', '\xF0', '\x96', '\xB9', '\xA2', ' ', '\xF0', '\x96', '\xB9', '\xB3', ' ', '\xF0', '\x96', '\xB9', '\xAD', ' ', '\xF0', '\x96', '\xB9', '\xBD',  /* 𖹠 𖹡 𖹢 𖹳 𖹭 𖹽 */
+    '\0',
+    '\xF0', '\x96', '\xB9', '\xA5', ' ', '\xF0', '\x96', '\xB9', '\xA8', ' ', '\xF0', '\x96', '\xB9', '\xA9',  /* 𖹥 𖹨 𖹩 */
+    '\0',
+    '\xF0', '\x96', '\xBA', '\x80', ' ', '\xF0', '\x96', '\xBA', '\x85', ' ', '\xF0', '\x96', '\xBA', '\x88', ' ', '\xF0', '\x96', '\xBA', '\x84', ' ', '\xF0', '\x96', '\xBA', '\x8D',  /* 𖺀 𖺅 𖺈 𖺄 𖺍 */
+    '\0',
     '\xE1', '\xA0', '\xB3', ' ', '\xE1', '\xA0', '\xB4', ' ', '\xE1', '\xA0', '\xB6', ' ', '\xE1', '\xA0', '\xBD', ' ', '\xE1', '\xA1', '\x82', ' ', '\xE1', '\xA1', '\x8A', ' ', '\xE2', '\x80', '\x8D', '\xE1', '\xA1', '\xA1', '\xE2', '\x80', '\x8D', ' ', '\xE2', '\x80', '\x8D', '\xE1', '\xA1', '\xB3', '\xE2', '\x80', '\x8D',  /* ᠳ ᠴ ᠶ ᠽ ᡂ ᡊ ‍ᡡ‍ ‍ᡳ‍ */
     '\0',
     '\xE1', '\xA1', '\x83',  /* ᡃ */
@@ -340,6 +354,12 @@
     '\0',
     '\xF0', '\x90', '\x92', '\x80', ' ', '\xF0', '\x90', '\x92', '\x82', ' ', '\xF0', '\x90', '\x92', '\x86', ' ', '\xF0', '\x90', '\x92', '\x88', ' ', '\xF0', '\x90', '\x92', '\x8A', ' ', '\xF0', '\x90', '\x92', '\x92', ' ', '\xF0', '\x90', '\x92', '\xA0', ' ', '\xF0', '\x90', '\x92', '\xA9',  /* 𐒀 𐒂 𐒆 𐒈 𐒊 𐒒 𐒠 𐒩 */
     '\0',
+    '\xF0', '\x90', '\xB4', '\x83', ' ', '\xF0', '\x90', '\xB4', '\x80', ' ', '\xF0', '\x90', '\xB4', '\x86', ' ', '\xF0', '\x90', '\xB4', '\x96', ' ', '\xF0', '\x90', '\xB4', '\x95',  /* 𐴃 𐴀 𐴆 𐴖 𐴕 */
+    '\0',
+    '\xF0', '\x90', '\xB4', '\x94', ' ', '\xF0', '\x90', '\xB4', '\x96', ' ', '\xF0', '\x90', '\xB4', '\x95', ' ', '\xF0', '\x90', '\xB4', '\x91', ' ', '\xF0', '\x90', '\xB4', '\x90',  /* 𐴔 𐴖 𐴕 𐴑 𐴐 */
+    '\0',
+    '\xD9', '\x80',  /* ـ */
+    '\0',
     '\xEA', '\xA2', '\x9C', ' ', '\xEA', '\xA2', '\x9E', ' ', '\xEA', '\xA2', '\xB3', ' ', '\xEA', '\xA2', '\x82', ' ', '\xEA', '\xA2', '\x96', ' ', '\xEA', '\xA2', '\x92', ' ', '\xEA', '\xA2', '\x9D', ' ', '\xEA', '\xA2', '\x9B',  /* ꢜ ꢞ ꢳ ꢂ ꢖ ꢒ ꢝ ꢛ */
     '\0',
     '\xEA', '\xA2', '\x82', ' ', '\xEA', '\xA2', '\xA8', ' ', '\xEA', '\xA2', '\xBA', ' ', '\xEA', '\xA2', '\xA4', ' ', '\xEA', '\xA2', '\x8E',  /* ꢂ ꢨ ꢺ ꢤ ꢎ */
@@ -488,14 +508,14 @@
     { AF_BLUE_STRING_CHAKMA_BOTTOM,    0                          },
     { AF_BLUE_STRING_CHAKMA_DESCENDER, 0                          },
     { AF_BLUE_STRING_MAX,              0                          },
-    { AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP,             AF_BLUE_PROPERTY_LATIN_TOP        },
-    { AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM,          0                                 },
-    { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_TOP,       AF_BLUE_PROPERTY_LATIN_TOP      |
-                                                         AF_BLUE_PROPERTY_LATIN_X_HEIGHT   },
-    { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM,    0                                 },
-    { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP,        AF_BLUE_PROPERTY_LATIN_TOP        },
-    { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM,     0                                 },
-    { AF_BLUE_STRING_MAX,                                0                                 },
+    { AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP,          AF_BLUE_PROPERTY_LATIN_TOP        },
+    { AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM,       0                                 },
+    { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_TOP,    AF_BLUE_PROPERTY_LATIN_TOP      |
+                                                      AF_BLUE_PROPERTY_LATIN_X_HEIGHT   },
+    { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM, 0                                 },
+    { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP,     AF_BLUE_PROPERTY_LATIN_TOP        },
+    { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM,  0                                 },
+    { AF_BLUE_STRING_MAX,                             0                                 },
     { AF_BLUE_STRING_CARIAN_TOP,    AF_BLUE_PROPERTY_LATIN_TOP },
     { AF_BLUE_STRING_CARIAN_BOTTOM, 0                          },
     { AF_BLUE_STRING_MAX,           0                          },
@@ -595,6 +615,9 @@
     { AF_BLUE_STRING_HEBREW_BOTTOM,    0                             },
     { AF_BLUE_STRING_HEBREW_DESCENDER, 0                             },
     { AF_BLUE_STRING_MAX,              0                             },
+    { AF_BLUE_STRING_KANNADA_TOP,    AF_BLUE_PROPERTY_LATIN_TOP },
+    { AF_BLUE_STRING_KANNADA_BOTTOM, 0                          },
+    { AF_BLUE_STRING_MAX,            0                          },
     { AF_BLUE_STRING_KAYAH_LI_TOP,             AF_BLUE_PROPERTY_LATIN_TOP      |
                                                AF_BLUE_PROPERTY_LATIN_X_HEIGHT   },
     { AF_BLUE_STRING_KAYAH_LI_BOTTOM,          0                                 },
@@ -613,9 +636,6 @@
                                                   AF_BLUE_PROPERTY_LATIN_X_HEIGHT   },
     { AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM, 0                                 },
     { AF_BLUE_STRING_MAX,                         0                                 },
-    { AF_BLUE_STRING_KANNADA_TOP,    AF_BLUE_PROPERTY_LATIN_TOP },
-    { AF_BLUE_STRING_KANNADA_BOTTOM, 0                          },
-    { AF_BLUE_STRING_MAX,            0                          },
     { AF_BLUE_STRING_LAO_TOP,            AF_BLUE_PROPERTY_LATIN_TOP      |
                                          AF_BLUE_PROPERTY_LATIN_X_HEIGHT   },
     { AF_BLUE_STRING_LAO_BOTTOM,         0                                 },
@@ -653,6 +673,15 @@
     { AF_BLUE_STRING_MALAYALAM_TOP,    AF_BLUE_PROPERTY_LATIN_TOP },
     { AF_BLUE_STRING_MALAYALAM_BOTTOM, 0                          },
     { AF_BLUE_STRING_MAX,              0                          },
+    { AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_TOP,     AF_BLUE_PROPERTY_LATIN_TOP        },
+    { AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_BOTTOM,  0                                 },
+    { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_F_TOP,     AF_BLUE_PROPERTY_LATIN_TOP        },
+    { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_TOP,       AF_BLUE_PROPERTY_LATIN_TOP      |
+                                                  AF_BLUE_PROPERTY_LATIN_X_HEIGHT   },
+    { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_BOTTOM,    0                                 },
+    { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_DESCENDER, 0                                 },
+    { AF_BLUE_STRING_MEDEFAIDRIN_DIGIT_TOP,       AF_BLUE_PROPERTY_LATIN_TOP        },
+    { AF_BLUE_STRING_MAX,                         0                                 },
     { AF_BLUE_STRING_MONGOLIAN_TOP_BASE,    AF_BLUE_PROPERTY_LATIN_TOP },
     { AF_BLUE_STRING_MONGOLIAN_BOTTOM_BASE, 0                          },
     { AF_BLUE_STRING_MAX,                   0                          },
@@ -687,6 +716,10 @@
     { AF_BLUE_STRING_OSMANYA_TOP,    AF_BLUE_PROPERTY_LATIN_TOP },
     { AF_BLUE_STRING_OSMANYA_BOTTOM, 0                          },
     { AF_BLUE_STRING_MAX,            0                          },
+    { AF_BLUE_STRING_ROHINGYA_TOP,    AF_BLUE_PROPERTY_LATIN_TOP     },
+    { AF_BLUE_STRING_ROHINGYA_BOTTOM, 0                              },
+    { AF_BLUE_STRING_ROHINGYA_JOIN,   AF_BLUE_PROPERTY_LATIN_NEUTRAL },
+    { AF_BLUE_STRING_MAX,             0                              },
     { AF_BLUE_STRING_SAURASHTRA_TOP,    AF_BLUE_PROPERTY_LATIN_TOP },
     { AF_BLUE_STRING_SAURASHTRA_BOTTOM, 0                          },
     { AF_BLUE_STRING_MAX,               0                          },
@@ -714,9 +747,6 @@
     { AF_BLUE_STRING_TELUGU_TOP,    AF_BLUE_PROPERTY_LATIN_TOP },
     { AF_BLUE_STRING_TELUGU_BOTTOM, 0                          },
     { AF_BLUE_STRING_MAX,           0                          },
-    { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP },
-    { AF_BLUE_STRING_TIFINAGH, 0                          },
-    { AF_BLUE_STRING_MAX,      0                          },
     { AF_BLUE_STRING_THAI_TOP,             AF_BLUE_PROPERTY_LATIN_TOP      |
                                            AF_BLUE_PROPERTY_LATIN_X_HEIGHT   },
     { AF_BLUE_STRING_THAI_BOTTOM,          0                                 },
@@ -726,6 +756,9 @@
     { AF_BLUE_STRING_THAI_LARGE_DESCENDER, 0                                 },
     { AF_BLUE_STRING_THAI_DIGIT_TOP,       0                                 },
     { AF_BLUE_STRING_MAX,                  0                                 },
+    { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP },
+    { AF_BLUE_STRING_TIFINAGH, 0                          },
+    { AF_BLUE_STRING_MAX,      0                          },
     { AF_BLUE_STRING_VAI_TOP,    AF_BLUE_PROPERTY_LATIN_TOP },
     { AF_BLUE_STRING_VAI_BOTTOM, 0                          },
     { AF_BLUE_STRING_MAX,        0                          },
diff --git a/src/autofit/afblue.cin b/src/autofit/afblue.cin
index 6545d1f..c6a697f 100644
--- a/src/autofit/afblue.cin
+++ b/src/autofit/afblue.cin
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter data for blue strings (body).
  *
- * Copyright (C) 2013-2019 by
+ * Copyright (C) 2013-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/autofit/afblue.dat b/src/autofit/afblue.dat
index 46db43f..b19b8df 100644
--- a/src/autofit/afblue.dat
+++ b/src/autofit/afblue.dat
@@ -2,7 +2,7 @@
 //
 //   Auto-fitter data for blue strings.
 //
-// Copyright (C) 2013-2019 by
+// Copyright (C) 2013-2020 by
 // David Turner, Robert Wilhelm, and Werner Lemberg.
 //
 // This file is part of the FreeType project, and may only be used,
@@ -203,7 +203,7 @@
     "𐐨 𐐪 𐐬 𐐿 𐑃"
 
   AF_BLUE_STRING_DEVANAGARI_BASE
-    "क म अ आ थ ध भ श"
+    "क न म उ छ ट ठ ड"
   AF_BLUE_STRING_DEVANAGARI_TOP
     "ई ऐ ओ औ ि ी ो ौ"
   // note that some fonts have extreme variation in the height of the
@@ -392,6 +392,21 @@
   AF_BLUE_STRING_MALAYALAM_BOTTOM
     "ട ഠ ധ ശ ഘ ച ഥ ല"
 
+  AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_TOP
+    "𖹀 𖹁 𖹂 𖹃 𖹏 𖹚 𖹟"
+  AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_BOTTOM
+    "𖹀 𖹁 𖹂 𖹃 𖹏 𖹚 𖹒 𖹓"
+  AF_BLUE_STRING_MEDEFAIDRIN_SMALL_F_TOP
+    "𖹤 𖹬 𖹧 𖹴 𖹶 𖹾"
+  AF_BLUE_STRING_MEDEFAIDRIN_SMALL_TOP
+    "𖹠 𖹡 𖹢 𖹹 𖹳 𖹮"
+  AF_BLUE_STRING_MEDEFAIDRIN_SMALL_BOTTOM
+    "𖹠 𖹡 𖹢 𖹳 𖹭 𖹽"
+  AF_BLUE_STRING_MEDEFAIDRIN_SMALL_DESCENDER
+    "𖹥 𖹨 𖹩"
+  AF_BLUE_STRING_MEDEFAIDRIN_DIGIT_TOP
+    "𖺀 𖺅 𖺈 𖺄 𖺍"
+
   AF_BLUE_STRING_MONGOLIAN_TOP_BASE
     "ᠳ ᠴ ᠶ ᠽ ᡂ ᡊ ‍ᡡ‍ ‍ᡳ‍"
   AF_BLUE_STRING_MONGOLIAN_BOTTOM_BASE
@@ -443,6 +458,13 @@
   AF_BLUE_STRING_OSMANYA_BOTTOM
     "𐒀 𐒂 𐒆 𐒈 𐒊 𐒒 𐒠 𐒩"
 
+  AF_BLUE_STRING_ROHINGYA_TOP
+    "𐴃 𐴀 𐴆 𐴖 𐴕"
+  AF_BLUE_STRING_ROHINGYA_BOTTOM
+    "𐴔 𐴖 𐴕 𐴑 𐴐"
+  AF_BLUE_STRING_ROHINGYA_JOIN
+    "ـ"
+
   AF_BLUE_STRING_SAURASHTRA_TOP
     "ꢜ ꢞ ꢳ ꢂ ꢖ ꢒ ꢝ ꢛ"
   AF_BLUE_STRING_SAURASHTRA_BOTTOM
@@ -734,14 +756,14 @@
     { AF_BLUE_STRING_MAX,              0                          }
 
   AF_BLUE_STRINGSET_CANS
-    { AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP,             AF_BLUE_PROPERTY_LATIN_TOP        }
-    { AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM,          0                                 }
-    { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_TOP,       AF_BLUE_PROPERTY_LATIN_TOP      |
-                                                         AF_BLUE_PROPERTY_LATIN_X_HEIGHT   }
-    { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM,    0                                 }
-    { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP,        AF_BLUE_PROPERTY_LATIN_TOP        }
-    { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM,     0                                 }
-    { AF_BLUE_STRING_MAX,                                0                                 }
+    { AF_BLUE_STRING_CANADIAN_SYLLABICS_TOP,          AF_BLUE_PROPERTY_LATIN_TOP        }
+    { AF_BLUE_STRING_CANADIAN_SYLLABICS_BOTTOM,       0                                 }
+    { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_TOP,    AF_BLUE_PROPERTY_LATIN_TOP      |
+                                                      AF_BLUE_PROPERTY_LATIN_X_HEIGHT   }
+    { AF_BLUE_STRING_CANADIAN_SYLLABICS_SMALL_BOTTOM, 0                                 }
+    { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_TOP,     AF_BLUE_PROPERTY_LATIN_TOP        }
+    { AF_BLUE_STRING_CANADIAN_SYLLABICS_SUPS_BOTTOM,  0                                 }
+    { AF_BLUE_STRING_MAX,                             0                                 }
 
   AF_BLUE_STRINGSET_CARI
     { AF_BLUE_STRING_CARIAN_TOP,    AF_BLUE_PROPERTY_LATIN_TOP }
@@ -874,6 +896,11 @@
     { AF_BLUE_STRING_HEBREW_DESCENDER, 0                             }
     { AF_BLUE_STRING_MAX,              0                             }
 
+  AF_BLUE_STRINGSET_KNDA
+    { AF_BLUE_STRING_KANNADA_TOP,    AF_BLUE_PROPERTY_LATIN_TOP }
+    { AF_BLUE_STRING_KANNADA_BOTTOM, 0                          }
+    { AF_BLUE_STRING_MAX,            0                          }
+
   AF_BLUE_STRINGSET_KALI
     { AF_BLUE_STRING_KAYAH_LI_TOP,             AF_BLUE_PROPERTY_LATIN_TOP      |
                                                AF_BLUE_PROPERTY_LATIN_X_HEIGHT   }
@@ -898,11 +925,6 @@
     { AF_BLUE_STRING_KHMER_SYMBOLS_WANING_BOTTOM, 0                                 }
     { AF_BLUE_STRING_MAX,                         0                                 }
 
-  AF_BLUE_STRINGSET_KNDA
-    { AF_BLUE_STRING_KANNADA_TOP,    AF_BLUE_PROPERTY_LATIN_TOP }
-    { AF_BLUE_STRING_KANNADA_BOTTOM, 0                          }
-    { AF_BLUE_STRING_MAX,            0                          }
-
   AF_BLUE_STRINGSET_LAO
     { AF_BLUE_STRING_LAO_TOP,            AF_BLUE_PROPERTY_LATIN_TOP      |
                                          AF_BLUE_PROPERTY_LATIN_X_HEIGHT   }
@@ -952,6 +974,17 @@
     { AF_BLUE_STRING_MALAYALAM_BOTTOM, 0                          }
     { AF_BLUE_STRING_MAX,              0                          }
 
+  AF_BLUE_STRINGSET_MEDF
+    { AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_TOP,     AF_BLUE_PROPERTY_LATIN_TOP        }
+    { AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_BOTTOM,  0                                 }
+    { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_F_TOP,     AF_BLUE_PROPERTY_LATIN_TOP        }
+    { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_TOP,       AF_BLUE_PROPERTY_LATIN_TOP      |
+                                                  AF_BLUE_PROPERTY_LATIN_X_HEIGHT   }
+    { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_BOTTOM,    0                                 }
+    { AF_BLUE_STRING_MEDEFAIDRIN_SMALL_DESCENDER, 0                                 }
+    { AF_BLUE_STRING_MEDEFAIDRIN_DIGIT_TOP,       AF_BLUE_PROPERTY_LATIN_TOP        }
+    { AF_BLUE_STRING_MAX,                         0                                 }
+
   AF_BLUE_STRINGSET_MONG
     { AF_BLUE_STRING_MONGOLIAN_TOP_BASE,    AF_BLUE_PROPERTY_LATIN_TOP }
     { AF_BLUE_STRING_MONGOLIAN_BOTTOM_BASE, 0                          }
@@ -1002,6 +1035,12 @@
     { AF_BLUE_STRING_OSMANYA_BOTTOM, 0                          }
     { AF_BLUE_STRING_MAX,            0                          }
 
+  AF_BLUE_STRINGSET_ROHG
+    { AF_BLUE_STRING_ROHINGYA_TOP,    AF_BLUE_PROPERTY_LATIN_TOP     }
+    { AF_BLUE_STRING_ROHINGYA_BOTTOM, 0                              }
+    { AF_BLUE_STRING_ROHINGYA_JOIN,   AF_BLUE_PROPERTY_LATIN_NEUTRAL }
+    { AF_BLUE_STRING_MAX,             0                              }
+
   AF_BLUE_STRINGSET_SAUR
     { AF_BLUE_STRING_SAURASHTRA_TOP,    AF_BLUE_PROPERTY_LATIN_TOP }
     { AF_BLUE_STRING_SAURASHTRA_BOTTOM, 0                          }
@@ -1043,11 +1082,6 @@
     { AF_BLUE_STRING_TELUGU_BOTTOM, 0                          }
     { AF_BLUE_STRING_MAX,           0                          }
 
-  AF_BLUE_STRINGSET_TFNG
-    { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP }
-    { AF_BLUE_STRING_TIFINAGH, 0                          }
-    { AF_BLUE_STRING_MAX,      0                          }
-
   AF_BLUE_STRINGSET_THAI
     { AF_BLUE_STRING_THAI_TOP,             AF_BLUE_PROPERTY_LATIN_TOP      |
                                            AF_BLUE_PROPERTY_LATIN_X_HEIGHT   }
@@ -1059,6 +1093,11 @@
     { AF_BLUE_STRING_THAI_DIGIT_TOP,       0                                 }
     { AF_BLUE_STRING_MAX,                  0                                 }
 
+  AF_BLUE_STRINGSET_TFNG
+    { AF_BLUE_STRING_TIFINAGH, AF_BLUE_PROPERTY_LATIN_TOP }
+    { AF_BLUE_STRING_TIFINAGH, 0                          }
+    { AF_BLUE_STRING_MAX,      0                          }
+
   AF_BLUE_STRINGSET_VAII
     { AF_BLUE_STRING_VAI_TOP,    AF_BLUE_PROPERTY_LATIN_TOP }
     { AF_BLUE_STRING_VAI_BOTTOM, 0                          }
diff --git a/src/autofit/afblue.h b/src/autofit/afblue.h
index b69b1df..486d663 100644
--- a/src/autofit/afblue.h
+++ b/src/autofit/afblue.h
@@ -7,7 +7,7 @@
  *
  *   Auto-fitter data for blue strings (specification).
  *
- * Copyright (C) 2013-2019 by
+ * Copyright (C) 2013-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -212,58 +212,68 @@
     AF_BLUE_STRING_LISU_BOTTOM = 3506,
     AF_BLUE_STRING_MALAYALAM_TOP = 3538,
     AF_BLUE_STRING_MALAYALAM_BOTTOM = 3582,
-    AF_BLUE_STRING_MONGOLIAN_TOP_BASE = 3614,
-    AF_BLUE_STRING_MONGOLIAN_BOTTOM_BASE = 3658,
-    AF_BLUE_STRING_MYANMAR_TOP = 3662,
-    AF_BLUE_STRING_MYANMAR_BOTTOM = 3694,
-    AF_BLUE_STRING_MYANMAR_ASCENDER = 3726,
-    AF_BLUE_STRING_MYANMAR_DESCENDER = 3754,
-    AF_BLUE_STRING_NKO_TOP = 3786,
-    AF_BLUE_STRING_NKO_BOTTOM = 3810,
-    AF_BLUE_STRING_NKO_SMALL_TOP = 3825,
-    AF_BLUE_STRING_NKO_SMALL_BOTTOM = 3834,
-    AF_BLUE_STRING_OL_CHIKI = 3846,
-    AF_BLUE_STRING_OLD_TURKIC_TOP = 3870,
-    AF_BLUE_STRING_OLD_TURKIC_BOTTOM = 3885,
-    AF_BLUE_STRING_OSAGE_CAPITAL_TOP = 3905,
-    AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM = 3945,
-    AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER = 3975,
-    AF_BLUE_STRING_OSAGE_SMALL_TOP = 3990,
-    AF_BLUE_STRING_OSAGE_SMALL_BOTTOM = 4030,
-    AF_BLUE_STRING_OSAGE_SMALL_ASCENDER = 4070,
-    AF_BLUE_STRING_OSAGE_SMALL_DESCENDER = 4095,
-    AF_BLUE_STRING_OSMANYA_TOP = 4110,
-    AF_BLUE_STRING_OSMANYA_BOTTOM = 4150,
-    AF_BLUE_STRING_SAURASHTRA_TOP = 4190,
-    AF_BLUE_STRING_SAURASHTRA_BOTTOM = 4222,
-    AF_BLUE_STRING_SHAVIAN_TOP = 4242,
-    AF_BLUE_STRING_SHAVIAN_BOTTOM = 4252,
-    AF_BLUE_STRING_SHAVIAN_DESCENDER = 4277,
-    AF_BLUE_STRING_SHAVIAN_SMALL_TOP = 4287,
-    AF_BLUE_STRING_SHAVIAN_SMALL_BOTTOM = 4322,
-    AF_BLUE_STRING_SINHALA_TOP = 4337,
-    AF_BLUE_STRING_SINHALA_BOTTOM = 4369,
-    AF_BLUE_STRING_SINHALA_DESCENDER = 4401,
-    AF_BLUE_STRING_SUNDANESE_TOP = 4445,
-    AF_BLUE_STRING_SUNDANESE_BOTTOM = 4469,
-    AF_BLUE_STRING_SUNDANESE_DESCENDER = 4501,
-    AF_BLUE_STRING_TAI_VIET_TOP = 4509,
-    AF_BLUE_STRING_TAI_VIET_BOTTOM = 4529,
-    AF_BLUE_STRING_TAMIL_TOP = 4541,
-    AF_BLUE_STRING_TAMIL_BOTTOM = 4573,
-    AF_BLUE_STRING_TELUGU_TOP = 4605,
-    AF_BLUE_STRING_TELUGU_BOTTOM = 4633,
-    AF_BLUE_STRING_THAI_TOP = 4661,
-    AF_BLUE_STRING_THAI_BOTTOM = 4685,
-    AF_BLUE_STRING_THAI_ASCENDER = 4713,
-    AF_BLUE_STRING_THAI_LARGE_ASCENDER = 4725,
-    AF_BLUE_STRING_THAI_DESCENDER = 4737,
-    AF_BLUE_STRING_THAI_LARGE_DESCENDER = 4753,
-    AF_BLUE_STRING_THAI_DIGIT_TOP = 4761,
-    AF_BLUE_STRING_TIFINAGH = 4773,
-    AF_BLUE_STRING_VAI_TOP = 4805,
-    AF_BLUE_STRING_VAI_BOTTOM = 4837,
-    af_blue_1_1 = 4868,
+    AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_TOP = 3614,
+    AF_BLUE_STRING_MEDEFAIDRIN_CAPITAL_BOTTOM = 3649,
+    AF_BLUE_STRING_MEDEFAIDRIN_SMALL_F_TOP = 3689,
+    AF_BLUE_STRING_MEDEFAIDRIN_SMALL_TOP = 3719,
+    AF_BLUE_STRING_MEDEFAIDRIN_SMALL_BOTTOM = 3749,
+    AF_BLUE_STRING_MEDEFAIDRIN_SMALL_DESCENDER = 3779,
+    AF_BLUE_STRING_MEDEFAIDRIN_DIGIT_TOP = 3794,
+    AF_BLUE_STRING_MONGOLIAN_TOP_BASE = 3819,
+    AF_BLUE_STRING_MONGOLIAN_BOTTOM_BASE = 3863,
+    AF_BLUE_STRING_MYANMAR_TOP = 3867,
+    AF_BLUE_STRING_MYANMAR_BOTTOM = 3899,
+    AF_BLUE_STRING_MYANMAR_ASCENDER = 3931,
+    AF_BLUE_STRING_MYANMAR_DESCENDER = 3959,
+    AF_BLUE_STRING_NKO_TOP = 3991,
+    AF_BLUE_STRING_NKO_BOTTOM = 4015,
+    AF_BLUE_STRING_NKO_SMALL_TOP = 4030,
+    AF_BLUE_STRING_NKO_SMALL_BOTTOM = 4039,
+    AF_BLUE_STRING_OL_CHIKI = 4051,
+    AF_BLUE_STRING_OLD_TURKIC_TOP = 4075,
+    AF_BLUE_STRING_OLD_TURKIC_BOTTOM = 4090,
+    AF_BLUE_STRING_OSAGE_CAPITAL_TOP = 4110,
+    AF_BLUE_STRING_OSAGE_CAPITAL_BOTTOM = 4150,
+    AF_BLUE_STRING_OSAGE_CAPITAL_DESCENDER = 4180,
+    AF_BLUE_STRING_OSAGE_SMALL_TOP = 4195,
+    AF_BLUE_STRING_OSAGE_SMALL_BOTTOM = 4235,
+    AF_BLUE_STRING_OSAGE_SMALL_ASCENDER = 4275,
+    AF_BLUE_STRING_OSAGE_SMALL_DESCENDER = 4300,
+    AF_BLUE_STRING_OSMANYA_TOP = 4315,
+    AF_BLUE_STRING_OSMANYA_BOTTOM = 4355,
+    AF_BLUE_STRING_ROHINGYA_TOP = 4395,
+    AF_BLUE_STRING_ROHINGYA_BOTTOM = 4420,
+    AF_BLUE_STRING_ROHINGYA_JOIN = 4445,
+    AF_BLUE_STRING_SAURASHTRA_TOP = 4448,
+    AF_BLUE_STRING_SAURASHTRA_BOTTOM = 4480,
+    AF_BLUE_STRING_SHAVIAN_TOP = 4500,
+    AF_BLUE_STRING_SHAVIAN_BOTTOM = 4510,
+    AF_BLUE_STRING_SHAVIAN_DESCENDER = 4535,
+    AF_BLUE_STRING_SHAVIAN_SMALL_TOP = 4545,
+    AF_BLUE_STRING_SHAVIAN_SMALL_BOTTOM = 4580,
+    AF_BLUE_STRING_SINHALA_TOP = 4595,
+    AF_BLUE_STRING_SINHALA_BOTTOM = 4627,
+    AF_BLUE_STRING_SINHALA_DESCENDER = 4659,
+    AF_BLUE_STRING_SUNDANESE_TOP = 4703,
+    AF_BLUE_STRING_SUNDANESE_BOTTOM = 4727,
+    AF_BLUE_STRING_SUNDANESE_DESCENDER = 4759,
+    AF_BLUE_STRING_TAI_VIET_TOP = 4767,
+    AF_BLUE_STRING_TAI_VIET_BOTTOM = 4787,
+    AF_BLUE_STRING_TAMIL_TOP = 4799,
+    AF_BLUE_STRING_TAMIL_BOTTOM = 4831,
+    AF_BLUE_STRING_TELUGU_TOP = 4863,
+    AF_BLUE_STRING_TELUGU_BOTTOM = 4891,
+    AF_BLUE_STRING_THAI_TOP = 4919,
+    AF_BLUE_STRING_THAI_BOTTOM = 4943,
+    AF_BLUE_STRING_THAI_ASCENDER = 4971,
+    AF_BLUE_STRING_THAI_LARGE_ASCENDER = 4983,
+    AF_BLUE_STRING_THAI_DESCENDER = 4995,
+    AF_BLUE_STRING_THAI_LARGE_DESCENDER = 5011,
+    AF_BLUE_STRING_THAI_DIGIT_TOP = 5019,
+    AF_BLUE_STRING_TIFINAGH = 5031,
+    AF_BLUE_STRING_VAI_TOP = 5063,
+    AF_BLUE_STRING_VAI_BOTTOM = 5095,
+    af_blue_1_1 = 5126,
 #ifdef AF_CONFIG_OPTION_CJK
     AF_BLUE_STRING_CJK_TOP = af_blue_1_1 + 1,
     AF_BLUE_STRING_CJK_BOTTOM = af_blue_1_1 + 203,
@@ -347,35 +357,37 @@
     AF_BLUE_STRINGSET_GUJR = 112,
     AF_BLUE_STRINGSET_GURU = 118,
     AF_BLUE_STRINGSET_HEBR = 124,
-    AF_BLUE_STRINGSET_KALI = 128,
-    AF_BLUE_STRINGSET_KHMR = 134,
-    AF_BLUE_STRINGSET_KHMS = 140,
-    AF_BLUE_STRINGSET_KNDA = 143,
+    AF_BLUE_STRINGSET_KNDA = 128,
+    AF_BLUE_STRINGSET_KALI = 131,
+    AF_BLUE_STRINGSET_KHMR = 137,
+    AF_BLUE_STRINGSET_KHMS = 143,
     AF_BLUE_STRINGSET_LAO = 146,
     AF_BLUE_STRINGSET_LATN = 152,
     AF_BLUE_STRINGSET_LATB = 159,
     AF_BLUE_STRINGSET_LATP = 166,
     AF_BLUE_STRINGSET_LISU = 173,
     AF_BLUE_STRINGSET_MLYM = 176,
-    AF_BLUE_STRINGSET_MONG = 179,
-    AF_BLUE_STRINGSET_MYMR = 182,
-    AF_BLUE_STRINGSET_NKOO = 187,
-    AF_BLUE_STRINGSET_NONE = 192,
-    AF_BLUE_STRINGSET_OLCK = 193,
-    AF_BLUE_STRINGSET_ORKH = 196,
-    AF_BLUE_STRINGSET_OSGE = 199,
-    AF_BLUE_STRINGSET_OSMA = 207,
-    AF_BLUE_STRINGSET_SAUR = 210,
-    AF_BLUE_STRINGSET_SHAW = 213,
-    AF_BLUE_STRINGSET_SINH = 219,
-    AF_BLUE_STRINGSET_SUND = 223,
-    AF_BLUE_STRINGSET_TAML = 227,
-    AF_BLUE_STRINGSET_TAVT = 230,
-    AF_BLUE_STRINGSET_TELU = 233,
-    AF_BLUE_STRINGSET_TFNG = 236,
-    AF_BLUE_STRINGSET_THAI = 239,
-    AF_BLUE_STRINGSET_VAII = 247,
-    af_blue_2_1 = 250,
+    AF_BLUE_STRINGSET_MEDF = 179,
+    AF_BLUE_STRINGSET_MONG = 187,
+    AF_BLUE_STRINGSET_MYMR = 190,
+    AF_BLUE_STRINGSET_NKOO = 195,
+    AF_BLUE_STRINGSET_NONE = 200,
+    AF_BLUE_STRINGSET_OLCK = 201,
+    AF_BLUE_STRINGSET_ORKH = 204,
+    AF_BLUE_STRINGSET_OSGE = 207,
+    AF_BLUE_STRINGSET_OSMA = 215,
+    AF_BLUE_STRINGSET_ROHG = 218,
+    AF_BLUE_STRINGSET_SAUR = 222,
+    AF_BLUE_STRINGSET_SHAW = 225,
+    AF_BLUE_STRINGSET_SINH = 231,
+    AF_BLUE_STRINGSET_SUND = 235,
+    AF_BLUE_STRINGSET_TAML = 239,
+    AF_BLUE_STRINGSET_TAVT = 242,
+    AF_BLUE_STRINGSET_TELU = 245,
+    AF_BLUE_STRINGSET_THAI = 248,
+    AF_BLUE_STRINGSET_TFNG = 256,
+    AF_BLUE_STRINGSET_VAII = 259,
+    af_blue_2_1 = 262,
 #ifdef AF_CONFIG_OPTION_CJK
     AF_BLUE_STRINGSET_HANI = af_blue_2_1 + 0,
     af_blue_2_1_1 = af_blue_2_1 + 2,
diff --git a/src/autofit/afblue.hin b/src/autofit/afblue.hin
index 30a28da..3957027 100644
--- a/src/autofit/afblue.hin
+++ b/src/autofit/afblue.hin
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter data for blue strings (specification).
  *
- * Copyright (C) 2013-2019 by
+ * Copyright (C) 2013-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c
index a61689b..3b340cd 100644
--- a/src/autofit/afcjk.c
+++ b/src/autofit/afcjk.c
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter hinting routines for CJK writing system (body).
  *
- * Copyright (C) 2006-2019 by
+ * Copyright (C) 2006-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -22,9 +22,8 @@
    *
    */
 
-#include <ft2build.h>
-#include FT_ADVANCES_H
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/ftadvanc.h>
+#include <freetype/internal/ftdebug.h>
 
 #include "afglobal.h"
 #include "aflatin.h"
@@ -158,7 +157,7 @@
       if ( !glyph_index )
         goto Exit;
 
-      FT_TRACE5(( "standard character: U+%04lX (glyph index %d)\n",
+      FT_TRACE5(( "standard character: U+%04lX (glyph index %ld)\n",
                   ch, glyph_index ));
 
       error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE );
@@ -261,9 +260,9 @@
                       dim == AF_DIMENSION_VERT ? "horizontal"
                                                : "vertical" ));
 
-          FT_TRACE5(( "  %d (standard)", axis->standard_width ));
+          FT_TRACE5(( "  %ld (standard)", axis->standard_width ));
           for ( i = 1; i < axis->width_count; i++ )
-            FT_TRACE5(( " %d", axis->widths[i].org ));
+            FT_TRACE5(( " %ld", axis->widths[i].org ));
 
           FT_TRACE5(( "\n" ));
         }
@@ -728,7 +727,7 @@
 
         delta2 = FT_MulFix( delta2, scale );
 
-        FT_TRACE5(( "delta: %d", delta1 ));
+        FT_TRACE5(( "delta: %ld", delta1 ));
         if ( delta2 < 32 )
           delta2 = 0;
 #if 0
@@ -737,7 +736,7 @@
 #endif
         else
           delta2 = FT_PIX_ROUND( delta2 );
-        FT_TRACE5(( "/%d\n", delta2 ));
+        FT_TRACE5(( "/%ld\n", delta2 ));
 
         if ( delta1 < 0 )
           delta2 = -delta2;
@@ -806,7 +805,7 @@
   {
     AF_AxisHints  axis          = &hints->axis[dim];
     AF_Segment    segments      = axis->segments;
-    AF_Segment    segment_limit = segments + axis->num_segments;
+    AF_Segment    segment_limit = FT_OFFSET( segments, axis->num_segments );
     FT_Error      error;
     AF_Segment    seg;
 
@@ -1644,7 +1643,7 @@
 
     stem_edge->pos = base_edge->pos + fitted_width;
 
-    FT_TRACE5(( "  CJKLINK: edge %d @%d (opos=%.2f) linked to %.2f,"
+    FT_TRACE5(( "  CJKLINK: edge %ld @%d (opos=%.2f) linked to %.2f,"
                 " dist was %.2f, now %.2f\n",
                 stem_edge - hints->axis[dim].edges, stem_edge->fpos,
                 stem_edge->opos / 64.0, stem_edge->pos / 64.0,
@@ -1866,7 +1865,7 @@
           continue;
 
 #ifdef FT_DEBUG_LEVEL_TRACE
-        FT_TRACE5(( "  CJKBLUE: edge %d @%d (opos=%.2f) snapped to %.2f,"
+        FT_TRACE5(( "  CJKBLUE: edge %ld @%d (opos=%.2f) snapped to %.2f,"
                     " was %.2f\n",
                     edge1 - edges, edge1->fpos, edge1->opos / 64.0,
                     blue->fit / 64.0, edge1->pos / 64.0 ));
@@ -1930,7 +1929,7 @@
       /* this should not happen, but it's better to be safe */
       if ( edge2->blue_edge )
       {
-        FT_TRACE5(( "ASSERTION FAILED for edge %d\n", edge2-edges ));
+        FT_TRACE5(( "ASSERTION FAILED for edge %ld\n", edge2-edges ));
 
         af_cjk_align_linked_edge( hints, dim, edge2, edge );
         edge->flags |= AF_EDGE_DONE;
diff --git a/src/autofit/afcjk.h b/src/autofit/afcjk.h
index 59acae5..fd0f451 100644
--- a/src/autofit/afcjk.h
+++ b/src/autofit/afcjk.h
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter hinting routines for CJK writing system (specification).
  *
- * Copyright (C) 2006-2019 by
+ * Copyright (C) 2006-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/autofit/afcover.h b/src/autofit/afcover.h
index ff207a9..03085ad 100644
--- a/src/autofit/afcover.h
+++ b/src/autofit/afcover.h
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter coverages (specification only).
  *
- * Copyright (C) 2013-2019 by
+ * Copyright (C) 2013-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/autofit/afdummy.c b/src/autofit/afdummy.c
index 7e07a41..77d31df 100644
--- a/src/autofit/afdummy.c
+++ b/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-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/autofit/afdummy.h b/src/autofit/afdummy.h
index ab9227d..efd799e 100644
--- a/src/autofit/afdummy.h
+++ b/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-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/autofit/aferrors.h b/src/autofit/aferrors.h
index 2ec336f..f908999 100644
--- a/src/autofit/aferrors.h
+++ b/src/autofit/aferrors.h
@@ -4,7 +4,7 @@
  *
  *   Autofitter error codes (specification only).
  *
- * Copyright (C) 2005-2019 by
+ * Copyright (C) 2005-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -26,7 +26,7 @@
 #ifndef AFERRORS_H_
 #define AFERRORS_H_
 
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
 
 #undef FTERRORS_H_
 
@@ -34,7 +34,7 @@
 #define FT_ERR_PREFIX  AF_Err_
 #define FT_ERR_BASE    FT_Mod_Err_Autofit
 
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
 
 #endif /* AFERRORS_H_ */
 
diff --git a/src/autofit/afglobal.c b/src/autofit/afglobal.c
index 6a9a1e5..d512942 100644
--- a/src/autofit/afglobal.c
+++ b/src/autofit/afglobal.c
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter routines to compute global hinting values (body).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,7 +19,7 @@
 #include "afglobal.h"
 #include "afranges.h"
 #include "afshaper.h"
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 
 
   /**************************************************************************
@@ -306,7 +306,7 @@
           if ( !( count % 10 ) )
             FT_TRACE4(( " " ));
 
-          FT_TRACE4(( " %d", idx ));
+          FT_TRACE4(( " %ld", idx ));
           count++;
 
           if ( !( count % 10 ) )
diff --git a/src/autofit/afglobal.h b/src/autofit/afglobal.h
index 52f3835..fecf7af 100644
--- a/src/autofit/afglobal.h
+++ b/src/autofit/afglobal.h
@@ -5,7 +5,7 @@
  *   Auto-fitter routines to compute global hinting values
  *   (specification).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/autofit/afhints.c b/src/autofit/afhints.c
index ed111c4..a8e0089 100644
--- a/src/autofit/afhints.c
+++ b/src/autofit/afhints.c
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter hinting routines (body).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -18,8 +18,8 @@
 
 #include "afhints.h"
 #include "aferrors.h"
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/ftdebug.h>
 
 
   /**************************************************************************
diff --git a/src/autofit/afhints.h b/src/autofit/afhints.h
index e0cf612..6397f09 100644
--- a/src/autofit/afhints.h
+++ b/src/autofit/afhints.h
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter hinting routines (specification).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/autofit/afindic.c b/src/autofit/afindic.c
index a17117c..bc2837a 100644
--- a/src/autofit/afindic.c
+++ b/src/autofit/afindic.c
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter hinting routines for Indic writing system (body).
  *
- * Copyright (C) 2007-2019 by
+ * Copyright (C) 2007-2020 by
  * Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/autofit/afindic.h b/src/autofit/afindic.h
index bc5bc59..088b88b 100644
--- a/src/autofit/afindic.h
+++ b/src/autofit/afindic.h
@@ -5,7 +5,7 @@
  *   Auto-fitter hinting routines for Indic writing system
  *   (specification).
  *
- * Copyright (C) 2007-2019 by
+ * Copyright (C) 2007-2020 by
  * Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index 27d4024..21ec02e 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter hinting routines for latin writing system (body).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,9 +16,8 @@
  */
 
 
-#include <ft2build.h>
-#include FT_ADVANCES_H
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/ftadvanc.h>
+#include <freetype/internal/ftdebug.h>
 
 #include "afglobal.h"
 #include "aflatin.h"
@@ -155,7 +154,7 @@
         goto Exit;
       }
 
-      FT_TRACE5(( "standard character: U+%04lX (glyph index %d)\n",
+      FT_TRACE5(( "standard character: U+%04lX (glyph index %ld)\n",
                   ch, glyph_index ));
 
       error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE );
@@ -258,9 +257,9 @@
                       dim == AF_DIMENSION_VERT ? "horizontal"
                                                : "vertical" ));
 
-          FT_TRACE5(( "  %d (standard)", axis->standard_width ));
+          FT_TRACE5(( "  %ld (standard)", axis->standard_width ));
           for ( i = 1; i < axis->width_count; i++ )
-            FT_TRACE5(( " %d", axis->widths[i].org ));
+            FT_TRACE5(( " %ld", axis->widths[i].org ));
 
           FT_TRACE5(( "\n" ));
         }
@@ -1032,7 +1031,7 @@
         {
           *a = *b;
           FT_TRACE5(( "blue zone overlap:"
-                      " adjusting %s %d to %ld\n",
+                      " adjusting %s %ld to %ld\n",
                       a_is_top ? "overshoot" : "reference",
                       blue_sorted[i] - axis->blues,
                       *a ));
@@ -1280,7 +1279,7 @@
                 "af_latin_metrics_scale_dim:"
                 " x height alignment (style `%s'):\n"
                 "                           "
-                " vertical scaling changed from %.5f to %.5f (by %d%%)\n"
+                " vertical scaling changed from %.5f to %.5f (by %ld%%)\n"
                 "\n",
                 af_style_names[metrics->root.style_class->style],
                 scale / 65536.0,
@@ -1333,7 +1332,7 @@
       width->cur = FT_MulFix( width->org, scale );
       width->fit = width->cur;
 
-      FT_TRACE5(( "  %d scaled to %.2f\n",
+      FT_TRACE5(( "  %ld scaled to %.2f\n",
                   width->org,
                   width->cur / 64.0 ));
     }
@@ -1474,8 +1473,8 @@
         AF_LatinBlue  blue = &axis->blues[nn];
 
 
-        FT_TRACE5(( "  reference %d: %d scaled to %.2f%s\n"
-                    "  overshoot %d: %d scaled to %.2f%s\n",
+        FT_TRACE5(( "  reference %d: %ld scaled to %.2f%s\n"
+                    "  overshoot %d: %ld scaled to %.2f%s\n",
                     nn,
                     blue->ref.org,
                     blue->ref.fit / 64.0,
@@ -1910,7 +1909,7 @@
     /* sense -- this is used to better detect and ignore serifs   */
     {
       AF_Segment  segments     = axis->segments;
-      AF_Segment  segments_end = segments + axis->num_segments;
+      AF_Segment  segments_end = FT_OFFSET( segments, axis->num_segments );
 
 
       for ( segment = segments; segment < segments_end; segment++ )
@@ -2314,7 +2313,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;
 
 
@@ -2945,7 +2944,7 @@
 
     stem_edge->pos = base_edge->pos + fitted_width;
 
-    FT_TRACE5(( "  LINK: edge %d (opos=%.2f) linked to %.2f,"
+    FT_TRACE5(( "  LINK: edge %ld (opos=%.2f) linked to %.2f,"
                 " dist was %.2f, now %.2f\n",
                 stem_edge - hints->axis[dim].edges, stem_edge->opos / 64.0,
                 stem_edge->pos / 64.0, dist / 64.0, fitted_width / 64.0 ));
@@ -3069,12 +3068,12 @@
 
 #ifdef FT_DEBUG_LEVEL_TRACE
         if ( !anchor )
-          FT_TRACE5(( "  BLUE_ANCHOR: edge %d (opos=%.2f) snapped to %.2f,"
-                      " was %.2f (anchor=edge %d)\n",
+          FT_TRACE5(( "  BLUE_ANCHOR: edge %ld (opos=%.2f) snapped to %.2f,"
+                      " was %.2f (anchor=edge %ld)\n",
                       edge1 - edges, edge1->opos / 64.0, blue->fit / 64.0,
                       edge1->pos / 64.0, edge - edges ));
         else
-          FT_TRACE5(( "  BLUE: edge %d (opos=%.2f) snapped to %.2f,"
+          FT_TRACE5(( "  BLUE: edge %ld (opos=%.2f) snapped to %.2f,"
                       " was %.2f\n",
                       edge1 - edges, edge1->opos / 64.0, blue->fit / 64.0,
                       edge1->pos / 64.0 ));
@@ -3123,7 +3122,7 @@
       /* this should not happen, but it's better to be safe */
       if ( edge2->blue_edge )
       {
-        FT_TRACE5(( "  ASSERTION FAILED for edge %d\n", edge2 - edges ));
+        FT_TRACE5(( "  ASSERTION FAILED for edge %ld\n", edge2 - edges ));
 
         af_latin_align_linked_edge( hints, dim, edge2, edge );
         edge->flags |= AF_EDGE_DONE;
@@ -3191,7 +3190,7 @@
         anchor       = edge;
         edge->flags |= AF_EDGE_DONE;
 
-        FT_TRACE5(( "  ANCHOR: edge %d (opos=%.2f) and %d (opos=%.2f)"
+        FT_TRACE5(( "  ANCHOR: edge %ld (opos=%.2f) and %ld (opos=%.2f)"
                     " snapped to %.2f and %.2f\n",
                     edge - edges, edge->opos / 64.0,
                     edge2 - edges, edge2->opos / 64.0,
@@ -3220,7 +3219,7 @@
 
         if ( edge2->flags & AF_EDGE_DONE )
         {
-          FT_TRACE5(( "  ADJUST: edge %d (pos=%.2f) moved to %.2f\n",
+          FT_TRACE5(( "  ADJUST: edge %ld (pos=%.2f) moved to %.2f\n",
                       edge - edges, edge->pos / 64.0,
                       ( edge2->pos - cur_len ) / 64.0 ));
 
@@ -3261,7 +3260,7 @@
           edge->pos  = cur_pos1 - cur_len / 2;
           edge2->pos = cur_pos1 + cur_len / 2;
 
-          FT_TRACE5(( "  STEM: edge %d (opos=%.2f) linked to %d (opos=%.2f)"
+          FT_TRACE5(( "  STEM: edge %ld (opos=%.2f) linked to %ld (opos=%.2f)"
                       " snapped to %.2f and %.2f\n",
                       edge - edges, edge->opos / 64.0,
                       edge2 - edges, edge2->opos / 64.0,
@@ -3292,7 +3291,7 @@
           edge->pos  = ( delta1 < delta2 ) ? cur_pos1 : cur_pos2;
           edge2->pos = edge->pos + cur_len;
 
-          FT_TRACE5(( "  STEM: edge %d (opos=%.2f) linked to %d (opos=%.2f)"
+          FT_TRACE5(( "  STEM: edge %ld (opos=%.2f) linked to %ld (opos=%.2f)"
                       " snapped to %.2f and %.2f\n",
                       edge - edges, edge->opos / 64.0,
                       edge2 - edges, edge2->opos / 64.0,
@@ -3315,7 +3314,7 @@
           if ( edge->link && FT_ABS( edge->link->pos - edge[-1].pos ) > 16 )
           {
 #ifdef FT_DEBUG_LEVEL_TRACE
-            FT_TRACE5(( "  BOUND: edge %d (pos=%.2f) moved to %.2f\n",
+            FT_TRACE5(( "  BOUND: edge %ld (pos=%.2f) moved to %.2f\n",
                         edge - edges,
                         edge->pos / 64.0,
                         edge[-1].pos / 64.0 ));
@@ -3417,7 +3416,7 @@
         if ( delta < 64 + 16 )
         {
           af_latin_align_serif_edge( hints, edge->serif, edge );
-          FT_TRACE5(( "  SERIF: edge %d (opos=%.2f) serif to %d (opos=%.2f)"
+          FT_TRACE5(( "  SERIF: edge %ld (opos=%.2f) serif to %ld (opos=%.2f)"
                       " aligned to %.2f\n",
                       edge - edges, edge->opos / 64.0,
                       edge->serif - edges, edge->serif->opos / 64.0,
@@ -3427,7 +3426,7 @@
         {
           edge->pos = FT_PIX_ROUND( edge->opos );
           anchor    = edge;
-          FT_TRACE5(( "  SERIF_ANCHOR: edge %d (opos=%.2f)"
+          FT_TRACE5(( "  SERIF_ANCHOR: edge %ld (opos=%.2f)"
                       " snapped to %.2f\n",
                       edge-edges, edge->opos / 64.0, edge->pos / 64.0 ));
         }
@@ -3455,8 +3454,8 @@
                                      after->pos - before->pos,
                                      after->opos - before->opos );
 
-            FT_TRACE5(( "  SERIF_LINK1: edge %d (opos=%.2f) snapped to %.2f"
-                        " from %d (opos=%.2f)\n",
+            FT_TRACE5(( "  SERIF_LINK1: edge %ld (opos=%.2f) snapped to %.2f"
+                        " from %ld (opos=%.2f)\n",
                         edge - edges, edge->opos / 64.0,
                         edge->pos / 64.0,
                         before - edges, before->opos / 64.0 ));
@@ -3465,7 +3464,7 @@
           {
             edge->pos = anchor->pos +
                         ( ( edge->opos - anchor->opos + 16 ) & ~31 );
-            FT_TRACE5(( "  SERIF_LINK2: edge %d (opos=%.2f)"
+            FT_TRACE5(( "  SERIF_LINK2: edge %ld (opos=%.2f)"
                         " snapped to %.2f\n",
                         edge - edges, edge->opos / 64.0, edge->pos / 64.0 ));
           }
@@ -3485,7 +3484,7 @@
           if ( edge->link && FT_ABS( edge->link->pos - edge[-1].pos ) > 16 )
           {
 #ifdef FT_DEBUG_LEVEL_TRACE
-            FT_TRACE5(( "  BOUND: edge %d (pos=%.2f) moved to %.2f\n",
+            FT_TRACE5(( "  BOUND: edge %ld (pos=%.2f) moved to %.2f\n",
                         edge - edges,
                         edge->pos / 64.0,
                         edge[-1].pos / 64.0 ));
@@ -3506,7 +3505,7 @@
           if ( edge->link && FT_ABS( edge->link->pos - edge[-1].pos ) > 16 )
           {
 #ifdef FT_DEBUG_LEVEL_TRACE
-            FT_TRACE5(( "  BOUND: edge %d (pos=%.2f) moved to %.2f\n",
+            FT_TRACE5(( "  BOUND: edge %ld (pos=%.2f) moved to %.2f\n",
                         edge - edges,
                         edge->pos / 64.0,
                         edge[1].pos / 64.0 ));
diff --git a/src/autofit/aflatin.h b/src/autofit/aflatin.h
index 4047953..62bc4c8 100644
--- a/src/autofit/aflatin.h
+++ b/src/autofit/aflatin.h
@@ -5,7 +5,7 @@
  *   Auto-fitter hinting routines for latin writing system
  *   (specification).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/autofit/aflatin2.c b/src/autofit/aflatin2.c
index c601ab8..902f398 100644
--- a/src/autofit/aflatin2.c
+++ b/src/autofit/aflatin2.c
@@ -9,7 +9,7 @@
  *
  *   Auto-fitter hinting routines for latin writing system (body).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -21,7 +21,7 @@
  */
 
 
-#include FT_ADVANCES_H
+#include <freetype/ftadvanc.h>
 
 
 #ifdef FT_OPTION_AUTOFIT2
diff --git a/src/autofit/aflatin2.h b/src/autofit/aflatin2.h
index 507cef3..c2aebc4 100644
--- a/src/autofit/aflatin2.h
+++ b/src/autofit/aflatin2.h
@@ -10,7 +10,7 @@
  *   Auto-fitter hinting routines for latin writing system
  *   (specification).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c
index 83743b7..c35d85c 100644
--- a/src/autofit/afloader.c
+++ b/src/autofit/afloader.c
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter glyph loading routines (body).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -22,7 +22,7 @@
 #include "aferrors.h"
 #include "afmodule.h"
 
-#include FT_INTERNAL_CALC_H
+#include <freetype/internal/ftcalc.h>
 
 
   /* Initialize glyph loader. */
diff --git a/src/autofit/afloader.h b/src/autofit/afloader.h
index d1e0f3c..9728237 100644
--- a/src/autofit/afloader.h
+++ b/src/autofit/afloader.h
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter glyph loading routines (specification).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/autofit/afmodule.c b/src/autofit/afmodule.c
index 3e46a36..e164944 100644
--- a/src/autofit/afmodule.c
+++ b/src/autofit/afmodule.c
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter module implementation (body).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -53,10 +53,10 @@
   void*  _af_debug_hints = _af_debug_hints_rec;
 #endif
 
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_DRIVER_H
-#include FT_SERVICE_PROPERTIES_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/ftdriver.h>
+#include <freetype/internal/services/svprop.h>
 
 
   /**************************************************************************
@@ -149,7 +149,7 @@
       if ( !af_style_classes[ss] )
       {
         FT_TRACE0(( "af_property_set: Invalid value %d for property `%s'\n",
-                    fallback_script, property_name ));
+                    *fallback_script, property_name ));
         return FT_THROW( Invalid_Argument );
       }
 
@@ -550,8 +550,8 @@
     NULL,                                                    /* reset_face */
     NULL,                                              /* get_global_hints */
     NULL,                                             /* done_global_hints */
-    (FT_AutoHinter_GlyphLoadFunc)af_autofitter_load_glyph )  /* load_glyph */
-
+    (FT_AutoHinter_GlyphLoadFunc)af_autofitter_load_glyph    /* load_glyph */
+  )
 
   FT_DEFINE_MODULE(
     autofit_module_class,
diff --git a/src/autofit/afmodule.h b/src/autofit/afmodule.h
index b410809..e8fe4a9 100644
--- a/src/autofit/afmodule.h
+++ b/src/autofit/afmodule.h
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter module implementation (specification).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,9 +19,8 @@
 #ifndef AFMODULE_H_
 #define AFMODULE_H_
 
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_MODULE_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/ftmodapi.h>
 
 
 FT_BEGIN_HEADER
@@ -47,6 +46,7 @@
   } AF_ModuleRec, *AF_Module;
 
 
+FT_DECLARE_AUTOHINTER_INTERFACE( af_autofitter_interface )
 FT_DECLARE_MODULE( autofit_module_class )
 
 
diff --git a/src/autofit/afranges.c b/src/autofit/afranges.c
index 45c8bbf..c8ebf5e 100644
--- a/src/autofit/afranges.c
+++ b/src/autofit/afranges.c
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter Unicode script ranges (body).
  *
- * Copyright (C) 2013-2019 by
+ * Copyright (C) 2013-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -664,6 +664,18 @@
   };
 
 
+  const AF_Script_UniRangeRec  af_medf_uniranges[] =
+  {
+    AF_UNIRANGE_REC( 0x16E40, 0x16E9F ),  /* Medefaidrin */
+    AF_UNIRANGE_REC(       0,       0 )
+  };
+
+  const AF_Script_UniRangeRec  af_medf_nonbase_uniranges[] =
+  {
+    AF_UNIRANGE_REC(       0,       0 )
+  };
+
+
   const AF_Script_UniRangeRec  af_mong_uniranges[] =
   {
     AF_UNIRANGE_REC(  0x1800,  0x18AF ),  /* Mongolian            */
@@ -778,6 +790,18 @@
   };
 
 
+  const AF_Script_UniRangeRec  af_rohg_uniranges[] =
+  {
+    AF_UNIRANGE_REC( 0x10D00, 0x10D3F ),   /* Hanifi Rohingya */
+    AF_UNIRANGE_REC(       0,       0 )
+  };
+
+  const AF_Script_UniRangeRec  af_rohg_nonbase_uniranges[] =
+  {
+    AF_UNIRANGE_REC( 0, 0 )
+  };
+
+
   const AF_Script_UniRangeRec  af_saur_uniranges[] =
   {
     AF_UNIRANGE_REC(  0xA880,  0xA8DF ),   /* Saurashtra */
diff --git a/src/autofit/afranges.h b/src/autofit/afranges.h
index d5917ae..c2ffda4 100644
--- a/src/autofit/afranges.h
+++ b/src/autofit/afranges.h
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter Unicode script ranges (specification).
  *
- * Copyright (C) 2013-2019 by
+ * Copyright (C) 2013-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/autofit/afscript.h b/src/autofit/afscript.h
index 2da8c70..4cf9cc1 100644
--- a/src/autofit/afscript.h
+++ b/src/autofit/afscript.h
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter scripts (specification only).
  *
- * Copyright (C) 2013-2019 by
+ * Copyright (C) 2013-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -243,6 +243,12 @@
           HINTING_BOTTOM_TO_TOP,
           "\xE0\xB4\xA0 \xE0\xB4\xB1" ) /* ഠ റ */
 
+  SCRIPT( medf, MEDF,
+          "Medefaidrin",
+          HB_SCRIPT_MEDEFAIDRIN,
+          HINTING_BOTTOM_TO_TOP,
+          "\xF0\x96\xB9\xA1 \xF0\x96\xB9\x9B \xF0\x96\xB9\xAF" ) /* 𖹡 𖹛 𖹯 */
+
   SCRIPT( mong, MONG,
           "Mongolian",
           HB_SCRIPT_MONGOLIAN,
@@ -291,6 +297,12 @@
           HINTING_BOTTOM_TO_TOP,
           "\xF0\x90\x92\x86 \xF0\x90\x92\xA0" ) /* 𐒆 𐒠 */
 
+  SCRIPT( rohg, ROHG,
+          "Hanifi Rohingya",
+          HB_SCRIPT_HANIFI_ROHINGYA,
+          HINTING_BOTTOM_TO_TOP,
+          "\xF0\x90\xB4\xB0" ) /* 𐴰 */
+
   SCRIPT( saur, SAUR,
           "Saurashtra",
           HB_SCRIPT_SAURASHTRA,
diff --git a/src/autofit/afshaper.c b/src/autofit/afshaper.c
index a5191c6..bbf7b6b 100644
--- a/src/autofit/afshaper.c
+++ b/src/autofit/afshaper.c
@@ -4,7 +4,7 @@
  *
  *   HarfBuzz interface for accessing OpenType features (body).
  *
- * Copyright (C) 2013-2019 by
+ * Copyright (C) 2013-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,9 +16,8 @@
  */
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_ADVANCES_H
+#include <freetype/freetype.h>
+#include <freetype/ftadvanc.h>
 #include "afglobal.h"
 #include "aftypes.h"
 #include "afshaper.h"
diff --git a/src/autofit/afshaper.h b/src/autofit/afshaper.h
index 06a1e06..138c27b 100644
--- a/src/autofit/afshaper.h
+++ b/src/autofit/afshaper.h
@@ -4,7 +4,7 @@
  *
  *   HarfBuzz interface for accessing OpenType features (specification).
  *
- * Copyright (C) 2013-2019 by
+ * Copyright (C) 2013-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
 #define AFSHAPER_H_
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 
 #ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
diff --git a/src/autofit/afstyles.h b/src/autofit/afstyles.h
index 8d1d708..9113ec4 100644
--- a/src/autofit/afstyles.h
+++ b/src/autofit/afstyles.h
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter styles (specification only).
  *
- * Copyright (C) 2013-2019 by
+ * Copyright (C) 2013-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -322,6 +322,13 @@
          AF_BLUE_STRINGSET_MLYM,
          AF_COVERAGE_DEFAULT )
 
+  STYLE( medf_dflt, MEDF_DFLT,
+         "Medefaidrin default style",
+         AF_WRITING_SYSTEM_LATIN,
+         AF_SCRIPT_MEDF,
+         AF_BLUE_STRINGSET_MEDF,
+         AF_COVERAGE_DEFAULT )
+
   STYLE( mong_dflt, MONG_DFLT,
          "Mongolian default style",
          AF_WRITING_SYSTEM_LATIN,
@@ -378,6 +385,13 @@
          AF_BLUE_STRINGSET_OSMA,
          AF_COVERAGE_DEFAULT )
 
+  STYLE( rohg_dflt, ROHG_DFLT,
+         "Hanifi Rohingya default style",
+         AF_WRITING_SYSTEM_LATIN,
+         AF_SCRIPT_ROHG,
+         AF_BLUE_STRINGSET_ROHG,
+         AF_COVERAGE_DEFAULT )
+
   STYLE( saur_dflt, SAUR_DFLT,
          "Saurashtra default style",
          AF_WRITING_SYSTEM_LATIN,
diff --git a/src/autofit/aftypes.h b/src/autofit/aftypes.h
index 579003d..5f040c6 100644
--- a/src/autofit/aftypes.h
+++ b/src/autofit/aftypes.h
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter types (specification only).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -32,12 +32,11 @@
 #ifndef AFTYPES_H_
 #define AFTYPES_H_
 
-#include <ft2build.h>
 
-#include FT_FREETYPE_H
-#include FT_OUTLINE_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/freetype.h>
+#include <freetype/ftoutln.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
 
 #include "afblue.h"
 
diff --git a/src/autofit/afwarp.c b/src/autofit/afwarp.c
index 84e9753..808280d 100644
--- a/src/autofit/afwarp.c
+++ b/src/autofit/afwarp.c
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter warping algorithm (body).
  *
- * Copyright (C) 2006-2019 by
+ * Copyright (C) 2006-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/autofit/afwarp.h b/src/autofit/afwarp.h
index 9a2c9a4..cdea23e 100644
--- a/src/autofit/afwarp.h
+++ b/src/autofit/afwarp.h
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter warping algorithm (specification).
  *
- * Copyright (C) 2006-2019 by
+ * Copyright (C) 2006-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/autofit/afwrtsys.h b/src/autofit/afwrtsys.h
index 5611cf4..3990633 100644
--- a/src/autofit/afwrtsys.h
+++ b/src/autofit/afwrtsys.h
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter writing systems (specification only).
  *
- * Copyright (C) 2013-2019 by
+ * Copyright (C) 2013-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/autofit/autofit.c b/src/autofit/autofit.c
index facfec1..ef5e7f1 100644
--- a/src/autofit/autofit.c
+++ b/src/autofit/autofit.c
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter module (body).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -17,7 +17,6 @@
 
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
 
 #include "afangles.c"
 #include "afblue.c"
diff --git a/src/autofit/module.mk b/src/autofit/module.mk
index cf77b16..c32781f 100644
--- a/src/autofit/module.mk
+++ b/src/autofit/module.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 2003-2019 by
+# Copyright (C) 2003-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/autofit/rules.mk b/src/autofit/rules.mk
index c59da33..553ddce 100644
--- a/src/autofit/rules.mk
+++ b/src/autofit/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 2003-2019 by
+# Copyright (C) 2003-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/base/Jamfile b/src/base/Jamfile
deleted file mode 100644
index 8e1ec42..0000000
--- a/src/base/Jamfile
+++ /dev/null
@@ -1,90 +0,0 @@
-# FreeType 2 src/base Jamfile
-#
-# Copyright (C) 2001-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) base ;
-
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = basepic
-               ftadvanc
-               ftcalc
-               ftcolor
-               ftdbgmem
-               fterrors
-               ftfntfmt
-               ftgloadr
-               fthash
-               ftlcdfil
-               ftobjs
-               ftoutln
-               ftpic
-               ftpsprop
-               ftrfork
-               ftsnames
-               ftstream
-               fttrigon
-               ftutil
-               ;
-  }
-  else
-  {
-    _sources = ftbase ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# Add the optional/replaceable files.
-#
-{
-  local  _sources = ftbbox
-                    ftbdf
-                    ftbitmap
-                    ftcid
-                    ftdebug
-                    ftfstype
-                    ftgasp
-                    ftglyph
-                    ftgxval
-                    ftinit
-                    ftmm
-                    ftotval
-                    ftpatent
-                    ftpfr
-                    ftstroke
-                    ftsynth
-                    ftsystem
-                    fttype1
-                    ftwinfnt
-                    ;
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# Add Macintosh-specific file to the library when necessary.
-#
-if $(MAC)
-{
-  Library  $(FT2_LIB) : ftmac.c ;
-}
-else if $(OS) = MACOSX
-{
-  if $(FT2_MULTI)
-  {
-    Library  $(FT2_LIB) : ftmac.c ;
-  }
-}
-
-# end of src/base Jamfile
diff --git a/src/base/ftadvanc.c b/src/base/ftadvanc.c
index 0dfba57..c689e6a 100644
--- a/src/base/ftadvanc.c
+++ b/src/base/ftadvanc.c
@@ -4,7 +4,7 @@
  *
  *   Quick computation of advance widths (body).
  *
- * Copyright (C) 2008-2019 by
+ * Copyright (C) 2008-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,11 +16,10 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 
-#include FT_ADVANCES_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/ftadvanc.h>
+#include <freetype/internal/ftobjs.h>
 
 
   static FT_Error
diff --git a/src/base/ftbase.c b/src/base/ftbase.c
index fb8cbfc..bfbaffd 100644
--- a/src/base/ftbase.c
+++ b/src/base/ftbase.c
@@ -4,7 +4,7 @@
  *
  *   Single object library component (body only).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,7 +16,6 @@
  */
 
 
-#include <ft2build.h>
 #define  FT_MAKE_OPTION_SINGLE_OBJECT
 
 #include "ftadvanc.c"
diff --git a/src/base/ftbase.h b/src/base/ftbase.h
index 35b1c47..25afa9b 100644
--- a/src/base/ftbase.h
+++ b/src/base/ftbase.h
@@ -4,7 +4,7 @@
  *
  *   Private functions used in the `base' module (specification).
  *
- * Copyright (C) 2008-2019 by
+ * Copyright (C) 2008-2020 by
  * David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,13 +20,16 @@
 #define FTBASE_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/ftobjs.h>
 
 
 FT_BEGIN_HEADER
 
 
+  FT_DECLARE_GLYPH( ft_bitmap_glyph_class )
+  FT_DECLARE_GLYPH( ft_outline_glyph_class )
+
+
 #ifdef FT_CONFIG_OPTION_MAC_FONTS
 
   /* MacOS resource fork cannot exceed 16MB at least for Carbon code; */
diff --git a/src/base/ftbbox.c b/src/base/ftbbox.c
index a0b2c46..30a4eba 100644
--- a/src/base/ftbbox.c
+++ b/src/base/ftbbox.c
@@ -4,7 +4,7 @@
  *
  *   FreeType bbox computation (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used
@@ -24,14 +24,13 @@
    */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 
-#include FT_BBOX_H
-#include FT_IMAGE_H
-#include FT_OUTLINE_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/ftbbox.h>
+#include <freetype/ftimage.h>
+#include <freetype/ftoutln.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/ftobjs.h>
 
 
   typedef struct  TBBox_Rec_
@@ -294,10 +293,10 @@
       if ( shift > 2 )
         shift = 2;
 
-      q1 <<=  shift;
-      q2 <<=  shift;
-      q3 <<=  shift;
-      q4 <<=  shift;
+      q1 *= 1 << shift;
+      q2 *= 1 << shift;
+      q3 *= 1 << shift;
+      q4 *= 1 << shift;
     }
     else
     {
diff --git a/src/base/ftbdf.c b/src/base/ftbdf.c
index c0fccd7..fc374c6 100644
--- a/src/base/ftbdf.c
+++ b/src/base/ftbdf.c
@@ -4,7 +4,7 @@
  *
  *   FreeType API for accessing BDF-specific strings (body).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,11 +16,10 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_BDF_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/services/svbdf.h>
 
 
   /* documentation is in ftbdf.h */
diff --git a/src/base/ftbitmap.c b/src/base/ftbitmap.c
index 0e0a76f..584213d 100644
--- a/src/base/ftbitmap.c
+++ b/src/base/ftbitmap.c
@@ -4,7 +4,7 @@
  *
  *   FreeType utility functions for bitmaps (body).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,12 +16,11 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 
-#include FT_BITMAP_H
-#include FT_IMAGE_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/ftbitmap.h>
+#include <freetype/ftimage.h>
+#include <freetype/internal/ftobjs.h>
 
 
   /**************************************************************************
@@ -909,13 +908,13 @@
 
 #ifdef FT_DEBUG_LEVEL_TRACE
     FT_TRACE5(( "FT_Bitmap_Blend:\n"
-                "  source bitmap: (%d, %d) -- (%d, %d); %d x %d\n",
+                "  source bitmap: (%ld, %ld) -- (%ld, %ld); %d x %d\n",
       source_llx / 64, source_lly / 64,
       source_urx / 64, source_ury / 64,
       source_->width, source_->rows ));
 
     if ( target->width && target->rows )
-      FT_TRACE5(( "  target bitmap: (%d, %d) -- (%d, %d); %d x %d\n",
+      FT_TRACE5(( "  target bitmap: (%ld, %ld) -- (%ld, %ld); %d x %d\n",
         target_llx / 64, target_lly / 64,
         target_urx / 64, target_ury / 64,
         target->width, target->rows ));
@@ -923,7 +922,7 @@
       FT_TRACE5(( "  target bitmap: empty\n" ));
 
     if ( final_width && final_rows )
-      FT_TRACE5(( "  final bitmap: (%d, %d) -- (%d, %d); %d x %d\n",
+      FT_TRACE5(( "  final bitmap: (%ld, %ld) -- (%ld, %ld); %d x %d\n",
         final_llx / 64, final_lly / 64,
         final_urx / 64, final_ury / 64,
         final_width, final_rows ));
diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c
index 315dc44..b5258c8 100644
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -4,7 +4,7 @@
  *
  *   Arithmetic computations (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -32,12 +32,11 @@
    */
 
 
-#include <ft2build.h>
-#include FT_GLYPH_H
-#include FT_TRIGONOMETRY_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/ftglyph.h>
+#include <freetype/fttrigon.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftobjs.h>
 
 
 #ifdef FT_MULFIX_ASSEMBLER
diff --git a/src/base/ftcid.c b/src/base/ftcid.c
index 190b23f..ce8a876 100644
--- a/src/base/ftcid.c
+++ b/src/base/ftcid.c
@@ -4,7 +4,7 @@
  *
  *   FreeType API for accessing CID font information.
  *
- * Copyright (C) 2007-2019 by
+ * Copyright (C) 2007-2020 by
  * Derek Clegg and Michael Toftdal.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,10 +16,9 @@
  */
 
 
-#include <ft2build.h>
-#include FT_CID_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_CID_H
+#include <freetype/ftcid.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/services/svcid.h>
 
 
   /* documentation is in ftcid.h */
diff --git a/src/base/ftcolor.c b/src/base/ftcolor.c
index 8cb057a..a50d680 100644
--- a/src/base/ftcolor.c
+++ b/src/base/ftcolor.c
@@ -4,7 +4,7 @@
  *
  *   FreeType's glyph color management (body).
  *
- * Copyright (C) 2018-2019 by
+ * Copyright (C) 2018-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,11 +16,10 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
-#include FT_COLOR_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/sfnt.h>
+#include <freetype/internal/tttypes.h>
+#include <freetype/ftcolor.h>
 
 
 #ifdef TT_CONFIG_OPTION_COLOR_LAYERS
diff --git a/src/base/ftdbgmem.c b/src/base/ftdbgmem.c
index 55cd269..eb0d651 100644
--- a/src/base/ftdbgmem.c
+++ b/src/base/ftdbgmem.c
@@ -4,7 +4,7 @@
  *
  *   Memory debugger (body).
  *
- * Copyright (C) 2001-2019 by
+ * Copyright (C) 2001-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -18,11 +18,11 @@
 
 #include <ft2build.h>
 #include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_MEMORY_H
-#include FT_SYSTEM_H
-#include FT_ERRORS_H
-#include FT_TYPES_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftmemory.h>
+#include <freetype/ftsystem.h>
+#include <freetype/fterrors.h>
+#include <freetype/fttypes.h>
 
 
 #ifdef FT_DEBUG_MEMORY
@@ -621,8 +621,10 @@
 
         if ( node->size < 0 )
           ft_mem_debug_panic(
-            "freeing memory block at %p more than once at (%s:%ld)\n"
-            "block allocated at (%s:%ld) and released at (%s:%ld)",
+            "freeing memory block at %p more than once\n"
+            "  at (%s:%ld)!\n"
+            "  Block was allocated at (%s:%ld)\n"
+            "  and released at (%s:%ld).",
             address,
             FT_FILENAME( _ft_debug_file ), _ft_debug_lineno,
             FT_FILENAME( node->source->file_name ), node->source->line_no,
diff --git a/src/base/ftdebug.c b/src/base/ftdebug.c
index ec72337..62cf680 100644
--- a/src/base/ftdebug.c
+++ b/src/base/ftdebug.c
@@ -4,7 +4,7 @@
  *
  *   Debugging and logging component (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -41,9 +41,8 @@
    */
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/freetype.h>
+#include <freetype/internal/ftdebug.h>
 
 
 #ifdef FT_DEBUG_LEVEL_ERROR
@@ -126,7 +125,7 @@
 
   static const char*  ft_trace_toggles[trace_count + 1] =
   {
-#include FT_INTERNAL_TRACE_H
+#include <freetype/internal/fttrace.h>
     NULL
   };
 
diff --git a/src/base/fterrors.c b/src/base/fterrors.c
index 84fe590..eba9e76 100644
--- a/src/base/fterrors.c
+++ b/src/base/fterrors.c
@@ -4,7 +4,7 @@
  *
  *   FreeType API for error code handling.
  *
- * Copyright (C) 2018-2019 by
+ * Copyright (C) 2018-2020 by
  * Armin Hasitzka, David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,9 +16,8 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_ERRORS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/fterrors.h>
 
 
   /* documentation is in fterrors.h */
@@ -38,7 +37,7 @@
 #define FT_ERRORDEF( e, v, s )    case v: return s;
 #define FT_ERROR_END_LIST       }
 
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
 
 #endif /* defined( FT_CONFIG_OPTION_ERROR_STRINGS ) || ... */
 
diff --git a/src/base/ftfntfmt.c b/src/base/ftfntfmt.c
index 54ba537..a45317e 100644
--- a/src/base/ftfntfmt.c
+++ b/src/base/ftfntfmt.c
@@ -4,7 +4,7 @@
  *
  *   FreeType utility file for font formats (body).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,10 +16,9 @@
  */
 
 
-#include <ft2build.h>
-#include FT_FONT_FORMATS_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_FONT_FORMAT_H
+#include <freetype/ftfntfmt.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/services/svfntfmt.h>
 
 
   /* documentation is in ftfntfmt.h */
diff --git a/src/base/ftfstype.c b/src/base/ftfstype.c
index 45e2d80..bca548f 100644
--- a/src/base/ftfstype.c
+++ b/src/base/ftfstype.c
@@ -4,7 +4,7 @@
  *
  *   FreeType utility file to access FSType data (body).
  *
- * Copyright (C) 2008-2019 by
+ * Copyright (C) 2008-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -15,11 +15,10 @@
  *
  */
 
-#include <ft2build.h>
-#include FT_TYPE1_TABLES_H
-#include FT_TRUETYPE_TABLES_H
-#include FT_INTERNAL_SERVICE_H
-#include FT_SERVICE_POSTSCRIPT_INFO_H
+#include <freetype/t1tables.h>
+#include <freetype/tttables.h>
+#include <freetype/internal/ftserv.h>
+#include <freetype/internal/services/svpsinfo.h>
 
 
   /* documentation is in freetype.h */
diff --git a/src/base/ftgasp.c b/src/base/ftgasp.c
index 720fb11..eed05a3 100644
--- a/src/base/ftgasp.c
+++ b/src/base/ftgasp.c
@@ -4,7 +4,7 @@
  *
  *   Access of TrueType's `gasp' table (body).
  *
- * Copyright (C) 2007-2019 by
+ * Copyright (C) 2007-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,9 +16,8 @@
  */
 
 
-#include <ft2build.h>
-#include FT_GASP_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
+#include <freetype/ftgasp.h>
+#include <freetype/internal/tttypes.h>
 
 
   FT_EXPORT_DEF( FT_Int )
diff --git a/src/base/ftgloadr.c b/src/base/ftgloadr.c
index bfeed46..05fc769 100644
--- a/src/base/ftgloadr.c
+++ b/src/base/ftgloadr.c
@@ -4,7 +4,7 @@
  *
  *   The FreeType glyph loader (body).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,11 +16,10 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_GLYPH_LOADER_H
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftgloadr.h>
+#include <freetype/internal/ftmemory.h>
+#include <freetype/internal/ftobjs.h>
 
 #undef  FT_COMPONENT
 #define FT_COMPONENT  gloader
@@ -93,6 +92,7 @@
 
     base->outline.n_points   = 0;
     base->outline.n_contours = 0;
+    base->outline.flags      = 0;
     base->num_subglyphs      = 0;
 
     *current = *base;
@@ -146,9 +146,9 @@
     FT_Outline*  current = &loader->current.outline;
 
 
-    current->points   = base->points   + base->n_points;
-    current->tags     = base->tags     + base->n_points;
-    current->contours = base->contours + base->n_contours;
+    current->points   = FT_OFFSET( base->points,   base->n_points );
+    current->tags     = FT_OFFSET( base->tags,     base->n_points );
+    current->contours = FT_OFFSET( base->contours, base->n_contours );
 
     /* handle extra points table - if any */
     if ( loader->use_extra )
@@ -169,6 +169,10 @@
     FT_Memory  memory = loader->memory;
 
 
+    if ( loader->max_points == 0           ||
+         loader->base.extra_points != NULL )
+      return FT_Err_Ok;
+
     if ( !FT_NEW_ARRAY( loader->base.extra_points, 2 * loader->max_points ) )
     {
       loader->use_extra          = 1;
@@ -189,7 +193,7 @@
     FT_GlyphLoad  current = &loader->current;
 
 
-    current->subglyphs = base->subglyphs + base->num_subglyphs;
+    current->subglyphs = FT_OFFSET( base->subglyphs, base->num_subglyphs );
   }
 
 
@@ -211,6 +215,10 @@
     FT_UInt      new_max, old_max;
 
 
+    error = FT_GlyphLoader_CreateExtra( loader );
+    if ( error )
+      return error;
+
     /* check points & tags */
     new_max = (FT_UInt)base->n_points + (FT_UInt)current->n_points +
               n_points;
@@ -244,6 +252,10 @@
       loader->max_points = new_max;
     }
 
+    error = FT_GlyphLoader_CreateExtra( loader );
+    if ( error )
+      return error;
+
     /* check contours */
     old_max = loader->max_contours;
     new_max = (FT_UInt)base->n_contours + (FT_UInt)current->n_contours +
diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c
index e6b1327..825eba2 100644
--- a/src/base/ftglyph.c
+++ b/src/base/ftglyph.c
@@ -4,7 +4,7 @@
  *
  *   FreeType convenience functions to handle glyphs (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -28,13 +28,14 @@
    */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 
-#include FT_GLYPH_H
-#include FT_OUTLINE_H
-#include FT_BITMAP_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/ftglyph.h>
+#include <freetype/ftoutln.h>
+#include <freetype/ftbitmap.h>
+#include <freetype/internal/ftobjs.h>
+
+#include "ftbase.h"
 
 
   /**************************************************************************
diff --git a/src/base/ftgxval.c b/src/base/ftgxval.c
index 0677d26..f04df14 100644
--- a/src/base/ftgxval.c
+++ b/src/base/ftgxval.c
@@ -4,7 +4,7 @@
  *
  *   FreeType API for validating TrueTypeGX/AAT tables (body).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * Masatake YAMATO, Redhat K.K,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
@@ -25,11 +25,10 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_GX_VALIDATE_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/services/svgxval.h>
 
 
   /* documentation is in ftgxval.h */
diff --git a/src/base/fthash.c b/src/base/fthash.c
index 387e6d2..449b03a 100644
--- a/src/base/fthash.c
+++ b/src/base/fthash.c
@@ -39,9 +39,8 @@
    */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_HASH_H
-#include FT_INTERNAL_MEMORY_H
+#include <freetype/internal/fthash.h>
+#include <freetype/internal/ftmemory.h>
 
 
 #define INITIAL_HT_SIZE  241
diff --git a/src/base/ftinit.c b/src/base/ftinit.c
index c73cd78..0acc75e 100644
--- a/src/base/ftinit.c
+++ b/src/base/ftinit.c
@@ -4,7 +4,7 @@
  *
  *   FreeType initialization layer (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -39,9 +39,9 @@
 
 #include <ft2build.h>
 #include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_MODULE_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/ftmodapi.h>
 
 
   /**************************************************************************
diff --git a/src/base/ftlcdfil.c b/src/base/ftlcdfil.c
index d9f4af4..1e84dbc 100644
--- a/src/base/ftlcdfil.c
+++ b/src/base/ftlcdfil.c
@@ -4,7 +4,7 @@
  *
  *   FreeType API for color filtering of subpixel bitmap glyphs (body).
  *
- * Copyright (C) 2006-2019 by
+ * Copyright (C) 2006-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,12 +16,11 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 
-#include FT_LCD_FILTER_H
-#include FT_IMAGE_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/ftlcdfil.h>
+#include <freetype/ftimage.h>
+#include <freetype/internal/ftobjs.h>
 
 
 #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
diff --git a/src/base/ftmac.c b/src/base/ftmac.c
index 5f23cee..55a631f 100644
--- a/src/base/ftmac.c
+++ b/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-2019 by
+ * Copyright (C) 1996-2020 by
  * Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -65,10 +65,9 @@
   */
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_INTERNAL_STREAM_H
+#include <freetype/freetype.h>
+#include <freetype/tttags.h>
+#include <freetype/internal/ftstream.h>
 #include "ftbase.h"
 
 
diff --git a/src/base/ftmm.c b/src/base/ftmm.c
index ba9e67f..9a702b9 100644
--- a/src/base/ftmm.c
+++ b/src/base/ftmm.c
@@ -4,7 +4,7 @@
  *
  *   Multiple Master font support (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,13 +16,12 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 
-#include FT_MULTIPLE_MASTERS_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_MULTIPLE_MASTERS_H
-#include FT_SERVICE_METRICS_VARIATIONS_H
+#include <freetype/ftmm.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/services/svmm.h>
+#include <freetype/internal/services/svmetric.h>
 
 
   /**************************************************************************
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index e301f8f..c060bbb 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -4,7 +4,7 @@
  *
  *   The FreeType private base classes (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,32 +16,31 @@
  */
 
 
-#include <ft2build.h>
-#include FT_LIST_H
-#include FT_OUTLINE_H
-#include FT_FONT_FORMATS_H
+#include <freetype/ftlist.h>
+#include <freetype/ftoutln.h>
+#include <freetype/ftfntfmt.h>
 
-#include FT_INTERNAL_VALIDATE_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_RFORK_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_SFNT_H            /* for SFNT_Load_Table_Func */
-#include FT_INTERNAL_POSTSCRIPT_AUX_H  /* for PS_Driver            */
+#include <freetype/internal/ftvalid.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftrfork.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/sfnt.h>          /* for SFNT_Load_Table_Func */
+#include <freetype/internal/psaux.h>         /* for PS_Driver            */
 
-#include FT_TRUETYPE_TABLES_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_TRUETYPE_IDS_H
+#include <freetype/tttables.h>
+#include <freetype/tttags.h>
+#include <freetype/ttnameid.h>
 
-#include FT_SERVICE_PROPERTIES_H
-#include FT_SERVICE_SFNT_H
-#include FT_SERVICE_POSTSCRIPT_NAME_H
-#include FT_SERVICE_GLYPH_DICT_H
-#include FT_SERVICE_TT_CMAP_H
-#include FT_SERVICE_KERNING_H
-#include FT_SERVICE_TRUETYPE_ENGINE_H
+#include <freetype/internal/services/svprop.h>
+#include <freetype/internal/services/svsfnt.h>
+#include <freetype/internal/services/svpostnm.h>
+#include <freetype/internal/services/svgldict.h>
+#include <freetype/internal/services/svttcmap.h>
+#include <freetype/internal/services/svkern.h>
+#include <freetype/internal/services/svtteng.h>
 
-#include FT_DRIVER_H
+#include <freetype/ftdriver.h>
 
 #ifdef FT_CONFIG_OPTION_MAC_FONTS
 #include "ftbase.h"
@@ -50,7 +49,7 @@
 
 #ifdef FT_DEBUG_LEVEL_TRACE
 
-#include FT_BITMAP_H
+#include <freetype/ftbitmap.h>
 
 #if defined( _MSC_VER )      /* Visual C++ (and Intel C++)   */
   /* We disable the warning `conversion from XXX to YYY,     */
@@ -1063,11 +1062,30 @@
                 slot->linearHoriAdvance / 65536.0 ));
     FT_TRACE5(( "  linear y advance: %f\n",
                 slot->linearVertAdvance / 65536.0 ));
+    FT_TRACE5(( "\n" ));
     FT_TRACE5(( "  bitmap %dx%d, %s (mode %d)\n",
                 slot->bitmap.width,
                 slot->bitmap.rows,
                 pixel_modes[slot->bitmap.pixel_mode],
                 slot->bitmap.pixel_mode ));
+    FT_TRACE5(( "\n" ));
+
+    {
+      FT_Glyph_Metrics*  metrics = &slot->metrics;
+
+
+      FT_TRACE5(( "  metrics:\n" ));
+      FT_TRACE5(( "    width:  %f\n", metrics->width  / 64.0 ));
+      FT_TRACE5(( "    height: %f\n", metrics->height / 64.0 ));
+      FT_TRACE5(( "\n" ));
+      FT_TRACE5(( "    horiBearingX: %f\n", metrics->horiBearingX / 64.0 ));
+      FT_TRACE5(( "    horiBearingY: %f\n", metrics->horiBearingY / 64.0 ));
+      FT_TRACE5(( "    horiAdvance:  %f\n", metrics->horiAdvance  / 64.0 ));
+      FT_TRACE5(( "\n" ));
+      FT_TRACE5(( "    vertBearingX: %f\n", metrics->vertBearingX / 64.0 ));
+      FT_TRACE5(( "    vertBearingY: %f\n", metrics->vertBearingY / 64.0 ));
+      FT_TRACE5(( "    vertAdvance:  %f\n", metrics->vertAdvance  / 64.0 ));
+    }
 #endif
 
   Exit:
@@ -1842,15 +1860,15 @@
       /* FT2 allocator takes signed long buffer length,
        * too large value causing overflow should be checked
        */
-      FT_TRACE4(( "                 POST fragment #%d: length=0x%08x"
-                  " total pfb_len=0x%08x\n",
+      FT_TRACE4(( "                 POST fragment #%d: length=0x%08lx"
+                  " total pfb_len=0x%08lx\n",
                   i, temp, pfb_len + temp + 6 ));
 
       if ( FT_MAC_RFORK_MAX_LEN < temp               ||
            FT_MAC_RFORK_MAX_LEN - temp < pfb_len + 6 )
       {
         FT_TRACE2(( "             MacOS resource length cannot exceed"
-                    " 0x%08x\n",
+                    " 0x%08lx\n",
                     FT_MAC_RFORK_MAX_LEN ));
 
         error = FT_THROW( Invalid_Offset );
@@ -1861,13 +1879,13 @@
     }
 
     FT_TRACE2(( "             total buffer size to concatenate"
-                " %d POST fragments: 0x%08x\n",
+                " %ld POST fragments: 0x%08lx\n",
                  resource_cnt, pfb_len + 2 ));
 
     if ( pfb_len + 2 < 6 )
     {
       FT_TRACE2(( "             too long fragment length makes"
-                  " pfb_len confused: pfb_len=0x%08x\n",
+                  " pfb_len confused: pfb_len=0x%08lx\n",
                   pfb_len ));
 
       error = FT_THROW( Array_Too_Large );
@@ -1910,7 +1928,7 @@
         goto Exit2;
 
       FT_TRACE3(( "POST fragment[%d]:"
-                  " offsets=0x%08x, rlen=0x%08x, flags=0x%04x\n",
+                  " offsets=0x%08lx, rlen=0x%08lx, flags=0x%04x\n",
                   i, offsets[i], rlen, flags ));
 
       error = FT_ERR( Array_Too_Large );
@@ -1937,7 +1955,7 @@
       else
       {
         FT_TRACE3(( "    Write POST fragment #%d header (4-byte) to buffer"
-                    " %p + 0x%08x\n",
+                    " %p + 0x%08lx\n",
                     i, pfb_data, pfb_lenpos ));
 
         if ( pfb_lenpos + 3 > pfb_len + 2 )
@@ -1952,7 +1970,7 @@
           break;
 
         FT_TRACE3(( "    Write POST fragment #%d header (6-byte) to buffer"
-                    " %p + 0x%08x\n",
+                    " %p + 0x%08lx\n",
                     i, pfb_data, pfb_pos ));
 
         if ( pfb_pos + 6 > pfb_len + 2 )
@@ -1974,8 +1992,8 @@
       if ( pfb_pos > pfb_len || pfb_pos + rlen > pfb_len )
         goto Exit2;
 
-      FT_TRACE3(( "    Load POST fragment #%d (%d byte) to buffer"
-                  " %p + 0x%08x\n",
+      FT_TRACE3(( "    Load POST fragment #%d (%ld byte) to buffer"
+                  " %p + 0x%08lx\n",
                   i, rlen, pfb_data, pfb_pos ));
 
       error = FT_Stream_Read( stream, (FT_Byte *)pfb_data + pfb_pos, rlen );
@@ -2260,7 +2278,7 @@
       args2.flags    = FT_OPEN_PATHNAME;
       args2.pathname = file_names[i] ? file_names[i] : args->pathname;
 
-      FT_TRACE3(( "Try rule %d: %s (offset=%d) ...",
+      FT_TRACE3(( "Try rule %d: %s (offset=%ld) ...",
                   i, args2.pathname, offsets[i] ));
 
       error = FT_Stream_New( library, &args2, &stream2 );
@@ -2858,6 +2876,8 @@
     if ( error )
     {
       FT_FREE( node );
+      if ( size )
+        FT_FREE( size->internal );
       FT_FREE( size );
     }
 
@@ -3213,9 +3233,9 @@
       FT_Size_Metrics*  metrics = &face->size->metrics;
 
 
-      FT_TRACE5(( "  x scale: %d (%f)\n",
+      FT_TRACE5(( "  x scale: %ld (%f)\n",
                   metrics->x_scale, metrics->x_scale / 65536.0 ));
-      FT_TRACE5(( "  y scale: %d (%f)\n",
+      FT_TRACE5(( "  y scale: %ld (%f)\n",
                   metrics->y_scale, metrics->y_scale / 65536.0 ));
       FT_TRACE5(( "  ascender: %f\n",    metrics->ascender / 64.0 ));
       FT_TRACE5(( "  descender: %f\n",   metrics->descender / 64.0 ));
@@ -3288,9 +3308,9 @@
       FT_Size_Metrics*  metrics = &face->size->metrics;
 
 
-      FT_TRACE5(( "  x scale: %d (%f)\n",
+      FT_TRACE5(( "  x scale: %ld (%f)\n",
                   metrics->x_scale, metrics->x_scale / 65536.0 ));
-      FT_TRACE5(( "  y scale: %d (%f)\n",
+      FT_TRACE5(( "  y scale: %ld (%f)\n",
                   metrics->y_scale, metrics->y_scale / 65536.0 ));
       FT_TRACE5(( "  ascender: %f\n",    metrics->ascender / 64.0 ));
       FT_TRACE5(( "  descender: %f\n",   metrics->descender / 64.0 ));
@@ -3450,7 +3470,7 @@
               if ( akerning->x != orig_x_rounded ||
                    akerning->y != orig_y_rounded )
                 FT_TRACE5(( "FT_Get_Kerning: horizontal kerning"
-                            " (%d, %d) scaled down to (%d, %d) pixels\n",
+                            " (%ld, %ld) scaled down to (%ld, %ld) pixels\n",
                             orig_x_rounded / 64, orig_y_rounded / 64,
                             akerning->x / 64, akerning->y / 64 ));
             }
@@ -3722,7 +3742,7 @@
       if ( charcode > 0xFFFFFFFFUL )
       {
         FT_TRACE1(( "FT_Get_Char_Index: too large charcode" ));
-        FT_TRACE1(( " 0x%x is truncated\n", charcode ));
+        FT_TRACE1(( " 0x%lx is truncated\n", charcode ));
       }
 
       result = cmap->clazz->char_index( cmap, (FT_UInt32)charcode );
@@ -3898,13 +3918,13 @@
         {
           FT_TRACE1(( "FT_Face_GetCharVariantIndex:"
                       " too large charcode" ));
-          FT_TRACE1(( " 0x%x is truncated\n", charcode ));
+          FT_TRACE1(( " 0x%lx is truncated\n", charcode ));
         }
         if ( variantSelector > 0xFFFFFFFFUL )
         {
           FT_TRACE1(( "FT_Face_GetCharVariantIndex:"
                       " too large variantSelector" ));
-          FT_TRACE1(( " 0x%x is truncated\n", variantSelector ));
+          FT_TRACE1(( " 0x%lx is truncated\n", variantSelector ));
         }
 
         result = vcmap->clazz->char_var_index( vcmap, ucmap,
@@ -3941,13 +3961,13 @@
         {
           FT_TRACE1(( "FT_Face_GetCharVariantIsDefault:"
                       " too large charcode" ));
-          FT_TRACE1(( " 0x%x is truncated\n", charcode ));
+          FT_TRACE1(( " 0x%lx is truncated\n", charcode ));
         }
         if ( variantSelector > 0xFFFFFFFFUL )
         {
           FT_TRACE1(( "FT_Face_GetCharVariantIsDefault:"
                       " too large variantSelector" ));
-          FT_TRACE1(( " 0x%x is truncated\n", variantSelector ));
+          FT_TRACE1(( " 0x%lx is truncated\n", variantSelector ));
         }
 
         result = vcmap->clazz->char_var_default( vcmap,
@@ -4010,7 +4030,7 @@
         if ( charcode > 0xFFFFFFFFUL )
         {
           FT_TRACE1(( "FT_Face_GetVariantsOfChar: too large charcode" ));
-          FT_TRACE1(( " 0x%x is truncated\n", charcode ));
+          FT_TRACE1(( " 0x%lx is truncated\n", charcode ));
         }
 
         result = vcmap->clazz->charvariant_list( vcmap, memory,
@@ -4044,7 +4064,7 @@
         if ( variantSelector > 0xFFFFFFFFUL )
         {
           FT_TRACE1(( "FT_Get_Char_Index: too large variantSelector" ));
-          FT_TRACE1(( " 0x%x is truncated\n", variantSelector ));
+          FT_TRACE1(( " 0x%lx is truncated\n", variantSelector ));
         }
 
         result = vcmap->clazz->variantchar_list( vcmap, memory,
diff --git a/src/base/ftotval.c b/src/base/ftotval.c
index 007576c..90a5dd6 100644
--- a/src/base/ftotval.c
+++ b/src/base/ftotval.c
@@ -4,7 +4,7 @@
  *
  *   FreeType API for validating OpenType tables (body).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -15,12 +15,11 @@
  *
  */
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_OPENTYPE_VALIDATE_H
-#include FT_OPENTYPE_VALIDATE_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/services/svotval.h>
+#include <freetype/ftotval.h>
 
 
   /* documentation is in ftotval.h */
diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c
index 0e2ba34..311f098 100644
--- a/src/base/ftoutln.c
+++ b/src/base/ftoutln.c
@@ -4,7 +4,7 @@
  *
  *   FreeType outline management (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,12 +16,11 @@
  */
 
 
-#include <ft2build.h>
-#include FT_OUTLINE_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_TRIGONOMETRY_H
+#include <freetype/ftoutln.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/fttrigon.h>
 
 
   /**************************************************************************
@@ -275,7 +274,7 @@
       first = (FT_UInt)last + 1;
     }
 
-    FT_TRACE5(( "FT_Outline_Decompose: Done\n", n ));
+    FT_TRACE5(( "FT_Outline_Decompose: Done\n" ));
     return FT_Err_Ok;
 
   Invalid_Outline:
@@ -711,7 +710,7 @@
     FT_Vector*  limit;
 
 
-    if ( !outline || !matrix )
+    if ( !outline || !matrix || !outline->points )
       return;
 
     vec   = outline->points;
@@ -1061,6 +1060,11 @@
     if ( cbox.xMin == cbox.xMax || cbox.yMin == cbox.yMax )
       return FT_ORIENTATION_NONE;
 
+    /* Reject values large outlines. */
+    if ( cbox.xMin < -0x1000000L || cbox.yMin < -0x1000000L ||
+         cbox.xMax >  0x1000000L || cbox.yMax >  0x1000000L )
+      return FT_ORIENTATION_NONE;
+
     xshift = FT_MSB( (FT_UInt32)( FT_ABS( cbox.xMax ) |
                                   FT_ABS( cbox.xMin ) ) ) - 14;
     xshift = FT_MAX( xshift, 0 );
diff --git a/src/base/ftpatent.c b/src/base/ftpatent.c
index 020f464..a02c636 100644
--- a/src/base/ftpatent.c
+++ b/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-2019 by
+ * Copyright (C) 2007-2020 by
  * David Turner.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,13 +16,12 @@
  *
  */
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_STREAM_H
-#include FT_SERVICE_SFNT_H
-#include FT_SERVICE_TRUETYPE_GLYF_H
+#include <freetype/freetype.h>
+#include <freetype/tttags.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/services/svsfnt.h>
+#include <freetype/internal/services/svttglyf.h>
 
 
   /* documentation is in freetype.h */
diff --git a/src/base/ftpfr.c b/src/base/ftpfr.c
index aeff1db..c656fcd 100644
--- a/src/base/ftpfr.c
+++ b/src/base/ftpfr.c
@@ -4,7 +4,7 @@
  *
  *   FreeType API for accessing PFR-specific data (body).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -15,11 +15,10 @@
  *
  */
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_PFR_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/services/svpfr.h>
 
 
   /* check the format */
diff --git a/src/base/ftpsprop.c b/src/base/ftpsprop.c
index 52b9d45..8c29f50 100644
--- a/src/base/ftpsprop.c
+++ b/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-2019 by
+ * Copyright (C) 2017-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -17,12 +17,11 @@
  */
 
 
-#include <ft2build.h>
-#include FT_DRIVER_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_POSTSCRIPT_PROPS_H
+#include <freetype/ftdriver.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/psaux.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftpsprop.h>
 
 
   /**************************************************************************
@@ -165,9 +164,9 @@
           driver->hinting_engine = *hinting_engine;
         else
           error = FT_ERR( Unimplemented_Feature );
-
-        return error;
       }
+
+      return error;
     }
 
     else if ( !ft_strcmp( property_name, "no-stem-darkening" ) )
diff --git a/src/base/ftrfork.c b/src/base/ftrfork.c
index 73b7eb0..f989be4 100644
--- a/src/base/ftrfork.c
+++ b/src/base/ftrfork.c
@@ -4,7 +4,7 @@
  *
  *   Embedded resource forks accessor (body).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * Masatake YAMATO and Redhat K.K.
  *
  * FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are
@@ -24,10 +24,9 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_RFORK_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftrfork.h>
 
 #include "ftbase.h"
 
@@ -240,7 +239,7 @@
                   (char)( 0xFF & ( tag_internal >> 16 ) ),
                   (char)( 0xFF & ( tag_internal >>  8 ) ),
                   (char)( 0xFF & ( tag_internal >>  0 ) ) ));
-      FT_TRACE3(( "             : subcount=%d, suboffset=0x%04x\n",
+      FT_TRACE3(( "             : subcount=%d, suboffset=0x%04lx\n",
                   subcnt, rpos ));
 
       if ( tag_internal == tag )
@@ -286,7 +285,7 @@
           ref[j].offset = temp & 0xFFFFFFL;
 
           FT_TRACE3(( "             [%d]:"
-                      " resource_id=0x%04x, offset=0x%08x\n",
+                      " resource_id=0x%04x, offset=0x%08lx\n",
                       j, (FT_UShort)ref[j].res_id, ref[j].offset ));
         }
 
@@ -302,7 +301,7 @@
 
           for ( j = 0; j < *count; j++ )
             FT_TRACE3(( "             [%d]:"
-                        " resource_id=0x%04x, offset=0x%08x\n",
+                        " resource_id=0x%04x, offset=0x%08lx\n",
                         j, ref[j].res_id, ref[j].offset ));
         }
 
diff --git a/src/base/ftsnames.c b/src/base/ftsnames.c
index 7ab3fe3..8507f28 100644
--- a/src/base/ftsnames.c
+++ b/src/base/ftsnames.c
@@ -7,7 +7,7 @@
  *
  *   This is _not_ used to retrieve glyph names!
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,12 +19,11 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 
-#include FT_SFNT_NAMES_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
-#include FT_INTERNAL_STREAM_H
+#include <freetype/ftsnames.h>
+#include <freetype/internal/tttypes.h>
+#include <freetype/internal/ftstream.h>
 
 
 #ifdef TT_CONFIG_OPTION_SFNT_NAMES
diff --git a/src/base/ftstream.c b/src/base/ftstream.c
index 4b0890d..d940254 100644
--- a/src/base/ftstream.c
+++ b/src/base/ftstream.c
@@ -4,7 +4,7 @@
  *
  *   I/O stream support (body).
  *
- * Copyright (C) 2000-2019 by
+ * Copyright (C) 2000-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,9 +16,8 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftdebug.h>
 
 
   /**************************************************************************
@@ -286,7 +285,7 @@
       }
 
       stream->cursor = stream->base;
-      stream->limit  = stream->cursor + count;
+      stream->limit  = FT_OFFSET( stream->cursor, count );
       stream->pos   += read_bytes;
     }
     else
diff --git a/src/base/ftstroke.c b/src/base/ftstroke.c
index 1b2c0f6..56f98e1 100644
--- a/src/base/ftstroke.c
+++ b/src/base/ftstroke.c
@@ -4,7 +4,7 @@
  *
  *   FreeType path stroker (body).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,13 +16,12 @@
  */
 
 
-#include <ft2build.h>
-#include FT_STROKER_H
-#include FT_TRIGONOMETRY_H
-#include FT_OUTLINE_H
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/ftstroke.h>
+#include <freetype/fttrigon.h>
+#include <freetype/ftoutln.h>
+#include <freetype/internal/ftmemory.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftobjs.h>
 
 
   /* declare an extern to access `ft_outline_glyph_class' globally */
@@ -540,63 +539,52 @@
                           FT_Angle         angle_start,
                           FT_Angle         angle_diff )
   {
-    FT_Angle   total, angle, step, rotate, next, theta;
-    FT_Vector  a, b, a2, b2;
-    FT_Fixed   length;
+    FT_Fixed   coef;
+    FT_Vector  a0, a1, a2, a3;
+    FT_Int     i, arcs = 1;
     FT_Error   error = FT_Err_Ok;
 
 
-    /* compute start point */
-    FT_Vector_From_Polar( &a, radius, angle_start );
-    a.x += center->x;
-    a.y += center->y;
+    /* number of cubic arcs to draw */
+    while (  angle_diff > FT_ARC_CUBIC_ANGLE * arcs ||
+            -angle_diff > FT_ARC_CUBIC_ANGLE * arcs )
+      arcs++;
 
-    total  = angle_diff;
-    angle  = angle_start;
-    rotate = ( angle_diff >= 0 ) ? FT_ANGLE_PI2 : -FT_ANGLE_PI2;
+    /* control tangents */
+    coef  = FT_Tan( angle_diff / ( 4 * arcs ) );
+    coef += coef / 3;
 
-    while ( total != 0 )
+    /* compute start and first control point */
+    FT_Vector_From_Polar( &a0, radius, angle_start );
+    a1.x = FT_MulFix( -a0.y, coef );
+    a1.y = FT_MulFix(  a0.x, coef );
+
+    a0.x += center->x;
+    a0.y += center->y;
+    a1.x += a0.x;
+    a1.y += a0.y;
+
+    for ( i = 1; i <= arcs; i++ )
     {
-      step = total;
-      if ( step > FT_ARC_CUBIC_ANGLE )
-        step = FT_ARC_CUBIC_ANGLE;
+      /* compute end and second control point */
+      FT_Vector_From_Polar( &a3, radius,
+                            angle_start + i * angle_diff / arcs );
+      a2.x = FT_MulFix(  a3.y, coef );
+      a2.y = FT_MulFix( -a3.x, coef );
 
-      else if ( step < -FT_ARC_CUBIC_ANGLE )
-        step = -FT_ARC_CUBIC_ANGLE;
-
-      next  = angle + step;
-      theta = step;
-      if ( theta < 0 )
-        theta = -theta;
-
-      theta >>= 1;
-
-      /* compute end point */
-      FT_Vector_From_Polar( &b, radius, next );
-      b.x += center->x;
-      b.y += center->y;
-
-      /* compute first and second control points */
-      length = FT_MulDiv( radius, FT_Sin( theta ) * 4,
-                          ( 0x10000L + FT_Cos( theta ) ) * 3 );
-
-      FT_Vector_From_Polar( &a2, length, angle + rotate );
-      a2.x += a.x;
-      a2.y += a.y;
-
-      FT_Vector_From_Polar( &b2, length, next - rotate );
-      b2.x += b.x;
-      b2.y += b.y;
+      a3.x += center->x;
+      a3.y += center->y;
+      a2.x += a3.x;
+      a2.y += a3.y;
 
       /* add cubic arc */
-      error = ft_stroke_border_cubicto( border, &a2, &b2, &b );
+      error = ft_stroke_border_cubicto( border, &a1, &a2, &a3 );
       if ( error )
         break;
 
-      /* process the rest of the arc ?? */
-      a      = b;
-      total -= step;
-      angle  = next;
+      /* a0 = a3; */
+      a1.x = a3.x - a2.x + a3.x;
+      a1.y = a3.y - a2.y + a3.y;
     }
 
     return error;
@@ -934,55 +922,40 @@
 
       error = ft_stroker_arcto( stroker, side );
     }
-    else if ( stroker->line_cap == FT_STROKER_LINECAP_SQUARE )
+    else
     {
-      /* add a square cap */
-      FT_Vector        delta, delta2;
-      FT_Angle         rotate = FT_SIDE_TO_ROTATE( side );
+      /* add a square or butt cap */
+      FT_Vector        middle, delta;
       FT_Fixed         radius = stroker->radius;
       FT_StrokeBorder  border = stroker->borders + side;
 
 
-      FT_Vector_From_Polar( &delta2, radius, angle + rotate );
-      FT_Vector_From_Polar( &delta,  radius, angle );
+      /* compute middle point and first angle point */
+      FT_Vector_From_Polar( &middle, radius, angle );
+      delta.x = side ?  middle.y : -middle.y;
+      delta.y = side ? -middle.x :  middle.x;
 
-      delta.x += stroker->center.x + delta2.x;
-      delta.y += stroker->center.y + delta2.y;
+      if ( stroker->line_cap == FT_STROKER_LINECAP_SQUARE )
+      {
+        middle.x += stroker->center.x;
+        middle.y += stroker->center.y;
+      }
+      else  /* FT_STROKER_LINECAP_BUTT */
+      {
+        middle.x  = stroker->center.x;
+        middle.y  = stroker->center.y;
+      }
+
+      delta.x  += middle.x;
+      delta.y  += middle.y;
 
       error = ft_stroke_border_lineto( border, &delta, FALSE );
       if ( error )
         goto Exit;
 
-      FT_Vector_From_Polar( &delta2, radius, angle - rotate );
-      FT_Vector_From_Polar( &delta,  radius, angle );
-
-      delta.x += delta2.x + stroker->center.x;
-      delta.y += delta2.y + stroker->center.y;
-
-      error = ft_stroke_border_lineto( border, &delta, FALSE );
-    }
-    else if ( stroker->line_cap == FT_STROKER_LINECAP_BUTT )
-    {
-      /* add a butt ending */
-      FT_Vector        delta;
-      FT_Angle         rotate = FT_SIDE_TO_ROTATE( side );
-      FT_Fixed         radius = stroker->radius;
-      FT_StrokeBorder  border = stroker->borders + side;
-
-
-      FT_Vector_From_Polar( &delta, radius, angle + rotate );
-
-      delta.x += stroker->center.x;
-      delta.y += stroker->center.y;
-
-      error = ft_stroke_border_lineto( border, &delta, FALSE );
-      if ( error )
-        goto Exit;
-
-      FT_Vector_From_Polar( &delta, radius, angle - rotate );
-
-      delta.x += stroker->center.x;
-      delta.y += stroker->center.y;
+      /* compute second angle point */
+      delta.x = middle.x - delta.x + middle.x;
+      delta.y = middle.y - delta.y + middle.y;
 
       error = ft_stroke_border_lineto( border, &delta, FALSE );
     }
@@ -1000,8 +973,8 @@
   {
     FT_StrokeBorder  border = stroker->borders + side;
     FT_Angle         phi, theta, rotate;
-    FT_Fixed         length, thcos;
-    FT_Vector        delta;
+    FT_Fixed         length;
+    FT_Vector        sigma, delta;
     FT_Error         error = FT_Err_Ok;
     FT_Bool          intersect;          /* use intersection of lines? */
 
@@ -1019,10 +992,13 @@
     else
     {
       /* compute minimum required length of lines */
-      FT_Fixed  min_length = ft_pos_abs( FT_MulFix( stroker->radius,
-                                                    FT_Tan( theta ) ) );
+      FT_Fixed  min_length;
 
 
+      FT_Vector_Unit( &sigma, theta );
+      min_length =
+        ft_pos_abs( FT_MulDiv( stroker->radius, sigma.y, sigma.x ) );
+
       intersect = FT_BOOL( min_length                         &&
                            stroker->line_length >= min_length &&
                            line_length          >= min_length );
@@ -1040,13 +1016,11 @@
     else
     {
       /* compute median angle */
-      phi = stroker->angle_in + theta;
+      phi = stroker->angle_in + theta + rotate;
 
-      thcos = FT_Cos( theta );
+      length = FT_DivFix( stroker->radius, sigma.x );
 
-      length = FT_DivFix( stroker->radius, thcos );
-
-      FT_Vector_From_Polar( &delta, length, phi + rotate );
+      FT_Vector_From_Polar( &delta, length, phi );
       delta.x += stroker->center.x;
       delta.y += stroker->center.y;
     }
@@ -1073,10 +1047,10 @@
     else
     {
       /* this is a mitered (pointed) or beveled (truncated) corner */
-      FT_Fixed  sigma = 0, radius = stroker->radius;
-      FT_Angle  theta = 0, phi = 0;
-      FT_Fixed  thcos = 0;
-      FT_Bool   bevel, fixed_bevel;
+      FT_Fixed   radius = stroker->radius;
+      FT_Vector  sigma;
+      FT_Angle   theta = 0, phi = 0;
+      FT_Bool    bevel, fixed_bevel;
 
 
       rotate = FT_SIDE_TO_ROTATE( side );
@@ -1087,26 +1061,20 @@
       fixed_bevel =
         FT_BOOL( stroker->line_join != FT_STROKER_LINEJOIN_MITER_VARIABLE );
 
+      /* check miter limit first */
       if ( !bevel )
       {
-        theta = FT_Angle_Diff( stroker->angle_in, stroker->angle_out );
+        theta = FT_Angle_Diff( stroker->angle_in, stroker->angle_out ) / 2;
 
-        if ( theta == FT_ANGLE_PI )
-        {
-          theta = rotate;
-          phi   = stroker->angle_in;
-        }
-        else
-        {
-          theta /= 2;
-          phi    = stroker->angle_in + theta + rotate;
-        }
+        if ( theta == FT_ANGLE_PI2 )
+          theta = -rotate;
 
-        thcos = FT_Cos( theta );
-        sigma = FT_MulFix( stroker->miter_limit, thcos );
+        phi    = stroker->angle_in + theta + rotate;
+
+        FT_Vector_From_Polar( &sigma, stroker->miter_limit, theta );
 
         /* is miter limit exceeded? */
-        if ( sigma < 0x10000L )
+        if ( sigma.x < 0x10000L )
         {
           /* don't create variable bevels for very small deviations; */
           /* FT_Sin(x) = 0 for x <= 57                               */
@@ -1133,36 +1101,34 @@
           border->movable = FALSE;
           error = ft_stroke_border_lineto( border, &delta, FALSE );
         }
-        else /* variable bevel */
+        else /* variable bevel or clipped miter */
         {
           /* the miter is truncated */
           FT_Vector  middle, delta;
-          FT_Fixed   length;
+          FT_Fixed   coef;
 
 
-          /* compute middle point */
+          /* compute middle point and first angle point */
           FT_Vector_From_Polar( &middle,
                                 FT_MulFix( radius, stroker->miter_limit ),
                                 phi );
+
+          coef    = FT_DivFix(  0x10000L - sigma.x, sigma.y );
+          delta.x = FT_MulFix(  middle.y, coef );
+          delta.y = FT_MulFix( -middle.x, coef );
+
           middle.x += stroker->center.x;
           middle.y += stroker->center.y;
-
-          /* compute first angle point */
-          length = FT_MulDiv( radius, 0x10000L - sigma,
-                              ft_pos_abs( FT_Sin( theta ) ) );
-
-          FT_Vector_From_Polar( &delta, length, phi + rotate );
-          delta.x += middle.x;
-          delta.y += middle.y;
+          delta.x  += middle.x;
+          delta.y  += middle.y;
 
           error = ft_stroke_border_lineto( border, &delta, FALSE );
           if ( error )
             goto Exit;
 
           /* compute second angle point */
-          FT_Vector_From_Polar( &delta, length, phi - rotate );
-          delta.x += middle.x;
-          delta.y += middle.y;
+          delta.x = middle.x - delta.x + middle.x;
+          delta.y = middle.y - delta.y + middle.y;
 
           error = ft_stroke_border_lineto( border, &delta, FALSE );
           if ( error )
@@ -1189,7 +1155,7 @@
         FT_Vector  delta;
 
 
-        length = FT_DivFix( stroker->radius, thcos );
+        length = FT_MulDiv( stroker->radius, stroker->miter_limit, sigma.x );
 
         FT_Vector_From_Polar( &delta, length, phi );
         delta.x += stroker->center.x;
diff --git a/src/base/ftsynth.c b/src/base/ftsynth.c
index f87ed65..a9119e2 100644
--- a/src/base/ftsynth.c
+++ b/src/base/ftsynth.c
@@ -4,7 +4,7 @@
  *
  *   FreeType synthesizing code for emboldening and slanting (body).
  *
- * Copyright (C) 2000-2019 by
+ * Copyright (C) 2000-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,12 +16,11 @@
  */
 
 
-#include <ft2build.h>
-#include FT_SYNTHESIS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_OUTLINE_H
-#include FT_BITMAP_H
+#include <freetype/ftsynth.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/ftoutln.h>
+#include <freetype/ftbitmap.h>
 
 
   /**************************************************************************
@@ -130,7 +129,7 @@
       if ( ( ystr >> 6 ) > FT_INT_MAX || ( ystr >> 6 ) < FT_INT_MIN )
       {
         FT_TRACE1(( "FT_GlyphSlot_Embolden:" ));
-        FT_TRACE1(( "too strong emboldening parameter ystr=%d\n", ystr ));
+        FT_TRACE1(( "too strong emboldening parameter ystr=%ld\n", ystr ));
         return;
       }
       error = FT_GlyphSlot_Own_Bitmap( slot );
diff --git a/src/base/ftsystem.c b/src/base/ftsystem.c
index f92b3a0..3013cbd 100644
--- a/src/base/ftsystem.c
+++ b/src/base/ftsystem.c
@@ -4,7 +4,7 @@
  *
  *   ANSI-specific FreeType low-level system interface (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -27,11 +27,11 @@
 
 #include <ft2build.h>
 #include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_SYSTEM_H
-#include FT_ERRORS_H
-#include FT_TYPES_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/ftsystem.h>
+#include <freetype/fterrors.h>
+#include <freetype/fttypes.h>
 
 
   /**************************************************************************
diff --git a/src/base/fttrigon.c b/src/base/fttrigon.c
index 3872197..c6f027c 100644
--- a/src/base/fttrigon.c
+++ b/src/base/fttrigon.c
@@ -4,7 +4,7 @@
  *
  *   FreeType trigonometric functions (body).
  *
- * Copyright (C) 2001-2019 by
+ * Copyright (C) 2001-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -29,10 +29,9 @@
    *
    */
 
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_CALC_H
-#include FT_TRIGONOMETRY_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/fttrigon.h>
 
 
   /* the Cordic shrink factor 0.858785336480436 * 2^32 */
diff --git a/src/base/fttype1.c b/src/base/fttype1.c
index 26d4f1c..be60ed6 100644
--- a/src/base/fttype1.c
+++ b/src/base/fttype1.c
@@ -4,7 +4,7 @@
  *
  *   FreeType utility file for PS names support (body).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,11 +16,10 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_SERVICE_H
-#include FT_SERVICE_POSTSCRIPT_INFO_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftserv.h>
+#include <freetype/internal/services/svpsinfo.h>
 
 
   /* documentation is in t1tables.h */
diff --git a/src/base/ftutil.c b/src/base/ftutil.c
index 92bd857..d90cfbc 100644
--- a/src/base/ftutil.c
+++ b/src/base/ftutil.c
@@ -4,7 +4,7 @@
  *
  *   FreeType utility file for memory and list management (body).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,11 +16,10 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_LIST_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftmemory.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/ftlist.h>
 
 
   /**************************************************************************
diff --git a/src/base/ftver.rc b/src/base/ftver.rc
index 1354497..0b92e9b 100644
--- a/src/base/ftver.rc
+++ b/src/base/ftver.rc
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType VERSIONINFO resource for Windows DLLs.                      */
 /*                                                                         */
-/*  Copyright (C) 2018-2019 by                                             */
+/*  Copyright (C) 2018-2020 by                                             */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -18,8 +18,8 @@
 
 #include<windows.h>
 
-#define FT_VERSION      2,10,1,0
-#define FT_VERSION_STR  "2.10.1"
+#define FT_VERSION      2,10,4,0
+#define FT_VERSION_STR  "2.10.4"
 
 VS_VERSION_INFO      VERSIONINFO
 FILEVERSION          FT_VERSION
@@ -45,7 +45,7 @@
       VALUE "FileVersion",      FT_VERSION_STR
       VALUE "ProductName",      "FreeType"
       VALUE "ProductVersion",   FT_VERSION_STR
-      VALUE "LegalCopyright",   "\251 2018-2019 The FreeType Project www.freetype.org. All rights reserved."
+      VALUE "LegalCopyright",   "\251 2000-2020 The FreeType Project www.freetype.org. All rights reserved."
       VALUE "InternalName",     "freetype"
       VALUE "OriginalFilename", FT_FILENAME
     END
diff --git a/src/base/ftwinfnt.c b/src/base/ftwinfnt.c
index 59daa77..699dc3d 100644
--- a/src/base/ftwinfnt.c
+++ b/src/base/ftwinfnt.c
@@ -4,7 +4,7 @@
  *
  *   FreeType API for accessing Windows FNT specific info (body).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,11 +16,10 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_WINFONTS_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_WINFNT_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/ftwinfnt.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/services/svwinfnt.h>
 
 
   /* documentation is in ftwinfnt.h */
diff --git a/src/base/rules.mk b/src/base/rules.mk
index 4b24c6d..411c4c8 100644
--- a/src/base/rules.mk
+++ b/src/base/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/bdf/Jamfile b/src/bdf/Jamfile
deleted file mode 100644
index a49c7f5..0000000
--- a/src/bdf/Jamfile
+++ /dev/null
@@ -1,31 +0,0 @@
-# FreeType 2 src/bdf Jamfile
-#
-# Copyright (C) 2002-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) bdf ;
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = bdfdrivr
-               bdflib
-               ;
-  }
-  else
-  {
-    _sources = bdf ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/bdf Jamfile
diff --git a/src/bdf/bdf.c b/src/bdf/bdf.c
index e54df66..249012e 100644
--- a/src/bdf/bdf.c
+++ b/src/bdf/bdf.c
@@ -26,7 +26,6 @@
 
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
 
 #include "bdflib.c"
 #include "bdfdrivr.c"
diff --git a/src/bdf/bdf.h b/src/bdf/bdf.h
index d9abd23..5acbd5f 100644
--- a/src/bdf/bdf.h
+++ b/src/bdf/bdf.h
@@ -30,10 +30,9 @@
  * Based on bdf.h,v 1.16 2000/03/16 20:08:51 mleisher
  */
 
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_HASH_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/fthash.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c
index 60eb933..d29188b 100644
--- a/src/bdf/bdfdrivr.c
+++ b/src/bdf/bdfdrivr.c
@@ -24,16 +24,15 @@
 THE SOFTWARE.
 */
 
-#include <ft2build.h>
 
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_BDF_H
-#include FT_TRUETYPE_IDS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/ftbdf.h>
+#include <freetype/ttnameid.h>
 
-#include FT_SERVICE_BDF_H
-#include FT_SERVICE_FONT_FORMAT_H
+#include <freetype/internal/services/svbdf.h>
+#include <freetype/internal/services/svfntfmt.h>
 
 #include "bdf.h"
 #include "bdfdrivr.h"
@@ -184,7 +183,8 @@
   Exit:
     if ( charcode > 0xFFFFFFFFUL )
     {
-      FT_TRACE1(( "bdf_cmap_char_next: charcode 0x%x > 32bit API" ));
+      FT_TRACE1(( "bdf_cmap_char_next: charcode 0x%lx > 32bit API",
+                  charcode ));
       *acharcode = 0;
       /* XXX: result should be changed to indicate an overflow error */
     }
@@ -402,10 +402,10 @@
       bdf_property_t*  prop = NULL;
 
 
-      FT_TRACE4(( "  number of glyphs: allocated %d (used %d)\n",
+      FT_TRACE4(( "  number of glyphs: allocated %ld (used %ld)\n",
                   font->glyphs_size,
                   font->glyphs_used ));
-      FT_TRACE4(( "  number of unencoded glyphs: allocated %d (used %d)\n",
+      FT_TRACE4(( "  number of unencoded glyphs: allocated %ld (used %ld)\n",
                   font->unencoded_size,
                   font->unencoded_used ));
 
@@ -457,13 +457,13 @@
         if ( font->font_ascent > 0x7FFF || font->font_ascent < -0x7FFF )
         {
           font->font_ascent = font->font_ascent < 0 ? -0x7FFF : 0x7FFF;
-          FT_TRACE0(( "BDF_Face_Init: clamping font ascent to value %d\n",
+          FT_TRACE0(( "BDF_Face_Init: clamping font ascent to value %ld\n",
                       font->font_ascent ));
         }
         if ( font->font_descent > 0x7FFF || font->font_descent < -0x7FFF )
         {
           font->font_descent = font->font_descent < 0 ? -0x7FFF : 0x7FFF;
-          FT_TRACE0(( "BDF_Face_Init: clamping font descent to value %d\n",
+          FT_TRACE0(( "BDF_Face_Init: clamping font descent to value %ld\n",
                       font->font_descent ));
         }
 
@@ -504,7 +504,7 @@
                prop->value.l < -0x504C2L )
           {
             bsize->size = 0x7FFF;
-            FT_TRACE0(( "BDF_Face_Init: clamping point size to value %d\n",
+            FT_TRACE0(( "BDF_Face_Init: clamping point size to value %ld\n",
                         bsize->size ));
           }
           else
@@ -517,7 +517,7 @@
           if ( font->point_size > 0x7FFF )
           {
             bsize->size = 0x7FFF;
-            FT_TRACE0(( "BDF_Face_Init: clamping point size to value %d\n",
+            FT_TRACE0(( "BDF_Face_Init: clamping point size to value %ld\n",
                         bsize->size ));
           }
           else
@@ -539,7 +539,7 @@
           if ( prop->value.l > 0x7FFF || prop->value.l < -0x7FFF )
           {
             bsize->y_ppem = 0x7FFF << 6;
-            FT_TRACE0(( "BDF_Face_Init: clamping pixel size to value %d\n",
+            FT_TRACE0(( "BDF_Face_Init: clamping pixel size to value %ld\n",
                         bsize->y_ppem ));
           }
           else
@@ -615,7 +615,7 @@
         for ( n = 0; n < font->glyphs_size; n++ )
         {
           (face->en_table[n]).enc = cur[n].encoding;
-          FT_TRACE4(( "  idx %d, val 0x%lX\n", n, cur[n].encoding ));
+          FT_TRACE4(( "  idx %ld, val 0x%lX\n", n, cur[n].encoding ));
           (face->en_table[n]).glyph = (FT_UShort)n;
 
           if ( cur[n].encoding == font->default_char )
@@ -624,7 +624,7 @@
               face->default_glyph = (FT_UInt)n;
             else
               FT_TRACE1(( "BDF_Face_Init:"
-                          " idx %d is too large for this system\n", n ));
+                          " idx %ld is too large for this system\n", n ));
           }
         }
       }
@@ -825,7 +825,7 @@
     bitmap->rows  = glyph.bbx.height;
     bitmap->width = glyph.bbx.width;
     if ( glyph.bpr > FT_INT_MAX )
-      FT_TRACE1(( "BDF_Glyph_Load: too large pitch %d is truncated\n",
+      FT_TRACE1(( "BDF_Glyph_Load: too large pitch %ld is truncated\n",
                    glyph.bpr ));
     bitmap->pitch = (int)glyph.bpr; /* same as FT_Bitmap.pitch */
 
@@ -902,7 +902,8 @@
         if ( prop->value.l > 0x7FFFFFFFL || prop->value.l < ( -1 - 0x7FFFFFFFL ) )
         {
           FT_TRACE1(( "bdf_get_bdf_property:"
-                      " too large integer 0x%x is truncated\n" ));
+                      " too large integer 0x%lx is truncated\n",
+                      prop->value.l ));
         }
         aproperty->type      = BDF_PROPERTY_TYPE_INTEGER;
         aproperty->u.integer = (FT_Int32)prop->value.l;
@@ -912,7 +913,8 @@
         if ( prop->value.ul > 0xFFFFFFFFUL )
         {
           FT_TRACE1(( "bdf_get_bdf_property:"
-                      " too large cardinal 0x%x is truncated\n" ));
+                      " too large cardinal 0x%lx is truncated\n",
+                      prop->value.ul ));
         }
         aproperty->type       = BDF_PROPERTY_TYPE_CARDINAL;
         aproperty->u.cardinal = (FT_UInt32)prop->value.ul;
diff --git a/src/bdf/bdfdrivr.h b/src/bdf/bdfdrivr.h
index b37b84e..54aaa33 100644
--- a/src/bdf/bdfdrivr.h
+++ b/src/bdf/bdfdrivr.h
@@ -28,8 +28,7 @@
 #ifndef BDFDRIVR_H_
 #define BDFDRIVR_H_
 
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
+#include <freetype/internal/ftdrv.h>
 
 #include "bdf.h"
 
diff --git a/src/bdf/bdferror.h b/src/bdf/bdferror.h
index dbe41c0..c1b5444 100644
--- a/src/bdf/bdferror.h
+++ b/src/bdf/bdferror.h
@@ -29,7 +29,7 @@
 #ifndef BDFERROR_H_
 #define BDFERROR_H_
 
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
 
 #undef FTERRORS_H_
 
@@ -37,7 +37,7 @@
 #define FT_ERR_PREFIX  BDF_Err_
 #define FT_ERR_BASE    FT_Mod_Err_BDF
 
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
 
 #endif /* BDFERROR_H_ */
 
diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c
index 63813f7..a4ddb9a 100644
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -31,12 +31,11 @@
    */
 
 
-#include <ft2build.h>
 
-#include FT_FREETYPE_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/freetype.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftobjs.h>
 
 #include "bdf.h"
 #include "bdferror.h"
diff --git a/src/bzip2/Jamfile b/src/bzip2/Jamfile
deleted file mode 100644
index 4b77916..0000000
--- a/src/bzip2/Jamfile
+++ /dev/null
@@ -1,18 +0,0 @@
-# FreeType 2 src/bzip2 Jamfile
-#
-# Copyright (C) 2010-2019 by
-# Joel Klinghed
-#
-# based on `src/lzw/Jamfile'
-#
-# 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.
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) bzip2 ;
-
-Library  $(FT2_LIB) : ftbzip2.c ;
-
-# end of src/bzip2 Jamfile
diff --git a/src/bzip2/ftbzip2.c b/src/bzip2/ftbzip2.c
index 1fda59b..411c5d2 100644
--- a/src/bzip2/ftbzip2.c
+++ b/src/bzip2/ftbzip2.c
@@ -8,7 +8,7 @@
  * parse compressed PCF fonts, as found with many X11 server
  * distributions.
  *
- * Copyright (C) 2010-2019 by
+ * Copyright (C) 2010-2020 by
  * Joel Klinghed.
  *
  * based on `src/gzip/ftgzip.c'
@@ -22,15 +22,14 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_BZIP2_H
+#include <freetype/internal/ftmemory.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/ftbzip2.h>
 #include FT_CONFIG_STANDARD_LIBRARY_H
 
 
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
 
 #undef FTERRORS_H_
 
@@ -38,7 +37,7 @@
 #define FT_ERR_PREFIX  Bzip2_Err_
 #define FT_ERR_BASE    FT_Mod_Err_Bzip2
 
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
 
 
 #ifdef FT_CONFIG_OPTION_USE_BZIP2
diff --git a/src/bzip2/rules.mk b/src/bzip2/rules.mk
index f365c1f..eed0f4b 100644
--- a/src/bzip2/rules.mk
+++ b/src/bzip2/rules.mk
@@ -2,7 +2,7 @@
 # FreeType 2 BZIP2 support configuration rules
 #
 
-# Copyright (C) 2010-2019 by
+# Copyright (C) 2010-2020 by
 # Joel Klinghed.
 #
 # based on `src/lzw/rules.mk'
diff --git a/src/cache/Jamfile b/src/cache/Jamfile
deleted file mode 100644
index 51f7196..0000000
--- a/src/cache/Jamfile
+++ /dev/null
@@ -1,37 +0,0 @@
-# FreeType 2 src/cache Jamfile
-#
-# Copyright (C) 2001-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) cache ;
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = ftcbasic
-               ftccache
-               ftcglyph
-               ftcimage
-               ftcmanag
-               ftccmap
-               ftcmru
-               ftcsbits
-               ;
-  }
-  else
-  {
-    _sources = ftcache ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/cache Jamfile
diff --git a/src/cache/ftcache.c b/src/cache/ftcache.c
index a6a3e63..e90f463 100644
--- a/src/cache/ftcache.c
+++ b/src/cache/ftcache.c
@@ -4,7 +4,7 @@
  *
  *   The FreeType Caching sub-system (body only).
  *
- * Copyright (C) 2000-2019 by
+ * Copyright (C) 2000-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -17,7 +17,6 @@
 
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
 
 #include "ftcbasic.c"
 #include "ftccache.c"
diff --git a/src/cache/ftcbasic.c b/src/cache/ftcbasic.c
index a473585..43ea314 100644
--- a/src/cache/ftcbasic.c
+++ b/src/cache/ftcbasic.c
@@ -4,7 +4,7 @@
  *
  *   The FreeType basic cache interface (body).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,10 +16,9 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_CACHE_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/ftcache.h>
 #include "ftcglyph.h"
 #include "ftcimage.h"
 #include "ftcsbits.h"
@@ -111,7 +110,9 @@
 
     if ( (FT_ULong)face->num_glyphs > FT_UINT_MAX || 0 > face->num_glyphs )
       FT_TRACE1(( "ftc_basic_family_get_count:"
-                  " too large number of glyphs in this face, truncated\n",
+                  " the number of glyphs in this face is %ld,\n"
+                  "                           "
+                  " which is too much and thus truncated\n",
                   face->num_glyphs ));
 
     if ( !error )
@@ -394,7 +395,7 @@
 #if FT_ULONG_MAX > FT_UINT_MAX
     if ( load_flags > FT_UINT_MAX )
       FT_TRACE1(( "FTC_ImageCache_LookupScaler:"
-                  " higher bits in load_flags 0x%x are dropped\n",
+                  " higher bits in load_flags 0x%lx are dropped\n",
                   load_flags & ~((FT_ULong)FT_UINT_MAX) ));
 #endif
 
@@ -594,7 +595,7 @@
 #if FT_ULONG_MAX > FT_UINT_MAX
     if ( load_flags > FT_UINT_MAX )
       FT_TRACE1(( "FTC_ImageCache_LookupScaler:"
-                  " higher bits in load_flags 0x%x are dropped\n",
+                  " higher bits in load_flags 0x%lx are dropped\n",
                   load_flags & ~((FT_ULong)FT_UINT_MAX) ));
 #endif
 
diff --git a/src/cache/ftccache.c b/src/cache/ftccache.c
index f38ca44..1c8e0f3 100644
--- a/src/cache/ftccache.c
+++ b/src/cache/ftccache.c
@@ -4,7 +4,7 @@
  *
  *   The FreeType internal cache interface (body).
  *
- * Copyright (C) 2000-2019 by
+ * Copyright (C) 2000-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,10 +16,9 @@
  */
 
 
-#include <ft2build.h>
 #include "ftcmanag.h"
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
 
 #include "ftccback.h"
 #include "ftcerror.h"
diff --git a/src/cache/ftccache.h b/src/cache/ftccache.h
index 140cead..11698bb 100644
--- a/src/cache/ftccache.h
+++ b/src/cache/ftccache.h
@@ -4,7 +4,7 @@
  *
  *   FreeType internal cache interface (specification).
  *
- * Copyright (C) 2000-2019 by
+ * Copyright (C) 2000-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,7 +19,7 @@
 #ifndef FTCCACHE_H_
 #define FTCCACHE_H_
 
-
+#include <freetype/internal/compiler-macros.h>
 #include "ftcmru.h"
 
 FT_BEGIN_HEADER
diff --git a/src/cache/ftccback.h b/src/cache/ftccback.h
index 9321bc3..542acb1 100644
--- a/src/cache/ftccback.h
+++ b/src/cache/ftccback.h
@@ -4,7 +4,7 @@
  *
  *   Callback functions of the caching sub-system (specification only).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -18,14 +18,14 @@
 #ifndef FTCCBACK_H_
 #define FTCCBACK_H_
 
-#include <ft2build.h>
-#include FT_CACHE_H
+#include <freetype/ftcache.h>
 #include "ftcmru.h"
 #include "ftcimage.h"
 #include "ftcmanag.h"
 #include "ftcglyph.h"
 #include "ftcsbits.h"
 
+FT_BEGIN_HEADER
 
   FT_LOCAL( void )
   ftc_inode_free( FTC_Node   inode,
@@ -85,6 +85,7 @@
   ftc_node_destroy( FTC_Node     node,
                     FTC_Manager  manager );
 
+FT_END_HEADER
 
 #endif /* FTCCBACK_H_ */
 
diff --git a/src/cache/ftccmap.c b/src/cache/ftccmap.c
index 76ba10e..468c008 100644
--- a/src/cache/ftccmap.c
+++ b/src/cache/ftccmap.c
@@ -4,7 +4,7 @@
  *
  *   FreeType CharMap cache (body)
  *
- * Copyright (C) 2000-2019 by
+ * Copyright (C) 2000-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,13 +16,12 @@
  */
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_CACHE_H
+#include <freetype/freetype.h>
+#include <freetype/ftcache.h>
 #include "ftcmanag.h"
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftmemory.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
 
 #include "ftccback.h"
 #include "ftcerror.h"
diff --git a/src/cache/ftcerror.h b/src/cache/ftcerror.h
index e2d6417..bedfd28 100644
--- a/src/cache/ftcerror.h
+++ b/src/cache/ftcerror.h
@@ -4,7 +4,7 @@
  *
  *   Caching sub-system error codes (specification only).
  *
- * Copyright (C) 2001-2019 by
+ * Copyright (C) 2001-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -26,7 +26,7 @@
 #ifndef FTCERROR_H_
 #define FTCERROR_H_
 
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
 
 #undef FTERRORS_H_
 
@@ -34,7 +34,7 @@
 #define FT_ERR_PREFIX  FTC_Err_
 #define FT_ERR_BASE    FT_Mod_Err_Cache
 
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
 
 #endif /* FTCERROR_H_ */
 
diff --git a/src/cache/ftcglyph.c b/src/cache/ftcglyph.c
index 2a0e97d..7f5438a 100644
--- a/src/cache/ftcglyph.c
+++ b/src/cache/ftcglyph.c
@@ -4,7 +4,7 @@
  *
  *   FreeType Glyph Image (FT_Glyph) cache (body).
  *
- * Copyright (C) 2000-2019 by
+ * Copyright (C) 2000-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,11 +16,10 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_CACHE_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/ftcache.h>
 #include "ftcglyph.h"
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
 
 #include "ftccback.h"
 #include "ftcerror.h"
diff --git a/src/cache/ftcglyph.h b/src/cache/ftcglyph.h
index 5a1f0e2..5629545 100644
--- a/src/cache/ftcglyph.h
+++ b/src/cache/ftcglyph.h
@@ -4,7 +4,7 @@
  *
  *   FreeType abstract glyph cache (specification).
  *
- * Copyright (C) 2000-2019 by
+ * Copyright (C) 2000-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -117,7 +117,6 @@
 #define FTCGLYPH_H_
 
 
-#include <ft2build.h>
 #include "ftcmanag.h"
 
 
diff --git a/src/cache/ftcimage.c b/src/cache/ftcimage.c
index 9e64d51..58ebad8 100644
--- a/src/cache/ftcimage.c
+++ b/src/cache/ftcimage.c
@@ -4,7 +4,7 @@
  *
  *   FreeType Image cache (body).
  *
- * Copyright (C) 2000-2019 by
+ * Copyright (C) 2000-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,11 +16,10 @@
  */
 
 
-#include <ft2build.h>
-#include FT_CACHE_H
+#include <freetype/ftcache.h>
 #include "ftcimage.h"
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/ftmemory.h>
+#include <freetype/internal/ftobjs.h>
 
 #include "ftccback.h"
 #include "ftcerror.h"
diff --git a/src/cache/ftcimage.h b/src/cache/ftcimage.h
index dcb101f..a400788 100644
--- a/src/cache/ftcimage.h
+++ b/src/cache/ftcimage.h
@@ -4,7 +4,7 @@
  *
  *   FreeType Generic Image cache (specification)
  *
- * Copyright (C) 2000-2019 by
+ * Copyright (C) 2000-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -36,8 +36,7 @@
 #define FTCIMAGE_H_
 
 
-#include <ft2build.h>
-#include FT_CACHE_H
+#include <freetype/ftcache.h>
 #include "ftcglyph.h"
 
 FT_BEGIN_HEADER
diff --git a/src/cache/ftcmanag.c b/src/cache/ftcmanag.c
index bd58596..436d41f 100644
--- a/src/cache/ftcmanag.c
+++ b/src/cache/ftcmanag.c
@@ -4,7 +4,7 @@
  *
  *   FreeType Cache Manager (body).
  *
- * Copyright (C) 2000-2019 by
+ * Copyright (C) 2000-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,12 +16,11 @@
  */
 
 
-#include <ft2build.h>
-#include FT_CACHE_H
+#include <freetype/ftcache.h>
 #include "ftcmanag.h"
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_SIZES_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/ftsizes.h>
 
 #include "ftccback.h"
 #include "ftcerror.h"
diff --git a/src/cache/ftcmanag.h b/src/cache/ftcmanag.h
index 60c66c8..6c6ec68 100644
--- a/src/cache/ftcmanag.h
+++ b/src/cache/ftcmanag.h
@@ -4,7 +4,7 @@
  *
  *   FreeType Cache Manager (specification).
  *
- * Copyright (C) 2000-2019 by
+ * Copyright (C) 2000-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -63,8 +63,7 @@
 #define FTCMANAG_H_
 
 
-#include <ft2build.h>
-#include FT_CACHE_H
+#include <freetype/ftcache.h>
 #include "ftcmru.h"
 #include "ftccache.h"
 
diff --git a/src/cache/ftcmru.c b/src/cache/ftcmru.c
index 18a7b80..8feed45 100644
--- a/src/cache/ftcmru.c
+++ b/src/cache/ftcmru.c
@@ -4,7 +4,7 @@
  *
  *   FreeType MRU support (body).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,11 +16,10 @@
  */
 
 
-#include <ft2build.h>
-#include FT_CACHE_H
+#include <freetype/ftcache.h>
 #include "ftcmru.h"
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
 
 #include "ftcerror.h"
 
diff --git a/src/cache/ftcmru.h b/src/cache/ftcmru.h
index 58721ed..ac4f9b1 100644
--- a/src/cache/ftcmru.h
+++ b/src/cache/ftcmru.h
@@ -4,7 +4,7 @@
  *
  *   Simple MRU list-cache (specification).
  *
- * Copyright (C) 2000-2019 by
+ * Copyright (C) 2000-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -44,8 +44,8 @@
 #define FTCMRU_H_
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
+#include <freetype/internal/compiler-macros.h>
 
 #ifdef FREETYPE_H
 #error "freetype.h of FreeType 1 has been loaded!"
diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c
index 06b46c8..e0db930 100644
--- a/src/cache/ftcsbits.c
+++ b/src/cache/ftcsbits.c
@@ -4,7 +4,7 @@
  *
  *   FreeType sbits manager (body).
  *
- * Copyright (C) 2000-2019 by
+ * Copyright (C) 2000-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,12 +16,11 @@
  */
 
 
-#include <ft2build.h>
-#include FT_CACHE_H
+#include <freetype/ftcache.h>
 #include "ftcsbits.h"
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_ERRORS_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/fterrors.h>
 
 #include "ftccback.h"
 #include "ftcerror.h"
diff --git a/src/cache/ftcsbits.h b/src/cache/ftcsbits.h
index f1b71c2..46f797e 100644
--- a/src/cache/ftcsbits.h
+++ b/src/cache/ftcsbits.h
@@ -4,7 +4,7 @@
  *
  *   A small-bitmap cache (specification).
  *
- * Copyright (C) 2000-2019 by
+ * Copyright (C) 2000-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
 #define FTCSBITS_H_
 
 
-#include <ft2build.h>
-#include FT_CACHE_H
+#include <freetype/ftcache.h>
 #include "ftcglyph.h"
 
 
diff --git a/src/cache/rules.mk b/src/cache/rules.mk
index 1618d98..4738b51 100644
--- a/src/cache/rules.mk
+++ b/src/cache/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 2000-2019 by
+# Copyright (C) 2000-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/cff/Jamfile b/src/cff/Jamfile
deleted file mode 100644
index 10f49ce..0000000
--- a/src/cff/Jamfile
+++ /dev/null
@@ -1,36 +0,0 @@
-# FreeType 2 src/cff Jamfile
-#
-# Copyright (C) 2001-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) cff ;
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = cffcmap
-               cffdrivr
-               cffgload
-               cffload
-               cffobjs
-               cffparse
-               cffpic
-               ;
-  }
-  else
-  {
-    _sources = cff ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/cff Jamfile
diff --git a/src/cff/cff.c b/src/cff/cff.c
index a34ba9b..0fa6c87 100644
--- a/src/cff/cff.c
+++ b/src/cff/cff.c
@@ -4,7 +4,7 @@
  *
  *   FreeType OpenType driver component (body only).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -17,7 +17,6 @@
 
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
 
 #include "cffcmap.c"
 #include "cffdrivr.c"
diff --git a/src/cff/cffcmap.c b/src/cff/cffcmap.c
index 15cc94c..6d16ed4 100644
--- a/src/cff/cffcmap.c
+++ b/src/cff/cffcmap.c
@@ -4,7 +4,7 @@
  *
  *   CFF character mapping table (cmap) support (body).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,8 +16,7 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 #include "cffcmap.h"
 #include "cffload.h"
 
diff --git a/src/cff/cffcmap.h b/src/cff/cffcmap.h
index 07366bc..69fab8d 100644
--- a/src/cff/cffcmap.h
+++ b/src/cff/cffcmap.h
@@ -4,7 +4,7 @@
  *
  *   CFF character mapping table (cmap) support (specification).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,7 +19,7 @@
 #ifndef CFFCMAP_H_
 #define CFFCMAP_H_
 
-#include FT_INTERNAL_CFF_OBJECTS_TYPES_H
+#include <freetype/internal/cffotypes.h>
 
 FT_BEGIN_HEADER
 
@@ -43,7 +43,7 @@
   } CFF_CMapStdRec;
 
 
-  FT_DECLARE_CMAP_CLASS(cff_cmap_encoding_class_rec)
+  FT_DECLARE_CMAP_CLASS( cff_cmap_encoding_class_rec )
 
 
   /*************************************************************************/
@@ -56,7 +56,7 @@
 
   /* unicode (synthetic) cmaps */
 
-  FT_DECLARE_CMAP_CLASS(cff_cmap_unicode_class_rec)
+  FT_DECLARE_CMAP_CLASS( cff_cmap_unicode_class_rec )
 
 
 FT_END_HEADER
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index 2324989..486ab24 100644
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -4,7 +4,7 @@
  *
  *   OpenType font driver implementation (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,18 +16,17 @@
  */
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_POSTSCRIPT_PROPS_H
-#include FT_SERVICE_CID_H
-#include FT_SERVICE_POSTSCRIPT_INFO_H
-#include FT_SERVICE_POSTSCRIPT_NAME_H
-#include FT_SERVICE_TT_CMAP_H
-#include FT_SERVICE_CFF_TABLE_LOAD_H
+#include <freetype/freetype.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/sfnt.h>
+#include <freetype/internal/psaux.h>
+#include <freetype/internal/ftpsprop.h>
+#include <freetype/internal/services/svcid.h>
+#include <freetype/internal/services/svpsinfo.h>
+#include <freetype/internal/services/svpostnm.h>
+#include <freetype/internal/services/svttcmap.h>
+#include <freetype/internal/services/svcfftl.h>
 
 #include "cffdrivr.h"
 #include "cffgload.h"
@@ -37,16 +36,16 @@
 #include "cffobjs.h"
 
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include FT_SERVICE_MULTIPLE_MASTERS_H
-#include FT_SERVICE_METRICS_VARIATIONS_H
+#include <freetype/internal/services/svmm.h>
+#include <freetype/internal/services/svmetric.h>
 #endif
 
 #include "cfferrs.h"
 
-#include FT_SERVICE_FONT_FORMAT_H
-#include FT_SERVICE_GLYPH_DICT_H
-#include FT_SERVICE_PROPERTIES_H
-#include FT_DRIVER_H
+#include <freetype/internal/services/svfntfmt.h>
+#include <freetype/internal/services/svgldict.h>
+#include <freetype/internal/services/svprop.h>
+#include <freetype/ftdriver.h>
 
 
   /**************************************************************************
@@ -738,7 +737,7 @@
       {
         if ( dict->cid_supplement < FT_INT_MIN ||
              dict->cid_supplement > FT_INT_MAX )
-          FT_TRACE1(( "cff_get_ros: too large supplement %d is truncated\n",
+          FT_TRACE1(( "cff_get_ros: too large supplement %ld is truncated\n",
                       dict->cid_supplement ));
         *supplement = (FT_Int)dict->cid_supplement;
       }
diff --git a/src/cff/cffdrivr.h b/src/cff/cffdrivr.h
index f2bbcfe..d198dd3 100644
--- a/src/cff/cffdrivr.h
+++ b/src/cff/cffdrivr.h
@@ -4,7 +4,7 @@
  *
  *   High-level OpenType driver interface (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
 #define CFFDRIVER_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
+#include <freetype/internal/ftdrv.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/cff/cfferrs.h b/src/cff/cfferrs.h
index 78d47a1..5b00a3f 100644
--- a/src/cff/cfferrs.h
+++ b/src/cff/cfferrs.h
@@ -4,7 +4,7 @@
  *
  *   CFF error codes (specification only).
  *
- * Copyright (C) 2001-2019 by
+ * Copyright (C) 2001-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -25,7 +25,7 @@
 #ifndef CFFERRS_H_
 #define CFFERRS_H_
 
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
 
 #undef FTERRORS_H_
 
@@ -34,7 +34,7 @@
 #define FT_ERR_BASE    FT_Mod_Err_CFF
 
 
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
 
 #endif /* CFFERRS_H_ */
 
diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c
index 36aa7d1..feee38a 100644
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -4,7 +4,7 @@
  *
  *   OpenType Glyph Loader (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,14 +16,13 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_OUTLINE_H
-#include FT_DRIVER_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/sfnt.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/psaux.h>
+#include <freetype/ftoutln.h>
+#include <freetype/ftdriver.h>
 
 #include "cffload.h"
 #include "cffgload.h"
@@ -207,8 +206,8 @@
     PSAux_Service            psaux         = (PSAux_Service)face->psaux;
     const CFF_Decoder_Funcs  decoder_funcs = psaux->cff_decoder_funcs;
 
-    FT_Matrix    font_matrix;
-    FT_Vector    font_offset;
+    FT_Matrix  font_matrix;
+    FT_Vector  font_offset;
 
 
     force_scaling = FALSE;
@@ -364,7 +363,6 @@
       top_upm = (FT_Long)cff->top_font.font_dict.units_per_em;
       sub_upm = (FT_Long)cff->subfonts[fd_index]->font_dict.units_per_em;
 
-
       font_matrix = cff->subfonts[fd_index]->font_dict.font_matrix;
       font_offset = cff->subfonts[fd_index]->font_dict.font_offset;
 
@@ -399,7 +397,6 @@
       PS_Driver  driver = (PS_Driver)FT_FACE_DRIVER( face );
 #endif
 
-
       FT_Byte*  charstring;
       FT_ULong  charstring_len;
 
@@ -665,8 +662,12 @@
         metrics->horiBearingY = cbox.yMax;
 
         if ( has_vertical_info )
+        {
           metrics->vertBearingX = metrics->horiBearingX -
                                     metrics->horiAdvance / 2;
+          metrics->vertBearingY = FT_MulFix( metrics->vertBearingY,
+                                             glyph->y_scale );
+        }
         else
         {
           if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
diff --git a/src/cff/cffgload.h b/src/cff/cffgload.h
index 754c55a..3b312f4 100644
--- a/src/cff/cffgload.h
+++ b/src/cff/cffgload.h
@@ -4,7 +4,7 @@
  *
  *   OpenType Glyph Loader (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,9 +20,8 @@
 #define CFFGLOAD_H_
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_CFF_OBJECTS_TYPES_H
+#include <freetype/freetype.h>
+#include <freetype/internal/cffotypes.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/cff/cffload.c b/src/cff/cffload.c
index 12efd18..73d3eec 100644
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -4,7 +4,7 @@
  *
  *   OpenType and CFF data/program tables loader (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,17 +16,16 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_TYPE1_TABLES_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
+#include <freetype/t1tables.h>
+#include <freetype/internal/psaux.h>
 
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include FT_MULTIPLE_MASTERS_H
-#include FT_SERVICE_MULTIPLE_MASTERS_H
+#include <freetype/ftmm.h>
+#include <freetype/internal/services/svmm.h>
 #endif
 
 #include "cffload.h"
@@ -411,7 +410,7 @@
     FT_Error   error     = FT_Err_Ok;
     FT_Memory  memory    = idx->stream->memory;
 
-    FT_Byte**  t         = NULL;
+    FT_Byte**  tbl       = NULL;
     FT_Byte*   new_bytes = NULL;
     FT_ULong   new_size;
 
@@ -428,11 +427,11 @@
     new_size = idx->data_size + idx->count;
 
     if ( idx->count > 0                                &&
-         !FT_NEW_ARRAY( t, idx->count + 1 )            &&
+         !FT_NEW_ARRAY( tbl, idx->count + 1 )          &&
          ( !pool || !FT_ALLOC( new_bytes, new_size ) ) )
     {
       FT_ULong  n, cur_offset;
-      FT_ULong  extra = 0;
+      FT_ULong  extra     = 0;
       FT_Byte*  org_bytes = idx->bytes;
 
 
@@ -443,15 +442,15 @@
       if ( cur_offset != 0 )
       {
         FT_TRACE0(( "cff_index_get_pointers:"
-                    " invalid first offset value %d set to zero\n",
+                    " invalid first offset value %ld set to zero\n",
                     cur_offset ));
         cur_offset = 0;
       }
 
       if ( !pool )
-        t[0] = org_bytes + cur_offset;
+        tbl[0] = org_bytes + cur_offset;
       else
-        t[0] = new_bytes + cur_offset;
+        tbl[0] = new_bytes + cur_offset;
 
       for ( n = 1; n <= idx->count; n++ )
       {
@@ -465,23 +464,25 @@
           next_offset = idx->data_size;
 
         if ( !pool )
-          t[n] = org_bytes + next_offset;
+          tbl[n] = org_bytes + next_offset;
         else
         {
-          t[n] = new_bytes + next_offset + extra;
+          tbl[n] = new_bytes + next_offset + extra;
 
           if ( next_offset != cur_offset )
           {
-            FT_MEM_COPY( t[n - 1], org_bytes + cur_offset, t[n] - t[n - 1] );
-            t[n][0] = '\0';
-            t[n]   += 1;
+            FT_MEM_COPY( tbl[n - 1],
+                         org_bytes + cur_offset,
+                         tbl[n] - tbl[n - 1] );
+            tbl[n][0] = '\0';
+            tbl[n]   += 1;
             extra++;
           }
         }
 
         cur_offset = next_offset;
       }
-      *table = t;
+      *table = tbl;
 
       if ( pool )
         *pool = new_bytes;
@@ -490,6 +491,11 @@
     }
 
   Exit:
+    if ( error && new_bytes )
+      FT_FREE( new_bytes );
+    if ( error && tbl )
+      FT_FREE( tbl );
+
     return error;
   }
 
@@ -553,8 +559,8 @@
            idx->data_offset > stream->size - off2 + 1 )
       {
         FT_ERROR(( "cff_index_access_element:"
-                   " offset to next entry (%d)"
-                   " exceeds the end of stream (%d)\n",
+                   " offset to next entry (%ld)"
+                   " exceeds the end of stream (%ld)\n",
                    off2, stream->size - idx->data_offset + 1 ));
         off2 = stream->size - idx->data_offset + 1;
       }
@@ -978,7 +984,7 @@
             if ( glyph_sid > 0xFFFFL - nleft )
             {
               FT_ERROR(( "cff_charset_load: invalid SID range trimmed"
-                         " nleft=%d -> %d\n", nleft, 0xFFFFL - glyph_sid ));
+                         " nleft=%d -> %ld\n", nleft, 0xFFFFL - glyph_sid ));
               nleft = ( FT_UInt )( 0xFFFFL - glyph_sid );
             }
 
@@ -1945,7 +1951,7 @@
     if ( priv->blue_shift > 1000 || priv->blue_shift < 0 )
     {
       FT_TRACE2(( "cff_load_private_dict:"
-                  " setting unlikely BlueShift value %d to default (7)\n",
+                  " setting unlikely BlueShift value %ld to default (7)\n",
                   priv->blue_shift ));
       priv->blue_shift = 7;
     }
@@ -1953,7 +1959,7 @@
     if ( priv->blue_fuzz > 1000 || priv->blue_fuzz < 0 )
     {
       FT_TRACE2(( "cff_load_private_dict:"
-                  " setting unlikely BlueFuzz value %d to default (1)\n",
+                  " setting unlikely BlueFuzz value %ld to default (1)\n",
                   priv->blue_fuzz ));
       priv->blue_fuzz = 1;
     }
@@ -2057,7 +2063,7 @@
     if ( !error )
     {
       FT_TRACE4(( " top dictionary:\n" ));
-      error = cff_parser_run( &parser, dict, dict + dict_len );
+      error = cff_parser_run( &parser, dict, FT_OFFSET( dict, dict_len ) );
     }
 
     /* clean up regardless of error */
diff --git a/src/cff/cffload.h b/src/cff/cffload.h
index 42d2696..fc998db 100644
--- a/src/cff/cffload.h
+++ b/src/cff/cffload.h
@@ -4,7 +4,7 @@
  *
  *   OpenType & CFF data/program tables loader (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,10 +20,9 @@
 #define CFFLOAD_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_CFF_TYPES_H
+#include <freetype/internal/cfftypes.h>
 #include "cffparse.h"
-#include FT_INTERNAL_CFF_OBJECTS_TYPES_H  /* for CFF_Face */
+#include <freetype/internal/cffotypes.h>  /* for CFF_Face */
 
 
 FT_BEGIN_HEADER
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index f76245f..d555d52 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -4,7 +4,7 @@
  *
  *   OpenType objects manager (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,32 +16,31 @@
  */
 
 
-#include <ft2build.h>
 
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_STREAM_H
-#include FT_ERRORS_H
-#include FT_TRUETYPE_IDS_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_INTERNAL_SFNT_H
-#include FT_DRIVER_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/fterrors.h>
+#include <freetype/ttnameid.h>
+#include <freetype/tttags.h>
+#include <freetype/internal/sfnt.h>
+#include <freetype/ftdriver.h>
 
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include FT_MULTIPLE_MASTERS_H
-#include FT_SERVICE_MULTIPLE_MASTERS_H
-#include FT_SERVICE_METRICS_VARIATIONS_H
+#include <freetype/ftmm.h>
+#include <freetype/internal/services/svmm.h>
+#include <freetype/internal/services/svmetric.h>
 #endif
 
-#include FT_INTERNAL_CFF_OBJECTS_TYPES_H
+#include <freetype/internal/cffotypes.h>
 #include "cffobjs.h"
 #include "cffload.h"
 #include "cffcmap.h"
 
 #include "cfferrs.h"
 
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_SERVICE_CFF_TABLE_LOAD_H
+#include <freetype/internal/psaux.h>
+#include <freetype/internal/services/svcfftl.h>
 
 
   /**************************************************************************
@@ -167,46 +166,56 @@
     FT_Error           error = FT_Err_Ok;
     PSH_Globals_Funcs  funcs = cff_size_get_globals_funcs( size );
 
+    FT_Memory     memory   = cffsize->face->memory;
+    CFF_Internal  internal = NULL;
+    CFF_Face      face     = (CFF_Face)cffsize->face;
+    CFF_Font      font     = (CFF_Font)face->extra.data;
 
-    if ( funcs )
-    {
-      CFF_Face      face     = (CFF_Face)cffsize->face;
-      CFF_Font      font     = (CFF_Font)face->extra.data;
-      CFF_Internal  internal = NULL;
+    PS_PrivateRec priv;
 
-      PS_PrivateRec  priv;
-      FT_Memory      memory = cffsize->face->memory;
+    FT_UInt       i;
 
-      FT_UInt  i;
+    if ( !funcs )
+      goto Exit;
 
+    if ( FT_NEW( internal ) )
+      goto Exit;
 
-      if ( FT_NEW( internal ) )
-        goto Exit;
-
-      cff_make_private_dict( &font->top_font, &priv );
-      error = funcs->create( cffsize->face->memory, &priv,
+    cff_make_private_dict( &font->top_font, &priv );
+    error = funcs->create( cffsize->face->memory, &priv,
                              &internal->topfont );
+    if ( error )
+      goto Exit;
+
+    for ( i = font->num_subfonts; i > 0; i-- )
+    {
+      CFF_SubFont  sub = font->subfonts[i - 1];
+
+
+      cff_make_private_dict( sub, &priv );
+      error = funcs->create( cffsize->face->memory, &priv,
+                               &internal->subfonts[i - 1] );
       if ( error )
         goto Exit;
-
-      for ( i = font->num_subfonts; i > 0; i-- )
-      {
-        CFF_SubFont  sub = font->subfonts[i - 1];
-
-
-        cff_make_private_dict( sub, &priv );
-        error = funcs->create( cffsize->face->memory, &priv,
-                               &internal->subfonts[i - 1] );
-        if ( error )
-          goto Exit;
-      }
-
-      cffsize->internal->module_data = internal;
     }
 
+    cffsize->internal->module_data = internal;
+
     size->strike_index = 0xFFFFFFFFUL;
 
   Exit:
+    if ( error )
+    {
+      if ( internal )
+      {
+        for ( i = font->num_subfonts; i > 0; i-- )
+          FT_FREE( internal->subfonts[i - 1] );
+        FT_FREE( internal->topfont );
+      }
+
+      FT_FREE( internal );
+    }
+
     return error;
   }
 
@@ -349,7 +358,8 @@
   FT_LOCAL_DEF( void )
   cff_slot_done( FT_GlyphSlot  slot )
   {
-    slot->internal->glyph_hints = NULL;
+    if ( slot->internal )
+      slot->internal->glyph_hints = NULL;
   }
 
 
@@ -940,7 +950,8 @@
                 style_name = cff_strcpy( memory, fullp );
 
                 /* remove the style part from the family name (if present) */
-                remove_style( cffface->family_name, style_name );
+                if ( style_name )
+                  remove_style( cffface->family_name, style_name );
               }
               break;
             }
@@ -1018,9 +1029,9 @@
       }
 
 #ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
-      /* CID-keyed CFF fonts don't have glyph names -- the SFNT loader */
-      /* has unset this flag because of the 3.0 `post' table.          */
-      if ( dict->cid_registry == 0xFFFFU )
+      /* CID-keyed CFF or CFF2 fonts don't have glyph names -- the SFNT */
+      /* loader has unset this flag because of the 3.0 `post' table.    */
+      if ( dict->cid_registry == 0xFFFFU && !cff2 )
         cffface->face_flags |= FT_FACE_FLAG_GLYPH_NAMES;
 #endif
 
diff --git a/src/cff/cffobjs.h b/src/cff/cffobjs.h
index 03bc78a..845bd90 100644
--- a/src/cff/cffobjs.h
+++ b/src/cff/cffobjs.h
@@ -4,7 +4,7 @@
  *
  *   OpenType objects manager (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,7 +20,6 @@
 #define CFFOBJS_H_
 
 
-#include <ft2build.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c
index 008752c..69bcd5d 100644
--- a/src/cff/cffparse.c
+++ b/src/cff/cffparse.c
@@ -4,7 +4,7 @@
  *
  *   CFF token stream parser (body)
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,13 +16,12 @@
  */
 
 
-#include <ft2build.h>
 #include "cffparse.h"
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_LIST_H
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/psaux.h>
+#include <freetype/ftlist.h>
 
 #include "cfferrs.h"
 #include "cffload.h"
@@ -714,7 +713,7 @@
            ( max_scaling - min_scaling ) > 9 )
       {
         FT_TRACE1(( "cff_parse_font_matrix:"
-                    " strange scaling values (minimum %d, maximum %d),\n"
+                    " strange scaling values (minimum %ld, maximum %ld),\n"
                     "                      "
                     " using default matrix\n", min_scaling, max_scaling ));
         goto Unlikely;
@@ -811,7 +810,7 @@
       bbox->yMax = FT_RoundFix( cff_parse_fixed( parser, data   ) );
       error = FT_Err_Ok;
 
-      FT_TRACE4(( " [%d %d %d %d]\n",
+      FT_TRACE4(( " [%ld %ld %ld %ld]\n",
                   bbox->xMin / 65536,
                   bbox->yMin / 65536,
                   bbox->xMax / 65536,
@@ -934,11 +933,11 @@
         FT_TRACE1(( "cff_parse_cid_ros: real supplement is rounded\n" ));
       dict->cid_supplement = cff_parse_num( parser, data );
       if ( dict->cid_supplement < 0 )
-        FT_TRACE1(( "cff_parse_cid_ros: negative supplement %d is found\n",
+        FT_TRACE1(( "cff_parse_cid_ros: negative supplement %ld is found\n",
                    dict->cid_supplement ));
       error = FT_Err_Ok;
 
-      FT_TRACE4(( " %d %d %d\n",
+      FT_TRACE4(( " %d %d %ld\n",
                   dict->cid_registry,
                   dict->cid_ordering,
                   dict->cid_supplement ));
@@ -1264,11 +1263,11 @@
         FT_Byte*     charstring_base;
         FT_ULong     charstring_len;
 
-        FT_Fixed*     stack;
-        FT_ListNode   node;
-        CFF_T2_String t2;
-        size_t        t2_size;
-        FT_Byte*      q;
+        FT_Fixed*      stack;
+        FT_ListNode    node;
+        CFF_T2_String  t2;
+        FT_Fixed       t2_size;
+        FT_Byte*       q;
 
 
         charstring_base = ++p;
diff --git a/src/cff/cffparse.h b/src/cff/cffparse.h
index 4e74709..6f3fbb3 100644
--- a/src/cff/cffparse.h
+++ b/src/cff/cffparse.h
@@ -4,7 +4,7 @@
  *
  *   CFF token stream parser (specification)
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,9 +20,8 @@
 #define CFFPARSE_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_CFF_TYPES_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/cfftypes.h>
+#include <freetype/internal/ftobjs.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/cff/cfftoken.h b/src/cff/cfftoken.h
index 063a7b3..4c6a53e 100644
--- a/src/cff/cfftoken.h
+++ b/src/cff/cfftoken.h
@@ -4,7 +4,7 @@
  *
  *   CFF token definitions (specification only).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/cff/module.mk b/src/cff/module.mk
index 8c61095..bd728c6 100644
--- a/src/cff/module.mk
+++ b/src/cff/module.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/cff/rules.mk b/src/cff/rules.mk
index 6e2dc47..70bb92d 100644
--- a/src/cff/rules.mk
+++ b/src/cff/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/cid/Jamfile b/src/cid/Jamfile
deleted file mode 100644
index 1cfb702..0000000
--- a/src/cid/Jamfile
+++ /dev/null
@@ -1,34 +0,0 @@
-# FreeType 2 src/cid Jamfile
-#
-# Copyright (C) 2001-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) cid ;
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = cidgload
-               cidload
-               cidobjs
-               cidparse
-               cidriver
-               ;
-  }
-  else
-  {
-    _sources = type1cid ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/cid Jamfile
diff --git a/src/cid/ciderrs.h b/src/cid/ciderrs.h
index be80bed..f698bb2 100644
--- a/src/cid/ciderrs.h
+++ b/src/cid/ciderrs.h
@@ -4,7 +4,7 @@
  *
  *   CID error codes (specification only).
  *
- * Copyright (C) 2001-2019 by
+ * Copyright (C) 2001-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -25,7 +25,7 @@
 #ifndef CIDERRS_H_
 #define CIDERRS_H_
 
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
 
 #undef FTERRORS_H_
 
@@ -33,7 +33,7 @@
 #define FT_ERR_PREFIX  CID_Err_
 #define FT_ERR_BASE    FT_Mod_Err_CID
 
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
 
 #endif /* CIDERRS_H_ */
 
diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c
index f59f288..54aa62f 100644
--- a/src/cid/cidgload.c
+++ b/src/cid/cidgload.c
@@ -4,7 +4,7 @@
  *
  *   CID-keyed Type1 Glyph Loader (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,17 +16,16 @@
  */
 
 
-#include <ft2build.h>
 #include "cidload.h"
 #include "cidgload.h"
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_OUTLINE_H
-#include FT_INTERNAL_CALC_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/ftoutln.h>
+#include <freetype/internal/ftcalc.h>
 
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_CFF_TYPES_H
-#include FT_DRIVER_H
+#include <freetype/internal/psaux.h>
+#include <freetype/internal/cfftypes.h>
+#include <freetype/ftdriver.h>
 
 #include "ciderrs.h"
 
diff --git a/src/cid/cidgload.h b/src/cid/cidgload.h
index 37eba7c..da36e37 100644
--- a/src/cid/cidgload.h
+++ b/src/cid/cidgload.h
@@ -4,7 +4,7 @@
  *
  *   OpenType Glyph Loader (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,7 +20,6 @@
 #define CIDGLOAD_H_
 
 
-#include <ft2build.h>
 #include "cidobjs.h"
 
 
diff --git a/src/cid/cidload.c b/src/cid/cidload.c
index fce3e37..bb9136a 100644
--- a/src/cid/cidload.c
+++ b/src/cid/cidload.c
@@ -4,7 +4,7 @@
  *
  *   CID-keyed Type1 font loader (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -17,11 +17,11 @@
 
 
 #include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 #include FT_CONFIG_CONFIG_H
-#include FT_MULTIPLE_MASTERS_H
-#include FT_INTERNAL_TYPE1_TYPES_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/ftmm.h>
+#include <freetype/internal/t1types.h>
+#include <freetype/internal/psaux.h>
 
 #include "cidload.h"
 
@@ -254,7 +254,7 @@
       goto Exit;
     }
 
-    FT_TRACE4(( " %d\n", num_dicts ));
+    FT_TRACE4(( " %ld\n", num_dicts ));
 
     /*
      * A single entry in the FDArray must (at least) contain the following
@@ -275,7 +275,7 @@
     if ( (FT_ULong)num_dicts > stream->size / 100 )
     {
       FT_TRACE0(( "parse_fd_array: adjusting FDArray size"
-                  " (from %d to %d)\n",
+                  " (from %ld to %ld)\n",
                   num_dicts,
                   stream->size / 100 ));
       num_dicts = (FT_Long)( stream->size / 100 );
@@ -329,7 +329,7 @@
       dict->expansion_factor              = cid_parser_to_fixed( parser, 0 );
       dict->private_dict.expansion_factor = dict->expansion_factor;
 
-      FT_TRACE4(( "%d\n", dict->expansion_factor ));
+      FT_TRACE4(( "%ld\n", dict->expansion_factor ));
     }
 
     return;
@@ -715,7 +715,7 @@
       if ( ft_isdigit( *p ) )
         val = (FT_Byte)( *p - '0' );
       else if ( *p >= 'a' && *p <= 'f' )
-        val = (FT_Byte)( *p - 'a' );
+        val = (FT_Byte)( *p - 'a' + 10 );
       else if ( *p >= 'A' && *p <= 'F' )
         val = (FT_Byte)( *p - 'A' + 10 );
       else if ( *p == ' '  ||
@@ -804,7 +804,7 @@
              face->root.stream->size - parser->data_offset )
       {
         FT_TRACE0(( "cid_face_open: adjusting length of binary data\n"
-                    "               (from %d to %d bytes)\n",
+                    "               (from %ld to %ld bytes)\n",
                     parser->binary_length,
                     face->root.stream->size - parser->data_offset ));
         parser->binary_length = face->root.stream->size -
diff --git a/src/cid/cidload.h b/src/cid/cidload.h
index fb9d462..06fb9ef 100644
--- a/src/cid/cidload.h
+++ b/src/cid/cidload.h
@@ -4,7 +4,7 @@
  *
  *   CID-keyed Type1 font loader (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
 #define CIDLOAD_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_STREAM_H
+#include <freetype/internal/ftstream.h>
 #include "cidparse.h"
 
 
diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c
index 4e97287..04b295e 100644
--- a/src/cid/cidobjs.c
+++ b/src/cid/cidobjs.c
@@ -4,7 +4,7 @@
  *
  *   CID objects manager (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,17 +16,16 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
 
 #include "cidgload.h"
 #include "cidload.h"
 
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
-#include FT_DRIVER_H
+#include <freetype/internal/services/svpscmap.h>
+#include <freetype/internal/psaux.h>
+#include <freetype/internal/pshints.h>
+#include <freetype/ftdriver.h>
 
 #include "ciderrs.h"
 
@@ -50,7 +49,8 @@
   FT_LOCAL_DEF( void )
   cid_slot_done( FT_GlyphSlot  slot )
   {
-    slot->internal->glyph_hints = NULL;
+    if ( slot->internal )
+      slot->internal->glyph_hints = NULL;
   }
 
 
diff --git a/src/cid/cidobjs.h b/src/cid/cidobjs.h
index 89c9aa7..6ae3061 100644
--- a/src/cid/cidobjs.h
+++ b/src/cid/cidobjs.h
@@ -4,7 +4,7 @@
  *
  *   CID objects manager (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -21,9 +21,9 @@
 
 
 #include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/ftobjs.h>
 #include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_TYPE1_TYPES_H
+#include <freetype/internal/t1types.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/cid/cidparse.c b/src/cid/cidparse.c
index 1be46ec..1fc098b 100644
--- a/src/cid/cidparse.c
+++ b/src/cid/cidparse.c
@@ -4,7 +4,7 @@
  *
  *   CID-keyed Type1 parser (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,10 +16,9 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_STREAM_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftstream.h>
 
 #include "cidparse.h"
 
diff --git a/src/cid/cidparse.h b/src/cid/cidparse.h
index ec1f6a3..0b49beb 100644
--- a/src/cid/cidparse.h
+++ b/src/cid/cidparse.h
@@ -4,7 +4,7 @@
  *
  *   CID-keyed Type1 parser (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,10 +20,9 @@
 #define CIDPARSE_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_TYPE1_TYPES_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/internal/t1types.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/psaux.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c
index 4d91e87..d08cea1 100644
--- a/src/cid/cidriver.c
+++ b/src/cid/cidriver.c
@@ -4,7 +4,7 @@
  *
  *   CID driver interface (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,22 +16,21 @@
  */
 
 
-#include <ft2build.h>
 #include "cidriver.h"
 #include "cidgload.h"
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_POSTSCRIPT_PROPS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftpsprop.h>
 
 #include "ciderrs.h"
 
-#include FT_SERVICE_POSTSCRIPT_NAME_H
-#include FT_SERVICE_FONT_FORMAT_H
-#include FT_SERVICE_POSTSCRIPT_INFO_H
-#include FT_SERVICE_CID_H
-#include FT_SERVICE_PROPERTIES_H
-#include FT_DRIVER_H
+#include <freetype/internal/services/svpostnm.h>
+#include <freetype/internal/services/svfntfmt.h>
+#include <freetype/internal/services/svpsinfo.h>
+#include <freetype/internal/services/svcid.h>
+#include <freetype/internal/services/svprop.h>
+#include <freetype/ftdriver.h>
 
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/internal/psaux.h>
 
 
   /**************************************************************************
diff --git a/src/cid/cidriver.h b/src/cid/cidriver.h
index 3402fd7..0fc8ed3 100644
--- a/src/cid/cidriver.h
+++ b/src/cid/cidriver.h
@@ -4,7 +4,7 @@
  *
  *   High-level CID driver interface (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
 #define CIDRIVER_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
+#include <freetype/internal/ftdrv.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/cid/cidtoken.h b/src/cid/cidtoken.h
index f505c9e..e9f068b 100644
--- a/src/cid/cidtoken.h
+++ b/src/cid/cidtoken.h
@@ -4,7 +4,7 @@
  *
  *   CID token definitions (specification only).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/cid/module.mk b/src/cid/module.mk
index 875c683..9fb0223 100644
--- a/src/cid/module.mk
+++ b/src/cid/module.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/cid/rules.mk b/src/cid/rules.mk
index 2b68dd4..94f663c 100644
--- a/src/cid/rules.mk
+++ b/src/cid/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/cid/type1cid.c b/src/cid/type1cid.c
index d21801c..082e8bf 100644
--- a/src/cid/type1cid.c
+++ b/src/cid/type1cid.c
@@ -4,7 +4,7 @@
  *
  *   FreeType OpenType driver component (body only).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -17,7 +17,6 @@
 
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
 
 #include "cidgload.c"
 #include "cidload.c"
diff --git a/src/gxvalid/Jamfile b/src/gxvalid/Jamfile
deleted file mode 100644
index a08e7a9..0000000
--- a/src/gxvalid/Jamfile
+++ /dev/null
@@ -1,52 +0,0 @@
-# FreeType 2 src/gxvalid Jamfile
-#
-# Copyright (C) 2005-2019 by
-# suzuki toshiya, Masatake YAMATO and Red Hat K.K.
-#
-# 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.
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) gxvalid ;
-
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = gxvbsln
-               gxvcommn
-               gxvfeat
-               gxvjust
-               gxvkern
-               gxvlcar
-               gxvmod
-               gxvmort
-               gxvmort0
-               gxvmort1
-               gxvmort2
-               gxvmort4
-               gxvmort5
-               gxvmorx
-               gxvmorx0
-               gxvmorx1
-               gxvmorx2
-               gxvmorx4
-               gxvmorx5
-               gxvopbd
-               gxvprop
-               gxvtrak
-               ;
-  }
-  else
-  {
-    _sources = gxvalid ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/gxvalid Jamfile
diff --git a/src/gxvalid/README b/src/gxvalid/README
index d493587..2a32bab 100644
--- a/src/gxvalid/README
+++ b/src/gxvalid/README
@@ -518,7 +518,7 @@
 
 ------------------------------------------------------------------------
 
-Copyright (C) 2004-2019 by
+Copyright (C) 2004-2020 by
 suzuki toshiya, Masatake YAMATO, Red hat K.K.,
 David Turner, Robert Wilhelm, and Werner Lemberg.
 
diff --git a/src/gxvalid/gxvalid.c b/src/gxvalid/gxvalid.c
index 462e461..683b8a6 100644
--- a/src/gxvalid/gxvalid.c
+++ b/src/gxvalid/gxvalid.c
@@ -4,7 +4,7 @@
  *
  *   FreeType validator for TrueTypeGX/AAT tables (body only).
  *
- * Copyright (C) 2005-2019 by
+ * Copyright (C) 2005-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
@@ -18,7 +18,6 @@
 
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
 
 #include "gxvbsln.c"
 #include "gxvcommn.c"
diff --git a/src/gxvalid/gxvalid.h b/src/gxvalid/gxvalid.h
index 969cd09..ff2812d 100644
--- a/src/gxvalid/gxvalid.h
+++ b/src/gxvalid/gxvalid.h
@@ -4,7 +4,7 @@
  *
  *   TrueTypeGX/AAT table validation (specification only).
  *
- * Copyright (C) 2005-2019 by
+ * Copyright (C) 2005-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
@@ -28,13 +28,12 @@
 #ifndef GXVALID_H_
 #define GXVALID_H_
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
-#include "gxverror.h"          /* must come before FT_INTERNAL_VALIDATE_H */
+#include "gxverror.h"                     /* must come before `ftvalid.h' */
 
-#include FT_INTERNAL_VALIDATE_H
-#include FT_INTERNAL_STREAM_H
+#include <freetype/internal/ftvalid.h>
+#include <freetype/internal/ftstream.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/gxvalid/gxvbsln.c b/src/gxvalid/gxvbsln.c
index f22f254..ac58d46 100644
--- a/src/gxvalid/gxvbsln.c
+++ b/src/gxvalid/gxvbsln.c
@@ -4,7 +4,7 @@
  *
  *   TrueTypeGX/AAT bsln table validation (body).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
diff --git a/src/gxvalid/gxvcommn.c b/src/gxvalid/gxvcommn.c
index c5cb8eb..ead0f24 100644
--- a/src/gxvalid/gxvcommn.c
+++ b/src/gxvalid/gxvcommn.c
@@ -4,7 +4,7 @@
  *
  *   TrueTypeGX/AAT common tables validation (body).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
diff --git a/src/gxvalid/gxvcommn.h b/src/gxvalid/gxvcommn.h
index 334dc9d..59d1492 100644
--- a/src/gxvalid/gxvcommn.h
+++ b/src/gxvalid/gxvcommn.h
@@ -4,7 +4,7 @@
  *
  *   TrueTypeGX/AAT common tables validation (specification).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
@@ -43,10 +43,9 @@
 #define GXVCOMMN_H_
 
 
-#include <ft2build.h>
 #include "gxvalid.h"
-#include FT_INTERNAL_DEBUG_H
-#include FT_SFNT_NAMES_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/ftsnames.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/gxvalid/gxverror.h b/src/gxvalid/gxverror.h
index da0edb3..5d8f0b6 100644
--- a/src/gxvalid/gxverror.h
+++ b/src/gxvalid/gxverror.h
@@ -4,7 +4,7 @@
  *
  *   TrueTypeGX/AAT validation module error codes (specification only).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
@@ -35,7 +35,7 @@
 #ifndef GXVERROR_H_
 #define GXVERROR_H_
 
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
 
 #undef FTERRORS_H_
 
@@ -43,7 +43,7 @@
 #define FT_ERR_PREFIX  GXV_Err_
 #define FT_ERR_BASE    FT_Mod_Err_GXvalid
 
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
 
 #endif /* GXVERROR_H_ */
 
diff --git a/src/gxvalid/gxvfeat.c b/src/gxvalid/gxvfeat.c
index e1a12a1..400ec8a 100644
--- a/src/gxvalid/gxvfeat.c
+++ b/src/gxvalid/gxvfeat.c
@@ -4,7 +4,7 @@
  *
  *   TrueTypeGX/AAT feat table validation (body).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
diff --git a/src/gxvalid/gxvfeat.h b/src/gxvalid/gxvfeat.h
index 6c98929..435dcef 100644
--- a/src/gxvalid/gxvfeat.h
+++ b/src/gxvalid/gxvfeat.h
@@ -4,7 +4,7 @@
  *
  *   TrueTypeGX/AAT feat table validation (specification).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
diff --git a/src/gxvalid/gxvfgen.c b/src/gxvalid/gxvfgen.c
index 5ecb944..fe05a6f 100644
--- a/src/gxvalid/gxvfgen.c
+++ b/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-2019 by
+ * Copyright (C) 2004-2020 by
  * Masatake YAMATO and Redhat K.K.
  *
  * This file may only be used,
diff --git a/src/gxvalid/gxvjust.c b/src/gxvalid/gxvjust.c
index a582377..3c7f1f9 100644
--- a/src/gxvalid/gxvjust.c
+++ b/src/gxvalid/gxvjust.c
@@ -4,7 +4,7 @@
  *
  *   TrueTypeGX/AAT just table validation (body).
  *
- * Copyright (C) 2005-2019 by
+ * Copyright (C) 2005-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
@@ -28,7 +28,7 @@
 #include "gxvalid.h"
 #include "gxvcommn.h"
 
-#include FT_SFNT_NAMES_H
+#include <freetype/ftsnames.h>
 
 
   /**************************************************************************
diff --git a/src/gxvalid/gxvkern.c b/src/gxvalid/gxvkern.c
index a753233..cc0b3df 100644
--- a/src/gxvalid/gxvkern.c
+++ b/src/gxvalid/gxvkern.c
@@ -4,7 +4,7 @@
  *
  *   TrueTypeGX/AAT kern table validation (body).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
@@ -28,8 +28,8 @@
 #include "gxvalid.h"
 #include "gxvcommn.h"
 
-#include FT_SFNT_NAMES_H
-#include FT_SERVICE_GX_VALIDATE_H
+#include <freetype/ftsnames.h>
+#include <freetype/internal/services/svgxval.h>
 
 
   /**************************************************************************
diff --git a/src/gxvalid/gxvlcar.c b/src/gxvalid/gxvlcar.c
index 13b3de3..82ac190 100644
--- a/src/gxvalid/gxvlcar.c
+++ b/src/gxvalid/gxvlcar.c
@@ -4,7 +4,7 @@
  *
  *   TrueTypeGX/AAT lcar table validation (body).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
diff --git a/src/gxvalid/gxvmod.c b/src/gxvalid/gxvmod.c
index eeadeb3..a467e87 100644
--- a/src/gxvalid/gxvmod.c
+++ b/src/gxvalid/gxvmod.c
@@ -4,7 +4,7 @@
  *
  *   FreeType's TrueTypeGX/AAT validation module implementation (body).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
@@ -25,12 +25,11 @@
  */
 
 
-#include <ft2build.h>
-#include FT_TRUETYPE_TABLES_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_GX_VALIDATE_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_GX_VALIDATE_H
+#include <freetype/tttables.h>
+#include <freetype/tttags.h>
+#include <freetype/ftgxval.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/services/svgxval.h>
 
 #include "gxvmod.h"
 #include "gxvalid.h"
diff --git a/src/gxvalid/gxvmod.h b/src/gxvalid/gxvmod.h
index 6ecd731..f2982c9 100644
--- a/src/gxvalid/gxvmod.h
+++ b/src/gxvalid/gxvmod.h
@@ -5,7 +5,7 @@
  *   FreeType's TrueTypeGX/AAT validation module implementation
  *   (specification).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
@@ -29,8 +29,7 @@
 #ifndef GXVMOD_H_
 #define GXVMOD_H_
 
-#include <ft2build.h>
-#include FT_MODULE_H
+#include <freetype/ftmodapi.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/gxvalid/gxvmort.c b/src/gxvalid/gxvmort.c
index 288ef69..aae7f01 100644
--- a/src/gxvalid/gxvmort.c
+++ b/src/gxvalid/gxvmort.c
@@ -4,7 +4,7 @@
  *
  *   TrueTypeGX/AAT mort table validation (body).
  *
- * Copyright (C) 2005-2019 by
+ * Copyright (C) 2005-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
diff --git a/src/gxvalid/gxvmort.h b/src/gxvalid/gxvmort.h
index 0619e24..7237c58 100644
--- a/src/gxvalid/gxvmort.h
+++ b/src/gxvalid/gxvmort.h
@@ -4,7 +4,7 @@
  *
  *   TrueTypeGX/AAT common definition for mort table (specification).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
@@ -31,7 +31,10 @@
 #include "gxvalid.h"
 #include "gxvcommn.h"
 
-#include FT_SFNT_NAMES_H
+#include <freetype/ftsnames.h>
+
+
+FT_BEGIN_HEADER
 
 
   typedef struct  GXV_mort_featureRec_
@@ -88,6 +91,8 @@
                                     GXV_Validator  gxvalid );
 
 
+FT_END_HEADER
+
 #endif /* GXVMORT_H_ */
 
 
diff --git a/src/gxvalid/gxvmort0.c b/src/gxvalid/gxvmort0.c
index 2c01bf9..d452c1c 100644
--- a/src/gxvalid/gxvmort0.c
+++ b/src/gxvalid/gxvmort0.c
@@ -5,7 +5,7 @@
  *   TrueTypeGX/AAT mort table validation
  *   body for type0 (Indic Script Rearrangement) subtable.
  *
- * Copyright (C) 2005-2019 by
+ * Copyright (C) 2005-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
diff --git a/src/gxvalid/gxvmort1.c b/src/gxvalid/gxvmort1.c
index c71ba13..d743f89 100644
--- a/src/gxvalid/gxvmort1.c
+++ b/src/gxvalid/gxvmort1.c
@@ -5,7 +5,7 @@
  *   TrueTypeGX/AAT mort table validation
  *   body for type1 (Contextual Substitution) subtable.
  *
- * Copyright (C) 2005-2019 by
+ * Copyright (C) 2005-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
diff --git a/src/gxvalid/gxvmort2.c b/src/gxvalid/gxvmort2.c
index 889d3bd..9e69e12 100644
--- a/src/gxvalid/gxvmort2.c
+++ b/src/gxvalid/gxvmort2.c
@@ -5,7 +5,7 @@
  *   TrueTypeGX/AAT mort table validation
  *   body for type2 (Ligature Substitution) subtable.
  *
- * Copyright (C) 2005-2019 by
+ * Copyright (C) 2005-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
diff --git a/src/gxvalid/gxvmort4.c b/src/gxvalid/gxvmort4.c
index f8ce6cf..4584d20 100644
--- a/src/gxvalid/gxvmort4.c
+++ b/src/gxvalid/gxvmort4.c
@@ -5,7 +5,7 @@
  *   TrueTypeGX/AAT mort table validation
  *   body for type4 (Non-Contextual Glyph Substitution) subtable.
  *
- * Copyright (C) 2005-2019 by
+ * Copyright (C) 2005-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
diff --git a/src/gxvalid/gxvmort5.c b/src/gxvalid/gxvmort5.c
index 1ba1e5d..a15a24f 100644
--- a/src/gxvalid/gxvmort5.c
+++ b/src/gxvalid/gxvmort5.c
@@ -5,7 +5,7 @@
  *   TrueTypeGX/AAT mort table validation
  *   body for type5 (Contextual Glyph Insertion) subtable.
  *
- * Copyright (C) 2005-2019 by
+ * Copyright (C) 2005-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
diff --git a/src/gxvalid/gxvmorx.c b/src/gxvalid/gxvmorx.c
index 8bd45c2..754d9f8 100644
--- a/src/gxvalid/gxvmorx.c
+++ b/src/gxvalid/gxvmorx.c
@@ -4,7 +4,7 @@
  *
  *   TrueTypeGX/AAT morx table validation (body).
  *
- * Copyright (C) 2005-2019 by
+ * Copyright (C) 2005-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
diff --git a/src/gxvalid/gxvmorx.h b/src/gxvalid/gxvmorx.h
index e257270..f747b1d 100644
--- a/src/gxvalid/gxvmorx.h
+++ b/src/gxvalid/gxvmorx.h
@@ -4,7 +4,7 @@
  *
  *   TrueTypeGX/AAT common definition for morx table (specification).
  *
- * Copyright (C) 2005-2019 by
+ * Copyright (C) 2005-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
@@ -33,7 +33,10 @@
 #include "gxvcommn.h"
 #include "gxvmort.h"
 
-#include FT_SFNT_NAMES_H
+#include <freetype/ftsnames.h>
+
+
+FT_BEGIN_HEADER
 
 
   FT_LOCAL( void )
@@ -62,6 +65,8 @@
                                     GXV_Validator  gxvalid );
 
 
+FT_END_HEADER
+
 #endif /* GXVMORX_H_ */
 
 
diff --git a/src/gxvalid/gxvmorx0.c b/src/gxvalid/gxvmorx0.c
index d7764a0..5a42e55 100644
--- a/src/gxvalid/gxvmorx0.c
+++ b/src/gxvalid/gxvmorx0.c
@@ -5,7 +5,7 @@
  *   TrueTypeGX/AAT morx table validation
  *   body for type0 (Indic Script Rearrangement) subtable.
  *
- * Copyright (C) 2005-2019 by
+ * Copyright (C) 2005-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
diff --git a/src/gxvalid/gxvmorx1.c b/src/gxvalid/gxvmorx1.c
index 5b41b36..9f8b690 100644
--- a/src/gxvalid/gxvmorx1.c
+++ b/src/gxvalid/gxvmorx1.c
@@ -5,7 +5,7 @@
  *   TrueTypeGX/AAT morx table validation
  *   body for type1 (Contextual Substitution) subtable.
  *
- * Copyright (C) 2005-2019 by
+ * Copyright (C) 2005-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
diff --git a/src/gxvalid/gxvmorx2.c b/src/gxvalid/gxvmorx2.c
index ec4c812..98b5c49 100644
--- a/src/gxvalid/gxvmorx2.c
+++ b/src/gxvalid/gxvmorx2.c
@@ -5,7 +5,7 @@
  *   TrueTypeGX/AAT morx table validation
  *   body for type2 (Ligature Substitution) subtable.
  *
- * Copyright (C) 2005-2019 by
+ * Copyright (C) 2005-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
diff --git a/src/gxvalid/gxvmorx4.c b/src/gxvalid/gxvmorx4.c
index 7b04153..857e4d4 100644
--- a/src/gxvalid/gxvmorx4.c
+++ b/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-2019 by
+ * Copyright (C) 2005-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
diff --git a/src/gxvalid/gxvmorx5.c b/src/gxvalid/gxvmorx5.c
index 70a4623..7ceba07 100644
--- a/src/gxvalid/gxvmorx5.c
+++ b/src/gxvalid/gxvmorx5.c
@@ -5,7 +5,7 @@
  *   TrueTypeGX/AAT morx table validation
  *   body for type5 (Contextual Glyph Insertion) subtable.
  *
- * Copyright (C) 2005-2019 by
+ * Copyright (C) 2005-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
diff --git a/src/gxvalid/gxvopbd.c b/src/gxvalid/gxvopbd.c
index f055a22..a398fe0 100644
--- a/src/gxvalid/gxvopbd.c
+++ b/src/gxvalid/gxvopbd.c
@@ -4,7 +4,7 @@
  *
  *   TrueTypeGX/AAT opbd table validation (body).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
diff --git a/src/gxvalid/gxvprop.c b/src/gxvalid/gxvprop.c
index e1911ed..bee8bab 100644
--- a/src/gxvalid/gxvprop.c
+++ b/src/gxvalid/gxvprop.c
@@ -4,7 +4,7 @@
  *
  *   TrueTypeGX/AAT prop table validation (body).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
diff --git a/src/gxvalid/gxvtrak.c b/src/gxvalid/gxvtrak.c
index b7794b7..58a631c 100644
--- a/src/gxvalid/gxvtrak.c
+++ b/src/gxvalid/gxvtrak.c
@@ -4,7 +4,7 @@
  *
  *   TrueTypeGX/AAT trak table validation (body).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
diff --git a/src/gxvalid/module.mk b/src/gxvalid/module.mk
index 04067ce..e7d408d 100644
--- a/src/gxvalid/module.mk
+++ b/src/gxvalid/module.mk
@@ -2,7 +2,7 @@
 # FreeType 2 gxvalid module definition
 #
 
-# Copyright (C) 2004-2019 by
+# Copyright (C) 2004-2020 by
 # suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
diff --git a/src/gxvalid/rules.mk b/src/gxvalid/rules.mk
index 4ef463b..d55a493 100644
--- a/src/gxvalid/rules.mk
+++ b/src/gxvalid/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 2004-2019 by
+# Copyright (C) 2004-2020 by
 # suzuki toshiya, Masatake YAMATO, Red Hat K.K.,
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
diff --git a/src/gzip/Jamfile b/src/gzip/Jamfile
deleted file mode 100644
index 2c808b7..0000000
--- a/src/gzip/Jamfile
+++ /dev/null
@@ -1,16 +0,0 @@
-# FreeType 2 src/gzip Jamfile
-#
-# Copyright (C) 2001-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) gzip ;
-
-Library  $(FT2_LIB) : ftgzip.c ;
-
-# end of src/pcf Jamfile
diff --git a/src/gzip/ftgzip.c b/src/gzip/ftgzip.c
index 5e78bc6..de7d0fd 100644
--- a/src/gzip/ftgzip.c
+++ b/src/gzip/ftgzip.c
@@ -8,7 +8,7 @@
  * parse compressed PCF fonts, as found with many X11 server
  * distributions.
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,15 +20,14 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_GZIP_H
+#include <freetype/internal/ftmemory.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/ftgzip.h>
 #include FT_CONFIG_STANDARD_LIBRARY_H
 
 
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
 
 #undef FTERRORS_H_
 
@@ -36,7 +35,7 @@
 #define FT_ERR_PREFIX  Gzip_Err_
 #define FT_ERR_BASE    FT_Mod_Err_Gzip
 
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
 
 
 #ifdef FT_CONFIG_OPTION_USE_ZLIB
@@ -746,7 +745,17 @@
     stream.zfree  = (free_func) 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/src/gzip/infutil.h b/src/gzip/infutil.h
index 7174b6d..cdf18b4 100644
--- a/src/gzip/infutil.h
+++ b/src/gzip/infutil.h
@@ -86,7 +86,7 @@
 
 /* masks for lower bits (size given to avoid silly warnings with Visual C++) */
 #ifndef NO_INFLATE_MASK
-local uInt inflate_mask[17];
+local const uInt inflate_mask[17];
 #endif
 
 /* copy as much as possible from the sliding window to the output area */
diff --git a/src/gzip/rules.mk b/src/gzip/rules.mk
index 44206a1..4ea823f 100644
--- a/src/gzip/rules.mk
+++ b/src/gzip/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 2002-2019 by
+# Copyright (C) 2002-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/lzw/Jamfile b/src/lzw/Jamfile
deleted file mode 100644
index ba2d6eb..0000000
--- a/src/lzw/Jamfile
+++ /dev/null
@@ -1,16 +0,0 @@
-# FreeType 2 src/lzw Jamfile
-#
-# Copyright (C) 2004-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) lzw ;
-
-Library  $(FT2_LIB) : ftlzw.c ;
-
-# end of src/lzw Jamfile
diff --git a/src/lzw/ftlzw.c b/src/lzw/ftlzw.c
index 9805a1e..ddb81e6 100644
--- a/src/lzw/ftlzw.c
+++ b/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-2019 by
+ * Copyright (C) 2004-2020 by
  * Albert Chin-A-Young.
  *
  * based on code in `src/gzip/ftgzip.c'
@@ -21,15 +21,14 @@
  *
  */
 
-#include <ft2build.h>
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_LZW_H
+#include <freetype/internal/ftmemory.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/ftlzw.h>
 #include FT_CONFIG_STANDARD_LIBRARY_H
 
 
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
 
 #undef FTERRORS_H_
 
@@ -37,7 +36,7 @@
 #define FT_ERR_PREFIX  LZW_Err_
 #define FT_ERR_BASE    FT_Mod_Err_LZW
 
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
 
 
 #ifdef FT_CONFIG_OPTION_USE_LZW
diff --git a/src/lzw/ftzopen.c b/src/lzw/ftzopen.c
index 67e6760..884d2ec 100644
--- a/src/lzw/ftzopen.c
+++ b/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-2019 by
+ * Copyright (C) 2005-2020 by
  * David Turner.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,9 +20,9 @@
  */
 
 #include "ftzopen.h"
-#include FT_INTERNAL_MEMORY_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftmemory.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftdebug.h>
 
 
   static int
diff --git a/src/lzw/ftzopen.h b/src/lzw/ftzopen.h
index 44fe36d..d8768f7 100644
--- a/src/lzw/ftzopen.h
+++ b/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-2019 by
+ * Copyright (C) 2005-2020 by
  * David Turner.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -22,9 +22,9 @@
 #ifndef FTZOPEN_H_
 #define FTZOPEN_H_
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
+FT_BEGIN_HEADER
 
   /*
    * This is a complete re-implementation of the LZW file reader,
@@ -166,6 +166,8 @@
 
 /* */
 
+FT_END_HEADER
+
 #endif /* FTZOPEN_H_ */
 
 
diff --git a/src/lzw/rules.mk b/src/lzw/rules.mk
index 930b32e..3468ee0 100644
--- a/src/lzw/rules.mk
+++ b/src/lzw/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 2004-2019 by
+# Copyright (C) 2004-2020 by
 # Albert Chin-A-Young.
 #
 # based on `src/lzw/rules.mk'
diff --git a/src/otvalid/Jamfile b/src/otvalid/Jamfile
deleted file mode 100644
index 36db0e1..0000000
--- a/src/otvalid/Jamfile
+++ /dev/null
@@ -1,37 +0,0 @@
-# FreeType 2 src/otvalid Jamfile
-#
-# Copyright (C) 2004-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) otvalid ;
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = otvbase
-               otvcommn
-               otvgdef
-               otvgpos
-               otvgsub
-               otvjstf
-               otvmath
-               otvmod
-               ;
-  }
-  else
-  {
-    _sources = otvalid ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/otvalid Jamfile
diff --git a/src/otvalid/module.mk b/src/otvalid/module.mk
index 5ea5b7b..67b9820 100644
--- a/src/otvalid/module.mk
+++ b/src/otvalid/module.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 2004-2019 by
+# Copyright (C) 2004-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/otvalid/otvalid.c b/src/otvalid/otvalid.c
index e3964b9..d640209 100644
--- a/src/otvalid/otvalid.c
+++ b/src/otvalid/otvalid.c
@@ -4,7 +4,7 @@
  *
  *   FreeType validator for OpenType tables (body only).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -17,7 +17,6 @@
 
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
 
 #include "otvbase.c"
 #include "otvcommn.c"
diff --git a/src/otvalid/otvalid.h b/src/otvalid/otvalid.h
index 5ca819f..8208ff0 100644
--- a/src/otvalid/otvalid.h
+++ b/src/otvalid/otvalid.h
@@ -4,7 +4,7 @@
  *
  *   OpenType table validation (specification only).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,13 +20,12 @@
 #define OTVALID_H_
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
-#include "otverror.h"           /* must come before FT_INTERNAL_VALIDATE_H */
+#include "otverror.h"                      /* must come before `ftvalid.h' */
 
-#include FT_INTERNAL_VALIDATE_H
-#include FT_INTERNAL_STREAM_H
+#include <freetype/internal/ftvalid.h>
+#include <freetype/internal/ftstream.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/otvalid/otvbase.c b/src/otvalid/otvbase.c
index be69d7c..250ae98 100644
--- a/src/otvalid/otvbase.c
+++ b/src/otvalid/otvbase.c
@@ -4,7 +4,7 @@
  *
  *   OpenType BASE table validation (body).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/otvalid/otvcommn.c b/src/otvalid/otvcommn.c
index 5ed1723..faaa846 100644
--- a/src/otvalid/otvcommn.c
+++ b/src/otvalid/otvcommn.c
@@ -4,7 +4,7 @@
  *
  *   OpenType common tables validation (body).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -151,6 +151,9 @@
     FT_UInt   result = 0;
 
 
+    if ( !count )
+      return result;
+
     switch ( CoverageFormat )
     {
     case 1:
diff --git a/src/otvalid/otvcommn.h b/src/otvalid/otvcommn.h
index bfcc5b9..f992603 100644
--- a/src/otvalid/otvcommn.h
+++ b/src/otvalid/otvcommn.h
@@ -4,7 +4,7 @@
  *
  *   OpenType common tables validation (specification).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,9 +20,8 @@
 #define OTVCOMMN_H_
 
 
-#include <ft2build.h>
 #include "otvalid.h"
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/otvalid/otverror.h b/src/otvalid/otverror.h
index a7d35ac..979e9cb 100644
--- a/src/otvalid/otverror.h
+++ b/src/otvalid/otverror.h
@@ -4,7 +4,7 @@
  *
  *   OpenType validation module error codes (specification only).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -26,7 +26,7 @@
 #ifndef OTVERROR_H_
 #define OTVERROR_H_
 
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
 
 #undef FTERRORS_H_
 
@@ -34,7 +34,7 @@
 #define FT_ERR_PREFIX  OTV_Err_
 #define FT_ERR_BASE    FT_Mod_Err_OTvalid
 
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
 
 #endif /* OTVERROR_H_ */
 
diff --git a/src/otvalid/otvgdef.c b/src/otvalid/otvgdef.c
index 2529b54..88874b8 100644
--- a/src/otvalid/otvgdef.c
+++ b/src/otvalid/otvgdef.c
@@ -4,7 +4,7 @@
  *
  *   OpenType GDEF table validation (body).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/otvalid/otvgpos.c b/src/otvalid/otvgpos.c
index f3bddea..29d56f9 100644
--- a/src/otvalid/otvgpos.c
+++ b/src/otvalid/otvgpos.c
@@ -4,7 +4,7 @@
  *
  *   OpenType GPOS table validation (body).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/otvalid/otvgpos.h b/src/otvalid/otvgpos.h
index b315431..06a03a0 100644
--- a/src/otvalid/otvgpos.h
+++ b/src/otvalid/otvgpos.h
@@ -4,7 +4,7 @@
  *
  *   OpenType GPOS table validator (specification).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/otvalid/otvgsub.c b/src/otvalid/otvgsub.c
index 97da997..f0d563b 100644
--- a/src/otvalid/otvgsub.c
+++ b/src/otvalid/otvgsub.c
@@ -4,7 +4,7 @@
  *
  *   OpenType GSUB table validation (body).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/otvalid/otvjstf.c b/src/otvalid/otvjstf.c
index d4e6d87..79de7b8 100644
--- a/src/otvalid/otvjstf.c
+++ b/src/otvalid/otvjstf.c
@@ -4,7 +4,7 @@
  *
  *   OpenType JSTF table validation (body).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/otvalid/otvmath.c b/src/otvalid/otvmath.c
index 3aaf0ec..dfdeaab 100644
--- a/src/otvalid/otvmath.c
+++ b/src/otvalid/otvmath.c
@@ -4,7 +4,7 @@
  *
  *   OpenType MATH table validation (body).
  *
- * Copyright (C) 2007-2019 by
+ * Copyright (C) 2007-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * Written by George Williams.
diff --git a/src/otvalid/otvmod.c b/src/otvalid/otvmod.c
index f417bd2..0188b27 100644
--- a/src/otvalid/otvmod.c
+++ b/src/otvalid/otvmod.c
@@ -4,7 +4,7 @@
  *
  *   FreeType's OpenType validation module implementation (body).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,12 +16,11 @@
  */
 
 
-#include <ft2build.h>
-#include FT_TRUETYPE_TABLES_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_OPENTYPE_VALIDATE_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_OPENTYPE_VALIDATE_H
+#include <freetype/tttables.h>
+#include <freetype/tttags.h>
+#include <freetype/ftotval.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/services/svotval.h>
 
 #include "otvmod.h"
 #include "otvalid.h"
diff --git a/src/otvalid/otvmod.h b/src/otvalid/otvmod.h
index 5539de7..efd6da0 100644
--- a/src/otvalid/otvmod.h
+++ b/src/otvalid/otvmod.h
@@ -5,7 +5,7 @@
  *   FreeType's OpenType validation module implementation
  *   (specification).
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -21,8 +21,7 @@
 #define OTVMOD_H_
 
 
-#include <ft2build.h>
-#include FT_MODULE_H
+#include <freetype/ftmodapi.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/otvalid/rules.mk b/src/otvalid/rules.mk
index 3c6ece1..7f0169f 100644
--- a/src/otvalid/rules.mk
+++ b/src/otvalid/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 2004-2019 by
+# Copyright (C) 2004-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/pcf/Jamfile b/src/pcf/Jamfile
deleted file mode 100644
index fd17d53..0000000
--- a/src/pcf/Jamfile
+++ /dev/null
@@ -1,32 +0,0 @@
-# FreeType 2 src/pcf Jamfile
-#
-# Copyright (C) 2001-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) pcf ;
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = pcfdrivr
-               pcfread
-               pcfutil
-               ;
-  }
-  else
-  {
-    _sources = pcf ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/pcf Jamfile
diff --git a/src/pcf/pcf.c b/src/pcf/pcf.c
index 8ffd6e2..6b30fb2 100644
--- a/src/pcf/pcf.c
+++ b/src/pcf/pcf.c
@@ -26,7 +26,6 @@
 
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
 
 #include "pcfdrivr.c"
 #include "pcfread.c"
diff --git a/src/pcf/pcf.h b/src/pcf/pcf.h
index 33be4bc..3134cc3 100644
--- a/src/pcf/pcf.h
+++ b/src/pcf/pcf.h
@@ -29,9 +29,8 @@
 #define PCF_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
-#include FT_INTERNAL_STREAM_H
+#include <freetype/internal/ftdrv.h>
+#include <freetype/internal/ftstream.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c
index b39592c..e9dd517 100644
--- a/src/pcf/pcfdrivr.c
+++ b/src/pcf/pcfdrivr.c
@@ -25,17 +25,16 @@
 */
 
 
-#include <ft2build.h>
 
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_GZIP_H
-#include FT_LZW_H
-#include FT_BZIP2_H
-#include FT_ERRORS_H
-#include FT_BDF_H
-#include FT_TRUETYPE_IDS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/ftgzip.h>
+#include <freetype/ftlzw.h>
+#include <freetype/ftbzip2.h>
+#include <freetype/fterrors.h>
+#include <freetype/ftbdf.h>
+#include <freetype/ttnameid.h>
 
 #include "pcf.h"
 #include "pcfdrivr.h"
@@ -47,10 +46,10 @@
 #undef  FT_COMPONENT
 #define FT_COMPONENT  pcfread
 
-#include FT_SERVICE_BDF_H
-#include FT_SERVICE_FONT_FORMAT_H
-#include FT_SERVICE_PROPERTIES_H
-#include FT_DRIVER_H
+#include <freetype/internal/services/svbdf.h>
+#include <freetype/internal/services/svfntfmt.h>
+#include <freetype/internal/services/svprop.h>
+#include <freetype/ftdriver.h>
 
 
   /**************************************************************************
@@ -137,7 +136,7 @@
     FT_UInt32  charcode  = *acharcode;
     FT_UShort  charcodeRow;
     FT_UShort  charcodeCol;
-    FT_Int     result = 0;
+    FT_UInt    result = 0;
 
 
     while ( charcode < (FT_UInt32)( enc->lastRow * 256 + enc->lastCol ) )
@@ -607,8 +606,9 @@
         if ( prop->value.l > 0x7FFFFFFFL          ||
              prop->value.l < ( -1 - 0x7FFFFFFFL ) )
         {
-          FT_TRACE1(( "pcf_get_bdf_property:" ));
-          FT_TRACE1(( " too large integer 0x%x is truncated\n" ));
+          FT_TRACE1(( "pcf_get_bdf_property:"
+                      " too large integer 0x%lx is truncated\n",
+                      prop->value.l ));
         }
 
         /*
diff --git a/src/pcf/pcfdrivr.h b/src/pcf/pcfdrivr.h
index 73db082..d465393 100644
--- a/src/pcf/pcfdrivr.h
+++ b/src/pcf/pcfdrivr.h
@@ -28,8 +28,7 @@
 #ifndef PCFDRIVR_H_
 #define PCFDRIVR_H_
 
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
+#include <freetype/internal/ftdrv.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/pcf/pcferror.h b/src/pcf/pcferror.h
index 2e69d1d..8b9e990 100644
--- a/src/pcf/pcferror.h
+++ b/src/pcf/pcferror.h
@@ -25,7 +25,7 @@
 #ifndef PCFERROR_H_
 #define PCFERROR_H_
 
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
 
 #undef FTERRORS_H_
 
@@ -33,7 +33,7 @@
 #define FT_ERR_PREFIX  PCF_Err_
 #define FT_ERR_BASE    FT_Mod_Err_PCF
 
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
 
 #endif /* PCFERROR_H_ */
 
diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c
index 2ffe22d..8817682 100644
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -25,11 +25,10 @@
 */
 
 
-#include <ft2build.h>
 
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftobjs.h>
 
 #include "pcf.h"
 #include "pcfread.h"
@@ -122,7 +121,7 @@
          toc->count > 9                     )
     {
       FT_TRACE0(( "pcf_read_TOC: adjusting number of tables"
-                  " (from %d to %d)\n",
+                  " (from %ld to %ld)\n",
                   toc->count,
                   FT_MIN( stream->size >> 4, 9 ) ));
       toc->count = FT_MIN( stream->size >> 4, 9 );
@@ -242,7 +241,7 @@
           if ( tables[i].type == (FT_UInt)( 1 << j ) )
             name = tableNames[j];
 
-        FT_TRACE4(( "  %d: type=%s, format=0x%X,"
+        FT_TRACE4(( "  %d: type=%s, format=0x%lX,"
                     " size=%ld (0x%lX), offset=%ld (0x%lX)\n",
                     i, name,
                     tables[i].format,
@@ -661,7 +660,7 @@
       {
         properties[i].value.l = props[i].value;
 
-        FT_TRACE4(( " %d\n", properties[i].value.l ));
+        FT_TRACE4(( " %ld\n", properties[i].value.l ));
       }
     }
 
@@ -798,7 +797,7 @@
         metrics->descent          = 0;
 
         FT_TRACE0(( "pcf_get_metrics:"
-                    " invalid metrics for glyph %d\n", i ));
+                    " invalid metrics for glyph %ld\n", i ));
       }
     }
 
@@ -918,11 +917,11 @@
 
       sizebitmaps = bitmapSizes[PCF_GLYPH_PAD_INDEX( format )];
 
-      FT_TRACE4(( "  %ld-bit padding implies a size of %lu\n",
+      FT_TRACE4(( "  %d-bit padding implies a size of %lu\n",
                   8 << i, bitmapSizes[i] ));
     }
 
-    FT_TRACE4(( "  %lu bitmaps, using %ld-bit padding\n",
+    FT_TRACE4(( "  %lu bitmaps, using %d-bit padding\n",
                 nbitmaps,
                 8 << PCF_GLYPH_PAD_INDEX( format ) ));
     FT_TRACE4(( "  bitmap size: %lu\n", sizebitmaps ));
@@ -1252,13 +1251,13 @@
     if ( FT_ABS( accel->fontAscent ) > 0x7FFF )
     {
       accel->fontAscent = accel->fontAscent < 0 ? -0x7FFF : 0x7FFF;
-      FT_TRACE0(( "pfc_get_accel: clamping font ascent to value %d\n",
+      FT_TRACE0(( "pfc_get_accel: clamping font ascent to value %ld\n",
                   accel->fontAscent ));
     }
     if ( FT_ABS( accel->fontDescent ) > 0x7FFF )
     {
       accel->fontDescent = accel->fontDescent < 0 ? -0x7FFF : 0x7FFF;
-      FT_TRACE0(( "pfc_get_accel: clamping font descent to value %d\n",
+      FT_TRACE0(( "pfc_get_accel: clamping font descent to value %ld\n",
                   accel->fontDescent ));
     }
 
@@ -1631,7 +1630,7 @@
           if ( FT_ABS( prop->value.l ) > 0x504C2L ) /* 0x7FFF * 72270/7200 */
           {
             bsize->size = 0x7FFF;
-            FT_TRACE0(( "pcf_load_font: clamping point size to value %d\n",
+            FT_TRACE0(( "pcf_load_font: clamping point size to value %ld\n",
                         bsize->size ));
           }
           else
@@ -1650,7 +1649,7 @@
           if ( FT_ABS( prop->value.l ) > 0x7FFF )
           {
             bsize->y_ppem = 0x7FFF << 6;
-            FT_TRACE0(( "pcf_load_font: clamping pixel size to value %d\n",
+            FT_TRACE0(( "pcf_load_font: clamping pixel size to value %ld\n",
                         bsize->y_ppem ));
           }
           else
diff --git a/src/pcf/pcfread.h b/src/pcf/pcfread.h
index bed30e5..a54648f 100644
--- a/src/pcf/pcfread.h
+++ b/src/pcf/pcfread.h
@@ -29,7 +29,6 @@
 #define PCFREAD_H_
 
 
-#include <ft2build.h>
 
 FT_BEGIN_HEADER
 
diff --git a/src/pcf/pcfutil.c b/src/pcf/pcfutil.c
index 045c42d..5d3c007 100644
--- a/src/pcf/pcfutil.c
+++ b/src/pcf/pcfutil.c
@@ -32,7 +32,6 @@
 /* Modified for use with FreeType */
 
 
-#include <ft2build.h>
 #include "pcfutil.h"
 
 
diff --git a/src/pcf/pcfutil.h b/src/pcf/pcfutil.h
index be986e7..a197c15 100644
--- a/src/pcf/pcfutil.h
+++ b/src/pcf/pcfutil.h
@@ -31,7 +31,7 @@
 
 #include <ft2build.h>
 #include FT_CONFIG_CONFIG_H
-
+#include <freetype/internal/compiler-macros.h>
 
 FT_BEGIN_HEADER
 
diff --git a/src/pfr/Jamfile b/src/pfr/Jamfile
deleted file mode 100644
index fbca806..0000000
--- a/src/pfr/Jamfile
+++ /dev/null
@@ -1,35 +0,0 @@
-# FreeType 2 src/pfr Jamfile
-#
-# Copyright (C) 2002-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) pfr ;
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = pfrcmap
-               pfrdrivr
-               pfrgload
-               pfrload
-               pfrobjs
-               pfrsbit
-               ;
-  }
-  else
-  {
-    _sources = pfr ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/pfr Jamfile
diff --git a/src/pfr/module.mk b/src/pfr/module.mk
index 30d876d..762353d 100644
--- a/src/pfr/module.mk
+++ b/src/pfr/module.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 2002-2019 by
+# Copyright (C) 2002-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/pfr/pfr.c b/src/pfr/pfr.c
index 6d885ea..9264c77 100644
--- a/src/pfr/pfr.c
+++ b/src/pfr/pfr.c
@@ -4,7 +4,7 @@
  *
  *   FreeType PFR driver component.
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -17,7 +17,6 @@
 
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
 
 #include "pfrcmap.c"
 #include "pfrdrivr.c"
diff --git a/src/pfr/pfrcmap.c b/src/pfr/pfrcmap.c
index bfa1b9e..ebc7b84 100644
--- a/src/pfr/pfrcmap.c
+++ b/src/pfr/pfrcmap.c
@@ -4,7 +4,7 @@
  *
  *   FreeType PFR cmap handling (body).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,8 +16,7 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 #include "pfrcmap.h"
 #include "pfrobjs.h"
 
diff --git a/src/pfr/pfrcmap.h b/src/pfr/pfrcmap.h
index 1e203a0..a6d920c 100644
--- a/src/pfr/pfrcmap.h
+++ b/src/pfr/pfrcmap.h
@@ -4,7 +4,7 @@
  *
  *   FreeType PFR cmap handling (specification).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,8 +19,7 @@
 #ifndef PFRCMAP_H_
 #define PFRCMAP_H_
 
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/ftobjs.h>
 #include "pfrtypes.h"
 
 
diff --git a/src/pfr/pfrdrivr.c b/src/pfr/pfrdrivr.c
index f67eebf..b143208 100644
--- a/src/pfr/pfrdrivr.c
+++ b/src/pfr/pfrdrivr.c
@@ -4,7 +4,7 @@
  *
  *   FreeType PFR driver interface (body).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,11 +16,10 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_SERVICE_PFR_H
-#include FT_SERVICE_FONT_FORMAT_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/services/svpfr.h>
+#include <freetype/internal/services/svfntfmt.h>
 #include "pfrdrivr.h"
 #include "pfrobjs.h"
 
diff --git a/src/pfr/pfrdrivr.h b/src/pfr/pfrdrivr.h
index 33b7b94..7646b4d 100644
--- a/src/pfr/pfrdrivr.h
+++ b/src/pfr/pfrdrivr.h
@@ -4,7 +4,7 @@
  *
  *   High-level Type PFR driver interface (specification).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
 #define PFRDRIVR_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
+#include <freetype/internal/ftdrv.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/pfr/pfrerror.h b/src/pfr/pfrerror.h
index 4829cfc..33460ef 100644
--- a/src/pfr/pfrerror.h
+++ b/src/pfr/pfrerror.h
@@ -4,7 +4,7 @@
  *
  *   PFR error codes (specification only).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -25,7 +25,7 @@
 #ifndef PFRERROR_H_
 #define PFRERROR_H_
 
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
 
 #undef FTERRORS_H_
 
@@ -33,7 +33,7 @@
 #define FT_ERR_PREFIX  PFR_Err_
 #define FT_ERR_BASE    FT_Mod_Err_PFR
 
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
 
 #endif /* PFRERROR_H_ */
 
diff --git a/src/pfr/pfrgload.c b/src/pfr/pfrgload.c
index 6ef5856..aa640c3 100644
--- a/src/pfr/pfrgload.c
+++ b/src/pfr/pfrgload.c
@@ -4,7 +4,7 @@
  *
  *   FreeType PFR glyph loader (body).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,7 +19,7 @@
 #include "pfrgload.h"
 #include "pfrsbit.h"
 #include "pfrload.h"            /* for macro definitions */
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 
 #include "pfrerror.h"
 
@@ -451,7 +451,7 @@
           case 1:                           /* 16-bit absolute value */
             PFR_CHECK( 2 );
             cur->x = PFR_NEXT_SHORT( p );
-            FT_TRACE7(( " x.%d", cur->x ));
+            FT_TRACE7(( " x.%ld", cur->x ));
             break;
 
           case 2:                           /* 8-bit delta */
@@ -481,7 +481,7 @@
           case 1:                           /* 16-bit absolute value */
             PFR_CHECK( 2 );
             cur->y = PFR_NEXT_SHORT( p );
-            FT_TRACE7(( " y.%d", cur->y ));
+            FT_TRACE7(( " y.%ld", cur->y ));
             break;
 
           case 2:                           /* 8-bit delta */
diff --git a/src/pfr/pfrgload.h b/src/pfr/pfrgload.h
index d0e1420..f356b4c 100644
--- a/src/pfr/pfrgload.h
+++ b/src/pfr/pfrgload.h
@@ -4,7 +4,7 @@
  *
  *   FreeType PFR glyph loader (specification).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/pfr/pfrload.c b/src/pfr/pfrload.c
index ccf0b7e..a2832e5 100644
--- a/src/pfr/pfrload.c
+++ b/src/pfr/pfrload.c
@@ -4,7 +4,7 @@
  *
  *   FreeType PFR loader (body).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -17,8 +17,8 @@
 
 
 #include "pfrload.h"
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
 
 #include "pfrerror.h"
 
diff --git a/src/pfr/pfrload.h b/src/pfr/pfrload.h
index 2e7ffd0..7615b9c 100644
--- a/src/pfr/pfrload.h
+++ b/src/pfr/pfrload.h
@@ -4,7 +4,7 @@
  *
  *   FreeType PFR loader (specification).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,7 +20,7 @@
 #define PFRLOAD_H_
 
 #include "pfrobjs.h"
-#include FT_INTERNAL_STREAM_H
+#include <freetype/internal/ftstream.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/pfr/pfrobjs.c b/src/pfr/pfrobjs.c
index 9765f95..918e7fd 100644
--- a/src/pfr/pfrobjs.c
+++ b/src/pfr/pfrobjs.c
@@ -4,7 +4,7 @@
  *
  *   FreeType PFR object methods (body).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -21,10 +21,10 @@
 #include "pfrgload.h"
 #include "pfrcmap.h"
 #include "pfrsbit.h"
-#include FT_OUTLINE_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
-#include FT_TRUETYPE_IDS_H
+#include <freetype/ftoutln.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/ttnameid.h>
 
 #include "pfrerror.h"
 
diff --git a/src/pfr/pfrobjs.h b/src/pfr/pfrobjs.h
index 39cffd0..808822f 100644
--- a/src/pfr/pfrobjs.h
+++ b/src/pfr/pfrobjs.h
@@ -4,7 +4,7 @@
  *
  *   FreeType PFR object methods (specification).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/pfr/pfrsbit.c b/src/pfr/pfrsbit.c
index 00a9616..a6691e6 100644
--- a/src/pfr/pfrsbit.c
+++ b/src/pfr/pfrsbit.c
@@ -4,7 +4,7 @@
  *
  *   FreeType PFR bitmap loader (body).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -18,8 +18,8 @@
 
 #include "pfrsbit.h"
 #include "pfrload.h"
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
 
 #include "pfrerror.h"
 
@@ -745,7 +745,7 @@
            ypos + (FT_Long)ysize < FT_INT_MIN )
       {
         FT_TRACE1(( "pfr_slot_load_bitmap:" ));
-        FT_TRACE1(( "huge bitmap glyph %dx%d over FT_GlyphSlot\n",
+        FT_TRACE1(( "huge bitmap glyph %ldx%ld over FT_GlyphSlot\n",
                      xpos, ypos ));
         error = FT_THROW( Invalid_Pixel_Size );
       }
diff --git a/src/pfr/pfrsbit.h b/src/pfr/pfrsbit.h
index 6568b90..8cb0de0 100644
--- a/src/pfr/pfrsbit.h
+++ b/src/pfr/pfrsbit.h
@@ -4,7 +4,7 @@
  *
  *   FreeType PFR bitmap loader (specification).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/pfr/pfrtypes.h b/src/pfr/pfrtypes.h
index 6a5f9d5..06fb82d 100644
--- a/src/pfr/pfrtypes.h
+++ b/src/pfr/pfrtypes.h
@@ -4,7 +4,7 @@
  *
  *   FreeType PFR data structures (specification only).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,8 +19,7 @@
 #ifndef PFRTYPES_H_
 #define PFRTYPES_H_
 
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/ftobjs.h>
 
 FT_BEGIN_HEADER
 
diff --git a/src/pfr/rules.mk b/src/pfr/rules.mk
index f14ca69..a1fe82b 100644
--- a/src/pfr/rules.mk
+++ b/src/pfr/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 2002-2019 by
+# Copyright (C) 2002-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/psaux/Jamfile b/src/psaux/Jamfile
deleted file mode 100644
index 30bcc1c..0000000
--- a/src/psaux/Jamfile
+++ /dev/null
@@ -1,45 +0,0 @@
-# FreeType 2 src/psaux Jamfile
-#
-# Copyright (C) 2001-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) psaux ;
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = afmparse
-               psauxmod
-               psconv
-               psobjs
-               t1cmap
-               t1decode
-               cffdecode
-               psarrst
-               psblues
-               pserror
-               psfont
-               psft
-               pshints
-               psintrp
-               psread
-               psstack
-               ;
-  }
-  else
-  {
-    _sources = psaux ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/psaux Jamfile
diff --git a/src/psaux/afmparse.c b/src/psaux/afmparse.c
index f78adbb..2d6a0d9 100644
--- a/src/psaux/afmparse.c
+++ b/src/psaux/afmparse.c
@@ -4,7 +4,7 @@
  *
  *   AFM parser (body).
  *
- * Copyright (C) 2006-2019 by
+ * Copyright (C) 2006-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -15,10 +15,9 @@
  *
  */
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/freetype.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/psaux.h>
 
 #ifndef T1_CONFIG_OPTION_NO_AFM
 
diff --git a/src/psaux/afmparse.h b/src/psaux/afmparse.h
index 2ceb775..16a3a3e 100644
--- a/src/psaux/afmparse.h
+++ b/src/psaux/afmparse.h
@@ -4,7 +4,7 @@
  *
  *   AFM parser (specification).
  *
- * Copyright (C) 2006-2019 by
+ * Copyright (C) 2006-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
 #define AFMPARSE_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/internal/psaux.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/psaux/cffdecode.c b/src/psaux/cffdecode.c
index 17cccf8..3d2da1e 100644
--- a/src/psaux/cffdecode.c
+++ b/src/psaux/cffdecode.c
@@ -4,7 +4,7 @@
  *
  *   PostScript CFF (Type 2) decoding routines (body).
  *
- * Copyright (C) 2017-2019 by
+ * Copyright (C) 2017-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,11 +16,10 @@
  */
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_SERVICE_H
-#include FT_SERVICE_CFF_TABLE_LOAD_H
+#include <freetype/freetype.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftserv.h>
+#include <freetype/internal/services/svcfftl.h>
 
 #include "cffdecode.h"
 #include "psobjs.h"
@@ -330,7 +329,7 @@
     builder->left_bearing.x = 0;
     builder->left_bearing.y = 0;
 
-    builder->pos_x = adx - asb;
+    builder->pos_x = SUB_LONG( adx, asb );
     builder->pos_y = ady;
 
     /* Now load `achar' on top of the base outline. */
@@ -530,6 +529,9 @@
 
     builder->path_begun = 0;
 
+    if ( !charstring_base )
+      return FT_Err_Ok;
+
     zone->base           = charstring_base;
     limit = zone->limit  = charstring_base + charstring_len;
     ip    = zone->cursor = zone->base;
diff --git a/src/psaux/cffdecode.h b/src/psaux/cffdecode.h
index a669197..77a4962 100644
--- a/src/psaux/cffdecode.h
+++ b/src/psaux/cffdecode.h
@@ -4,7 +4,7 @@
  *
  *   PostScript CFF (Type 2) decoding routines (specification).
  *
- * Copyright (C) 2017-2019 by
+ * Copyright (C) 2017-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
 #define CFFDECODE_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/internal/psaux.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/psaux/module.mk b/src/psaux/module.mk
index bb0886a..651db01 100644
--- a/src/psaux/module.mk
+++ b/src/psaux/module.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/psaux/psarrst.c b/src/psaux/psarrst.c
index 011803b..8751d27 100644
--- a/src/psaux/psarrst.c
+++ b/src/psaux/psarrst.c
@@ -37,7 +37,7 @@
 
 
 #include "psft.h"
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 
 #include "psglue.h"
 #include "psarrst.h"
diff --git a/src/psaux/psaux.c b/src/psaux/psaux.c
index 1db0462..f428222 100644
--- a/src/psaux/psaux.c
+++ b/src/psaux/psaux.c
@@ -4,7 +4,7 @@
  *
  *   FreeType auxiliary PostScript driver component (body only).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -17,7 +17,6 @@
 
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
 
 #include "afmparse.c"
 #include "psauxmod.c"
diff --git a/src/psaux/psauxerr.h b/src/psaux/psauxerr.h
index 523e188..8b9a958 100644
--- a/src/psaux/psauxerr.h
+++ b/src/psaux/psauxerr.h
@@ -4,7 +4,7 @@
  *
  *   PS auxiliary module error codes (specification only).
  *
- * Copyright (C) 2001-2019 by
+ * Copyright (C) 2001-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -26,7 +26,7 @@
 #ifndef PSAUXERR_H_
 #define PSAUXERR_H_
 
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
 
 #undef FTERRORS_H_
 
@@ -34,7 +34,7 @@
 #define FT_ERR_PREFIX  PSaux_Err_
 #define FT_ERR_BASE    FT_Mod_Err_PSaux
 
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
 
 #endif /* PSAUXERR_H_ */
 
diff --git a/src/psaux/psauxmod.c b/src/psaux/psauxmod.c
index 5df8e69..e73ba22 100644
--- a/src/psaux/psauxmod.c
+++ b/src/psaux/psauxmod.c
@@ -4,7 +4,7 @@
  *
  *   FreeType auxiliary PostScript module implementation (body).
  *
- * Copyright (C) 2000-2019 by
+ * Copyright (C) 2000-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,7 +16,6 @@
  */
 
 
-#include <ft2build.h>
 #include "psauxmod.h"
 #include "psobjs.h"
 #include "t1decode.h"
@@ -171,9 +170,9 @@
   };
 
 
-  FT_CALLBACK_TABLE_DEF
-  const FT_Module_Class  psaux_module_class =
-  {
+  FT_DEFINE_MODULE(
+    psaux_module_class,
+
     0,
     sizeof ( FT_ModuleRec ),
     "psaux",
@@ -185,7 +184,7 @@
     (FT_Module_Constructor)NULL,  /* module_init   */
     (FT_Module_Destructor) NULL,  /* module_done   */
     (FT_Module_Requester)  NULL   /* get_interface */
-  };
+  )
 
 
 /* END */
diff --git a/src/psaux/psauxmod.h b/src/psaux/psauxmod.h
index a0eda0b..a6bebe4 100644
--- a/src/psaux/psauxmod.h
+++ b/src/psaux/psauxmod.h
@@ -4,7 +4,7 @@
  *
  *   FreeType auxiliary PostScript module implementation (specification).
  *
- * Copyright (C) 2000-2019 by
+ * Copyright (C) 2000-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,10 +20,9 @@
 #define PSAUXMOD_H_
 
 
-#include <ft2build.h>
-#include FT_MODULE_H
+#include <freetype/ftmodapi.h>
 
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/internal/psaux.h>
 
 
 FT_BEGIN_HEADER
@@ -35,10 +34,24 @@
   FT_CALLBACK_TABLE
   const PS_Builder_FuncsRec   ps_builder_funcs;
 
+#ifndef T1_CONFIG_OPTION_NO_AFM
+  FT_CALLBACK_TABLE
+  const AFM_Parser_FuncsRec  afm_parser_funcs;
+#endif
+
+  FT_CALLBACK_TABLE
+  const T1_CMap_ClassesRec  t1_cmap_classes;
+
+  FT_CALLBACK_TABLE
+  const CFF_Decoder_FuncsRec  cff_decoder_funcs;
+
 
   FT_EXPORT_VAR( const FT_Module_Class )  psaux_driver_class;
 
 
+  FT_DECLARE_MODULE( psaux_module_class )
+
+
 FT_END_HEADER
 
 #endif /* PSAUXMOD_H_ */
diff --git a/src/psaux/psblues.c b/src/psaux/psblues.c
index 89738ce..3878e9b 100644
--- a/src/psaux/psblues.c
+++ b/src/psaux/psblues.c
@@ -37,7 +37,7 @@
 
 
 #include "psft.h"
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 
 #include "psblues.h"
 #include "pshints.h"
diff --git a/src/psaux/psconv.c b/src/psaux/psconv.c
index c887616..4cf5cd5 100644
--- a/src/psaux/psconv.c
+++ b/src/psaux/psconv.c
@@ -4,7 +4,7 @@
  *
  *   Some convenience conversions (body).
  *
- * Copyright (C) 2006-2019 by
+ * Copyright (C) 2006-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,9 +16,8 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/psaux.h>
+#include <freetype/internal/ftdebug.h>
 
 #include "psconv.h"
 #include "psauxerr.h"
diff --git a/src/psaux/psconv.h b/src/psaux/psconv.h
index 6b24bf6..833e827 100644
--- a/src/psaux/psconv.h
+++ b/src/psaux/psconv.h
@@ -4,7 +4,7 @@
  *
  *   Some convenience conversions (specification).
  *
- * Copyright (C) 2006-2019 by
+ * Copyright (C) 2006-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
 #define PSCONV_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/internal/psaux.h>
 
 FT_BEGIN_HEADER
 
diff --git a/src/psaux/pserror.h b/src/psaux/pserror.h
index b2156b3..5738853 100644
--- a/src/psaux/pserror.h
+++ b/src/psaux/pserror.h
@@ -40,7 +40,7 @@
 #define PSERROR_H_
 
 
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
 
 #undef FTERRORS_H_
 
@@ -49,7 +49,8 @@
 #define FT_ERR_BASE    FT_Mod_Err_CF2
 
 
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
+#include <freetype/internal/compiler-macros.h>
 #include "psft.h"
 
 
diff --git a/src/psaux/psfont.c b/src/psaux/psfont.c
index 00e4210..0db1f0c 100644
--- a/src/psaux/psfont.c
+++ b/src/psaux/psfont.c
@@ -36,8 +36,7 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_CALC_H
+#include <freetype/internal/ftcalc.h>
 
 #include "psft.h"
 
diff --git a/src/psaux/psfont.h b/src/psaux/psfont.h
index 8fbacbb..836fce4 100644
--- a/src/psaux/psfont.h
+++ b/src/psaux/psfont.h
@@ -40,7 +40,7 @@
 #define PSFONT_H_
 
 
-#include FT_SERVICE_CFF_TABLE_LOAD_H
+#include <freetype/internal/services/svcfftl.h>
 
 #include "psft.h"
 #include "psblues.h"
diff --git a/src/psaux/psft.c b/src/psaux/psft.c
index 54be468..41c1654 100644
--- a/src/psaux/psft.c
+++ b/src/psaux/psft.c
@@ -37,7 +37,7 @@
 
 
 #include "psft.h"
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 
 #include "psfont.h"
 #include "pserror.h"
@@ -45,11 +45,11 @@
 #include "cffdecode.h"
 
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include FT_MULTIPLE_MASTERS_H
-#include FT_SERVICE_MULTIPLE_MASTERS_H
+#include <freetype/ftmm.h>
+#include <freetype/internal/services/svmm.h>
 #endif
 
-#include FT_SERVICE_CFF_TABLE_LOAD_H
+#include <freetype/internal/services/svcfftl.h>
 
 
 #define CF2_MAX_SIZE  cf2_intToFixed( 2000 )    /* max ppem */
@@ -313,7 +313,7 @@
     FT_Error   error = FT_Err_Ok;
     CF2_Font   font;
 
-    FT_Bool    is_t1 = decoder->builder.is_t1;
+    FT_Bool  is_t1 = decoder->builder.is_t1;
 
 
     FT_ASSERT( decoder &&
@@ -385,7 +385,7 @@
       FT_ZERO( &buf );
       buf.start =
       buf.ptr   = charstring_base;
-      buf.end   = charstring_base + charstring_len;
+      buf.end   = FT_OFFSET( charstring_base, charstring_len );
 
       FT_ZERO( &transform );
 
@@ -697,7 +697,7 @@
     FT_ASSERT( charstring + len >= charstring );
 
     buf->start = charstring;
-    buf->end   = charstring + len;
+    buf->end   = FT_OFFSET( charstring, len );
     buf->ptr   = buf->start;
 
     return FT_Err_Ok;
@@ -820,7 +820,7 @@
       /* The CID driver stores subroutines with seed bytes.  This     */
       /* case is taken care of when decoder->subrs_len == 0.          */
       if ( decoder->locals_len )
-        buf->end = buf->start + decoder->locals_len[idx];
+        buf->end = FT_OFFSET( buf->start, decoder->locals_len[idx] );
       else
       {
         /* We are using subroutines from a CID font.  We must adjust */
diff --git a/src/psaux/psft.h b/src/psaux/psft.h
index 4c930f0..3da454e 100644
--- a/src/psaux/psft.h
+++ b/src/psaux/psft.h
@@ -40,17 +40,17 @@
 #define PSFT_H_
 
 
+#include <freetype/internal/compiler-macros.h>
 #include "pstypes.h"
 
-
   /* TODO: disable asserts for now */
 #define CF2_NDEBUG
 
 
-#include FT_SYSTEM_H
+#include <freetype/ftsystem.h>
 
 #include "psglue.h"
-#include FT_INTERNAL_POSTSCRIPT_AUX_H    /* for PS_Decoder */
+#include <freetype/internal/psaux.h>    /* for PS_Decoder */
 
 
 FT_BEGIN_HEADER
diff --git a/src/psaux/pshints.c b/src/psaux/pshints.c
index 1cbecd2..ce8cfca 100644
--- a/src/psaux/pshints.c
+++ b/src/psaux/pshints.c
@@ -37,7 +37,7 @@
 
 
 #include "psft.h"
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 
 #include "psglue.h"
 #include "psfont.h"
@@ -310,7 +310,7 @@
       CF2_Hint  hint = &hintmap->edge[i];
 
 
-      FT_TRACE6(( "  %3d    %7.2f  %7.2f  %5d  %s%s%s%s\n",
+      FT_TRACE6(( "  %3ld    %7.2f  %7.2f  %5d  %s%s%s%s\n",
                   hint->index,
                   hint->csCoord / 65536.0,
                   hint->dsCoord / ( hint->scale * 1.0 ),
diff --git a/src/psaux/psintrp.c b/src/psaux/psintrp.c
index e2f3acc..519c694 100644
--- a/src/psaux/psintrp.c
+++ b/src/psaux/psintrp.c
@@ -37,8 +37,8 @@
 
 
 #include "psft.h"
-#include FT_INTERNAL_DEBUG_H
-#include FT_SERVICE_CFF_TABLE_LOAD_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/services/svcfftl.h>
 
 #include "psglue.h"
 #include "psfont.h"
@@ -1433,6 +1433,13 @@
                       lastError = error2; /* pass FreeType error through */
                       goto exit;
                     }
+
+                    /* save the left bearing and width of the SEAC   */
+                    /* glyph as they will be erased by the next load */
+
+                    left_bearing = *decoder->builder.left_bearing;
+                    advance      = *decoder->builder.advance;
+
                     cf2_interpT2CharString( font,
                                             &component,
                                             callbacks,
@@ -1443,11 +1450,14 @@
                                             &dummyWidth );
                     cf2_freeT1SeacComponent( decoder, &component );
 
-                    /* save the left bearing and width of the base       */
-                    /* character as they will be erased by the next load */
+                    /* If the SEAC glyph doesn't have a (H)SBW of its */
+                    /* own use the values from the base glyph.        */
 
-                    left_bearing = *decoder->builder.left_bearing;
-                    advance      = *decoder->builder.advance;
+                    if ( !haveWidth )
+                    {
+                      left_bearing = *decoder->builder.left_bearing;
+                      advance      = *decoder->builder.advance;
+                    }
 
                     decoder->builder.left_bearing->x = 0;
                     decoder->builder.left_bearing->y = 0;
@@ -1473,8 +1483,8 @@
                                             &dummyWidth );
                     cf2_freeT1SeacComponent( decoder, &component );
 
-                    /* restore the left side bearing and   */
-                    /* advance width of the base character */
+                    /* restore the left side bearing and advance width   */
+                    /* of the SEAC glyph or base character (saved above) */
 
                     *decoder->builder.left_bearing = left_bearing;
                     *decoder->builder.advance      = advance;
diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c
index 8bfdb92..defc4d4 100644
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -4,7 +4,7 @@
  *
  *   Auxiliary functions for PostScript fonts (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,11 +16,10 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
-#include FT_DRIVER_H
+#include <freetype/internal/psaux.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/ftdriver.h>
 
 #include "psobjs.h"
 #include "psconv.h"
@@ -214,7 +213,7 @@
     }
 
     /* add the object to the base block and adjust offset */
-    table->elements[idx] = table->block + table->cursor;
+    table->elements[idx] = FT_OFFSET( table->block, table->cursor );
     table->lengths [idx] = length;
     FT_MEM_COPY( table->block + table->cursor, object, length );
 
@@ -1233,7 +1232,7 @@
           bbox->xMax = FT_RoundFix( temp[2] );
           bbox->yMax = FT_RoundFix( temp[3] );
 
-          FT_TRACE4(( " [%d %d %d %d]",
+          FT_TRACE4(( " [%ld %ld %ld %ld]",
                       bbox->xMin / 65536,
                       bbox->yMin / 65536,
                       bbox->xMax / 65536,
@@ -1287,7 +1286,7 @@
             bbox->xMax = FT_RoundFix( temp[i + 2 * max_objects] );
             bbox->yMax = FT_RoundFix( temp[i + 3 * max_objects] );
 
-            FT_TRACE4(( " [%d %d %d %d]",
+            FT_TRACE4(( " [%ld %ld %ld %ld]",
                         bbox->xMin / 65536,
                         bbox->yMin / 65536,
                         bbox->xMax / 65536,
@@ -2577,7 +2576,7 @@
               FT_UShort  seed )
   {
     PS_Conv_EexecDecode( &buffer,
-                         buffer + length,
+                         FT_OFFSET( buffer, length ),
                          buffer,
                          length,
                          &seed );
diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h
index c44dc45..fdad672 100644
--- a/src/psaux/psobjs.h
+++ b/src/psaux/psobjs.h
@@ -4,7 +4,7 @@
  *
  *   Auxiliary functions for PostScript fonts (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,9 +20,8 @@
 #define PSOBJS_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_CFF_OBJECTS_TYPES_H
+#include <freetype/internal/psaux.h>
+#include <freetype/internal/cffotypes.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/psaux/psread.c b/src/psaux/psread.c
index 86bfc03..7f657f2 100644
--- a/src/psaux/psread.c
+++ b/src/psaux/psread.c
@@ -37,7 +37,7 @@
 
 
 #include "psft.h"
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 
 #include "psglue.h"
 
diff --git a/src/psaux/psstack.c b/src/psaux/psstack.c
index 6659068..7ae5256 100644
--- a/src/psaux/psstack.c
+++ b/src/psaux/psstack.c
@@ -37,7 +37,7 @@
 
 
 #include "psft.h"
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 
 #include "psglue.h"
 #include "psfont.h"
@@ -59,12 +59,12 @@
     CF2_Stack  stack = NULL;
 
 
-    if ( !FT_NEW( stack ) )
-    {
-      /* initialize the structure; FT_NEW zeroes it */
-      stack->memory = memory;
-      stack->error  = e;
-    }
+    if ( FT_NEW( stack ) )
+      return NULL;
+
+    /* initialize the structure; FT_NEW zeroes it */
+    stack->memory = memory;
+    stack->error  = e;
 
     /* allocate the stack buffer */
     if ( FT_NEW_ARRAY( stack->buffer, stackSize ) )
diff --git a/src/psaux/psstack.h b/src/psaux/psstack.h
index 18cd39b..b9ef9ed 100644
--- a/src/psaux/psstack.h
+++ b/src/psaux/psstack.h
@@ -39,6 +39,7 @@
 #ifndef PSSTACK_H_
 #define PSSTACK_H_
 
+#include <freetype/internal/compiler-macros.h>
 
 FT_BEGIN_HEADER
 
diff --git a/src/psaux/pstypes.h b/src/psaux/pstypes.h
index 041287e..435ef7e 100644
--- a/src/psaux/pstypes.h
+++ b/src/psaux/pstypes.h
@@ -39,8 +39,7 @@
 #ifndef PSTYPES_H_
 #define PSTYPES_H_
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
+#include <freetype/freetype.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/psaux/rules.mk b/src/psaux/rules.mk
index 2de734d..f49aecb 100644
--- a/src/psaux/rules.mk
+++ b/src/psaux/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/psaux/t1cmap.c b/src/psaux/t1cmap.c
index d62d2d5..e21e93c 100644
--- a/src/psaux/t1cmap.c
+++ b/src/psaux/t1cmap.c
@@ -4,7 +4,7 @@
  *
  *   Type 1 character map support (body).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -18,7 +18,7 @@
 
 #include "t1cmap.h"
 
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 
 #include "psauxerr.h"
 
diff --git a/src/psaux/t1cmap.h b/src/psaux/t1cmap.h
index d325e7b..0317965 100644
--- a/src/psaux/t1cmap.h
+++ b/src/psaux/t1cmap.h
@@ -4,7 +4,7 @@
  *
  *   Type 1 character map support (specification).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,9 +19,8 @@
 #ifndef T1CMAP_H_
 #define T1CMAP_H_
 
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_TYPE1_TYPES_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/t1types.h>
 
 FT_BEGIN_HEADER
 
diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c
index c2b3729..2ed27ca 100644
--- a/src/psaux/t1decode.c
+++ b/src/psaux/t1decode.c
@@ -4,7 +4,7 @@
  *
  *   PostScript Type 1 decoding routines (body).
  *
- * Copyright (C) 2000-2019 by
+ * Copyright (C) 2000-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,12 +16,11 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
-#include FT_INTERNAL_HASH_H
-#include FT_OUTLINE_H
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/pshints.h>
+#include <freetype/internal/fthash.h>
+#include <freetype/ftoutln.h>
 
 #include "t1decode.h"
 #include "psobjs.h"
@@ -367,6 +366,12 @@
 
     FT_GlyphLoader_Prepare( decoder->builder.loader );  /* prepare loader */
 
+    /* save the left bearing and width of the SEAC   */
+    /* glyph as they will be erased by the next load */
+
+    left_bearing = decoder->builder.left_bearing;
+    advance      = decoder->builder.advance;
+
     /* the seac operator must not be nested */
     decoder->seac = TRUE;
     error = t1_decoder_parse_glyph( decoder, (FT_UInt)bchar_index );
@@ -374,11 +379,14 @@
     if ( error )
       goto Exit;
 
-    /* save the left bearing and width of the base character */
-    /* as they will be erased by the next load.              */
+    /* If the SEAC glyph doesn't have a (H)SBW of its */
+    /* own use the values from the base glyph.        */
 
-    left_bearing = decoder->builder.left_bearing;
-    advance      = decoder->builder.advance;
+    if ( decoder->builder.parse_state != T1_Parse_Have_Width )
+    {
+      left_bearing = decoder->builder.left_bearing;
+      advance      = decoder->builder.advance;
+    }
 
     decoder->builder.left_bearing.x = 0;
     decoder->builder.left_bearing.y = 0;
@@ -396,8 +404,8 @@
     if ( error )
       goto Exit;
 
-    /* restore the left side bearing and   */
-    /* advance width of the base character */
+    /* restore the left side bearing and advance width   */
+    /* of the SEAC glyph or base character (saved above) */
 
     decoder->builder.left_bearing = left_bearing;
     decoder->builder.advance      = advance;
@@ -650,10 +658,8 @@
         if ( value > 32000 || value < -32000 )
         {
           if ( large_int )
-          {
             FT_ERROR(( "t1_decoder_parse_charstrings:"
                        " no `div' after large integer\n" ));
-          }
           else
             large_int = TRUE;
         }
@@ -1231,8 +1237,8 @@
 
           FT_UNUSED( orig_y );
 
-          /* the `metrics_only' indicates that we only want to compute */
-          /* the glyph's metrics (lsb + advance width), not load the   */
+          /* `metrics_only' indicates that we only want to compute the */
+          /* glyph's metrics (lsb + advance width) without loading the */
           /* rest of it; so exit immediately                           */
           if ( builder->metrics_only )
           {
@@ -1266,8 +1272,8 @@
           x = ADD_LONG( builder->pos_x, top[0] );
           y = ADD_LONG( builder->pos_y, top[1] );
 
-          /* the `metrics_only' indicates that we only want to compute */
-          /* the glyph's metrics (lsb + advance width), not load the   */
+          /* `metrics_only' indicates that we only want to compute the */
+          /* glyph's metrics (lsb + advance width) without loading the */
           /* rest of it; so exit immediately                           */
           if ( builder->metrics_only )
           {
@@ -1690,6 +1696,7 @@
     FT_Byte*         ip;
     FT_Byte*         limit;
     T1_Builder       builder = &decoder->builder;
+    FT_Bool          large_int;
 
 #ifdef FT_DEBUG_LEVEL_TRACE
     FT_Bool          bol = TRUE;
@@ -1707,6 +1714,8 @@
     limit = zone->limit  = charstring_base + charstring_len;
     ip    = zone->cursor = zone->base;
 
+    large_int = FALSE;
+
     /* now, execute loop */
     while ( ip < limit )
     {
@@ -1718,7 +1727,7 @@
 #ifdef FT_DEBUG_LEVEL_TRACE
       if ( bol )
       {
-        FT_TRACE5(( " (%d)", decoder->top - decoder->stack ));
+        FT_TRACE5(( " (%ld)", decoder->top - decoder->stack ));
         bol = FALSE;
       }
 #endif
@@ -1740,8 +1749,6 @@
       case 7:
       case 8:
       case 9:
-      case 10:
-      case 11:
       case 14:
       case 15:
       case 21:
@@ -1750,6 +1757,13 @@
       case 31:
         goto No_Width;
 
+      case 10:
+        op = op_callsubr;
+        break;
+      case 11:
+        op = op_return;
+        break;
+
       case 13:
         op = op_hsbw;
         break;
@@ -1767,6 +1781,9 @@
         case 7:
           op = op_sbw;
           break;
+        case 12:
+          op = op_div;
+          break;
 
         default:
           goto No_Width;
@@ -1796,13 +1813,19 @@
         /* anyway.                                                         */
         if ( value > 32000 || value < -32000 )
         {
-          FT_ERROR(( "t1_decoder_parse_metrics:"
-                     " large integer found for width\n" ));
-          goto Syntax_Error;
+          if ( large_int )
+          {
+            FT_ERROR(( "t1_decoder_parse_metrics:"
+                       " no `div' after large integer\n" ));
+            goto Syntax_Error;
+          }
+          else
+            large_int = TRUE;
         }
         else
         {
-          value = (FT_Int32)( (FT_UInt32)value << 16 );
+          if ( !large_int )
+            value = (FT_Int32)( (FT_UInt32)value << 16 );
         }
 
         break;
@@ -1827,7 +1850,8 @@
               value = -( ( ( ip[-2] - 251 ) * 256 ) + ip[-1] + 108 );
           }
 
-          value = (FT_Int32)( (FT_UInt32)value << 16 );
+          if ( !large_int )
+            value = (FT_Int32)( (FT_UInt32)value << 16 );
         }
         else
         {
@@ -1837,6 +1861,13 @@
         }
       }
 
+      if ( large_int && !( op == op_none || op == op_div ) )
+      {
+        FT_ERROR(( "t1_decoder_parse_metrics:"
+                   " no `div' after large integer\n" ));
+        goto Syntax_Error;
+      }
+
       /**********************************************************************
        *
        * Push value on stack, or process operator
@@ -1851,6 +1882,9 @@
         }
 
 #ifdef FT_DEBUG_LEVEL_TRACE
+        if ( large_int )
+          FT_TRACE4(( " %d", value ));
+        else
           FT_TRACE4(( " %d", value / 65536 ));
 #endif
 
@@ -1869,11 +1903,21 @@
 
 #ifdef FT_DEBUG_LEVEL_TRACE
 
-        if ( top - decoder->stack != num_args )
-          FT_TRACE0(( "t1_decoder_parse_metrics:"
-                      " too much operands on the stack"
-                      " (seen %d, expected %d)\n",
-                      top - decoder->stack, num_args ));
+        switch ( op )
+        {
+        case op_callsubr:
+        case op_div:
+        case op_return:
+          break;
+
+        default:
+          if ( top - decoder->stack != num_args )
+            FT_TRACE0(( "t1_decoder_parse_metrics:"
+                        " too much operands on the stack"
+                        " (seen %ld, expected %d)\n",
+                        top - decoder->stack, num_args ));
+          break;
+        }
 
 #endif /* FT_DEBUG_LEVEL_TRACE */
 
@@ -1893,8 +1937,8 @@
           builder->advance.y = 0;
 
           /* we only want to compute the glyph's metrics */
-          /* (lsb + advance width), not load the rest of */
-          /* it; so exit immediately                     */
+          /* (lsb + advance width) without loading the   */
+          /* rest of it; so exit immediately             */
           FT_TRACE4(( "\n" ));
           return FT_Err_Ok;
 
@@ -1912,17 +1956,116 @@
           builder->advance.y = top[3];
 
           /* we only want to compute the glyph's metrics */
-          /* (lsb + advance width), not load the rest of */
-          /* it; so exit immediately                     */
+          /* (lsb + advance width), without loading the  */
+          /* rest of it; so exit immediately             */
           FT_TRACE4(( "\n" ));
           return FT_Err_Ok;
 
+        case op_div:
+          FT_TRACE4(( " div" ));
+
+          /* if `large_int' is set, we divide unscaled numbers; */
+          /* otherwise, we divide numbers in 16.16 format --    */
+          /* in both cases, it is the same operation            */
+          *top = FT_DivFix( top[0], top[1] );
+          top++;
+
+          large_int = FALSE;
+          break;
+
+        case op_callsubr:
+          {
+            FT_Int  idx;
+
+
+            FT_TRACE4(( " callsubr" ));
+
+            idx = Fix2Int( top[0] );
+
+            if ( decoder->subrs_hash )
+            {
+              size_t*  val = ft_hash_num_lookup( idx,
+                                                 decoder->subrs_hash );
+
+
+              if ( val )
+                idx = *val;
+              else
+                idx = -1;
+            }
+
+            if ( idx < 0 || idx >= decoder->num_subrs )
+            {
+              FT_ERROR(( "t1_decoder_parse_metrics:"
+                         " invalid subrs index\n" ));
+              goto Syntax_Error;
+            }
+
+            if ( zone - decoder->zones >= T1_MAX_SUBRS_CALLS )
+            {
+              FT_ERROR(( "t1_decoder_parse_metrics:"
+                         " too many nested subrs\n" ));
+              goto Syntax_Error;
+            }
+
+            zone->cursor = ip;  /* save current instruction pointer */
+
+            zone++;
+
+            /* The Type 1 driver stores subroutines without the seed bytes. */
+            /* The CID driver stores subroutines with seed bytes.  This     */
+            /* case is taken care of when decoder->subrs_len == 0.          */
+            zone->base = decoder->subrs[idx];
+
+            if ( decoder->subrs_len )
+              zone->limit = zone->base + decoder->subrs_len[idx];
+            else
+            {
+              /* We are using subroutines from a CID font.  We must adjust */
+              /* for the seed bytes.                                       */
+              zone->base  += ( decoder->lenIV >= 0 ? decoder->lenIV : 0 );
+              zone->limit  = decoder->subrs[idx + 1];
+            }
+
+            zone->cursor = zone->base;
+
+            if ( !zone->base )
+            {
+              FT_ERROR(( "t1_decoder_parse_metrics:"
+                         " invoking empty subrs\n" ));
+              goto Syntax_Error;
+            }
+
+            decoder->zone = zone;
+            ip            = zone->base;
+            limit         = zone->limit;
+            break;
+          }
+
+        case op_return:
+          FT_TRACE4(( " return" ));
+
+          if ( zone <= decoder->zones )
+          {
+            FT_ERROR(( "t1_decoder_parse_metrics:"
+                       " unexpected return\n" ));
+            goto Syntax_Error;
+          }
+
+          zone--;
+          ip            = zone->cursor;
+          limit         = zone->limit;
+          decoder->zone = zone;
+          break;
+
         default:
           FT_ERROR(( "t1_decoder_parse_metrics:"
                      " unhandled opcode %d\n", op ));
           goto Syntax_Error;
         }
 
+        decoder->top = top;
+
       } /* general operator processing */
 
     } /* while ip < limit */
diff --git a/src/psaux/t1decode.h b/src/psaux/t1decode.h
index 1b5d626..b793504 100644
--- a/src/psaux/t1decode.h
+++ b/src/psaux/t1decode.h
@@ -4,7 +4,7 @@
  *
  *   PostScript Type 1 decoding routines (specification).
  *
- * Copyright (C) 2000-2019 by
+ * Copyright (C) 2000-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,9 +20,8 @@
 #define T1DECODE_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_TYPE1_TYPES_H
+#include <freetype/internal/psaux.h>
+#include <freetype/internal/t1types.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/pshinter/Jamfile b/src/pshinter/Jamfile
deleted file mode 100644
index 0e44c19..0000000
--- a/src/pshinter/Jamfile
+++ /dev/null
@@ -1,34 +0,0 @@
-# FreeType 2 src/pshinter Jamfile
-#
-# Copyright (C) 2001-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) pshinter ;
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = pshalgo
-               pshglob
-               pshmod
-               pshpic
-               pshrec
-               ;
-  }
-  else
-  {
-    _sources = pshinter ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/pshinter Jamfile
diff --git a/src/pshinter/module.mk b/src/pshinter/module.mk
index 0a12a26..b440d2e 100644
--- a/src/pshinter/module.mk
+++ b/src/pshinter/module.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/pshinter/pshalgo.c b/src/pshinter/pshalgo.c
index 0c5ae62..920b9a7 100644
--- a/src/pshinter/pshalgo.c
+++ b/src/pshinter/pshalgo.c
@@ -4,7 +4,7 @@
  *
  *   PostScript hinting algorithm (body).
  *
- * Copyright (C) 2001-2019 by
+ * Copyright (C) 2001-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used
@@ -16,10 +16,9 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftcalc.h>
 #include "pshalgo.h"
 
 #include "pshnterr.h"
diff --git a/src/pshinter/pshalgo.h b/src/pshinter/pshalgo.h
index 6859e95..5367a5d 100644
--- a/src/pshinter/pshalgo.h
+++ b/src/pshinter/pshalgo.h
@@ -4,7 +4,7 @@
  *
  *   PostScript hinting algorithm (specification).
  *
- * Copyright (C) 2001-2019 by
+ * Copyright (C) 2001-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/pshinter/pshglob.c b/src/pshinter/pshglob.c
index b021e6e..cdc1c3a 100644
--- a/src/pshinter/pshglob.c
+++ b/src/pshinter/pshglob.c
@@ -5,7 +5,7 @@
  *   PostScript hinter global hinting management (body).
  *   Inspired by the new auto-hinter module.
  *
- * Copyright (C) 2001-2019 by
+ * Copyright (C) 2001-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used
@@ -17,10 +17,9 @@
  */
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_CALC_H
+#include <freetype/freetype.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftcalc.h>
 #include "pshglob.h"
 
 #ifdef DEBUG_HINTER
diff --git a/src/pshinter/pshglob.h b/src/pshinter/pshglob.h
index 0049d4c..8181324 100644
--- a/src/pshinter/pshglob.h
+++ b/src/pshinter/pshglob.h
@@ -4,7 +4,7 @@
  *
  *   PostScript hinter global hinting management.
  *
- * Copyright (C) 2001-2019 by
+ * Copyright (C) 2001-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,8 @@
 #define PSHGLOB_H_
 
 
-#include FT_FREETYPE_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
+#include <freetype/freetype.h>
+#include <freetype/internal/pshints.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/pshinter/pshinter.c b/src/pshinter/pshinter.c
index 16c3a0a..3cca0ad 100644
--- a/src/pshinter/pshinter.c
+++ b/src/pshinter/pshinter.c
@@ -4,7 +4,7 @@
  *
  *   FreeType PostScript Hinting module
  *
- * Copyright (C) 2001-2019 by
+ * Copyright (C) 2001-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -17,7 +17,6 @@
 
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
 
 #include "pshalgo.c"
 #include "pshglob.c"
diff --git a/src/pshinter/pshmod.c b/src/pshinter/pshmod.c
index 2d36ea2..e0abd38 100644
--- a/src/pshinter/pshmod.c
+++ b/src/pshinter/pshmod.c
@@ -4,7 +4,7 @@
  *
  *   FreeType PostScript hinter module implementation (body).
  *
- * Copyright (C) 2001-2019 by
+ * Copyright (C) 2001-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,10 +16,10 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/ftobjs.h>
 #include "pshrec.h"
 #include "pshalgo.h"
+#include "pshmod.h"
 
 
   /* the Postscript Hinter module structure */
diff --git a/src/pshinter/pshmod.h b/src/pshinter/pshmod.h
index ea87713..2a6eb1c 100644
--- a/src/pshinter/pshmod.h
+++ b/src/pshinter/pshmod.h
@@ -4,7 +4,7 @@
  *
  *   PostScript hinter module interface (specification).
  *
- * Copyright (C) 2001-2019 by
+ * Copyright (C) 2001-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
 #define PSHMOD_H_
 
 
-#include <ft2build.h>
-#include FT_MODULE_H
+#include <freetype/ftmodapi.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/pshinter/pshnterr.h b/src/pshinter/pshnterr.h
index fb9dbca..d67955c 100644
--- a/src/pshinter/pshnterr.h
+++ b/src/pshinter/pshnterr.h
@@ -4,7 +4,7 @@
  *
  *   PS Hinter error codes (specification only).
  *
- * Copyright (C) 2003-2019 by
+ * Copyright (C) 2003-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -25,7 +25,7 @@
 #ifndef PSHNTERR_H_
 #define PSHNTERR_H_
 
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
 
 #undef FTERRORS_H_
 
@@ -33,7 +33,7 @@
 #define FT_ERR_PREFIX  PSH_Err_
 #define FT_ERR_BASE    FT_Mod_Err_PShinter
 
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
 
 #endif /* PSHNTERR_H_ */
 
diff --git a/src/pshinter/pshrec.c b/src/pshinter/pshrec.c
index 9dd09ef..bddccf2 100644
--- a/src/pshinter/pshrec.c
+++ b/src/pshinter/pshrec.c
@@ -4,7 +4,7 @@
  *
  *   FreeType PostScript hints recorder (body).
  *
- * Copyright (C) 2001-2019 by
+ * Copyright (C) 2001-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,11 +16,10 @@
  */
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
+#include <freetype/freetype.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftcalc.h>
 
 #include "pshrec.h"
 #include "pshalgo.h"
@@ -875,7 +874,7 @@
       if ( error )
       {
         FT_ERROR(( "ps_hints_stem: could not add stem"
-                   " (%d,%d) to hints table\n", stems[0], stems[1] ));
+                   " (%ld,%ld) to hints table\n", stems[0], stems[1] ));
 
         hints->error = error;
         return;
diff --git a/src/pshinter/pshrec.h b/src/pshinter/pshrec.h
index 02cc210..b13c7be 100644
--- a/src/pshinter/pshrec.h
+++ b/src/pshinter/pshrec.h
@@ -4,7 +4,7 @@
  *
  *   Postscript (Type1/Type2) hints recorder (specification).
  *
- * Copyright (C) 2001-2019 by
+ * Copyright (C) 2001-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -32,8 +32,7 @@
 #define PSHREC_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
+#include <freetype/internal/pshints.h>
 #include "pshglob.h"
 
 
diff --git a/src/pshinter/rules.mk b/src/pshinter/rules.mk
index 58227d1..c845c25 100644
--- a/src/pshinter/rules.mk
+++ b/src/pshinter/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 2001-2019 by
+# Copyright (C) 2001-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/psnames/Jamfile b/src/psnames/Jamfile
deleted file mode 100644
index 75978a8..0000000
--- a/src/psnames/Jamfile
+++ /dev/null
@@ -1,31 +0,0 @@
-# FreeType 2 src/psnames Jamfile
-#
-# Copyright (C) 2001-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) psnames ;
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = psmodule
-               pspic
-               ;
-  }
-  else
-  {
-    _sources = psnames ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/psnames Jamfile
diff --git a/src/psnames/module.mk b/src/psnames/module.mk
index 0806a31..675bb37 100644
--- a/src/psnames/module.mk
+++ b/src/psnames/module.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c
index 0ec440e..b38f9d3 100644
--- a/src/psnames/psmodule.c
+++ b/src/psnames/psmodule.c
@@ -4,7 +4,7 @@
  *
  *   psnames module implementation (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,10 +16,9 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/services/svpscmap.h>
 
 #include "psmodule.h"
 
diff --git a/src/psnames/psmodule.h b/src/psnames/psmodule.h
index 0df9a7d..c85a9ec 100644
--- a/src/psnames/psmodule.h
+++ b/src/psnames/psmodule.h
@@ -4,7 +4,7 @@
  *
  *   High-level psnames module interface (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
 #define PSMODULE_H_
 
 
-#include <ft2build.h>
-#include FT_MODULE_H
+#include <freetype/ftmodapi.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/psnames/psnamerr.h b/src/psnames/psnamerr.h
index 67ab176..154c701 100644
--- a/src/psnames/psnamerr.h
+++ b/src/psnames/psnamerr.h
@@ -4,7 +4,7 @@
  *
  *   PS names module error codes (specification only).
  *
- * Copyright (C) 2001-2019 by
+ * Copyright (C) 2001-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -26,7 +26,7 @@
 #ifndef PSNAMERR_H_
 #define PSNAMERR_H_
 
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
 
 #undef FTERRORS_H_
 
@@ -34,7 +34,7 @@
 #define FT_ERR_PREFIX  PSnames_Err_
 #define FT_ERR_BASE    FT_Mod_Err_PSnames
 
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
 
 #endif /* PSNAMERR_H_ */
 
diff --git a/src/psnames/psnames.c b/src/psnames/psnames.c
index 4722f98..cff3685 100644
--- a/src/psnames/psnames.c
+++ b/src/psnames/psnames.c
@@ -4,7 +4,7 @@
  *
  *   FreeType psnames module component (body only).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -17,7 +17,6 @@
 
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
 
 #include "psmodule.c"
 
diff --git a/src/psnames/pstables.h b/src/psnames/pstables.h
index c0139bb..c215f16 100644
--- a/src/psnames/pstables.h
+++ b/src/psnames/pstables.h
@@ -4,7 +4,7 @@
  *
  *   PostScript glyph names.
  *
- * Copyright (C) 2005-2019 by
+ * Copyright (C) 2005-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/psnames/rules.mk b/src/psnames/rules.mk
index dcc203e..14cdda3 100644
--- a/src/psnames/rules.mk
+++ b/src/psnames/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/raster/Jamfile b/src/raster/Jamfile
deleted file mode 100644
index 3990c05..0000000
--- a/src/raster/Jamfile
+++ /dev/null
@@ -1,32 +0,0 @@
-# FreeType 2 src/raster Jamfile
-#
-# Copyright (C) 2001-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) raster ;
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = ftraster
-               ftrend1
-               rastpic
-               ;
-  }
-  else
-  {
-    _sources = raster ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/raster Jamfile
diff --git a/src/raster/ftmisc.h b/src/raster/ftmisc.h
index a246569..6efe4a9 100644
--- a/src/raster/ftmisc.h
+++ b/src/raster/ftmisc.h
@@ -5,7 +5,7 @@
  *   Miscellaneous macros for stand-alone rasterizer (specification
  *   only).
  *
- * Copyright (C) 2005-2019 by
+ * Copyright (C) 2005-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used
diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c
index 023b6c1..9f0a797 100644
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -4,7 +4,7 @@
  *
  *   The FreeType glyph rasterizer (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -62,10 +62,9 @@
 
 #else /* !STANDALONE_ */
 
-#include <ft2build.h>
 #include "ftraster.h"
-#include FT_INTERNAL_CALC_H   /* for FT_MulDiv and FT_MulDiv_No_Round */
-#include FT_OUTLINE_H         /* for FT_Outline_Get_CBox              */
+#include <freetype/internal/ftcalc.h> /* for FT_MulDiv and FT_MulDiv_No_Round */
+#include <freetype/ftoutln.h>         /* for FT_Outline_Get_CBox              */
 
 #endif /* !STANDALONE_ */
 
@@ -226,8 +225,8 @@
 #else /* !STANDALONE_ */
 
 
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H       /* for FT_TRACE, FT_ERROR, and FT_THROW */
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h> /* for FT_TRACE, FT_ERROR, and FT_THROW */
 
 #include "rasterrs.h"
 
@@ -460,6 +459,11 @@
 #define IS_TOP_OVERSHOOT( x )    \
           (Bool)( x - FLOOR( x ) >= ras.precision_half )
 
+  /* Smart dropout rounding to find which pixel is closer to span ends. */
+  /* To mimick Windows, symmetric cases break down indepenently of the  */
+  /* precision.                                                         */
+#define SMART( p, q )  FLOOR( ( (p) + (q) + ras.precision * 63 / 64 ) >> 1 )
+
 #if FT_RENDER_POOL_SIZE > 2048
 #define FT_MAX_BLACK_POOL  ( FT_RENDER_POOL_SIZE / sizeof ( Long ) )
 #else
@@ -674,13 +678,13 @@
       if ( overshoot )
         ras.cProfile->flags |= Overshoot_Bottom;
 
-      FT_TRACE6(( "  new ascending profile = %p\n", ras.cProfile ));
+      FT_TRACE6(( "  new ascending profile = %p\n", (void *)ras.cProfile ));
       break;
 
     case Descending_State:
       if ( overshoot )
         ras.cProfile->flags |= Overshoot_Top;
-      FT_TRACE6(( "  new descending profile = %p\n", ras.cProfile ));
+      FT_TRACE6(( "  new descending profile = %p\n", (void *)ras.cProfile ));
       break;
 
     default:
@@ -737,7 +741,7 @@
 
 
       FT_TRACE6(( "  ending profile %p, start = %ld, height = %ld\n",
-                  ras.cProfile, ras.cProfile->start, h ));
+                  (void *)ras.cProfile, ras.cProfile->start, h ));
 
       ras.cProfile->height = h;
       if ( overshoot )
@@ -2242,11 +2246,10 @@
 
     /* in high-precision mode, we need 12 digits after the comma to */
     /* represent multiples of 1/(1<<12) = 1/4096                    */
-    FT_TRACE7(( "  y=%d x=[%.12f;%.12f], drop-out=%d",
+    FT_TRACE7(( "  y=%d x=[% .12f;% .12f]",
                 y,
                 x1 / (double)ras.precision,
-                x2 / (double)ras.precision,
-                dropOutControl ));
+                x2 / (double)ras.precision ));
 
     /* Drop-out control */
 
@@ -2274,7 +2277,7 @@
       if ( e2 >= ras.bWidth )
         e2 = ras.bWidth - 1;
 
-      FT_TRACE7(( " -> x=[%d;%d]", e1, e2 ));
+      FT_TRACE7(( " -> x=[%ld;%ld]", e1, e2 ));
 
       c1 = (Short)( e1 >> 3 );
       c2 = (Short)( e2 >> 3 );
@@ -2316,7 +2319,7 @@
     Short  c1, f1;
 
 
-    FT_TRACE7(( "  y=%d x=[%.12f;%.12f]",
+    FT_TRACE7(( "  y=%d x=[% .12f;% .12f]",
                 y,
                 x1 / (double)ras.precision,
                 x2 / (double)ras.precision ));
@@ -2353,8 +2356,6 @@
       Int  dropOutControl = left->flags & 7;
 
 
-      FT_TRACE7(( ", drop-out=%d", dropOutControl ));
-
       if ( e1 == e2 + ras.precision )
       {
         switch ( dropOutControl )
@@ -2364,7 +2365,7 @@
           break;
 
         case 4: /* smart drop-outs including stubs */
-          pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );
+          pxl = SMART( x1, x2 );
           break;
 
         case 1: /* simple drop-outs excluding stubs */
@@ -2413,7 +2414,7 @@
           if ( dropOutControl == 1 )
             pxl = e2;
           else
-            pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );
+            pxl = SMART( x1, x2 );
           break;
 
         default: /* modes 2, 3, 6, 7 */
@@ -2448,7 +2449,7 @@
 
     if ( e1 >= 0 && e1 < ras.bWidth )
     {
-      FT_TRACE7(( " -> x=%d (drop-out)", e1 ));
+      FT_TRACE7(( " -> x=%ld", e1 ));
 
       c1 = (Short)( e1 >> 3 );
       f1 = (Short)( e1 & 7 );
@@ -2457,7 +2458,7 @@
     }
 
   Exit:
-    FT_TRACE7(( "\n" ));
+    FT_TRACE7(( " dropout=%d\n", left->flags & 7 ));
   }
 
 
@@ -2495,44 +2496,68 @@
                                   PProfile    left,
                                   PProfile    right )
   {
+    Long  e1, e2;
+
     FT_UNUSED( left );
     FT_UNUSED( right );
 
 
-    if ( x2 - x1 < ras.precision )
+    FT_TRACE7(( "  x=%d y=[% .12f;% .12f]",
+                y,
+                x1 / (double)ras.precision,
+                x2 / (double)ras.precision ));
+
+    /* We should not need this procedure but the vertical sweep   */
+    /* mishandles horizontal lines through pixel centers.  So we  */
+    /* have to check perfectly aligned span edges here.           */
+    /*                                                            */
+    /* XXX: Can we handle horizontal lines better and drop this?  */
+
+    e1 = CEILING( x1 );
+
+    if ( x1 == e1 )
     {
-      Long  e1, e2;
+      e1 = TRUNC( e1 );
 
-
-      FT_TRACE7(( "  x=%d y=[%.12f;%.12f]",
-                  y,
-                  x1 / (double)ras.precision,
-                  x2 / (double)ras.precision ));
-
-      e1 = CEILING( x1 );
-      e2 = FLOOR  ( x2 );
-
-      if ( e1 == e2 )
+      if ( e1 >= 0 && (ULong)e1 < ras.target.rows )
       {
-        e1 = TRUNC( e1 );
-
-        if ( e1 >= 0 && (ULong)e1 < ras.target.rows )
-        {
-          Byte   f1;
-          PByte  bits;
+        Byte   f1;
+        PByte  bits;
 
 
-          FT_TRACE7(( " -> y=%d (drop-out)", e1 ));
+        bits = ras.bOrigin + ( y >> 3 ) - e1 * ras.target.pitch;
+        f1   = (Byte)( 0x80 >> ( y & 7 ) );
 
-          bits = ras.bOrigin + ( y >> 3 ) - e1 * ras.target.pitch;
-          f1   = (Byte)( 0x80 >> ( y & 7 ) );
+        FT_TRACE7(( bits[0] & f1 ? " redundant"
+                                 : " -> y=%ld edge", e1 ));
 
-          bits[0] |= f1;
-        }
+        bits[0] |= f1;
       }
-
-      FT_TRACE7(( "\n" ));
     }
+
+    e2 = FLOOR  ( x2 );
+
+    if ( x2 == e2 )
+    {
+      e2 = TRUNC( e2 );
+
+      if ( e2 >= 0 && (ULong)e2 < ras.target.rows )
+      {
+        Byte   f1;
+        PByte  bits;
+
+
+        bits = ras.bOrigin + ( y >> 3 ) - e2 * ras.target.pitch;
+        f1   = (Byte)( 0x80 >> ( y & 7 ) );
+
+        FT_TRACE7(( bits[0] & f1 ? " redundant"
+                                 : " -> y=%ld edge", e2 ));
+
+        bits[0] |= f1;
+      }
+    }
+
+    FT_TRACE7(( "\n" ));
   }
 
 
@@ -2548,7 +2573,7 @@
     Byte   f1;
 
 
-    FT_TRACE7(( "  x=%d y=[%.12f;%.12f]",
+    FT_TRACE7(( "  x=%d y=[% .12f;% .12f]",
                 y,
                 x1 / (double)ras.precision,
                 x2 / (double)ras.precision ));
@@ -2574,8 +2599,6 @@
       Int  dropOutControl = left->flags & 7;
 
 
-      FT_TRACE7(( ", dropout=%d", dropOutControl ));
-
       if ( e1 == e2 + ras.precision )
       {
         switch ( dropOutControl )
@@ -2585,7 +2608,7 @@
           break;
 
         case 4: /* smart drop-outs including stubs */
-          pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );
+          pxl = SMART( x1, x2 );
           break;
 
         case 1: /* simple drop-outs excluding stubs */
@@ -2609,7 +2632,7 @@
           if ( dropOutControl == 1 )
             pxl = e2;
           else
-            pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half );
+            pxl = SMART( x1, x2 );
           break;
 
         default: /* modes 2, 3, 6, 7 */
@@ -2645,7 +2668,7 @@
 
     if ( e1 >= 0 && (ULong)e1 < ras.target.rows )
     {
-      FT_TRACE7(( " -> y=%d (drop-out)", e1 ));
+      FT_TRACE7(( " -> y=%ld", e1 ));
 
       bits  = ras.bOrigin + ( y >> 3 ) - e1 * ras.target.pitch;
       f1    = (Byte)( 0x80 >> ( y & 7 ) );
@@ -2654,7 +2677,7 @@
     }
 
   Exit:
-    FT_TRACE7(( "\n" ));
+    FT_TRACE7(( " dropout=%d\n", left->flags & 7 ));
   }
 
 
diff --git a/src/raster/ftraster.h b/src/raster/ftraster.h
index 50d3420..1b2ee3c 100644
--- a/src/raster/ftraster.h
+++ b/src/raster/ftraster.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType glyph rasterizer (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used
@@ -22,8 +22,9 @@
 
 #include <ft2build.h>
 #include FT_CONFIG_CONFIG_H
-#include FT_IMAGE_H
+#include <freetype/ftimage.h>
 
+#include <freetype/internal/compiler-macros.h>
 
 FT_BEGIN_HEADER
 
diff --git a/src/raster/ftrend1.c b/src/raster/ftrend1.c
index 62c7271..57fed9b 100644
--- a/src/raster/ftrend1.c
+++ b/src/raster/ftrend1.c
@@ -4,7 +4,7 @@
  *
  *   The FreeType glyph rasterizer interface (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,10 +16,9 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_OUTLINE_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/ftoutln.h>
 #include "ftrend1.h"
 #include "ftraster.h"
 
diff --git a/src/raster/ftrend1.h b/src/raster/ftrend1.h
index 82ecac6..3f6be53 100644
--- a/src/raster/ftrend1.h
+++ b/src/raster/ftrend1.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType glyph rasterizer interface (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
 #define FTREND1_H_
 
 
-#include <ft2build.h>
-#include FT_RENDER_H
+#include <freetype/ftrender.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/raster/module.mk b/src/raster/module.mk
index 0a6d4b0..3600732 100644
--- a/src/raster/module.mk
+++ b/src/raster/module.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/raster/raster.c b/src/raster/raster.c
index e3ac9e5..cd37943 100644
--- a/src/raster/raster.c
+++ b/src/raster/raster.c
@@ -4,7 +4,7 @@
  *
  *   FreeType monochrome rasterer module component (body only).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -17,7 +17,6 @@
 
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
 
 #include "ftraster.c"
 #include "ftrend1.c"
diff --git a/src/raster/rasterrs.h b/src/raster/rasterrs.h
index 7266407..a29651a 100644
--- a/src/raster/rasterrs.h
+++ b/src/raster/rasterrs.h
@@ -4,7 +4,7 @@
  *
  *   monochrome renderer error codes (specification only).
  *
- * Copyright (C) 2001-2019 by
+ * Copyright (C) 2001-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -26,7 +26,7 @@
 #ifndef RASTERRS_H_
 #define RASTERRS_H_
 
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
 
 #undef FTERRORS_H_
 
@@ -34,7 +34,7 @@
 #define FT_ERR_PREFIX  Raster_Err_
 #define FT_ERR_BASE    FT_Mod_Err_Raster
 
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
 
 #endif /* RASTERRS_H_ */
 
diff --git a/src/raster/rules.mk b/src/raster/rules.mk
index 7664671..3e949d7 100644
--- a/src/raster/rules.mk
+++ b/src/raster/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/sfnt/Jamfile b/src/sfnt/Jamfile
deleted file mode 100644
index f646b35..0000000
--- a/src/sfnt/Jamfile
+++ /dev/null
@@ -1,42 +0,0 @@
-# FreeType 2 src/sfnt Jamfile
-#
-# Copyright (C) 2001-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) sfnt ;
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = pngshim
-               sfdriver
-               sfntpic
-               sfobjs
-               ttbdf
-               ttcmap
-               ttcolr
-               ttcpal
-               ttkern
-               ttload
-               ttmtx
-               ttpost
-               ttsbit
-               ;
-  }
-  else
-  {
-    _sources = sfnt ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/sfnt Jamfile
diff --git a/src/sfnt/module.mk b/src/sfnt/module.mk
index 8c3b44f..0f459d8 100644
--- a/src/sfnt/module.mk
+++ b/src/sfnt/module.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/sfnt/pngshim.c b/src/sfnt/pngshim.c
index 15f4e16..f550161 100644
--- a/src/sfnt/pngshim.c
+++ b/src/sfnt/pngshim.c
@@ -4,7 +4,7 @@
  *
  *   PNG Bitmap glyph support.
  *
- * Copyright (C) 2013-2019 by
+ * Copyright (C) 2013-2020 by
  * Google, Inc.
  * Written by Stuart Gill and Behdad Esfahbod.
  *
@@ -17,10 +17,9 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
 #include FT_CONFIG_STANDARD_LIBRARY_H
 
 
@@ -61,13 +60,19 @@
     /* predates clang; the `__BYTE_ORDER__' preprocessor symbol was */
     /* introduced in gcc 4.6 and clang 3.2, respectively.           */
     /* `__builtin_shuffle' for gcc was introduced in gcc 4.7.0.     */
-#if ( ( defined( __GNUC__ )                                &&             \
+    /*                                                              */
+    /* Intel compilers do not currently support __builtin_shuffle;  */
+
+    /* The Intel check must be first. */
+#if !defined( __INTEL_COMPILER )                                       && \
+    ( ( defined( __GNUC__ )                                &&             \
         ( ( __GNUC__ >= 5 )                              ||               \
         ( ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ >= 7 ) ) ) )         ||   \
       ( defined( __clang__ )                                       &&     \
         ( ( __clang_major__ >= 4 )                               ||       \
         ( ( __clang_major__ == 3 ) && ( __clang_minor__ >= 2 ) ) ) ) ) && \
     defined( __OPTIMIZE__ )                                            && \
+    defined( __SSE__ )                                                 && \
     __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
 
 #ifdef __clang__
diff --git a/src/sfnt/pngshim.h b/src/sfnt/pngshim.h
index 06c6f6b..2d6e83d 100644
--- a/src/sfnt/pngshim.h
+++ b/src/sfnt/pngshim.h
@@ -4,7 +4,7 @@
  *
  *   PNG Bitmap glyph support.
  *
- * Copyright (C) 2013-2019 by
+ * Copyright (C) 2013-2020 by
  * Google, Inc.
  * Written by Stuart Gill and Behdad Esfahbod.
  *
@@ -21,7 +21,6 @@
 #define PNGSHIM_H_
 
 
-#include <ft2build.h>
 #include "ttload.h"
 
 
diff --git a/src/sfnt/rules.mk b/src/sfnt/rules.mk
index ee3314e..f56ef06 100644
--- a/src/sfnt/rules.mk
+++ b/src/sfnt/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -28,19 +28,21 @@
 
 # SFNT driver sources (i.e., C files)
 #
-SFNT_DRV_SRC := $(SFNT_DIR)/pngshim.c  \
-                $(SFNT_DIR)/sfdriver.c \
-                $(SFNT_DIR)/sfobjs.c   \
-                $(SFNT_DIR)/sfwoff.c   \
-                $(SFNT_DIR)/ttbdf.c    \
-                $(SFNT_DIR)/ttcmap.c   \
-                $(SFNT_DIR)/ttcolr.c   \
-                $(SFNT_DIR)/ttcpal.c   \
-                $(SFNT_DIR)/ttkern.c   \
-                $(SFNT_DIR)/ttload.c   \
-                $(SFNT_DIR)/ttmtx.c    \
-                $(SFNT_DIR)/ttpost.c   \
-                $(SFNT_DIR)/ttsbit.c
+SFNT_DRV_SRC := $(SFNT_DIR)/pngshim.c   \
+                $(SFNT_DIR)/sfdriver.c  \
+                $(SFNT_DIR)/sfobjs.c    \
+                $(SFNT_DIR)/sfwoff.c    \
+                $(SFNT_DIR)/sfwoff2.c   \
+                $(SFNT_DIR)/ttbdf.c     \
+                $(SFNT_DIR)/ttcmap.c    \
+                $(SFNT_DIR)/ttcolr.c    \
+                $(SFNT_DIR)/ttcpal.c    \
+                $(SFNT_DIR)/ttkern.c    \
+                $(SFNT_DIR)/ttload.c    \
+                $(SFNT_DIR)/ttmtx.c     \
+                $(SFNT_DIR)/ttpost.c    \
+                $(SFNT_DIR)/ttsbit.c    \
+                $(SFNT_DIR)/woff2tags.c
 
 # SFNT driver headers
 #
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index 2611685..0460339 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -4,7 +4,7 @@
  *
  *   High-level SFNT driver interface (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,11 +16,10 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_TRUETYPE_IDS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/sfnt.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/ttnameid.h>
 
 #include "sfdriver.h"
 #include "ttload.h"
@@ -43,21 +42,21 @@
 
 #ifdef TT_CONFIG_OPTION_BDF
 #include "ttbdf.h"
-#include FT_SERVICE_BDF_H
+#include <freetype/internal/services/svbdf.h>
 #endif
 
 #include "ttcmap.h"
 #include "ttkern.h"
 #include "ttmtx.h"
 
-#include FT_SERVICE_GLYPH_DICT_H
-#include FT_SERVICE_POSTSCRIPT_NAME_H
-#include FT_SERVICE_SFNT_H
-#include FT_SERVICE_TT_CMAP_H
+#include <freetype/internal/services/svgldict.h>
+#include <freetype/internal/services/svpostnm.h>
+#include <freetype/internal/services/svsfnt.h>
+#include <freetype/internal/services/svttcmap.h>
 
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include FT_MULTIPLE_MASTERS_H
-#include FT_SERVICE_MULTIPLE_MASTERS_H
+#include <freetype/ftmm.h>
+#include <freetype/internal/services/svmm.h>
 #endif
 
 
@@ -195,7 +194,7 @@
     else if ( (FT_ULong)face->num_glyphs < FT_UINT_MAX )
       max_gid = (FT_UInt)face->num_glyphs;
     else
-      FT_TRACE0(( "Ignore glyph names for invalid GID 0x%08x - 0x%08x\n",
+      FT_TRACE0(( "Ignore glyph names for invalid GID 0x%08x - 0x%08lx\n",
                   FT_UINT_MAX, face->num_glyphs ));
 
     for ( i = 0; i < max_gid; i++ )
diff --git a/src/sfnt/sfdriver.h b/src/sfnt/sfdriver.h
index 8c17463..1ac2706 100644
--- a/src/sfnt/sfdriver.h
+++ b/src/sfnt/sfdriver.h
@@ -4,7 +4,7 @@
  *
  *   High-level SFNT driver interface (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
 #define SFDRIVER_H_
 
 
-#include <ft2build.h>
-#include FT_MODULE_H
+#include <freetype/ftmodapi.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/sfnt/sferrors.h b/src/sfnt/sferrors.h
index 43e148d..55c3e76 100644
--- a/src/sfnt/sferrors.h
+++ b/src/sfnt/sferrors.h
@@ -4,7 +4,7 @@
  *
  *   SFNT error codes (specification only).
  *
- * Copyright (C) 2001-2019 by
+ * Copyright (C) 2001-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -25,7 +25,7 @@
 #ifndef SFERRORS_H_
 #define SFERRORS_H_
 
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
 
 #undef FTERRORS_H_
 
@@ -33,7 +33,7 @@
 #define FT_ERR_PREFIX  SFNT_Err_
 #define FT_ERR_BASE    FT_Mod_Err_SFNT
 
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
 
 #endif /* SFERRORS_H_ */
 
diff --git a/src/sfnt/sfnt.c b/src/sfnt/sfnt.c
index b4faf34..471239f 100644
--- a/src/sfnt/sfnt.c
+++ b/src/sfnt/sfnt.c
@@ -4,7 +4,7 @@
  *
  *   Single object library component.
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -17,12 +17,12 @@
 
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
 
 #include "pngshim.c"
 #include "sfdriver.c"
 #include "sfobjs.c"
 #include "sfwoff.c"
+#include "sfwoff2.c"
 #include "ttbdf.c"
 #include "ttcmap.c"
 #include "ttcolr.c"
@@ -33,6 +33,7 @@
 #include "ttmtx.c"
 #include "ttpost.c"
 #include "ttsbit.c"
+#include "woff2tags.c"
 
 
 /* END */
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index 6edf3ae..39460be 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -4,7 +4,7 @@
  *
  *   SFNT object management (base).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,22 +16,22 @@
  */
 
 
-#include <ft2build.h>
 #include "sfobjs.h"
 #include "ttload.h"
 #include "ttcmap.h"
 #include "ttkern.h"
 #include "sfwoff.h"
-#include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_TRUETYPE_IDS_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-#include FT_SFNT_NAMES_H
+#include "sfwoff2.h"
+#include <freetype/internal/sfnt.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/ttnameid.h>
+#include <freetype/tttags.h>
+#include <freetype/internal/services/svpscmap.h>
+#include <freetype/ftsnames.h>
 
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include FT_SERVICE_MULTIPLE_MASTERS_H
-#include FT_SERVICE_METRICS_VARIATIONS_H
+#include <freetype/internal/services/svmm.h>
+#include <freetype/internal/services/svmetric.h>
 #endif
 
 #include "sferrors.h"
@@ -341,7 +341,9 @@
   /* synthesized into a TTC with one offset table.              */
   static FT_Error
   sfnt_open_font( FT_Stream  stream,
-                  TT_Face    face )
+                  TT_Face    face,
+                  FT_Int*    face_instance_index,
+                  FT_Long*   woff2_num_faces )
   {
     FT_Memory  memory = stream->memory;
     FT_Error   error;
@@ -385,6 +387,25 @@
       goto retry;
     }
 
+    if ( tag == TTAG_wOF2 )
+    {
+      FT_TRACE2(( "sfnt_open_font: file is a WOFF2; synthesizing SFNT\n" ));
+
+      if ( FT_STREAM_SEEK( offset ) )
+        return error;
+
+      error = woff2_open_font( stream,
+                               face,
+                               face_instance_index,
+                               woff2_num_faces );
+      if ( error )
+        return error;
+
+      /* Swap out stream and retry! */
+      stream = face->root.stream;
+      goto retry;
+    }
+
     if ( tag != 0x00010000UL &&
          tag != TTAG_ttcf    &&
          tag != TTAG_OTTO    &&
@@ -461,9 +482,10 @@
                   FT_Parameter*  params )
   {
     FT_Error      error;
-    FT_Library    library = face->root.driver->root.library;
+    FT_Library    library         = face->root.driver->root.library;
     SFNT_Service  sfnt;
     FT_Int        face_index;
+    FT_Long       woff2_num_faces = 0;
 
 
     /* for now, parameters are unused */
@@ -514,15 +536,18 @@
 
     FT_TRACE2(( "SFNT driver\n" ));
 
-    error = sfnt_open_font( stream, face );
+    error = sfnt_open_font( stream,
+                            face,
+                            &face_instance_index,
+                            &woff2_num_faces );
     if ( error )
       return error;
 
     /* Stream may have changed in sfnt_open_font. */
     stream = face->root.stream;
 
-    FT_TRACE2(( "sfnt_init_face: %08p (index %d)\n",
-                face,
+    FT_TRACE2(( "sfnt_init_face: %p (index %d)\n",
+                (void *)face,
                 face_instance_index ));
 
     face_index = FT_ABS( face_instance_index ) & 0xFFFF;
@@ -689,6 +714,10 @@
     face->root.num_faces  = face->ttc_header.count;
     face->root.face_index = face_instance_index;
 
+    /* `num_faces' for a WOFF2 needs to be handled separately. */
+    if ( woff2_num_faces )
+      face->root.num_faces = woff2_num_faces;
+
     return error;
   }
 
@@ -791,7 +820,7 @@
     /* it doesn't contain outlines.                                */
     /*                                                             */
 
-    FT_TRACE2(( "sfnt_load_face: %08p\n\n", face ));
+    FT_TRACE2(( "sfnt_load_face: %p\n\n", (void *)face ));
 
     /* do we have outlines in there? */
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
diff --git a/src/sfnt/sfobjs.h b/src/sfnt/sfobjs.h
index 3fbf2dd..e8e3042 100644
--- a/src/sfnt/sfobjs.h
+++ b/src/sfnt/sfobjs.h
@@ -4,7 +4,7 @@
  *
  *   SFNT object management (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,9 +20,8 @@
 #define SFOBJS_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/sfnt.h>
+#include <freetype/internal/ftobjs.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/sfnt/sfwoff.c b/src/sfnt/sfwoff.c
index ca4821a..f0a32e1 100644
--- a/src/sfnt/sfwoff.c
+++ b/src/sfnt/sfwoff.c
@@ -4,7 +4,7 @@
  *
  *   WOFF format management (base).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,12 +16,11 @@
  */
 
 
-#include <ft2build.h>
 #include "sfwoff.h"
-#include FT_TRUETYPE_TAGS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_GZIP_H
+#include <freetype/tttags.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/ftgzip.h>
 
 
   /**************************************************************************
@@ -371,18 +370,18 @@
                                     sfnt + table->OrigOffset, &output_len,
                                     stream->cursor, table->CompLength );
         if ( error )
-          goto Exit;
+          goto Exit1;
         if ( output_len != table->OrigLength )
         {
           FT_ERROR(( "woff_font_open: compressed table length mismatch\n" ));
           error = FT_THROW( Invalid_Table );
-          goto Exit;
+          goto Exit1;
         }
 
 #else /* !FT_CONFIG_OPTION_USE_ZLIB */
 
         error = FT_THROW( Unimplemented_Feature );
-        goto Exit;
+        goto Exit1;
 
 #endif /* !FT_CONFIG_OPTION_USE_ZLIB */
       }
@@ -424,6 +423,10 @@
     }
 
     return error;
+
+  Exit1:
+    FT_FRAME_EXIT();
+    goto Exit;
   }
 
 
diff --git a/src/sfnt/sfwoff.h b/src/sfnt/sfwoff.h
index 15495c3..d177ab1 100644
--- a/src/sfnt/sfwoff.h
+++ b/src/sfnt/sfwoff.h
@@ -4,7 +4,7 @@
  *
  *   WOFFF format management (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,9 +20,8 @@
 #define SFWOFF_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/sfnt.h>
+#include <freetype/internal/ftobjs.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/sfnt/sfwoff2.c b/src/sfnt/sfwoff2.c
new file mode 100644
index 0000000..5c8202f
--- /dev/null
+++ b/src/sfnt/sfwoff2.c
@@ -0,0 +1,2337 @@
+/****************************************************************************
+ *
+ * sfwoff2.c
+ *
+ *   WOFF2 format management (base).
+ *
+ * Copyright (C) 2019-2020 by
+ * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+ * modified, and distributed under the terms of the FreeType project
+ * license, LICENSE.TXT.  By continuing to use, modify, or distribute
+ * this file you indicate that you have read the license and
+ * understand and accept it fully.
+ *
+ */
+
+#include "sfwoff2.h"
+#include "woff2tags.h"
+#include <freetype/tttags.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+
+
+#ifdef FT_CONFIG_OPTION_USE_BROTLI
+
+#include <brotli/decode.h>
+
+#endif
+
+
+  /**************************************************************************
+   *
+   * The macro FT_COMPONENT is used in trace mode.  It is an implicit
+   * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log
+   * messages during execution.
+   */
+#undef  FT_COMPONENT
+#define FT_COMPONENT  sfwoff2
+
+
+#define READ_255USHORT( var )  FT_SET_ERROR( Read255UShort( stream, &var ) )
+
+#define READ_BASE128( var )    FT_SET_ERROR( ReadBase128( stream, &var ) )
+
+  /* `var' should be FT_ULong */
+#define ROUND4( var )          ( ( var + 3 ) & ~3UL )
+
+#define WRITE_USHORT( p, v )                \
+          do                                \
+          {                                 \
+            *(p)++ = (FT_Byte)( (v) >> 8 ); \
+            *(p)++ = (FT_Byte)( (v) >> 0 ); \
+                                            \
+          } while ( 0 )
+
+#define WRITE_ULONG( p, v )                  \
+          do                                 \
+          {                                  \
+            *(p)++ = (FT_Byte)( (v) >> 24 ); \
+            *(p)++ = (FT_Byte)( (v) >> 16 ); \
+            *(p)++ = (FT_Byte)( (v) >>  8 ); \
+            *(p)++ = (FT_Byte)( (v) >>  0 ); \
+                                             \
+          } while ( 0 )
+
+#define WRITE_SHORT( p, v )                 \
+          do                                \
+          {                                 \
+            *(p)++ = (FT_Byte)( (v) >> 8 ); \
+            *(p)++ = (FT_Byte)( (v) >> 0 ); \
+                                            \
+          } while ( 0 )
+
+#define WRITE_SFNT_BUF( buf, s ) \
+          write_buf( &sfnt, sfnt_size, &dest_offset, buf, s, memory )
+
+#define WRITE_SFNT_BUF_AT( offset, buf, s ) \
+          write_buf( &sfnt, sfnt_size, &offset, buf, s, memory )
+
+#define N_CONTOUR_STREAM    0
+#define N_POINTS_STREAM     1
+#define FLAG_STREAM         2
+#define GLYPH_STREAM        3
+#define COMPOSITE_STREAM    4
+#define BBOX_STREAM         5
+#define INSTRUCTION_STREAM  6
+
+
+  static void
+  stream_close( FT_Stream  stream )
+  {
+    FT_Memory  memory = stream->memory;
+
+
+    FT_FREE( stream->base );
+
+    stream->size  = 0;
+    stream->base  = NULL;
+    stream->close = NULL;
+  }
+
+
+  FT_CALLBACK_DEF( int )
+  compare_tags( const void*  a,
+                const void*  b )
+  {
+    WOFF2_Table  table1 = *(WOFF2_Table*)a;
+    WOFF2_Table  table2 = *(WOFF2_Table*)b;
+
+    FT_ULong  tag1 = table1->Tag;
+    FT_ULong  tag2 = table2->Tag;
+
+
+    if ( tag1 > tag2 )
+      return 1;
+    else if ( tag1 < tag2 )
+      return -1;
+    else
+      return 0;
+  }
+
+
+  static FT_Error
+  Read255UShort( FT_Stream   stream,
+                 FT_UShort*  value )
+  {
+    const FT_Byte    oneMoreByteCode1 = 255;
+    const FT_Byte    oneMoreByteCode2 = 254;
+    const FT_Byte    wordCode         = 253;
+    const FT_UShort  lowestUCode      = 253;
+
+    FT_Error   error        = FT_Err_Ok;
+    FT_Byte    code;
+    FT_Byte    result_byte  = 0;
+    FT_UShort  result_short = 0;
+
+
+    if ( FT_READ_BYTE( code ) )
+      return error;
+    if ( code == wordCode )
+    {
+      /* Read next two bytes and store `FT_UShort' value. */
+      if ( FT_READ_USHORT( result_short ) )
+        return error;
+      *value = result_short;
+      return FT_Err_Ok;
+    }
+    else if ( code == oneMoreByteCode1 )
+    {
+      if ( FT_READ_BYTE( result_byte ) )
+        return error;
+      *value = result_byte + lowestUCode;
+      return FT_Err_Ok;
+    }
+    else if ( code == oneMoreByteCode2 )
+    {
+      if ( FT_READ_BYTE( result_byte ) )
+        return error;
+      *value = result_byte + lowestUCode * 2;
+      return FT_Err_Ok;
+    }
+    else
+    {
+      *value = code;
+      return FT_Err_Ok;
+    }
+  }
+
+
+  static FT_Error
+  ReadBase128( FT_Stream  stream,
+               FT_ULong*  value )
+  {
+    FT_ULong  result = 0;
+    FT_Int    i;
+    FT_Byte   code;
+    FT_Error  error  = FT_Err_Ok;
+
+
+    for ( i = 0; i < 5; ++i )
+    {
+      code = 0;
+      if ( FT_READ_BYTE( code ) )
+        return error;
+
+      /* Leading zeros are invalid. */
+      if ( i == 0 && code == 0x80 )
+        return FT_THROW( Invalid_Table );
+
+      /* If any of top seven bits are set then we're about to overflow. */
+      if ( result & 0xfe000000 )
+        return FT_THROW( Invalid_Table );
+
+      result = ( result << 7 ) | ( code & 0x7f );
+
+      /* Spin until most significant bit of data byte is false. */
+      if ( ( code & 0x80 ) == 0 )
+      {
+        *value = result;
+        return FT_Err_Ok;
+      }
+    }
+
+    /* Make sure not to exceed the size bound. */
+    return FT_THROW( Invalid_Table );
+  }
+
+
+  /* Extend memory of `dst_bytes' buffer and copy data from `src'. */
+  static FT_Error
+  write_buf( FT_Byte**  dst_bytes,
+             FT_ULong*  dst_size,
+             FT_ULong*  offset,
+             FT_Byte*   src,
+             FT_ULong   size,
+             FT_Memory  memory )
+  {
+    FT_Error  error = FT_Err_Ok;
+    /* We are reallocating memory for `dst', so its pointer may change. */
+    FT_Byte*  dst   = *dst_bytes;
+
+
+    /* Check whether we are within limits. */
+    if ( ( *offset + size ) > WOFF2_DEFAULT_MAX_SIZE  )
+      return FT_THROW( Array_Too_Large );
+
+    /* Reallocate `dst'. */
+    if ( ( *offset + size ) > *dst_size )
+    {
+      FT_TRACE6(( "Reallocating %lu to %lu.\n",
+                  *dst_size, (*offset + size) ));
+      if ( FT_REALLOC( dst,
+                       (FT_ULong)( *dst_size ),
+                       (FT_ULong)( *offset + size ) ) )
+        goto Exit;
+
+      *dst_size = *offset + size;
+    }
+
+    /* Copy data. */
+    ft_memcpy( dst + *offset, src, size );
+
+    *offset += size;
+    /* Set pointer of `dst' to its correct value. */
+    *dst_bytes = dst;
+
+  Exit:
+    return error;
+  }
+
+
+  /* Pad buffer to closest multiple of 4. */
+  static FT_Error
+  pad4( FT_Byte**  sfnt_bytes,
+        FT_ULong*  sfnt_size,
+        FT_ULong*  out_offset,
+        FT_Memory  memory )
+  {
+    FT_Byte*  sfnt        = *sfnt_bytes;
+    FT_ULong  dest_offset = *out_offset;
+
+    FT_Byte   zeroes[] = { 0, 0, 0 };
+    FT_ULong  pad_bytes;
+
+
+    if ( dest_offset + 3 < dest_offset )
+      return FT_THROW( Invalid_Table );
+
+    pad_bytes = ROUND4( dest_offset ) - dest_offset;
+    if ( pad_bytes > 0 )
+    {
+      if ( WRITE_SFNT_BUF( &zeroes[0], pad_bytes ) )
+        return FT_THROW( Invalid_Table );
+    }
+
+    *sfnt_bytes = sfnt;
+    *out_offset = dest_offset;
+    return FT_Err_Ok;
+  }
+
+
+  /* Calculate table checksum of `buf'. */
+  static FT_ULong
+  compute_ULong_sum( FT_Byte*  buf,
+                     FT_ULong  size )
+  {
+    FT_ULong  checksum     = 0;
+    FT_ULong  aligned_size = size & ~3UL;
+    FT_ULong  i;
+    FT_ULong  v;
+
+
+    for ( i = 0; i < aligned_size; i += 4 )
+      checksum += ( (FT_ULong)buf[i    ] << 24 ) |
+                  ( (FT_ULong)buf[i + 1] << 16 ) |
+                  ( (FT_ULong)buf[i + 2] <<  8 ) |
+                  ( (FT_ULong)buf[i + 3] <<  0 );
+
+    /* If size is not aligned to 4, treat as if it is padded with 0s. */
+    if ( size != aligned_size )
+    {
+      v = 0;
+      for ( i = aligned_size ; i < size; ++i )
+        v |= (FT_ULong)buf[i] << ( 24 - 8 * ( i & 3 ) );
+      checksum += v;
+    }
+
+    return checksum;
+  }
+
+
+  static FT_Error
+  woff2_decompress( FT_Byte*        dst,
+                    FT_ULong        dst_size,
+                    const FT_Byte*  src,
+                    FT_ULong        src_size )
+  {
+#ifdef FT_CONFIG_OPTION_USE_BROTLI
+
+    /* this cast is only of importance on 32bit systems; */
+    /* we don't validate it                              */
+    FT_Offset            uncompressed_size = (FT_Offset)dst_size;
+    BrotliDecoderResult  result;
+
+
+    result = BrotliDecoderDecompress( src_size,
+                                      src,
+                                      &uncompressed_size,
+                                      dst );
+
+    if ( result != BROTLI_DECODER_RESULT_SUCCESS ||
+         uncompressed_size != dst_size           )
+    {
+      FT_ERROR(( "woff2_decompress: Stream length mismatch.\n" ));
+      return FT_THROW( Invalid_Table );
+    }
+
+    FT_TRACE2(( "woff2_decompress: Brotli stream decompressed.\n" ));
+    return FT_Err_Ok;
+
+#else /* !FT_CONFIG_OPTION_USE_BROTLI */
+
+    FT_ERROR(( "woff2_decompress: Brotli support not available.\n" ));
+    return FT_THROW( Unimplemented_Feature );
+
+#endif /* !FT_CONFIG_OPTION_USE_BROTLI */
+  }
+
+
+  static WOFF2_Table
+  find_table( WOFF2_Table*  tables,
+              FT_UShort     num_tables,
+              FT_ULong      tag )
+  {
+    FT_Int  i;
+
+
+    for ( i = 0; i < num_tables; i++ )
+    {
+      if ( tables[i]->Tag == tag )
+        return tables[i];
+    }
+    return NULL;
+  }
+
+
+  /* Read `numberOfHMetrics' field from `hhea' table. */
+  static FT_Error
+  read_num_hmetrics( FT_Stream   stream,
+                     FT_UShort*  num_hmetrics )
+  {
+    FT_Error   error = FT_Err_Ok;
+    FT_UShort  num_metrics;
+
+
+    if ( FT_STREAM_SKIP( 34 )  )
+      return FT_THROW( Invalid_Table );
+
+    if ( FT_READ_USHORT( num_metrics ) )
+      return FT_THROW( Invalid_Table );
+
+    *num_hmetrics = num_metrics;
+
+    return error;
+  }
+
+
+  /* An auxiliary function for overflow-safe addition. */
+  static FT_Int
+  with_sign( FT_Byte  flag,
+             FT_Int   base_val )
+  {
+    /* Precondition: 0 <= base_val < 65536 (to avoid overflow). */
+    return ( flag & 1 ) ? base_val : -base_val;
+  }
+
+
+  /* An auxiliary function for overflow-safe addition. */
+  static FT_Int
+  safe_int_addition( FT_Int   a,
+                     FT_Int   b,
+                     FT_Int*  result )
+  {
+    if ( ( ( a > 0 ) && ( b > FT_INT_MAX - a ) ) ||
+         ( ( a < 0 ) && ( b < FT_INT_MIN - a ) ) )
+      return FT_THROW( Invalid_Table );
+
+    *result = a + b;
+    return FT_Err_Ok;
+  }
+
+
+  /*
+   * Decode variable-length (flag, xCoordinate, yCoordinate) triplet for a
+   * simple glyph.  See
+   *
+   *   https://www.w3.org/TR/WOFF2/#triplet_decoding
+   */
+  static FT_Error
+  triplet_decode( const FT_Byte*  flags_in,
+                  const FT_Byte*  in,
+                  FT_ULong        in_size,
+                  FT_ULong        n_points,
+                  WOFF2_Point     result,
+                  FT_ULong*       in_bytes_used )
+  {
+    FT_Int  x = 0;
+    FT_Int  y = 0;
+    FT_Int  dx;
+    FT_Int  dy;
+    FT_Int  b0, b1, b2;
+
+    FT_ULong  triplet_index = 0;
+    FT_ULong  data_bytes;
+
+    FT_UInt  i;
+
+
+    if ( n_points > in_size )
+      return FT_THROW( Invalid_Table );
+
+    for ( i = 0; i < n_points; ++i )
+    {
+      FT_Byte  flag     = flags_in[i];
+      FT_Bool  on_curve = !( flag >> 7 );
+
+
+      flag &= 0x7f;
+      if ( flag < 84 )
+        data_bytes = 1;
+      else if ( flag < 120 )
+        data_bytes = 2;
+      else if ( flag < 124 )
+        data_bytes = 3;
+      else
+        data_bytes = 4;
+
+      /* Overflow checks */
+      if ( triplet_index + data_bytes > in_size       ||
+           triplet_index + data_bytes < triplet_index )
+        return FT_THROW( Invalid_Table );
+
+      if ( flag < 10 )
+      {
+        dx = 0;
+        dy = with_sign( flag,
+                        ( ( flag & 14 ) << 7 ) + in[triplet_index] );
+      }
+      else if ( flag < 20 )
+      {
+        dx = with_sign( flag,
+                        ( ( ( flag - 10 ) & 14 ) << 7 ) +
+                          in[triplet_index] );
+        dy = 0;
+      }
+      else if ( flag < 84 )
+      {
+        b0 = flag - 20;
+        b1 = in[triplet_index];
+        dx = with_sign( flag,
+                        1 + ( b0 & 0x30 ) + ( b1 >> 4 ) );
+        dy = with_sign( flag >> 1,
+                        1 + ( ( b0 & 0x0c ) << 2 ) + ( b1 & 0x0f ) );
+      }
+      else if ( flag < 120 )
+      {
+        b0 = flag - 84;
+        dx = with_sign( flag,
+                        1 + ( ( b0 / 12 ) << 8 ) + in[triplet_index] );
+        dy = with_sign( flag >> 1,
+                        1 + ( ( ( b0 % 12 ) >> 2 ) << 8 ) +
+                          in[triplet_index + 1] );
+      }
+      else if ( flag < 124 )
+      {
+        b2 = in[triplet_index + 1];
+        dx = with_sign( flag,
+                        ( in[triplet_index] << 4 ) + ( b2 >> 4 ) );
+        dy = with_sign( flag >> 1,
+                        ( ( b2 & 0x0f ) << 8 ) + in[triplet_index + 2] );
+      }
+      else
+      {
+        dx = with_sign( flag,
+                        ( in[triplet_index] << 8 ) +
+                          in[triplet_index + 1] );
+        dy = with_sign( flag >> 1,
+                        ( in[triplet_index + 2] << 8 ) +
+                          in[triplet_index + 3] );
+      }
+
+      triplet_index += data_bytes;
+
+      if ( safe_int_addition( x, dx, &x ) )
+        return FT_THROW( Invalid_Table );
+
+      if ( safe_int_addition( y, dy, &y ) )
+        return FT_THROW( Invalid_Table );
+
+      result[i].x        = x;
+      result[i].y        = y;
+      result[i].on_curve = on_curve;
+    }
+
+    *in_bytes_used = triplet_index;
+    return FT_Err_Ok;
+  }
+
+
+  /* Store decoded points in glyph buffer. */
+  static FT_Error
+  store_points( FT_ULong           n_points,
+                const WOFF2_Point  points,
+                FT_UShort          n_contours,
+                FT_UShort          instruction_len,
+                FT_Byte*           dst,
+                FT_ULong           dst_size,
+                FT_ULong*          glyph_size )
+  {
+    FT_UInt   flag_offset  = 10 + ( 2 * n_contours ) + 2 + instruction_len;
+    FT_Byte   last_flag    = 0xFFU;
+    FT_Byte   repeat_count = 0;
+    FT_Int    last_x       = 0;
+    FT_Int    last_y       = 0;
+    FT_UInt   x_bytes      = 0;
+    FT_UInt   y_bytes      = 0;
+    FT_UInt   xy_bytes;
+    FT_UInt   i;
+    FT_UInt   x_offset;
+    FT_UInt   y_offset;
+    FT_Byte*  pointer;
+
+
+    for ( i = 0; i < n_points; ++i )
+    {
+      const WOFF2_PointRec  point = points[i];
+
+      FT_Byte  flag = point.on_curve ? GLYF_ON_CURVE : 0;
+      FT_Int   dx   = point.x - last_x;
+      FT_Int   dy   = point.y - last_y;
+
+
+      if ( dx == 0 )
+        flag |= GLYF_THIS_X_IS_SAME;
+      else if ( dx > -256 && dx < 256 )
+      {
+        flag |= GLYF_X_SHORT | ( dx > 0 ? GLYF_THIS_X_IS_SAME : 0 );
+        x_bytes += 1;
+      }
+      else
+        x_bytes += 2;
+
+      if ( dy == 0 )
+        flag |= GLYF_THIS_Y_IS_SAME;
+      else if ( dy > -256 && dy < 256 )
+      {
+        flag |= GLYF_Y_SHORT | ( dy > 0 ? GLYF_THIS_Y_IS_SAME : 0 );
+        y_bytes += 1;
+      }
+      else
+        y_bytes += 2;
+
+      if ( flag == last_flag && repeat_count != 255 )
+      {
+        dst[flag_offset - 1] |= GLYF_REPEAT;
+        repeat_count++;
+      }
+      else
+      {
+        if ( repeat_count != 0 )
+        {
+          if ( flag_offset >= dst_size )
+            return FT_THROW( Invalid_Table );
+
+          dst[flag_offset++] = repeat_count;
+        }
+        if ( flag_offset >= dst_size )
+          return FT_THROW( Invalid_Table );
+
+        dst[flag_offset++] = flag;
+        repeat_count       = 0;
+      }
+
+      last_x    = point.x;
+      last_y    = point.y;
+      last_flag = flag;
+    }
+
+    if ( repeat_count != 0 )
+    {
+      if ( flag_offset >= dst_size )
+        return FT_THROW( Invalid_Table );
+
+      dst[flag_offset++] = repeat_count;
+    }
+
+    xy_bytes = x_bytes + y_bytes;
+    if ( xy_bytes < x_bytes                   ||
+         flag_offset + xy_bytes < flag_offset ||
+         flag_offset + xy_bytes > dst_size    )
+      return FT_THROW( Invalid_Table );
+
+    x_offset = flag_offset;
+    y_offset = flag_offset + x_bytes;
+    last_x = 0;
+    last_y = 0;
+
+    for ( i = 0; i < n_points; ++i )
+    {
+      FT_Int  dx = points[i].x - last_x;
+      FT_Int  dy = points[i].y - last_y;
+
+
+      if ( dx == 0 )
+        ;
+      else if ( dx > -256 && dx < 256 )
+        dst[x_offset++] = (FT_Byte)FT_ABS( dx );
+      else
+      {
+        pointer = dst + x_offset;
+        WRITE_SHORT( pointer, dx );
+        x_offset += 2;
+      }
+
+      last_x += dx;
+
+      if ( dy == 0 )
+        ;
+      else if ( dy > -256 && dy < 256 )
+        dst[y_offset++] = (FT_Byte)FT_ABS( dy );
+      else
+      {
+        pointer = dst + y_offset;
+        WRITE_SHORT( pointer, dy );
+        y_offset += 2;
+      }
+
+      last_y += dy;
+    }
+
+    *glyph_size = y_offset;
+    return FT_Err_Ok;
+  }
+
+
+  static void
+  compute_bbox( FT_ULong           n_points,
+                const WOFF2_Point  points,
+                FT_Byte*           dst,
+                FT_UShort*         src_x_min )
+  {
+    FT_Int  x_min = 0;
+    FT_Int  y_min = 0;
+    FT_Int  x_max = 0;
+    FT_Int  y_max = 0;
+
+    FT_UInt  i;
+
+    FT_ULong  offset;
+    FT_Byte*  pointer;
+
+
+    if ( n_points > 0 )
+    {
+      x_min = points[0].x;
+      y_min = points[0].y;
+      x_max = points[0].x;
+      y_max = points[0].y;
+    }
+
+    for ( i = 1; i < n_points; ++i )
+    {
+      FT_Int  x = points[i].x;
+      FT_Int  y = points[i].y;
+
+
+      x_min = FT_MIN( x, x_min );
+      y_min = FT_MIN( y, y_min );
+      x_max = FT_MAX( x, x_max );
+      y_max = FT_MAX( y, y_max );
+    }
+
+    /* Write values to `glyf' record. */
+    offset  = 2;
+    pointer = dst + offset;
+
+    WRITE_SHORT( pointer, x_min );
+    WRITE_SHORT( pointer, y_min );
+    WRITE_SHORT( pointer, x_max );
+    WRITE_SHORT( pointer, y_max );
+
+    *src_x_min = (FT_UShort)x_min;
+  }
+
+
+  static FT_Error
+  compositeGlyph_size( FT_Stream  stream,
+                       FT_ULong   offset,
+                       FT_ULong*  size,
+                       FT_Bool*   have_instructions )
+  {
+    FT_Error   error        = FT_Err_Ok;
+    FT_ULong   start_offset = offset;
+    FT_Bool    we_have_inst = FALSE;
+    FT_UShort  flags        = FLAG_MORE_COMPONENTS;
+
+
+    if ( FT_STREAM_SEEK( start_offset ) )
+      goto Exit;
+    while ( flags & FLAG_MORE_COMPONENTS )
+    {
+      FT_ULong  arg_size;
+
+
+      if ( FT_READ_USHORT( flags ) )
+        goto Exit;
+      we_have_inst |= ( flags & FLAG_WE_HAVE_INSTRUCTIONS ) != 0;
+      /* glyph index */
+      arg_size = 2;
+      if ( flags & FLAG_ARG_1_AND_2_ARE_WORDS )
+        arg_size += 4;
+      else
+        arg_size += 2;
+
+      if ( flags & FLAG_WE_HAVE_A_SCALE )
+        arg_size += 2;
+      else if ( flags & FLAG_WE_HAVE_AN_X_AND_Y_SCALE )
+        arg_size += 4;
+      else if ( flags & FLAG_WE_HAVE_A_TWO_BY_TWO )
+        arg_size += 8;
+
+      if ( FT_STREAM_SKIP( arg_size ) )
+        goto Exit;
+    }
+
+    *size              = FT_STREAM_POS() - start_offset;
+    *have_instructions = we_have_inst;
+
+  Exit:
+    return error;
+  }
+
+
+  /* Store loca values (provided by `reconstruct_glyf') to output stream. */
+  static FT_Error
+  store_loca( FT_ULong*  loca_values,
+              FT_ULong   loca_values_size,
+              FT_UShort  index_format,
+              FT_ULong*  checksum,
+              FT_Byte**  sfnt_bytes,
+              FT_ULong*  sfnt_size,
+              FT_ULong*  out_offset,
+              FT_Memory  memory )
+  {
+    FT_Error  error       = FT_Err_Ok;
+    FT_Byte*  sfnt        = *sfnt_bytes;
+    FT_ULong  dest_offset = *out_offset;
+
+    FT_Byte*  loca_buf = NULL;
+    FT_Byte*  dst      = NULL;
+
+    FT_UInt   i = 0;
+    FT_ULong  loca_buf_size;
+
+    const FT_ULong  offset_size = index_format ? 4 : 2;
+
+
+    if ( ( loca_values_size << 2 ) >> 2 != loca_values_size )
+      goto Fail;
+
+    loca_buf_size = loca_values_size * offset_size;
+    if ( FT_NEW_ARRAY( loca_buf, loca_buf_size ) )
+      goto Fail;
+
+    dst = loca_buf;
+    for ( i = 0; i < loca_values_size; i++ )
+    {
+      FT_ULong  value = loca_values[i];
+
+
+      if ( index_format )
+        WRITE_ULONG( dst, value );
+      else
+        WRITE_USHORT( dst, ( value >> 1 ) );
+    }
+
+    *checksum = compute_ULong_sum( loca_buf, loca_buf_size );
+    /* Write `loca' table to sfnt buffer. */
+    if ( WRITE_SFNT_BUF( loca_buf, loca_buf_size ) )
+      goto Fail;
+
+    /* Set pointer `sfnt_bytes' to its correct value. */
+    *sfnt_bytes = sfnt;
+    *out_offset = dest_offset;
+
+    FT_FREE( loca_buf );
+    return error;
+
+  Fail:
+    if ( !error )
+      error = FT_THROW( Invalid_Table );
+
+    FT_FREE( loca_buf );
+
+    return error;
+  }
+
+
+  static FT_Error
+  reconstruct_glyf( FT_Stream    stream,
+                    FT_ULong*    glyf_checksum,
+                    FT_ULong*    loca_checksum,
+                    FT_Byte**    sfnt_bytes,
+                    FT_ULong*    sfnt_size,
+                    FT_ULong*    out_offset,
+                    WOFF2_Info   info,
+                    FT_Memory    memory )
+  {
+    FT_Error  error = FT_Err_Ok;
+    FT_Byte*  sfnt  = *sfnt_bytes;
+
+    /* current position in stream */
+    const FT_ULong  pos = FT_STREAM_POS();
+
+    FT_UInt  num_substreams = 7;
+
+    FT_UShort  num_glyphs;
+    FT_UShort  index_format;
+    FT_ULong   expected_loca_length;
+    FT_UInt    offset;
+    FT_UInt    i;
+    FT_ULong   points_size;
+    FT_ULong   bitmap_length;
+    FT_ULong   glyph_buf_size;
+    FT_ULong   bbox_bitmap_offset;
+
+    const FT_ULong  glyf_start  = *out_offset;
+    FT_ULong        dest_offset = *out_offset;
+
+    WOFF2_Substream  substreams = NULL;
+
+    FT_ULong*    loca_values  = NULL;
+    FT_UShort*   n_points_arr = NULL;
+    FT_Byte*     glyph_buf    = NULL;
+    WOFF2_Point  points       = NULL;
+
+
+    if ( FT_NEW_ARRAY( substreams, num_substreams ) )
+      goto Fail;
+
+    if ( FT_STREAM_SKIP( 4 ) )
+      goto Fail;
+    if ( FT_READ_USHORT( num_glyphs ) )
+      goto Fail;
+    if ( FT_READ_USHORT( index_format ) )
+      goto Fail;
+
+    FT_TRACE4(( "num_glyphs = %u; index_format = %u\n",
+                num_glyphs, index_format ));
+
+    info->num_glyphs = num_glyphs;
+
+    /* Calculate expected length of loca and compare.          */
+    /* See https://www.w3.org/TR/WOFF2/#conform-mustRejectLoca */
+    /* index_format = 0 => Short version `loca'.               */
+    /* index_format = 1 => Long version `loca'.                */
+    expected_loca_length = ( index_format ? 4 : 2 ) *
+                             ( (FT_ULong)num_glyphs + 1 );
+    if ( info->loca_table->dst_length != expected_loca_length )
+      goto Fail;
+
+    offset = ( 2 + num_substreams ) * 4;
+    if ( offset > info->glyf_table->TransformLength )
+      goto Fail;
+
+    for ( i = 0; i < num_substreams; ++i )
+    {
+      FT_ULong  substream_size;
+
+
+      if ( FT_READ_ULONG( substream_size ) )
+        goto Fail;
+      if ( substream_size > info->glyf_table->TransformLength - offset )
+        goto Fail;
+
+      substreams[i].start  = pos + offset;
+      substreams[i].offset = pos + offset;
+      substreams[i].size   = substream_size;
+
+      FT_TRACE5(( "  Substream %d: offset = %lu; size = %lu;\n",
+                  i, substreams[i].offset, substreams[i].size ));
+      offset += substream_size;
+    }
+
+    if ( FT_NEW_ARRAY( loca_values, num_glyphs + 1 ) )
+      goto Fail;
+
+    points_size        = 0;
+    bbox_bitmap_offset = substreams[BBOX_STREAM].offset;
+
+    /* Size of bboxBitmap = 4 * floor((numGlyphs + 31) / 32) */
+    bitmap_length                   = ( ( num_glyphs + 31U ) >> 5 ) << 2;
+    substreams[BBOX_STREAM].offset += bitmap_length;
+
+    glyph_buf_size = WOFF2_DEFAULT_GLYPH_BUF;
+    if ( FT_NEW_ARRAY( glyph_buf, glyph_buf_size ) )
+      goto Fail;
+
+    if ( FT_NEW_ARRAY( info->x_mins, num_glyphs ) )
+      goto Fail;
+
+    for ( i = 0; i < num_glyphs; ++i )
+    {
+      FT_ULong   glyph_size = 0;
+      FT_UShort  n_contours = 0;
+      FT_Bool    have_bbox  = FALSE;
+      FT_Byte    bbox_bitmap;
+      FT_ULong   bbox_offset;
+      FT_UShort  x_min      = 0;
+
+
+      /* Set `have_bbox'. */
+      bbox_offset = bbox_bitmap_offset + ( i >> 3 );
+      if ( FT_STREAM_SEEK( bbox_offset ) ||
+           FT_READ_BYTE( bbox_bitmap )   )
+        goto Fail;
+      if ( bbox_bitmap & ( 0x80 >> ( i & 7 ) ) )
+        have_bbox = TRUE;
+
+      /* Read value from `nContourStream'. */
+      if ( FT_STREAM_SEEK( substreams[N_CONTOUR_STREAM].offset ) ||
+           FT_READ_USHORT( n_contours )                          )
+        goto Fail;
+      substreams[N_CONTOUR_STREAM].offset += 2;
+
+      if ( n_contours == 0xffff )
+      {
+        /* composite glyph */
+        FT_Bool    have_instructions = FALSE;
+        FT_UShort  instruction_size  = 0;
+        FT_ULong   composite_size;
+        FT_ULong   size_needed;
+        FT_Byte*   pointer           = NULL;
+
+
+        /* Composite glyphs must have explicit bbox. */
+        if ( !have_bbox )
+          goto Fail;
+
+        if ( compositeGlyph_size( stream,
+                                  substreams[COMPOSITE_STREAM].offset,
+                                  &composite_size,
+                                  &have_instructions) )
+          goto Fail;
+
+        if ( have_instructions )
+        {
+          if ( FT_STREAM_SEEK( substreams[GLYPH_STREAM].offset ) ||
+               READ_255USHORT( instruction_size )                )
+            goto Fail;
+          substreams[GLYPH_STREAM].offset = FT_STREAM_POS();
+        }
+
+        size_needed = 12 + composite_size + instruction_size;
+        if ( glyph_buf_size < size_needed )
+        {
+          if ( FT_RENEW_ARRAY( glyph_buf, glyph_buf_size, size_needed ) )
+            goto Fail;
+          glyph_buf_size = size_needed;
+        }
+
+        pointer = glyph_buf + glyph_size;
+        WRITE_USHORT( pointer, n_contours );
+        glyph_size += 2;
+
+        /* Read x_min for current glyph. */
+        if ( FT_STREAM_SEEK( substreams[BBOX_STREAM].offset ) ||
+             FT_READ_USHORT( x_min )                          )
+          goto Fail;
+        /* No increment here because we read again. */
+
+        if ( FT_STREAM_SEEK( substreams[BBOX_STREAM].offset ) ||
+             FT_STREAM_READ( glyph_buf + glyph_size, 8 )      )
+          goto Fail;
+
+        substreams[BBOX_STREAM].offset += 8;
+        glyph_size                     += 8;
+
+        if ( FT_STREAM_SEEK( substreams[COMPOSITE_STREAM].offset )    ||
+             FT_STREAM_READ( glyph_buf + glyph_size, composite_size ) )
+          goto Fail;
+
+        substreams[COMPOSITE_STREAM].offset += composite_size;
+        glyph_size                          += composite_size;
+
+        if ( have_instructions )
+        {
+          pointer = glyph_buf + glyph_size;
+          WRITE_USHORT( pointer, instruction_size );
+          glyph_size += 2;
+
+          if ( FT_STREAM_SEEK( substreams[INSTRUCTION_STREAM].offset )    ||
+               FT_STREAM_READ( glyph_buf + glyph_size, instruction_size ) )
+            goto Fail;
+
+          substreams[INSTRUCTION_STREAM].offset += instruction_size;
+          glyph_size                            += instruction_size;
+        }
+      }
+      else if ( n_contours > 0 )
+      {
+        /* simple glyph */
+        FT_ULong   total_n_points = 0;
+        FT_UShort  n_points_contour;
+        FT_UInt    j;
+        FT_ULong   flag_size;
+        FT_ULong   triplet_size;
+        FT_ULong   triplet_bytes_used;
+        FT_Byte*   flags_buf   = NULL;
+        FT_Byte*   triplet_buf = NULL;
+        FT_UShort  instruction_size;
+        FT_ULong   size_needed;
+        FT_Int     end_point;
+        FT_UInt    contour_ix;
+
+        FT_Byte*   pointer = NULL;
+
+
+        if ( FT_NEW_ARRAY( n_points_arr, n_contours ) )
+          goto Fail;
+
+        if ( FT_STREAM_SEEK( substreams[N_POINTS_STREAM].offset ) )
+          goto Fail;
+
+        for ( j = 0; j < n_contours; ++j )
+        {
+          if ( READ_255USHORT( n_points_contour ) )
+            goto Fail;
+          n_points_arr[j] = n_points_contour;
+          /* Prevent negative/overflow. */
+          if ( total_n_points + n_points_contour < total_n_points )
+            goto Fail;
+          total_n_points += n_points_contour;
+        }
+        substreams[N_POINTS_STREAM].offset = FT_STREAM_POS();
+
+        flag_size = total_n_points;
+        if ( flag_size > substreams[FLAG_STREAM].size )
+          goto Fail;
+
+        flags_buf   = stream->base + substreams[FLAG_STREAM].offset;
+        triplet_buf = stream->base + substreams[GLYPH_STREAM].offset;
+
+        if ( substreams[GLYPH_STREAM].size <
+               ( substreams[GLYPH_STREAM].offset -
+                 substreams[GLYPH_STREAM].start ) )
+          goto Fail;
+
+        triplet_size       = substreams[GLYPH_STREAM].size -
+                               ( substreams[GLYPH_STREAM].offset -
+                                 substreams[GLYPH_STREAM].start );
+        triplet_bytes_used = 0;
+
+        /* Create array to store point information. */
+        points_size = total_n_points;
+        if ( FT_NEW_ARRAY( points, points_size ) )
+          goto Fail;
+
+        if ( triplet_decode( flags_buf,
+                             triplet_buf,
+                             triplet_size,
+                             total_n_points,
+                             points,
+                             &triplet_bytes_used ) )
+          goto Fail;
+
+        substreams[FLAG_STREAM].offset  += flag_size;
+        substreams[GLYPH_STREAM].offset += triplet_bytes_used;
+
+        if ( FT_STREAM_SEEK( substreams[GLYPH_STREAM].offset ) ||
+             READ_255USHORT( instruction_size )                )
+          goto Fail;
+
+        substreams[GLYPH_STREAM].offset = FT_STREAM_POS();
+
+        if ( total_n_points >= ( 1 << 27 ) )
+          goto Fail;
+
+        size_needed = 12 +
+                      ( 2 * n_contours ) +
+                      ( 5 * total_n_points ) +
+                      instruction_size;
+        if ( glyph_buf_size < size_needed )
+        {
+          if ( FT_RENEW_ARRAY( glyph_buf, glyph_buf_size, size_needed ) )
+            goto Fail;
+          glyph_buf_size = size_needed;
+        }
+
+        pointer = glyph_buf + glyph_size;
+        WRITE_USHORT( pointer, n_contours );
+        glyph_size += 2;
+
+        if ( have_bbox )
+        {
+          /* Read x_min for current glyph. */
+          if ( FT_STREAM_SEEK( substreams[BBOX_STREAM].offset ) ||
+               FT_READ_USHORT( x_min )                          )
+            goto Fail;
+          /* No increment here because we read again. */
+
+          if ( FT_STREAM_SEEK( substreams[BBOX_STREAM].offset ) ||
+               FT_STREAM_READ( glyph_buf + glyph_size, 8 )      )
+            goto Fail;
+          substreams[BBOX_STREAM].offset += 8;
+        }
+        else
+          compute_bbox( total_n_points, points, glyph_buf, &x_min );
+
+        glyph_size = CONTOUR_OFFSET_END_POINT;
+
+        pointer   = glyph_buf + glyph_size;
+        end_point = -1;
+
+        for ( contour_ix = 0; contour_ix < n_contours; ++contour_ix )
+        {
+          end_point += n_points_arr[contour_ix];
+          if ( end_point >= 65536 )
+            goto Fail;
+
+          WRITE_SHORT( pointer, end_point );
+          glyph_size += 2;
+        }
+
+        WRITE_USHORT( pointer, instruction_size );
+        glyph_size += 2;
+
+        if ( FT_STREAM_SEEK( substreams[INSTRUCTION_STREAM].offset )    ||
+             FT_STREAM_READ( glyph_buf + glyph_size, instruction_size ) )
+          goto Fail;
+
+        substreams[INSTRUCTION_STREAM].offset += instruction_size;
+        glyph_size                            += instruction_size;
+
+        if ( store_points( total_n_points,
+                           points,
+                           n_contours,
+                           instruction_size,
+                           glyph_buf,
+                           glyph_buf_size,
+                           &glyph_size ) )
+          goto Fail;
+
+        FT_FREE( points );
+        FT_FREE( n_points_arr );
+      }
+      else
+      {
+        /* Empty glyph.          */
+        /* Must not have a bbox. */
+        if ( have_bbox )
+        {
+          FT_ERROR(( "Empty glyph has a bbox.\n" ));
+          goto Fail;
+        }
+      }
+
+      loca_values[i] = dest_offset - glyf_start;
+
+      if ( WRITE_SFNT_BUF( glyph_buf, glyph_size ) )
+        goto Fail;
+
+      if ( pad4( &sfnt, sfnt_size, &dest_offset, memory ) )
+        goto Fail;
+
+      *glyf_checksum += compute_ULong_sum( glyph_buf, glyph_size );
+
+      /* Store x_mins, may be required to reconstruct `hmtx'. */
+      if ( n_contours > 0 )
+        info->x_mins[i] = (FT_Short)x_min;
+    }
+
+    info->glyf_table->dst_length = dest_offset - info->glyf_table->dst_offset;
+    info->loca_table->dst_offset = dest_offset;
+
+    /* `loca[n]' will be equal to the length of the `glyf' table. */
+    loca_values[num_glyphs] = info->glyf_table->dst_length;
+
+    if ( store_loca( loca_values,
+                     num_glyphs + 1,
+                     index_format,
+                     loca_checksum,
+                     &sfnt,
+                     sfnt_size,
+                     &dest_offset,
+                     memory ) )
+      goto Fail;
+
+    info->loca_table->dst_length = dest_offset - info->loca_table->dst_offset;
+
+    FT_TRACE4(( "  loca table info:\n" ));
+    FT_TRACE4(( "    dst_offset = %lu\n", info->loca_table->dst_offset ));
+    FT_TRACE4(( "    dst_length = %lu\n", info->loca_table->dst_length ));
+    FT_TRACE4(( "    checksum = %09lx\n", *loca_checksum ));
+
+    /* Set pointer `sfnt_bytes' to its correct value. */
+    *sfnt_bytes = sfnt;
+    *out_offset = dest_offset;
+
+    FT_FREE( substreams );
+    FT_FREE( loca_values );
+    FT_FREE( n_points_arr );
+    FT_FREE( glyph_buf );
+    FT_FREE( points );
+
+    return error;
+
+  Fail:
+    if ( !error )
+      error = FT_THROW( Invalid_Table );
+
+    /* Set pointer `sfnt_bytes' to its correct value. */
+    *sfnt_bytes = sfnt;
+
+    FT_FREE( substreams );
+    FT_FREE( loca_values );
+    FT_FREE( n_points_arr );
+    FT_FREE( glyph_buf );
+    FT_FREE( points );
+
+    return error;
+  }
+
+
+  /* Get `x_mins' for untransformed `glyf' table. */
+  static FT_Error
+  get_x_mins( FT_Stream     stream,
+              WOFF2_Table*  tables,
+              FT_UShort     num_tables,
+              WOFF2_Info    info,
+              FT_Memory     memory )
+  {
+    FT_UShort  num_glyphs;
+    FT_UShort  index_format;
+    FT_ULong   glyf_offset;
+    FT_UShort  glyf_offset_short;
+    FT_ULong   loca_offset;
+    FT_Int     i;
+    FT_Error   error = FT_Err_Ok;
+    FT_ULong   offset_size;
+
+    /* At this point of time those tables might not have been read yet. */
+    const WOFF2_Table  maxp_table = find_table( tables, num_tables,
+                                                TTAG_maxp );
+    const WOFF2_Table  head_table = find_table( tables, num_tables,
+                                                TTAG_head );
+
+
+    if ( !maxp_table )
+    {
+      FT_ERROR(( "`maxp' table is missing.\n" ));
+      return FT_THROW( Invalid_Table );
+    }
+
+    if ( !head_table )
+    {
+      FT_ERROR(( "`head' table is missing.\n" ));
+      return FT_THROW( Invalid_Table );
+    }
+
+    if ( !info->loca_table )
+    {
+      FT_ERROR(( "`loca' table is missing.\n" ));
+      return FT_THROW( Invalid_Table );
+    }
+
+    /* Read `numGlyphs' field from `maxp' table. */
+    if ( FT_STREAM_SEEK( maxp_table->src_offset ) || FT_STREAM_SKIP( 8 ) )
+      return error;
+
+    if ( FT_READ_USHORT( num_glyphs ) )
+      return error;
+
+    info->num_glyphs = num_glyphs;
+
+    /* Read `indexToLocFormat' field from `head' table. */
+    if ( FT_STREAM_SEEK( head_table->src_offset ) ||
+         FT_STREAM_SKIP( 50 )                     )
+      return error;
+
+    if ( FT_READ_USHORT( index_format ) )
+      return error;
+
+    offset_size = index_format ? 4 : 2;
+
+    /* Create `x_mins' array. */
+    if ( FT_NEW_ARRAY( info->x_mins, num_glyphs ) )
+      return error;
+
+    loca_offset = info->loca_table->src_offset;
+
+    for ( i = 0; i < num_glyphs; ++i )
+    {
+      if ( FT_STREAM_SEEK( loca_offset ) )
+        return error;
+
+      loca_offset += offset_size;
+
+      if ( index_format )
+      {
+        if ( FT_READ_ULONG( glyf_offset ) )
+          return error;
+      }
+      else
+      {
+        if ( FT_READ_USHORT( glyf_offset_short ) )
+          return error;
+
+        glyf_offset = (FT_ULong)( glyf_offset_short );
+        glyf_offset = glyf_offset << 1;
+      }
+
+      glyf_offset += info->glyf_table->src_offset;
+
+      if ( FT_STREAM_SEEK( glyf_offset ) || FT_STREAM_SKIP( 2 ) )
+        return error;
+
+      if ( FT_READ_SHORT( info->x_mins[i] ) )
+        return error;
+    }
+
+    return error;
+  }
+
+
+  static FT_Error
+  reconstruct_hmtx( FT_Stream  stream,
+                    FT_UShort  num_glyphs,
+                    FT_UShort  num_hmetrics,
+                    FT_Short*  x_mins,
+                    FT_ULong*  checksum,
+                    FT_Byte**  sfnt_bytes,
+                    FT_ULong*  sfnt_size,
+                    FT_ULong*  out_offset,
+                    FT_Memory  memory )
+  {
+    FT_Error  error       = FT_Err_Ok;
+    FT_Byte*  sfnt        = *sfnt_bytes;
+    FT_ULong  dest_offset = *out_offset;
+
+    FT_Byte   hmtx_flags;
+    FT_Bool   has_proportional_lsbs, has_monospace_lsbs;
+    FT_ULong  hmtx_table_size;
+    FT_Int    i;
+
+    FT_UShort*  advance_widths = NULL;
+    FT_Short*   lsbs           = NULL;
+    FT_Byte*    hmtx_table     = NULL;
+    FT_Byte*    dst            = NULL;
+
+
+    if ( FT_READ_BYTE( hmtx_flags ) )
+      goto Fail;
+
+    has_proportional_lsbs = ( hmtx_flags & 1 ) == 0;
+    has_monospace_lsbs    = ( hmtx_flags & 2 ) == 0;
+
+    /* Bits 2-7 are reserved and MUST be zero. */
+    if ( ( hmtx_flags & 0xFC ) != 0 )
+      goto Fail;
+
+    /* Are you REALLY transformed? */
+    if ( has_proportional_lsbs && has_monospace_lsbs )
+      goto Fail;
+
+    /* Cannot have a transformed `hmtx' without `glyf'. */
+    if ( ( num_hmetrics > num_glyphs ) ||
+         ( num_hmetrics < 1 )          )
+      goto Fail;
+
+    /* Must have at least one entry. */
+    if ( num_hmetrics < 1 )
+      goto Fail;
+
+    if ( FT_NEW_ARRAY( advance_widths, num_hmetrics ) ||
+         FT_NEW_ARRAY( lsbs, num_glyphs )             )
+      goto Fail;
+
+    /* Read `advanceWidth' stream.  Always present. */
+    for ( i = 0; i < num_hmetrics; i++ )
+    {
+      FT_UShort  advance_width;
+
+
+      if ( FT_READ_USHORT( advance_width ) )
+        goto Fail;
+
+      advance_widths[i] = advance_width;
+    }
+
+    /* lsb values for proportional glyphs. */
+    for ( i = 0; i < num_hmetrics; i++ )
+    {
+      FT_Short  lsb;
+
+
+      if ( has_proportional_lsbs )
+      {
+        if ( FT_READ_SHORT( lsb ) )
+          goto Fail;
+      }
+      else
+        lsb = x_mins[i];
+
+      lsbs[i] = lsb;
+    }
+
+    /* lsb values for monospaced glyphs. */
+    for ( i = num_hmetrics; i < num_glyphs; i++ )
+    {
+      FT_Short  lsb;
+
+
+      if ( has_monospace_lsbs )
+      {
+        if ( FT_READ_SHORT( lsb ) )
+          goto Fail;
+      }
+      else
+        lsb = x_mins[i];
+
+      lsbs[i] = lsb;
+    }
+
+    /* Build the hmtx table. */
+    hmtx_table_size = 2 * num_hmetrics + 2 * num_glyphs;
+    if ( FT_NEW_ARRAY( hmtx_table, hmtx_table_size ) )
+      goto Fail;
+
+    dst = hmtx_table;
+    FT_TRACE6(( "hmtx values: \n" ));
+    for ( i = 0; i < num_glyphs; i++ )
+    {
+      if ( i < num_hmetrics )
+      {
+        WRITE_SHORT( dst, advance_widths[i] );
+        FT_TRACE6(( "%d ", advance_widths[i] ));
+      }
+
+      WRITE_SHORT( dst, lsbs[i] );
+      FT_TRACE6(( "%d ", lsbs[i] ));
+    }
+    FT_TRACE6(( "\n" ));
+
+    *checksum = compute_ULong_sum( hmtx_table, hmtx_table_size );
+    /* Write `hmtx' table to sfnt buffer. */
+    if ( WRITE_SFNT_BUF( hmtx_table, hmtx_table_size ) )
+      goto Fail;
+
+    /* Set pointer `sfnt_bytes' to its correct value. */
+    *sfnt_bytes = sfnt;
+    *out_offset = dest_offset;
+
+    FT_FREE( advance_widths );
+    FT_FREE( lsbs );
+    FT_FREE( hmtx_table );
+
+    return error;
+
+  Fail:
+    FT_FREE( advance_widths );
+    FT_FREE( lsbs );
+    FT_FREE( hmtx_table );
+
+    if ( !error )
+      error = FT_THROW( Invalid_Table );
+
+    return error;
+  }
+
+
+  static FT_Error
+  reconstruct_font( FT_Byte*      transformed_buf,
+                    FT_ULong      transformed_buf_size,
+                    WOFF2_Table*  indices,
+                    WOFF2_Header  woff2,
+                    WOFF2_Info    info,
+                    FT_Byte**     sfnt_bytes,
+                    FT_ULong*     sfnt_size,
+                    FT_Memory     memory )
+  {
+    /* Memory management of `transformed_buf' is handled by the caller. */
+
+    FT_Error   error       = FT_Err_Ok;
+    FT_Stream  stream      = NULL;
+    FT_Byte*   buf_cursor  = NULL;
+    FT_Byte*   table_entry = NULL;
+
+    /* We are reallocating memory for `sfnt', so its pointer may change. */
+    FT_Byte*   sfnt = *sfnt_bytes;
+
+    FT_UShort  num_tables  = woff2->num_tables;
+    FT_ULong   dest_offset = 12 + num_tables * 16UL;
+
+    FT_ULong   checksum      = 0;
+    FT_ULong   loca_checksum = 0;
+    FT_Int     nn            = 0;
+    FT_UShort  num_hmetrics  = 0;
+    FT_ULong   font_checksum = info->header_checksum;
+    FT_Bool    is_glyf_xform = FALSE;
+
+    FT_ULong  table_entry_offset = 12;
+
+
+    /* A few table checks before reconstruction. */
+    /* `glyf' must be present with `loca'.       */
+    info->glyf_table = find_table( indices, num_tables, TTAG_glyf );
+    info->loca_table = find_table( indices, num_tables, TTAG_loca );
+
+    if ( ( info->glyf_table == NULL ) ^ ( info->loca_table == NULL ) )
+    {
+      FT_ERROR(( "One of `glyf'/`loca' tables missing.\n" ));
+      return FT_THROW( Invalid_Table );
+    }
+
+    /* Both `glyf' and `loca' must have same transformation. */
+    if ( info->glyf_table != NULL )
+    {
+      if ( ( info->glyf_table->flags & WOFF2_FLAGS_TRANSFORM ) !=
+           ( info->loca_table->flags & WOFF2_FLAGS_TRANSFORM ) )
+      {
+        FT_ERROR(( "Transformation mismatch"
+                   " between `glyf' and `loca' table." ));
+        return FT_THROW( Invalid_Table );
+      }
+    }
+
+    /* Create buffer for table entries. */
+    if ( FT_NEW_ARRAY( table_entry, 16 ) )
+      goto Fail;
+
+    /* Create a stream for the uncompressed buffer. */
+    if ( FT_NEW( stream ) )
+      goto Fail;
+    FT_Stream_OpenMemory( stream, transformed_buf, transformed_buf_size );
+
+    FT_ASSERT( FT_STREAM_POS() == 0 );
+
+    /* Reconstruct/copy tables to output stream. */
+    for ( nn = 0; nn < num_tables; nn++ )
+    {
+      WOFF2_TableRec  table = *( indices[nn] );
+
+
+      FT_TRACE3(( "Seeking to %ld with table size %ld.\n",
+                  table.src_offset, table.src_length ));
+      FT_TRACE3(( "Table tag: %c%c%c%c.\n",
+                  (FT_Char)( table.Tag >> 24 ),
+                  (FT_Char)( table.Tag >> 16 ),
+                  (FT_Char)( table.Tag >> 8  ),
+                  (FT_Char)( table.Tag       ) ));
+
+      if ( FT_STREAM_SEEK( table.src_offset ) )
+        goto Fail;
+
+      if ( table.src_offset + table.src_length > transformed_buf_size )
+        goto Fail;
+
+      /* Get stream size for fields of `hmtx' table. */
+      if ( table.Tag == TTAG_hhea )
+      {
+        if ( read_num_hmetrics( stream, &num_hmetrics ) )
+          goto Fail;
+      }
+
+      info->num_hmetrics = num_hmetrics;
+
+      checksum = 0;
+      if ( ( table.flags & WOFF2_FLAGS_TRANSFORM ) != WOFF2_FLAGS_TRANSFORM )
+      {
+        /* Check whether `head' is at least 12 bytes. */
+        if ( table.Tag == TTAG_head )
+        {
+          if ( table.src_length < 12 )
+            goto Fail;
+
+          buf_cursor = transformed_buf + table.src_offset + 8;
+          /* Set checkSumAdjustment = 0 */
+          WRITE_ULONG( buf_cursor, 0 );
+        }
+
+        table.dst_offset = dest_offset;
+
+        checksum = compute_ULong_sum( transformed_buf + table.src_offset,
+                                      table.src_length );
+        FT_TRACE4(( "Checksum = %09lx.\n", checksum ));
+
+        if ( WRITE_SFNT_BUF( transformed_buf + table.src_offset,
+                             table.src_length ) )
+          goto Fail;
+      }
+      else
+      {
+        FT_TRACE3(( "This table is transformed.\n" ));
+
+        if ( table.Tag == TTAG_glyf )
+        {
+          is_glyf_xform    = TRUE;
+          table.dst_offset = dest_offset;
+
+          if ( reconstruct_glyf( stream,
+                                 &checksum,
+                                 &loca_checksum,
+                                 &sfnt,
+                                 sfnt_size,
+                                 &dest_offset,
+                                 info,
+                                 memory ) )
+            goto Fail;
+
+          FT_TRACE4(( "Checksum = %09lx.\n", checksum ));
+        }
+
+        else if ( table.Tag == TTAG_loca )
+          checksum = loca_checksum;
+
+        else if ( table.Tag == TTAG_hmtx )
+        {
+          /* If glyf is not transformed and hmtx is, handle separately. */
+          if ( !is_glyf_xform )
+          {
+            if ( get_x_mins( stream, indices, num_tables, info, memory ) )
+              goto Fail;
+          }
+
+          table.dst_offset = dest_offset;
+
+          if ( reconstruct_hmtx( stream,
+                                 info->num_glyphs,
+                                 info->num_hmetrics,
+                                 info->x_mins,
+                                 &checksum,
+                                 &sfnt,
+                                 sfnt_size,
+                                 &dest_offset,
+                                 memory ) )
+            goto Fail;
+        }
+        else
+        {
+          /* Unknown transform. */
+          FT_ERROR(( "Unknown table transform.\n" ));
+          goto Fail;
+        }
+      }
+
+      font_checksum += checksum;
+
+      buf_cursor = &table_entry[0];
+      WRITE_ULONG( buf_cursor, table.Tag );
+      WRITE_ULONG( buf_cursor, checksum );
+      WRITE_ULONG( buf_cursor, table.dst_offset );
+      WRITE_ULONG( buf_cursor, table.dst_length );
+
+      WRITE_SFNT_BUF_AT( table_entry_offset, table_entry, 16 );
+
+      /* Update checksum. */
+      font_checksum += compute_ULong_sum( table_entry, 16 );
+
+      if ( pad4( &sfnt, sfnt_size, &dest_offset, memory ) )
+        goto Fail;
+
+      /* Sanity check. */
+      if ( (FT_ULong)( table.dst_offset + table.dst_length ) > dest_offset )
+      {
+        FT_ERROR(( "Table was partially written.\n" ));
+        goto Fail;
+      }
+    }
+
+    /* Update `head' checkSumAdjustment. */
+    info->head_table = find_table( indices, num_tables, TTAG_head );
+    if ( !info->head_table )
+    {
+      FT_ERROR(( "`head' table is missing.\n" ));
+      goto Fail;
+    }
+
+    if ( info->head_table->dst_length < 12 )
+      goto Fail;
+
+    buf_cursor    = sfnt + info->head_table->dst_offset + 8;
+    font_checksum = 0xB1B0AFBA - font_checksum;
+
+    WRITE_ULONG( buf_cursor, font_checksum );
+
+    FT_TRACE2(( "Final checksum = %09lx.\n", font_checksum ));
+
+    woff2->actual_sfnt_size = dest_offset;
+
+    /* Set pointer of sfnt stream to its correct value. */
+    *sfnt_bytes = sfnt;
+
+    FT_FREE( table_entry );
+    FT_Stream_Close( stream );
+    FT_FREE( stream );
+
+    return error;
+
+  Fail:
+    if ( !error )
+      error = FT_THROW( Invalid_Table );
+
+    /* Set pointer of sfnt stream to its correct value. */
+    *sfnt_bytes = sfnt;
+
+    FT_FREE( table_entry );
+    FT_Stream_Close( stream );
+    FT_FREE( stream );
+
+    return error;
+  }
+
+
+  /* Replace `face->root.stream' with a stream containing the extracted */
+  /* SFNT of a WOFF2 font.                                              */
+
+  FT_LOCAL_DEF( FT_Error )
+  woff2_open_font( FT_Stream  stream,
+                   TT_Face    face,
+                   FT_Int*    face_instance_index,
+                   FT_Long*   num_faces )
+  {
+    FT_Memory  memory = stream->memory;
+    FT_Error   error  = FT_Err_Ok;
+    FT_Int     face_index;
+
+    WOFF2_HeaderRec  woff2;
+    WOFF2_InfoRec    info         = { 0, 0, 0, NULL, NULL, NULL, NULL };
+    WOFF2_Table      tables       = NULL;
+    WOFF2_Table*     indices      = NULL;
+    WOFF2_Table*     temp_indices = NULL;
+    WOFF2_Table      last_table;
+
+    FT_Int     nn;
+    FT_ULong   j;
+    FT_ULong   flags;
+    FT_UShort  xform_version;
+    FT_ULong   src_offset = 0;
+
+    FT_UInt    glyf_index;
+    FT_UInt    loca_index;
+    FT_UInt32  file_offset;
+
+    FT_Byte*   sfnt        = NULL;
+    FT_Stream  sfnt_stream = NULL;
+    FT_Byte*   sfnt_header;
+    FT_ULong   sfnt_size;
+
+    FT_Byte*  uncompressed_buf = NULL;
+
+    static const FT_Frame_Field  woff2_header_fields[] =
+    {
+#undef  FT_STRUCTURE
+#define FT_STRUCTURE  WOFF2_HeaderRec
+
+      FT_FRAME_START( 48 ),
+        FT_FRAME_ULONG     ( signature ),
+        FT_FRAME_ULONG     ( flavor ),
+        FT_FRAME_ULONG     ( length ),
+        FT_FRAME_USHORT    ( num_tables ),
+        FT_FRAME_SKIP_BYTES( 2 ),
+        FT_FRAME_ULONG     ( totalSfntSize ),
+        FT_FRAME_ULONG     ( totalCompressedSize ),
+        FT_FRAME_SKIP_BYTES( 2 * 2 ),
+        FT_FRAME_ULONG     ( metaOffset ),
+        FT_FRAME_ULONG     ( metaLength ),
+        FT_FRAME_ULONG     ( metaOrigLength ),
+        FT_FRAME_ULONG     ( privOffset ),
+        FT_FRAME_ULONG     ( privLength ),
+      FT_FRAME_END
+    };
+
+
+    FT_ASSERT( stream == face->root.stream );
+    FT_ASSERT( FT_STREAM_POS() == 0 );
+
+    face_index = FT_ABS( *face_instance_index ) & 0xFFFF;
+
+    /* Read WOFF2 Header. */
+    if ( FT_STREAM_READ_FIELDS( woff2_header_fields, &woff2 ) )
+      return error;
+
+    FT_TRACE4(( "signature     -> 0x%lX\n", woff2.signature ));
+    FT_TRACE2(( "flavor        -> 0x%08lx\n", woff2.flavor ));
+    FT_TRACE4(( "length        -> %lu\n", woff2.length ));
+    FT_TRACE2(( "num_tables    -> %hu\n", woff2.num_tables ));
+    FT_TRACE4(( "totalSfntSize -> %lu\n", woff2.totalSfntSize ));
+    FT_TRACE4(( "metaOffset    -> %lu\n", woff2.metaOffset ));
+    FT_TRACE4(( "metaLength    -> %lu\n", woff2.metaLength ));
+    FT_TRACE4(( "privOffset    -> %lu\n", woff2.privOffset ));
+    FT_TRACE4(( "privLength    -> %lu\n", woff2.privLength ));
+
+    /* Make sure we don't recurse back here. */
+    if ( woff2.flavor == TTAG_wOF2 )
+      return FT_THROW( Invalid_Table );
+
+    /* Miscellaneous checks. */
+    if ( woff2.length != stream->size                               ||
+         woff2.num_tables == 0                                      ||
+         48 + woff2.num_tables * 20UL >= woff2.length               ||
+         ( woff2.metaOffset == 0 && ( woff2.metaLength != 0     ||
+                                      woff2.metaOrigLength != 0 ) ) ||
+         ( woff2.metaLength != 0 && woff2.metaOrigLength == 0 )     ||
+         ( woff2.metaOffset >= woff2.length )                       ||
+         ( woff2.length - woff2.metaOffset < woff2.metaLength )     ||
+         ( woff2.privOffset == 0 && woff2.privLength != 0 )         ||
+         ( woff2.privOffset >= woff2.length )                       ||
+         ( woff2.length - woff2.privOffset < woff2.privLength )     )
+    {
+      FT_ERROR(( "woff2_open_font: invalid WOFF2 header\n" ));
+      return FT_THROW( Invalid_Table );
+    }
+
+    FT_TRACE2(( "woff2_open_font: WOFF2 Header is valid.\n" ));
+
+    woff2.ttc_fonts = NULL;
+
+    /* Read table directory. */
+    if ( FT_NEW_ARRAY( tables, woff2.num_tables )  ||
+         FT_NEW_ARRAY( indices, woff2.num_tables ) )
+      goto Exit;
+
+    FT_TRACE2((
+      "\n"
+      "  tag    flags    transform  origLen   transformLen   offset\n"
+      "  -----------------------------------------------------------\n" ));
+   /* "  XXXX  XXXXXXXX  XXXXXXXX   XXXXXXXX    XXXXXXXX    XXXXXXXX" */
+
+    for ( nn = 0; nn < woff2.num_tables; nn++ )
+    {
+      WOFF2_Table  table = tables + nn;
+
+
+      if ( FT_READ_BYTE( table->FlagByte ) )
+        goto Exit;
+
+      if ( ( table->FlagByte & 0x3f ) == 0x3f )
+      {
+        if ( FT_READ_ULONG( table->Tag ) )
+          goto Exit;
+      }
+      else
+      {
+        table->Tag = woff2_known_tags( table->FlagByte & 0x3f );
+        if ( !table->Tag )
+        {
+          FT_ERROR(( "woff2_open_font: Unknown table tag." ));
+          error = FT_THROW( Invalid_Table );
+          goto Exit;
+        }
+      }
+
+      flags = 0;
+      xform_version = ( table->FlagByte >> 6 ) & 0x03;
+
+      /* 0 means xform for glyph/loca, non-0 for others. */
+      if ( table->Tag == TTAG_glyf || table->Tag == TTAG_loca )
+      {
+        if ( xform_version == 0 )
+          flags |= WOFF2_FLAGS_TRANSFORM;
+      }
+      else if ( xform_version != 0 )
+        flags |= WOFF2_FLAGS_TRANSFORM;
+
+      flags |= xform_version;
+
+      if ( READ_BASE128( table->dst_length ) )
+        goto Exit;
+
+      table->TransformLength = table->dst_length;
+
+      if ( ( flags & WOFF2_FLAGS_TRANSFORM ) != 0 )
+      {
+        if ( READ_BASE128( table->TransformLength ) )
+          goto Exit;
+
+        if ( table->Tag == TTAG_loca && table->TransformLength )
+        {
+          FT_ERROR(( "woff2_open_font: Invalid loca `transformLength'.\n" ));
+          error = FT_THROW( Invalid_Table );
+          goto Exit;
+        }
+      }
+
+      if ( src_offset + table->TransformLength < src_offset )
+      {
+        FT_ERROR(( "woff2_open_font: invalid WOFF2 table directory.\n" ));
+        error = FT_THROW( Invalid_Table );
+        goto Exit;
+      }
+
+      table->src_offset = src_offset;
+      table->src_length = table->TransformLength;
+      src_offset       += table->TransformLength;
+      table->flags      = flags;
+
+      FT_TRACE2(( "  %c%c%c%c  %08d  %08d   %08ld    %08ld    %08ld\n",
+                  (FT_Char)( table->Tag >> 24 ),
+                  (FT_Char)( table->Tag >> 16 ),
+                  (FT_Char)( table->Tag >> 8  ),
+                  (FT_Char)( table->Tag       ),
+                  table->FlagByte & 0x3f,
+                  ( table->FlagByte >> 6 ) & 0x03,
+                  table->dst_length,
+                  table->TransformLength,
+                  table->src_offset ));
+
+      indices[nn] = table;
+    }
+
+    /* End of last table is uncompressed size. */
+    last_table = indices[woff2.num_tables - 1];
+
+    woff2.uncompressed_size = last_table->src_offset +
+                              last_table->src_length;
+    if ( woff2.uncompressed_size < last_table->src_offset )
+    {
+      error = FT_THROW( Invalid_Table );
+      goto Exit;
+    }
+
+    FT_TRACE2(( "Table directory parsed.\n" ));
+
+    /* Check for and read collection directory. */
+    woff2.num_fonts      = 1;
+    woff2.header_version = 0;
+
+    if ( woff2.flavor == TTAG_ttcf )
+    {
+      FT_TRACE2(( "Font is a TTC, reading collection directory.\n" ));
+
+      if ( FT_READ_ULONG( woff2.header_version ) )
+        goto Exit;
+
+      if ( woff2.header_version != 0x00010000 &&
+           woff2.header_version != 0x00020000 )
+      {
+        error = FT_THROW( Invalid_Table );
+        goto Exit;
+      }
+
+      if ( READ_255USHORT( woff2.num_fonts ) )
+        goto Exit;
+
+      if ( !woff2.num_fonts )
+      {
+        error = FT_THROW( Invalid_Table );
+        goto Exit;
+      }
+
+      FT_TRACE4(( "Number of fonts in TTC: %d\n", woff2.num_fonts ));
+
+      if ( FT_NEW_ARRAY( woff2.ttc_fonts, woff2.num_fonts ) )
+        goto Exit;
+
+      for ( nn = 0; nn < woff2.num_fonts; nn++ )
+      {
+        WOFF2_TtcFont  ttc_font = woff2.ttc_fonts + nn;
+
+
+        if ( READ_255USHORT( ttc_font->num_tables ) )
+          goto Exit;
+        if ( FT_READ_ULONG( ttc_font->flavor ) )
+          goto Exit;
+
+        if ( FT_NEW_ARRAY( ttc_font->table_indices, ttc_font->num_tables ) )
+          goto Exit;
+
+        FT_TRACE5(( "Number of tables in font %d: %d\n",
+                    nn, ttc_font->num_tables ));
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+        if ( ttc_font->num_tables )
+          FT_TRACE6(( "  Indices: " ));
+#endif
+
+        glyf_index = 0;
+        loca_index = 0;
+
+        for ( j = 0; j < ttc_font->num_tables; j++ )
+        {
+          FT_UShort    table_index;
+          WOFF2_Table  table;
+
+
+          if ( READ_255USHORT( table_index ) )
+            goto Exit;
+
+          FT_TRACE6(( "%hu ", table_index ));
+          if ( table_index >= woff2.num_tables )
+          {
+            FT_ERROR(( "woff2_open_font: invalid table index\n" ));
+            error = FT_THROW( Invalid_Table );
+            goto Exit;
+          }
+
+          ttc_font->table_indices[j] = table_index;
+
+          table = indices[table_index];
+          if ( table->Tag == TTAG_loca )
+            loca_index = table_index;
+          if ( table->Tag == TTAG_glyf )
+            glyf_index = table_index;
+        }
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+        if ( ttc_font->num_tables )
+          FT_TRACE6(( "\n" ));
+#endif
+
+        /* glyf and loca must be consecutive */
+        if ( glyf_index > 0 || loca_index > 0 )
+        {
+          if ( glyf_index > loca_index      ||
+               loca_index - glyf_index != 1 )
+          {
+            error = FT_THROW( Invalid_Table );
+            goto Exit;
+          }
+        }
+      }
+
+      /* Collection directory reading complete. */
+      FT_TRACE2(( "WOFF2 collection directory is valid.\n" ));
+    }
+    else
+      woff2.ttc_fonts = NULL;
+
+    woff2.compressed_offset = FT_STREAM_POS();
+    file_offset             = ROUND4( woff2.compressed_offset +
+                                      woff2.totalCompressedSize );
+
+    /* Some more checks before we start reading the tables. */
+    if ( file_offset > woff2.length )
+    {
+      error = FT_THROW( Invalid_Table );
+      goto Exit;
+    }
+
+    if ( woff2.metaOffset )
+    {
+      if ( file_offset != woff2.metaOffset )
+      {
+        error = FT_THROW( Invalid_Table );
+        goto Exit;
+      }
+      file_offset = ROUND4(woff2.metaOffset + woff2.metaLength);
+    }
+
+    if ( woff2.privOffset )
+    {
+      if ( file_offset != woff2.privOffset )
+      {
+        error = FT_THROW( Invalid_Table );
+        goto Exit;
+      }
+      file_offset = ROUND4(woff2.privOffset + woff2.privLength);
+    }
+
+    if ( file_offset != ( ROUND4( woff2.length ) ) )
+    {
+      error = FT_THROW( Invalid_Table );
+      goto Exit;
+    }
+
+    /* Validate requested face index. */
+    *num_faces = woff2.num_fonts;
+    /* value -(N+1) requests information on index N */
+    if ( *face_instance_index < 0 )
+      face_index--;
+
+    if ( face_index >= woff2.num_fonts )
+    {
+      if ( *face_instance_index >= 0 )
+      {
+        error = FT_THROW( Invalid_Argument );
+        goto Exit;
+      }
+      else
+        face_index = 0;
+    }
+
+    /* Only retain tables of the requested face in a TTC. */
+    if ( woff2.header_version )
+    {
+      WOFF2_TtcFont  ttc_font = woff2.ttc_fonts + face_index;
+
+
+      /* Create a temporary array. */
+      if ( FT_NEW_ARRAY( temp_indices,
+                         ttc_font->num_tables ) )
+        goto Exit;
+
+      FT_TRACE4(( "Storing tables for TTC face index %d.\n", face_index ));
+      for ( nn = 0; nn < ttc_font->num_tables; nn++ )
+        temp_indices[nn] = indices[ttc_font->table_indices[nn]];
+
+      /* Resize array to required size. */
+      if ( FT_RENEW_ARRAY( indices,
+                           woff2.num_tables,
+                           ttc_font->num_tables ) )
+        goto Exit;
+
+      for ( nn = 0; nn < ttc_font->num_tables; nn++ )
+        indices[nn] = temp_indices[nn];
+
+      FT_FREE( temp_indices );
+
+      /* Change header values. */
+      woff2.flavor     = ttc_font->flavor;
+      woff2.num_tables = ttc_font->num_tables;
+    }
+
+    /* We need to allocate this much at the minimum. */
+    sfnt_size = 12 + woff2.num_tables * 16UL;
+    /* This is what we normally expect.                              */
+    /* Initially trust `totalSfntSize' and change later as required. */
+    if ( woff2.totalSfntSize > sfnt_size )
+    {
+      /* However, adjust the value to something reasonable. */
+
+      /* Factor 64 is heuristic. */
+      if ( ( woff2.totalSfntSize >> 6 ) > woff2.length )
+        sfnt_size = woff2.length << 6;
+      else
+        sfnt_size = woff2.totalSfntSize;
+
+      /* Value 1<<26 = 67108864 is heuristic. */
+      if (sfnt_size >= (1 << 26))
+        sfnt_size = 1 << 26;
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+      if ( sfnt_size != woff2.totalSfntSize )
+        FT_TRACE4(( "adjusting estimate of uncompressed font size"
+                    " to %lu bytes\n",
+                    sfnt_size ));
+#endif
+    }
+
+    /* Write sfnt header. */
+    if ( FT_ALLOC( sfnt, sfnt_size ) ||
+         FT_NEW( sfnt_stream )       )
+      goto Exit;
+
+    sfnt_header = sfnt;
+
+    WRITE_ULONG( sfnt_header, woff2.flavor );
+
+    if ( woff2.num_tables )
+    {
+      FT_UInt  searchRange, entrySelector, rangeShift, x;
+
+
+      x             = woff2.num_tables;
+      entrySelector = 0;
+      while ( x )
+      {
+        x            >>= 1;
+        entrySelector += 1;
+      }
+      entrySelector--;
+
+      searchRange = ( 1 << entrySelector ) * 16;
+      rangeShift  = ( woff2.num_tables * 16 ) - searchRange;
+
+      WRITE_USHORT( sfnt_header, woff2.num_tables );
+      WRITE_USHORT( sfnt_header, searchRange );
+      WRITE_USHORT( sfnt_header, entrySelector );
+      WRITE_USHORT( sfnt_header, rangeShift );
+    }
+
+    info.header_checksum = compute_ULong_sum( sfnt, 12 );
+
+    /* Sort tables by tag. */
+    ft_qsort( indices,
+              woff2.num_tables,
+              sizeof ( WOFF2_Table ),
+              compare_tags );
+
+    if ( woff2.uncompressed_size < 1 )
+    {
+      error = FT_THROW( Invalid_Table );
+      goto Exit;
+    }
+
+    if ( woff2.uncompressed_size > sfnt_size )
+    {
+      FT_ERROR(( "woff2_open_font: SFNT table lengths are too large.\n" ));
+      error = FT_THROW( Invalid_Table );
+      goto Exit;
+    }
+
+    /* Allocate memory for uncompressed table data. */
+    if ( FT_ALLOC( uncompressed_buf, woff2.uncompressed_size ) ||
+         FT_FRAME_ENTER( woff2.totalCompressedSize )           )
+      goto Exit;
+
+    /* Uncompress the stream. */
+    error = woff2_decompress( uncompressed_buf,
+                              woff2.uncompressed_size,
+                              stream->cursor,
+                              woff2.totalCompressedSize );
+
+    FT_FRAME_EXIT();
+
+    if ( error )
+      goto Exit;
+
+    error = reconstruct_font( uncompressed_buf,
+                              woff2.uncompressed_size,
+                              indices,
+                              &woff2,
+                              &info,
+                              &sfnt,
+                              &sfnt_size,
+                              memory );
+
+    if ( error )
+      goto Exit;
+
+    /* Resize `sfnt' to actual size of sfnt stream. */
+    if ( woff2.actual_sfnt_size < sfnt_size )
+    {
+      FT_TRACE5(( "Trimming sfnt stream from %lu to %lu.\n",
+                  sfnt_size, woff2.actual_sfnt_size ));
+      if ( FT_REALLOC( sfnt,
+                       (FT_ULong)( sfnt_size ),
+                       (FT_ULong)( woff2.actual_sfnt_size ) ) )
+        goto Exit;
+    }
+
+    /* `reconstruct_font' has done all the work. */
+    /* Swap out stream and return.               */
+    FT_Stream_OpenMemory( sfnt_stream, sfnt, woff2.actual_sfnt_size );
+    sfnt_stream->memory = stream->memory;
+    sfnt_stream->close  = stream_close;
+
+    FT_Stream_Free(
+      face->root.stream,
+      ( face->root.face_flags & FT_FACE_FLAG_EXTERNAL_STREAM ) != 0 );
+
+    face->root.stream      = sfnt_stream;
+    face->root.face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM;
+
+    /* Set face_index to 0 or -1. */
+    if ( *face_instance_index >= 0 )
+      *face_instance_index = 0;
+    else
+      *face_instance_index = -1;
+
+    FT_TRACE2(( "woff2_open_font: SFNT synthesized.\n" ));
+
+  Exit:
+    FT_FREE( tables );
+    FT_FREE( indices );
+    FT_FREE( uncompressed_buf );
+    FT_FREE( info.x_mins );
+
+    if ( woff2.ttc_fonts )
+    {
+      WOFF2_TtcFont  ttc_font = woff2.ttc_fonts;
+
+
+      for ( nn = 0; nn < woff2.num_fonts; nn++ )
+      {
+        FT_FREE( ttc_font->table_indices );
+        ttc_font++;
+      }
+
+      FT_FREE( woff2.ttc_fonts );
+    }
+
+    if ( error )
+    {
+      FT_FREE( sfnt );
+      if ( sfnt_stream )
+      {
+        FT_Stream_Close( sfnt_stream );
+        FT_FREE( sfnt_stream );
+      }
+    }
+
+    return error;
+  }
+
+
+#undef READ_255USHORT
+#undef READ_BASE128
+#undef ROUND4
+#undef WRITE_USHORT
+#undef WRITE_ULONG
+#undef WRITE_SHORT
+#undef WRITE_SFNT_BUF
+#undef WRITE_SFNT_BUF_AT
+
+#undef N_CONTOUR_STREAM
+#undef N_POINTS_STREAM
+#undef FLAG_STREAM
+#undef GLYPH_STREAM
+#undef COMPOSITE_STREAM
+#undef BBOX_STREAM
+#undef INSTRUCTION_STREAM
+
+
+/* END */
diff --git a/src/sfnt/sfwoff2.h b/src/sfnt/sfwoff2.h
new file mode 100644
index 0000000..798f66b
--- /dev/null
+++ b/src/sfnt/sfwoff2.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+ *
+ * sfwoff2.h
+ *
+ *   WOFFF2 format management (specification).
+ *
+ * Copyright (C) 2019-2020 by
+ * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+ * modified, and distributed under the terms of the FreeType project
+ * license, LICENSE.TXT.  By continuing to use, modify, or distribute
+ * this file you indicate that you have read the license and
+ * understand and accept it fully.
+ *
+ */
+
+
+#ifndef SFWOFF2_H_
+#define SFWOFF2_H_
+
+
+#include <freetype/internal/sfnt.h>
+#include <freetype/internal/ftobjs.h>
+
+
+FT_BEGIN_HEADER
+
+
+  /* Leave the first byte open to store `flag_byte'. */
+#define WOFF2_FLAGS_TRANSFORM   1 << 8
+
+#define WOFF2_SFNT_HEADER_SIZE  12
+#define WOFF2_SFNT_ENTRY_SIZE   16
+
+  /* Suggested maximum size for output. */
+#define WOFF2_DEFAULT_MAX_SIZE  30 * 1024 * 1024
+
+  /* 98% of Google Fonts have no glyph above 5k bytes. */
+#define WOFF2_DEFAULT_GLYPH_BUF  5120
+
+  /* Composite glyph flags.                                      */
+  /* See `CompositeGlyph.java' in `sfntly' for full definitions. */
+#define FLAG_ARG_1_AND_2_ARE_WORDS     1 << 0
+#define FLAG_WE_HAVE_A_SCALE           1 << 3
+#define FLAG_MORE_COMPONENTS           1 << 5
+#define FLAG_WE_HAVE_AN_X_AND_Y_SCALE  1 << 6
+#define FLAG_WE_HAVE_A_TWO_BY_TWO      1 << 7
+#define FLAG_WE_HAVE_INSTRUCTIONS      1 << 8
+
+  /* Simple glyph flags */
+#define GLYF_ON_CURVE        1 << 0
+#define GLYF_X_SHORT         1 << 1
+#define GLYF_Y_SHORT         1 << 2
+#define GLYF_REPEAT          1 << 3
+#define GLYF_THIS_X_IS_SAME  1 << 4
+#define GLYF_THIS_Y_IS_SAME  1 << 5
+
+  /* Other constants */
+#define CONTOUR_OFFSET_END_POINT  10
+
+
+  FT_LOCAL( FT_Error )
+  woff2_open_font( FT_Stream  stream,
+                   TT_Face    face,
+                   FT_Int*    face_index,
+                   FT_Long*   num_faces );
+
+
+FT_END_HEADER
+
+#endif /* SFWOFF2_H_ */
+
+
+/* END */
diff --git a/src/sfnt/ttbdf.c b/src/sfnt/ttbdf.c
index 853599f..a287d3a 100644
--- a/src/sfnt/ttbdf.c
+++ b/src/sfnt/ttbdf.c
@@ -4,7 +4,7 @@
  *
  *   TrueType and OpenType embedded BDF properties (body).
  *
- * Copyright (C) 2005-2019 by
+ * Copyright (C) 2005-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,10 +16,9 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
 #include "ttbdf.h"
 
 #include "sferrors.h"
diff --git a/src/sfnt/ttbdf.h b/src/sfnt/ttbdf.h
index e4164e6..e60c01c 100644
--- a/src/sfnt/ttbdf.h
+++ b/src/sfnt/ttbdf.h
@@ -4,7 +4,7 @@
  *
  *   TrueType and OpenType embedded BDF properties (specification).
  *
- * Copyright (C) 2005-2019 by
+ * Copyright (C) 2005-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,9 +20,8 @@
 #define TTBDF_H_
 
 
-#include <ft2build.h>
 #include "ttload.h"
-#include FT_BDF_H
+#include <freetype/ftbdf.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c
index 683f3b1..556a712 100644
--- a/src/sfnt/ttcmap.c
+++ b/src/sfnt/ttcmap.c
@@ -4,7 +4,7 @@
  *
  *   TrueType character mapping table (cmap) support (body).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,14 +16,13 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 
-#include "sferrors.h"           /* must come before FT_INTERNAL_VALIDATE_H */
+#include "sferrors.h"                      /* must come before `ftvalid.h' */
 
-#include FT_INTERNAL_VALIDATE_H
-#include FT_INTERNAL_STREAM_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
+#include <freetype/internal/ftvalid.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/services/svpscmap.h>
 #include "ttload.h"
 #include "ttcmap.h"
 #include "ttpost.h"
@@ -3752,6 +3751,7 @@
 
   static const TT_CMap_Class  tt_cmap_classes[] =
   {
+#undef  TTCMAPCITEM
 #define TTCMAPCITEM( a )  &a,
 #include "ttcmapc.h"
     NULL,
@@ -3764,29 +3764,33 @@
   FT_LOCAL_DEF( FT_Error )
   tt_face_build_cmaps( TT_Face  face )
   {
-    FT_Byte*           table = face->cmap_table;
-    FT_Byte*           limit = table + face->cmap_size;
+    FT_Byte* const     table   = face->cmap_table;
+    FT_Byte*           limit;
     FT_UInt volatile   num_cmaps;
-    FT_Byte* volatile  p     = table;
+    FT_Byte* volatile  p       = table;
     FT_Library         library = FT_FACE_LIBRARY( face );
 
     FT_UNUSED( library );
 
 
-    if ( !p || p + 4 > limit )
+    if ( !p || face->cmap_size < 4 )
       return FT_THROW( Invalid_Table );
 
-    /* only recognize format 0 */
-    if ( TT_NEXT_USHORT( p ) != 0 )
-    {
-      FT_ERROR(( "tt_face_build_cmaps:"
-                 " unsupported `cmap' table format = %d\n",
-                 TT_PEEK_USHORT( p - 2 ) ));
-      return FT_THROW( Invalid_Table );
-    }
+    /* Version 1.8.3 of the OpenType specification contains the following */
+    /* (https://docs.microsoft.com/en-us/typography/opentype/spec/cmap):  */
+    /*                                                                    */
+    /*   The 'cmap' table version number remains at 0x0000 for fonts that */
+    /*   make use of the newer subtable formats.                          */
+    /*                                                                    */
+    /* This essentially means that a version format test is useless.      */
+
+    /* ignore format */
+    p += 2;
 
     num_cmaps = TT_NEXT_USHORT( p );
+    FT_TRACE4(( "tt_face_build_cmaps: %d cmaps\n", num_cmaps ));
 
+    limit = table + face->cmap_size;
     for ( ; num_cmaps > 0 && p + 8 <= limit; num_cmaps-- )
     {
       FT_CharMapRec  charmap;
diff --git a/src/sfnt/ttcmap.h b/src/sfnt/ttcmap.h
index 36801c9..c7d7c21 100644
--- a/src/sfnt/ttcmap.h
+++ b/src/sfnt/ttcmap.h
@@ -4,7 +4,7 @@
  *
  *   TrueType character mapping table (cmap) support (specification).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,10 +20,9 @@
 #define TTCMAP_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_TRUETYPE_TYPES_H
-#include FT_INTERNAL_VALIDATE_H
-#include FT_SERVICE_TT_CMAP_H
+#include <freetype/internal/tttypes.h>
+#include <freetype/internal/ftvalid.h>
+#include <freetype/internal/services/svttcmap.h>
 
 FT_BEGIN_HEADER
 
@@ -91,6 +90,11 @@
   };
 
 
+#undef  TTCMAPCITEM
+#define TTCMAPCITEM( a )  FT_CALLBACK_TABLE  const TT_CMap_ClassRec  a;
+#include "ttcmapc.h"
+
+
   typedef struct  TT_ValidatorRec_
   {
     FT_ValidatorRec  validator;
diff --git a/src/sfnt/ttcmapc.h b/src/sfnt/ttcmapc.h
index ace9e69..2e4ce50 100644
--- a/src/sfnt/ttcmapc.h
+++ b/src/sfnt/ttcmapc.h
@@ -4,7 +4,7 @@
  *
  *   TT CMAP classes definitions (specification only).
  *
- * Copyright (C) 2009-2019 by
+ * Copyright (C) 2009-2020 by
  * Oran Agra and Mickey Gabel.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/sfnt/ttcolr.c b/src/sfnt/ttcolr.c
index 6b537d9..9025e35 100644
--- a/src/sfnt/ttcolr.c
+++ b/src/sfnt/ttcolr.c
@@ -4,7 +4,7 @@
  *
  *   TrueType and OpenType colored glyph layer support (body).
  *
- * Copyright (C) 2018-2019 by
+ * Copyright (C) 2018-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * Originally written by Shao Yu Zhang <shaozhang@fb.com>.
@@ -27,11 +27,10 @@
    */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_COLOR_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
+#include <freetype/ftcolor.h>
 
 
 #ifdef TT_CONFIG_OPTION_COLOR_LAYERS
@@ -40,9 +39,9 @@
 
 
   /* NOTE: These are the table sizes calculated through the specs. */
-#define BASE_GLYPH_SIZE            6
-#define LAYER_SIZE                 4
-#define COLR_HEADER_SIZE          14
+#define BASE_GLYPH_SIZE            6U
+#define LAYER_SIZE                 4U
+#define COLR_HEADER_SIZE          14U
 
 
   typedef struct BaseGlyphRecord_
diff --git a/src/sfnt/ttcolr.h b/src/sfnt/ttcolr.h
index 817489a..6412162 100644
--- a/src/sfnt/ttcolr.h
+++ b/src/sfnt/ttcolr.h
@@ -4,7 +4,7 @@
  *
  *   TrueType and OpenType colored glyph layer support (specification).
  *
- * Copyright (C) 2018-2019 by
+ * Copyright (C) 2018-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * Originally written by Shao Yu Zhang <shaozhang@fb.com>.
@@ -22,7 +22,6 @@
 #define __TTCOLR_H__
 
 
-#include <ft2build.h>
 #include "ttload.h"
 
 
diff --git a/src/sfnt/ttcpal.c b/src/sfnt/ttcpal.c
index 3482169..9c514ba 100644
--- a/src/sfnt/ttcpal.c
+++ b/src/sfnt/ttcpal.c
@@ -4,7 +4,7 @@
  *
  *   TrueType and OpenType color palette support (body).
  *
- * Copyright (C) 2018-2019 by
+ * Copyright (C) 2018-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * Originally written by Shao Yu Zhang <shaozhang@fb.com>.
@@ -27,11 +27,10 @@
    */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_COLOR_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
+#include <freetype/ftcolor.h>
 
 
 #ifdef TT_CONFIG_OPTION_COLOR_LAYERS
@@ -40,8 +39,8 @@
 
 
   /* NOTE: These are the table sizes calculated through the specs. */
-#define CPAL_V0_HEADER_BASE_SIZE  12
-#define COLOR_SIZE                 4
+#define CPAL_V0_HEADER_BASE_SIZE  12U
+#define COLOR_SIZE                 4U
 
 
   /* all data from `CPAL' not covered in FT_Palette_Data */
@@ -140,7 +139,7 @@
            3U * 4                               > table_size )
         goto InvalidTable;
 
-      p += face->palette_data.num_palettes * 2;
+      p += face->palette_data.num_palettes * 2U;
 
       type_offset        = FT_NEXT_ULONG( p );
       label_offset       = FT_NEXT_ULONG( p );
@@ -150,7 +149,7 @@
       {
         if ( type_offset >= table_size )
           goto InvalidTable;
-        if ( face->palette_data.num_palettes * 2 >
+        if ( face->palette_data.num_palettes * 2U >
                table_size - type_offset )
           goto InvalidTable;
 
@@ -171,7 +170,7 @@
       {
         if ( label_offset >= table_size )
           goto InvalidTable;
-        if ( face->palette_data.num_palettes * 2 >
+        if ( face->palette_data.num_palettes * 2U >
                table_size - label_offset )
           goto InvalidTable;
 
@@ -192,7 +191,7 @@
       {
         if ( entry_label_offset >= table_size )
           goto InvalidTable;
-        if ( face->palette_data.num_palette_entries * 2 >
+        if ( face->palette_data.num_palette_entries * 2U >
                table_size - entry_label_offset )
           goto InvalidTable;
 
diff --git a/src/sfnt/ttcpal.h b/src/sfnt/ttcpal.h
index d1b244f..b544be6 100644
--- a/src/sfnt/ttcpal.h
+++ b/src/sfnt/ttcpal.h
@@ -4,7 +4,7 @@
  *
  *   TrueType and OpenType color palette support (specification).
  *
- * Copyright (C) 2018-2019 by
+ * Copyright (C) 2018-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * Originally written by Shao Yu Zhang <shaozhang@fb.com>.
@@ -22,7 +22,6 @@
 #define __TTCPAL_H__
 
 
-#include <ft2build.h>
 #include "ttload.h"
 
 
diff --git a/src/sfnt/ttkern.c b/src/sfnt/ttkern.c
index 8d1b781..d4a70c7 100644
--- a/src/sfnt/ttkern.c
+++ b/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-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -17,10 +17,9 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
 #include "ttkern.h"
 
 #include "sferrors.h"
diff --git a/src/sfnt/ttkern.h b/src/sfnt/ttkern.h
index 5f283e5..f44b5bd 100644
--- a/src/sfnt/ttkern.h
+++ b/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-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -21,9 +21,8 @@
 #define TTKERN_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/tttypes.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
index 5443bf4..4b46f41 100644
--- a/src/sfnt/ttload.c
+++ b/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-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -17,10 +17,9 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
 #include "ttload.h"
 
 #include "sferrors.h"
@@ -65,8 +64,8 @@
 #endif
 
 
-    FT_TRACE4(( "tt_face_lookup_table: %08p, `%c%c%c%c' -- ",
-                face,
+    FT_TRACE4(( "tt_face_lookup_table: %p, `%c%c%c%c' -- ",
+                (void *)face,
                 (FT_Char)( tag >> 24 ),
                 (FT_Char)( tag >> 16 ),
                 (FT_Char)( tag >> 8  ),
@@ -363,7 +362,7 @@
     };
 
 
-    FT_TRACE2(( "tt_face_load_font_dir: %08p\n", face ));
+    FT_TRACE2(( "tt_face_load_font_dir: %p\n", (void *)face ));
 
     /* read the offset table */
 
@@ -397,7 +396,15 @@
       }
     }
     else
+    {
       valid_entries = sfnt.num_tables;
+      if ( !valid_entries )
+      {
+        FT_TRACE2(( "tt_face_load_font_dir: no valid tables found\n" ));
+        error = FT_THROW( Unknown_File_Format );
+        goto Exit;
+      }
+    }
 
     face->num_tables = valid_entries;
     face->format_tag = sfnt.format_tag;
@@ -916,7 +923,7 @@
       /* load language tags */
       {
         TT_LangTag  entry = table->langTags;
-        TT_LangTag  limit = entry + table->numLangTagRecords;
+        TT_LangTag  limit = FT_OFFSET( entry, table->numLangTagRecords );
 
 
         for ( ; entry < limit; entry++ )
@@ -1307,7 +1314,7 @@
     /* we don't load the glyph names, we do that in another */
     /* module (ttpost).                                     */
 
-    FT_TRACE3(( "FormatType:   0x%x\n", post->FormatType ));
+    FT_TRACE3(( "FormatType:   0x%lx\n", post->FormatType ));
     FT_TRACE3(( "isFixedPitch:   %s\n", post->isFixedPitch
                                         ? "  yes" : "   no" ));
 
diff --git a/src/sfnt/ttload.h b/src/sfnt/ttload.h
index cc18c18..4e53d8b 100644
--- a/src/sfnt/ttload.h
+++ b/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-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -21,9 +21,8 @@
 #define TTLOAD_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/tttypes.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/sfnt/ttmtx.c b/src/sfnt/ttmtx.c
index b6725c9..0211233 100644
--- a/src/sfnt/ttmtx.c
+++ b/src/sfnt/ttmtx.c
@@ -4,7 +4,7 @@
  *
  *   Load the metrics tables common to TTF and OTF fonts (body).
  *
- * Copyright (C) 2006-2019 by
+ * Copyright (C) 2006-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,13 +16,12 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
 
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include FT_SERVICE_METRICS_VARIATIONS_H
+#include <freetype/internal/services/svmetric.h>
 #endif
 
 #include "ttmtx.h"
diff --git a/src/sfnt/ttmtx.h b/src/sfnt/ttmtx.h
index 5b0b60b..dba65ca 100644
--- a/src/sfnt/ttmtx.h
+++ b/src/sfnt/ttmtx.h
@@ -4,7 +4,7 @@
  *
  *   Load the metrics tables common to TTF and OTF fonts (specification).
  *
- * Copyright (C) 2006-2019 by
+ * Copyright (C) 2006-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,9 +20,8 @@
 #define TTMTX_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/tttypes.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c
index 636a0a0..e93a4bf 100644
--- a/src/sfnt/ttpost.c
+++ b/src/sfnt/ttpost.c
@@ -5,7 +5,7 @@
  *   PostScript name table processing for TrueType and OpenType fonts
  *   (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -25,10 +25,9 @@
    */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
 
 
 #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
@@ -54,7 +53,7 @@
 #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
 
 
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
+#include <freetype/internal/services/svpscmap.h>
 
 #define MAC_NAME( x )  (FT_String*)psnames->macintosh_name( (FT_UInt)(x) )
 
@@ -240,7 +239,7 @@
           break;
         else
         {
-          FT_TRACE6(( "load_format_20: %d byte left in post table\n",
+          FT_TRACE6(( "load_format_20: %ld byte left in post table\n",
                       post_limit - FT_STREAM_POS() ));
 
           if ( FT_READ_BYTE( len ) )
diff --git a/src/sfnt/ttpost.h b/src/sfnt/ttpost.h
index 812a0fc..94c7d16 100644
--- a/src/sfnt/ttpost.h
+++ b/src/sfnt/ttpost.h
@@ -5,7 +5,7 @@
  *   PostScript name table processing for TrueType and OpenType fonts
  *   (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -23,7 +23,7 @@
 
 #include <ft2build.h>
 #include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
+#include <freetype/internal/tttypes.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c
index 23bd9d7..9dd4419 100644
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -4,7 +4,7 @@
  *
  *   TrueType and OpenType embedded bitmap support (body).
  *
- * Copyright (C) 2005-2019 by
+ * Copyright (C) 2005-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * Copyright 2013 by Google, Inc.
@@ -19,11 +19,10 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_BITMAP_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
+#include <freetype/ftbitmap.h>
 
 
 #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
@@ -348,7 +347,7 @@
             FT_TRACE2(( "tt_face_load_strike_metrics:"
                         " sanitizing invalid ascender and descender\n"
                         "                            "
-                        " values for strike %d (%dppem, %dppem)\n",
+                        " values for strike %ld (%dppem, %dppem)\n",
                         strike_index,
                         metrics->x_ppem, metrics->y_ppem ));
 
diff --git a/src/sfnt/ttsbit.h b/src/sfnt/ttsbit.h
index 5ab8ff5..b867e43 100644
--- a/src/sfnt/ttsbit.h
+++ b/src/sfnt/ttsbit.h
@@ -4,7 +4,7 @@
  *
  *   TrueType and OpenType embedded bitmap support (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,7 +20,6 @@
 #define TTSBIT_H_
 
 
-#include <ft2build.h>
 #include "ttload.h"
 
 
diff --git a/src/sfnt/woff2tags.c b/src/sfnt/woff2tags.c
new file mode 100644
index 0000000..fd9f2e6
--- /dev/null
+++ b/src/sfnt/woff2tags.c
@@ -0,0 +1,109 @@
+/****************************************************************************
+ *
+ * woff2tags.c
+ *
+ *   WOFF2 Font table tags (base).
+ *
+ * Copyright (C) 2019-2020 by
+ * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+ * modified, and distributed under the terms of the FreeType project
+ * license, LICENSE.TXT.  By continuing to use, modify, or distribute
+ * this file you indicate that you have read the license and
+ * understand and accept it fully.
+ *
+ */
+
+
+#include <freetype/tttags.h>
+#include "woff2tags.h"
+
+  /*
+   * Return tag from index in the order given in WOFF2 specification.
+   *
+   * See
+   *
+   *       https://www.w3.org/TR/WOFF2/#table_dir_format
+   *
+   * for details.
+   */
+  FT_LOCAL_DEF( FT_ULong )
+  woff2_known_tags( FT_Byte  index )
+  {
+    const FT_ULong  known_tags[63] =
+    {
+      FT_MAKE_TAG('c', 'm', 'a', 'p'),  /*  0  */
+      FT_MAKE_TAG('h', 'e', 'a', 'd'),  /*  1  */
+      FT_MAKE_TAG('h', 'h', 'e', 'a'),  /*  2  */
+      FT_MAKE_TAG('h', 'm', 't', 'x'),  /*  3  */
+      FT_MAKE_TAG('m', 'a', 'x', 'p'),  /*  4  */
+      FT_MAKE_TAG('n', 'a', 'm', 'e'),  /*  5  */
+      FT_MAKE_TAG('O', 'S', '/', '2'),  /*  6  */
+      FT_MAKE_TAG('p', 'o', 's', 't'),  /*  7  */
+      FT_MAKE_TAG('c', 'v', 't', ' '),  /*  8  */
+      FT_MAKE_TAG('f', 'p', 'g', 'm'),  /*  9  */
+      FT_MAKE_TAG('g', 'l', 'y', 'f'),  /*  10 */
+      FT_MAKE_TAG('l', 'o', 'c', 'a'),  /*  11 */
+      FT_MAKE_TAG('p', 'r', 'e', 'p'),  /*  12 */
+      FT_MAKE_TAG('C', 'F', 'F', ' '),  /*  13 */
+      FT_MAKE_TAG('V', 'O', 'R', 'G'),  /*  14 */
+      FT_MAKE_TAG('E', 'B', 'D', 'T'),  /*  15 */
+      FT_MAKE_TAG('E', 'B', 'L', 'C'),  /*  16 */
+      FT_MAKE_TAG('g', 'a', 's', 'p'),  /*  17 */
+      FT_MAKE_TAG('h', 'd', 'm', 'x'),  /*  18 */
+      FT_MAKE_TAG('k', 'e', 'r', 'n'),  /*  19 */
+      FT_MAKE_TAG('L', 'T', 'S', 'H'),  /*  20 */
+      FT_MAKE_TAG('P', 'C', 'L', 'T'),  /*  21 */
+      FT_MAKE_TAG('V', 'D', 'M', 'X'),  /*  22 */
+      FT_MAKE_TAG('v', 'h', 'e', 'a'),  /*  23 */
+      FT_MAKE_TAG('v', 'm', 't', 'x'),  /*  24 */
+      FT_MAKE_TAG('B', 'A', 'S', 'E'),  /*  25 */
+      FT_MAKE_TAG('G', 'D', 'E', 'F'),  /*  26 */
+      FT_MAKE_TAG('G', 'P', 'O', 'S'),  /*  27 */
+      FT_MAKE_TAG('G', 'S', 'U', 'B'),  /*  28 */
+      FT_MAKE_TAG('E', 'B', 'S', 'C'),  /*  29 */
+      FT_MAKE_TAG('J', 'S', 'T', 'F'),  /*  30 */
+      FT_MAKE_TAG('M', 'A', 'T', 'H'),  /*  31 */
+      FT_MAKE_TAG('C', 'B', 'D', 'T'),  /*  32 */
+      FT_MAKE_TAG('C', 'B', 'L', 'C'),  /*  33 */
+      FT_MAKE_TAG('C', 'O', 'L', 'R'),  /*  34 */
+      FT_MAKE_TAG('C', 'P', 'A', 'L'),  /*  35 */
+      FT_MAKE_TAG('S', 'V', 'G', ' '),  /*  36 */
+      FT_MAKE_TAG('s', 'b', 'i', 'x'),  /*  37 */
+      FT_MAKE_TAG('a', 'c', 'n', 't'),  /*  38 */
+      FT_MAKE_TAG('a', 'v', 'a', 'r'),  /*  39 */
+      FT_MAKE_TAG('b', 'd', 'a', 't'),  /*  40 */
+      FT_MAKE_TAG('b', 'l', 'o', 'c'),  /*  41 */
+      FT_MAKE_TAG('b', 's', 'l', 'n'),  /*  42 */
+      FT_MAKE_TAG('c', 'v', 'a', 'r'),  /*  43 */
+      FT_MAKE_TAG('f', 'd', 's', 'c'),  /*  44 */
+      FT_MAKE_TAG('f', 'e', 'a', 't'),  /*  45 */
+      FT_MAKE_TAG('f', 'm', 't', 'x'),  /*  46 */
+      FT_MAKE_TAG('f', 'v', 'a', 'r'),  /*  47 */
+      FT_MAKE_TAG('g', 'v', 'a', 'r'),  /*  48 */
+      FT_MAKE_TAG('h', 's', 't', 'y'),  /*  49 */
+      FT_MAKE_TAG('j', 'u', 's', 't'),  /*  50 */
+      FT_MAKE_TAG('l', 'c', 'a', 'r'),  /*  51 */
+      FT_MAKE_TAG('m', 'o', 'r', 't'),  /*  52 */
+      FT_MAKE_TAG('m', 'o', 'r', 'x'),  /*  53 */
+      FT_MAKE_TAG('o', 'p', 'b', 'd'),  /*  54 */
+      FT_MAKE_TAG('p', 'r', 'o', 'p'),  /*  55 */
+      FT_MAKE_TAG('t', 'r', 'a', 'k'),  /*  56 */
+      FT_MAKE_TAG('Z', 'a', 'p', 'f'),  /*  57 */
+      FT_MAKE_TAG('S', 'i', 'l', 'f'),  /*  58 */
+      FT_MAKE_TAG('G', 'l', 'a', 't'),  /*  59 */
+      FT_MAKE_TAG('G', 'l', 'o', 'c'),  /*  60 */
+      FT_MAKE_TAG('F', 'e', 'a', 't'),  /*  61 */
+      FT_MAKE_TAG('S', 'i', 'l', 'l'),  /*  62 */
+    };
+
+
+    if ( index > 62 )
+      return 0;
+
+    return known_tags[index];
+  }
+
+
+/* END */
diff --git a/src/sfnt/woff2tags.h b/src/sfnt/woff2tags.h
new file mode 100644
index 0000000..c437c77
--- /dev/null
+++ b/src/sfnt/woff2tags.h
@@ -0,0 +1,39 @@
+/****************************************************************************
+ *
+ * woff2tags.h
+ *
+ *   WOFFF2 Font table tags (specification).
+ *
+ * Copyright (C) 2019-2020 by
+ * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+ * modified, and distributed under the terms of the FreeType project
+ * license, LICENSE.TXT.  By continuing to use, modify, or distribute
+ * this file you indicate that you have read the license and
+ * understand and accept it fully.
+ *
+ */
+
+
+#ifndef WOFF2TAGS_H
+#define WOFF2TAGS_H
+
+
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/compiler-macros.h>
+
+
+FT_BEGIN_HEADER
+
+
+  FT_LOCAL( FT_ULong )
+  woff2_known_tags( FT_Byte  index );
+
+
+FT_END_HEADER
+
+#endif /* WOFF2TAGS_H */
+
+
+/* END */
diff --git a/src/smooth/Jamfile b/src/smooth/Jamfile
deleted file mode 100644
index 6ca1ced..0000000
--- a/src/smooth/Jamfile
+++ /dev/null
@@ -1,32 +0,0 @@
-# FreeType 2 src/smooth Jamfile
-#
-# Copyright (C) 2001-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) smooth ;
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = ftgrays
-               ftsmooth
-               ftspic
-               ;
-  }
-  else
-  {
-    _sources = smooth ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/smooth Jamfile
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index fd357a5..681900f 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -4,7 +4,7 @@
  *
  *   A new `perfect' anti-aliasing renderer (body).
  *
- * Copyright (C) 2000-2019 by
+ * Copyright (C) 2000-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -278,12 +278,11 @@
 #else /* !STANDALONE_ */
 
 
-#include <ft2build.h>
 #include "ftgrays.h"
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
-#include FT_OUTLINE_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/ftoutln.h>
 
 #include "ftsmerrs.h"
 
@@ -1649,7 +1648,7 @@
       if ( !ras.invalid )
         gray_record_cell( RAS_VAR );
 
-      FT_TRACE7(( "band [%d..%d]: %d cell%s\n",
+      FT_TRACE7(( "band [%d..%d]: %ld cell%s\n",
                   ras.min_ey,
                   ras.max_ey,
                   ras.num_cells,
diff --git a/src/smooth/ftgrays.h b/src/smooth/ftgrays.h
index e9f9c7a..caba632 100644
--- a/src/smooth/ftgrays.h
+++ b/src/smooth/ftgrays.h
@@ -4,7 +4,7 @@
  *
  *   FreeType smooth renderer declaration
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -28,7 +28,7 @@
 #include "ftimage.h"
 #else
 #include <ft2build.h>
-#include FT_IMAGE_H
+#include <freetype/ftimage.h>
 #endif
 
 
diff --git a/src/smooth/ftsmerrs.h b/src/smooth/ftsmerrs.h
index d52c0dd..e93f3df 100644
--- a/src/smooth/ftsmerrs.h
+++ b/src/smooth/ftsmerrs.h
@@ -4,7 +4,7 @@
  *
  *   smooth renderer error codes (specification only).
  *
- * Copyright (C) 2001-2019 by
+ * Copyright (C) 2001-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -26,7 +26,7 @@
 #ifndef FTSMERRS_H_
 #define FTSMERRS_H_
 
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
 
 #undef FTERRORS_H_
 
@@ -34,7 +34,7 @@
 #define FT_ERR_PREFIX  Smooth_Err_
 #define FT_ERR_BASE    FT_Mod_Err_Smooth
 
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
 
 #endif /* FTSMERRS_H_ */
 
diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c
index cd034d2..5d66bd6 100644
--- a/src/smooth/ftsmooth.c
+++ b/src/smooth/ftsmooth.c
@@ -4,7 +4,7 @@
  *
  *   Anti-aliasing renderer interface (body).
  *
- * Copyright (C) 2000-2019 by
+ * Copyright (C) 2000-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,46 +16,15 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_OUTLINE_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/ftoutln.h>
 #include "ftsmooth.h"
 #include "ftgrays.h"
 
 #include "ftsmerrs.h"
 
 
-  /* initialize renderer -- init its raster */
-  static FT_Error
-  ft_smooth_init( FT_Renderer  render )
-  {
-
-#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
-
-    FT_Vector*  sub = render->root.library->lcd_geometry;
-
-
-    /* set up default subpixel geometry for striped RGB panels. */
-    sub[0].x = -21;
-    sub[0].y = 0;
-    sub[1].x = 0;
-    sub[1].y = 0;
-    sub[2].x = 21;
-    sub[2].y = 0;
-
-#elif 0   /* or else, once ClearType patents expire */
-
-    FT_Library_SetLcdFilter( render->root.library, FT_LCD_FILTER_DEFAULT );
-
-#endif
-
-    render->clazz->raster_class->raster_reset( render->raster, NULL, 0 );
-
-    return 0;
-  }
-
-
   /* sets render-specific mode */
   static FT_Error
   ft_smooth_set_mode( FT_Renderer  render,
@@ -107,14 +76,359 @@
       FT_Outline_Get_CBox( &slot->outline, cbox );
   }
 
+  typedef struct TOrigin_
+  {
+    unsigned char*  origin;  /* pixmap origin at the bottom-left */
+    int             pitch;   /* pitch to go down one row */
 
-  /* convert a slot's glyph image into a bitmap */
+  } TOrigin;
+
+#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
+
+  /* initialize renderer -- init its raster */
   static FT_Error
-  ft_smooth_render_generic( FT_Renderer       render,
-                            FT_GlyphSlot      slot,
-                            FT_Render_Mode    mode,
-                            const FT_Vector*  origin,
-                            FT_Render_Mode    required_mode )
+  ft_smooth_init( FT_Renderer  render )
+  {
+    FT_Vector*  sub = render->root.library->lcd_geometry;
+
+
+    /* set up default subpixel geometry for striped RGB panels. */
+    sub[0].x = -21;
+    sub[0].y = 0;
+    sub[1].x = 0;
+    sub[1].y = 0;
+    sub[2].x = 21;
+    sub[2].y = 0;
+
+    render->clazz->raster_class->raster_reset( render->raster, NULL, 0 );
+
+    return 0;
+  }
+
+
+  /* This function writes every third byte in direct rendering mode */
+  static void
+  ft_smooth_lcd_spans( int             y,
+                       int             count,
+                       const FT_Span*  spans,
+                       TOrigin*        target )
+  {
+    unsigned char*  dst_line = target->origin - y * target->pitch;
+    unsigned char*  dst;
+    unsigned short  w;
+
+
+    for ( ; count--; spans++ )
+      for ( dst = dst_line + spans->x * 3, w = spans->len; w--; dst += 3 )
+        *dst = spans->coverage;
+  }
+
+
+  static FT_Error
+  ft_smooth_raster_lcd( FT_Renderer  render,
+                        FT_Outline*  outline,
+                        FT_Bitmap*   bitmap )
+  {
+    FT_Error      error = FT_Err_Ok;
+    FT_Vector*    sub   = render->root.library->lcd_geometry;
+    FT_Pos        x, y;
+
+    FT_Raster_Params   params;
+    TOrigin            target;
+
+
+    /* Render 3 separate coverage bitmaps, shifting the outline.  */
+    /* Set up direct rendering to record them on each third byte. */
+    params.source     = outline;
+    params.flags      = FT_RASTER_FLAG_AA | FT_RASTER_FLAG_DIRECT;
+    params.gray_spans = (FT_SpanFunc)ft_smooth_lcd_spans;
+    params.user       = &target;
+
+    params.clip_box.xMin = 0;
+    params.clip_box.yMin = 0;
+    params.clip_box.xMax = bitmap->width;
+    params.clip_box.yMax = bitmap->rows;
+
+    if ( bitmap->pitch < 0 )
+      target.origin = bitmap->buffer;
+    else
+      target.origin = bitmap->buffer
+                      + ( bitmap->rows - 1 ) * (unsigned int)bitmap->pitch;
+
+    target.pitch = bitmap->pitch;
+
+    FT_Outline_Translate( outline,
+                          -sub[0].x,
+                          -sub[0].y );
+    error = render->raster_render( render->raster, &params );
+    x = sub[0].x;
+    y = sub[0].y;
+    if ( error )
+      goto Exit;
+
+    target.origin++;
+    FT_Outline_Translate( outline,
+                          sub[0].x - sub[1].x,
+                          sub[0].y - sub[1].y );
+    error = render->raster_render( render->raster, &params );
+    x = sub[1].x;
+    y = sub[1].y;
+    if ( error )
+      goto Exit;
+
+    target.origin++;
+    FT_Outline_Translate( outline,
+                          sub[1].x - sub[2].x,
+                          sub[1].y - sub[2].y );
+    error = render->raster_render( render->raster, &params );
+    x = sub[2].x;
+    y = sub[2].y;
+
+  Exit:
+    FT_Outline_Translate( outline, x, y );
+
+    return error;
+  }
+
+
+  static FT_Error
+  ft_smooth_raster_lcdv( FT_Renderer  render,
+                         FT_Outline*  outline,
+                         FT_Bitmap*   bitmap )
+  {
+    FT_Error     error = FT_Err_Ok;
+    int          pitch = bitmap->pitch;
+    FT_Vector*   sub   = render->root.library->lcd_geometry;
+    FT_Pos       x, y;
+
+    FT_Raster_Params  params;
+
+
+    params.target = bitmap;
+    params.source = outline;
+    params.flags  = FT_RASTER_FLAG_AA;
+
+    /* Render 3 separate coverage bitmaps, shifting the outline. */
+    /* Notice that the subpixel geometry vectors are rotated.    */
+    /* Triple the pitch to render on each third row.            */
+    bitmap->pitch *= 3;
+    bitmap->rows  /= 3;
+
+    FT_Outline_Translate( outline,
+                          -sub[0].y,
+                          sub[0].x );
+    error = render->raster_render( render->raster, &params );
+    x = sub[0].y;
+    y = -sub[0].x;
+    if ( error )
+      goto Exit;
+
+    bitmap->buffer += pitch;
+    FT_Outline_Translate( outline,
+                          sub[0].y - sub[1].y,
+                          sub[1].x - sub[0].x );
+    error = render->raster_render( render->raster, &params );
+    x = sub[1].y;
+    y = -sub[1].x;
+    bitmap->buffer -= pitch;
+    if ( error )
+      goto Exit;
+
+    bitmap->buffer += 2 * pitch;
+    FT_Outline_Translate( outline,
+                          sub[1].y - sub[2].y,
+                          sub[2].x - sub[1].x );
+    error = render->raster_render( render->raster, &params );
+    x = sub[2].y;
+    y = -sub[2].x;
+    bitmap->buffer -= 2 * pitch;
+
+  Exit:
+    FT_Outline_Translate( outline, x, y );
+
+    bitmap->pitch /= 3;
+    bitmap->rows  *= 3;
+
+    return error;
+  }
+
+#else   /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
+
+  /* initialize renderer -- init its raster */
+  static FT_Error
+  ft_smooth_init( FT_Renderer  render )
+  {
+    /* set up default LCD filtering */
+    FT_Library_SetLcdFilter( render->root.library, FT_LCD_FILTER_DEFAULT );
+
+    render->clazz->raster_class->raster_reset( render->raster, NULL, 0 );
+
+    return 0;
+  }
+
+
+  static FT_Error
+  ft_smooth_raster_lcd( FT_Renderer  render,
+                        FT_Outline*  outline,
+                        FT_Bitmap*   bitmap )
+  {
+    FT_Error    error      = FT_Err_Ok;
+    FT_Vector*  points     = outline->points;
+    FT_Vector*  points_end = FT_OFFSET( points, outline->n_points );
+    FT_Vector*  vec;
+
+    FT_Raster_Params  params;
+
+
+    params.target = bitmap;
+    params.source = outline;
+    params.flags  = FT_RASTER_FLAG_AA;
+
+    /* implode outline */
+    for ( vec = points; vec < points_end; vec++ )
+      vec->x *= 3;
+
+    /* render outline into the bitmap */
+    error = render->raster_render( render->raster, &params );
+
+    /* deflate outline */
+    for ( vec = points; vec < points_end; vec++ )
+      vec->x /= 3;
+
+    return error;
+  }
+
+
+  static FT_Error
+  ft_smooth_raster_lcdv( FT_Renderer  render,
+                         FT_Outline*  outline,
+                         FT_Bitmap*   bitmap )
+  {
+    FT_Error    error      = FT_Err_Ok;
+    FT_Vector*  points     = outline->points;
+    FT_Vector*  points_end = FT_OFFSET( points, outline->n_points );
+    FT_Vector*  vec;
+
+    FT_Raster_Params  params;
+
+
+    params.target = bitmap;
+    params.source = outline;
+    params.flags  = FT_RASTER_FLAG_AA;
+
+    /* implode outline */
+    for ( vec = points; vec < points_end; vec++ )
+      vec->y *= 3;
+
+    /* render outline into the bitmap */
+    error = render->raster_render( render->raster, &params );
+
+    /* deflate outline */
+    for ( vec = points; vec < points_end; vec++ )
+      vec->y /= 3;
+
+    return error;
+  }
+
+#endif  /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
+
+/* Oversampling scale to be used in rendering overlaps */
+#define SCALE  ( 1 << 2 )
+
+  /* This function averages inflated spans in direct rendering mode */
+  static void
+  ft_smooth_overlap_spans( int             y,
+                           int             count,
+                           const FT_Span*  spans,
+                           TOrigin*        target )
+  {
+    unsigned char*  dst = target->origin - ( y / SCALE ) * target->pitch;
+    unsigned short  x;
+    unsigned int    cover, sum;
+
+
+    /* When accumulating the oversampled spans we need to assure that  */
+    /* fully covered pixels are equal to 255 and do not overflow.      */
+    /* It is important that the SCALE is a power of 2, each subpixel   */
+    /* cover can also reach a power of 2 after rounding, and the total */
+    /* is clamped to 255 when it adds up to 256.                       */
+    for ( ; count--; spans++ )
+    {
+      cover = ( spans->coverage + SCALE * SCALE / 2 ) / ( SCALE * SCALE );
+      for ( x = 0; x < spans->len; x++ )
+      {
+        sum                           = dst[( spans->x + x ) / SCALE] + cover;
+        dst[( spans->x + x ) / SCALE] = (unsigned char)( sum - ( sum >> 8 ) );
+      }
+    }
+  }
+
+
+  static FT_Error
+  ft_smooth_raster_overlap( FT_Renderer  render,
+                            FT_Outline*  outline,
+                            FT_Bitmap*   bitmap )
+  {
+    FT_Error    error      = FT_Err_Ok;
+    FT_Vector*  points     = outline->points;
+    FT_Vector*  points_end = FT_OFFSET( points, outline->n_points );
+    FT_Vector*  vec;
+
+    FT_Raster_Params   params;
+    TOrigin            target;
+
+
+    /* Reject outlines that are too wide for 16-bit FT_Span.       */
+    /* Other limits are applied upstream with the same error code. */
+    if ( bitmap->width * SCALE > 0x7FFF )
+      return FT_THROW( Raster_Overflow );
+
+    /* Set up direct rendering to average oversampled spans. */
+    params.source     = outline;
+    params.flags      = FT_RASTER_FLAG_AA | FT_RASTER_FLAG_DIRECT;
+    params.gray_spans = (FT_SpanFunc)ft_smooth_overlap_spans;
+    params.user       = &target;
+
+    params.clip_box.xMin = 0;
+    params.clip_box.yMin = 0;
+    params.clip_box.xMax = bitmap->width * SCALE;
+    params.clip_box.yMax = bitmap->rows  * SCALE;
+
+    if ( bitmap->pitch < 0 )
+      target.origin = bitmap->buffer;
+    else
+      target.origin = bitmap->buffer
+                      + ( bitmap->rows - 1 ) * (unsigned int)bitmap->pitch;
+
+    target.pitch = bitmap->pitch;
+
+    /* inflate outline */
+    for ( vec = points; vec < points_end; vec++ )
+    {
+      vec->x *= SCALE;
+      vec->y *= SCALE;
+    }
+
+    /* render outline into the bitmap */
+    error = render->raster_render( render->raster, &params );
+
+    /* deflate outline */
+    for ( vec = points; vec < points_end; vec++ )
+    {
+      vec->x /= SCALE;
+      vec->y /= SCALE;
+    }
+
+    return error;
+  }
+
+#undef SCALE
+
+  static FT_Error
+  ft_smooth_render( FT_Renderer       render,
+                    FT_GlyphSlot      slot,
+                    FT_Render_Mode    mode,
+                    const FT_Vector*  origin )
   {
     FT_Error     error   = FT_Err_Ok;
     FT_Outline*  outline = &slot->outline;
@@ -122,10 +436,6 @@
     FT_Memory    memory  = render->root.memory;
     FT_Pos       x_shift = 0;
     FT_Pos       y_shift = 0;
-    FT_Int       hmul    = ( mode == FT_RENDER_MODE_LCD );
-    FT_Int       vmul    = ( mode == FT_RENDER_MODE_LCD_V );
-
-    FT_Raster_Params  params;
 
 
     /* check glyph image format */
@@ -136,7 +446,10 @@
     }
 
     /* check mode */
-    if ( mode != required_mode )
+    if ( mode != FT_RENDER_MODE_NORMAL &&
+         mode != FT_RENDER_MODE_LIGHT  &&
+         mode != FT_RENDER_MODE_LCD    &&
+         mode != FT_RENDER_MODE_LCD_V  )
     {
       error = FT_THROW( Cannot_Render_Glyph );
       goto Exit;
@@ -155,6 +468,9 @@
       goto Exit;
     }
 
+    if ( !bitmap->rows || !bitmap->pitch )
+      goto Exit;
+
     /* allocate new one */
     if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, bitmap->pitch ) )
       goto Exit;
@@ -178,188 +494,57 @@
     if ( x_shift || y_shift )
       FT_Outline_Translate( outline, x_shift, y_shift );
 
-    /* set up parameters */
-    params.target = bitmap;
-    params.source = outline;
-    params.flags  = FT_RASTER_FLAG_AA;
+    if ( mode == FT_RENDER_MODE_NORMAL ||
+         mode == FT_RENDER_MODE_LIGHT  )
+    {
+      if ( outline->flags & FT_OUTLINE_OVERLAP )
+        error = ft_smooth_raster_overlap( render, outline, bitmap );
+      else
+      {
+        FT_Raster_Params  params;
+
+
+        params.target = bitmap;
+        params.source = outline;
+        params.flags  = FT_RASTER_FLAG_AA;
+
+        error = render->raster_render( render->raster, &params );
+      }
+    }
+    else
+    {
+      if ( mode == FT_RENDER_MODE_LCD )
+        error = ft_smooth_raster_lcd ( render, outline, bitmap );
+      else if ( mode == FT_RENDER_MODE_LCD_V )
+        error = ft_smooth_raster_lcdv( render, outline, bitmap );
 
 #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
 
-    /* implode outline if needed */
-    {
-      FT_Vector*  points     = outline->points;
-      FT_Vector*  points_end = points + outline->n_points;
-      FT_Vector*  vec;
-
-
-      if ( hmul )
-        for ( vec = points; vec < points_end; vec++ )
-          vec->x *= 3;
-
-      if ( vmul )
-        for ( vec = points; vec < points_end; vec++ )
-          vec->y *= 3;
-    }
-
-    /* render outline into the bitmap */
-    error = render->raster_render( render->raster, &params );
-
-    /* deflate outline if needed */
-    {
-      FT_Vector*  points     = outline->points;
-      FT_Vector*  points_end = points + outline->n_points;
-      FT_Vector*  vec;
-
-
-      if ( hmul )
-        for ( vec = points; vec < points_end; vec++ )
-          vec->x /= 3;
-
-      if ( vmul )
-        for ( vec = points; vec < points_end; vec++ )
-          vec->y /= 3;
-    }
-
-    if ( error )
-      goto Exit;
-
-    /* finally apply filtering */
-    if ( hmul || vmul )
-    {
-      FT_Byte*                 lcd_weights;
-      FT_Bitmap_LcdFilterFunc  lcd_filter_func;
-
-
-      /* Per-face LCD filtering takes priority if set up. */
-      if ( slot->face && slot->face->internal->lcd_filter_func )
+      /* finally apply filtering */
       {
-        lcd_weights     = slot->face->internal->lcd_weights;
-        lcd_filter_func = slot->face->internal->lcd_filter_func;
-      }
-      else
-      {
-        lcd_weights     = slot->library->lcd_weights;
-        lcd_filter_func = slot->library->lcd_filter_func;
-      }
-
-      if ( lcd_filter_func )
-        lcd_filter_func( bitmap, lcd_weights );
-    }
-
-#else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
-
-    if ( hmul )  /* lcd */
-    {
-      FT_Byte*  line;
-      FT_Byte*  temp = NULL;
-      FT_UInt   i, j;
-
-      unsigned int  height = bitmap->rows;
-      unsigned int  width  = bitmap->width;
-      int           pitch  = bitmap->pitch;
-
-      FT_Vector*  sub = slot->library->lcd_geometry;
+        FT_Byte*                 lcd_weights;
+        FT_Bitmap_LcdFilterFunc  lcd_filter_func;
 
 
-      /* Render 3 separate monochrome bitmaps, shifting the outline.  */
-      width /= 3;
-
-      FT_Outline_Translate( outline,
-                            -sub[0].x,
-                            -sub[0].y );
-      error = render->raster_render( render->raster, &params );
-      if ( error )
-        goto Exit;
-
-      bitmap->buffer += width;
-      FT_Outline_Translate( outline,
-                            sub[0].x - sub[1].x,
-                            sub[0].y - sub[1].y );
-      error = render->raster_render( render->raster, &params );
-      bitmap->buffer -= width;
-      if ( error )
-        goto Exit;
-
-      bitmap->buffer += 2 * width;
-      FT_Outline_Translate( outline,
-                            sub[1].x - sub[2].x,
-                            sub[1].y - sub[2].y );
-      error = render->raster_render( render->raster, &params );
-      bitmap->buffer -= 2 * width;
-      if ( error )
-        goto Exit;
-
-      x_shift -= sub[2].x;
-      y_shift -= sub[2].y;
-
-      /* XXX: Rearrange the bytes according to FT_PIXEL_MODE_LCD.    */
-      /* XXX: It is more efficient to render every third byte above. */
-
-      if ( FT_ALLOC( temp, (FT_ULong)pitch ) )
-        goto Exit;
-
-      for ( i = 0; i < height; i++ )
-      {
-        line = bitmap->buffer + i * (FT_ULong)pitch;
-        for ( j = 0; j < width; j++ )
+        /* Per-face LCD filtering takes priority if set up. */
+        if ( slot->face && slot->face->internal->lcd_filter_func )
         {
-          temp[3 * j    ] = line[j];
-          temp[3 * j + 1] = line[j + width];
-          temp[3 * j + 2] = line[j + width + width];
+          lcd_weights     = slot->face->internal->lcd_weights;
+          lcd_filter_func = slot->face->internal->lcd_filter_func;
         }
-        FT_MEM_COPY( line, temp, pitch );
+        else
+        {
+          lcd_weights     = slot->library->lcd_weights;
+          lcd_filter_func = slot->library->lcd_filter_func;
+        }
+
+        if ( lcd_filter_func )
+          lcd_filter_func( bitmap, lcd_weights );
       }
 
-      FT_FREE( temp );
+#endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
+
     }
-    else if ( vmul )  /* lcd_v */
-    {
-      int  pitch  = bitmap->pitch;
-
-      FT_Vector*  sub = slot->library->lcd_geometry;
-
-
-      /* Render 3 separate monochrome bitmaps, shifting the outline. */
-      /* Notice that the subpixel geometry vectors are rotated.      */
-      /* Triple the pitch to render on each third row.               */
-      bitmap->pitch *= 3;
-      bitmap->rows  /= 3;
-
-      FT_Outline_Translate( outline,
-                            -sub[0].y,
-                            sub[0].x );
-      error = render->raster_render( render->raster, &params );
-      if ( error )
-        goto Exit;
-
-      bitmap->buffer += pitch;
-      FT_Outline_Translate( outline,
-                            sub[0].y - sub[1].y,
-                            sub[1].x - sub[0].x );
-      error = render->raster_render( render->raster, &params );
-      bitmap->buffer -= pitch;
-      if ( error )
-        goto Exit;
-
-      bitmap->buffer += 2 * pitch;
-      FT_Outline_Translate( outline,
-                            sub[1].y - sub[2].y,
-                            sub[2].x - sub[1].x );
-      error = render->raster_render( render->raster, &params );
-      bitmap->buffer -= 2 * pitch;
-      if ( error )
-        goto Exit;
-
-      x_shift -= sub[2].y;
-      y_shift += sub[2].x;
-
-      bitmap->pitch /= 3;
-      bitmap->rows  *= 3;
-    }
-    else  /* grayscale */
-      error = render->raster_render( render->raster, &params );
-
-#endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
 
   Exit:
     if ( !error )
@@ -380,45 +565,6 @@
   }
 
 
-  /* convert a slot's glyph image into a bitmap */
-  static FT_Error
-  ft_smooth_render( FT_Renderer       render,
-                    FT_GlyphSlot      slot,
-                    FT_Render_Mode    mode,
-                    const FT_Vector*  origin )
-  {
-    if ( mode == FT_RENDER_MODE_LIGHT )
-      mode = FT_RENDER_MODE_NORMAL;
-
-    return ft_smooth_render_generic( render, slot, mode, origin,
-                                     FT_RENDER_MODE_NORMAL );
-  }
-
-
-  /* convert a slot's glyph image into a horizontal LCD bitmap */
-  static FT_Error
-  ft_smooth_render_lcd( FT_Renderer       render,
-                        FT_GlyphSlot      slot,
-                        FT_Render_Mode    mode,
-                        const FT_Vector*  origin )
-  {
-    return ft_smooth_render_generic( render, slot, mode, origin,
-                                     FT_RENDER_MODE_LCD );
-  }
-
-
-  /* convert a slot's glyph image into a vertical LCD bitmap */
-  static FT_Error
-  ft_smooth_render_lcd_v( FT_Renderer       render,
-                          FT_GlyphSlot      slot,
-                          FT_Render_Mode    mode,
-                          const FT_Vector*  origin )
-  {
-    return ft_smooth_render_generic( render, slot, mode, origin,
-                                     FT_RENDER_MODE_LCD_V );
-  }
-
-
   FT_DEFINE_RENDERER(
     ft_smooth_renderer_class,
 
@@ -446,58 +592,4 @@
   )
 
 
-  FT_DEFINE_RENDERER(
-    ft_smooth_lcd_renderer_class,
-
-      FT_MODULE_RENDERER,
-      sizeof ( FT_RendererRec ),
-
-      "smooth-lcd",
-      0x10000L,
-      0x20000L,
-
-      NULL,    /* module specific interface */
-
-      (FT_Module_Constructor)ft_smooth_init,  /* module_init   */
-      (FT_Module_Destructor) NULL,            /* module_done   */
-      (FT_Module_Requester)  NULL,            /* get_interface */
-
-    FT_GLYPH_FORMAT_OUTLINE,
-
-    (FT_Renderer_RenderFunc)   ft_smooth_render_lcd,  /* render_glyph    */
-    (FT_Renderer_TransformFunc)ft_smooth_transform,   /* transform_glyph */
-    (FT_Renderer_GetCBoxFunc)  ft_smooth_get_cbox,    /* get_glyph_cbox  */
-    (FT_Renderer_SetModeFunc)  ft_smooth_set_mode,    /* set_mode        */
-
-    (FT_Raster_Funcs*)&ft_grays_raster                /* raster_class    */
-  )
-
-
-  FT_DEFINE_RENDERER(
-    ft_smooth_lcdv_renderer_class,
-
-      FT_MODULE_RENDERER,
-      sizeof ( FT_RendererRec ),
-
-      "smooth-lcdv",
-      0x10000L,
-      0x20000L,
-
-      NULL,    /* module specific interface */
-
-      (FT_Module_Constructor)ft_smooth_init,  /* module_init   */
-      (FT_Module_Destructor) NULL,            /* module_done   */
-      (FT_Module_Requester)  NULL,            /* get_interface */
-
-    FT_GLYPH_FORMAT_OUTLINE,
-
-    (FT_Renderer_RenderFunc)   ft_smooth_render_lcd_v,  /* render_glyph    */
-    (FT_Renderer_TransformFunc)ft_smooth_transform,     /* transform_glyph */
-    (FT_Renderer_GetCBoxFunc)  ft_smooth_get_cbox,      /* get_glyph_cbox  */
-    (FT_Renderer_SetModeFunc)  ft_smooth_set_mode,      /* set_mode        */
-
-    (FT_Raster_Funcs*)&ft_grays_raster                  /* raster_class    */
-  )
-
-
 /* END */
diff --git a/src/smooth/ftsmooth.h b/src/smooth/ftsmooth.h
index fbb21a3..22a88d5 100644
--- a/src/smooth/ftsmooth.h
+++ b/src/smooth/ftsmooth.h
@@ -4,7 +4,7 @@
  *
  *   Anti-aliasing renderer interface (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
 #define FTSMOOTH_H_
 
 
-#include <ft2build.h>
-#include FT_RENDER_H
+#include <freetype/ftrender.h>
 
 
 FT_BEGIN_HEADER
@@ -29,10 +28,6 @@
 
   FT_DECLARE_RENDERER( ft_smooth_renderer_class )
 
-  FT_DECLARE_RENDERER( ft_smooth_lcd_renderer_class )
-
-  FT_DECLARE_RENDERER( ft_smooth_lcdv_renderer_class )
-
 
 FT_END_HEADER
 
diff --git a/src/smooth/module.mk b/src/smooth/module.mk
index 44b76df..9b1507f 100644
--- a/src/smooth/module.mk
+++ b/src/smooth/module.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
@@ -18,10 +18,6 @@
 define SMOOTH_RENDERER
 $(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_renderer_class $(CLOSE_DRIVER)
 $(ECHO_DRIVER)smooth    $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer$(ECHO_DRIVER_DONE)
-$(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_lcd_renderer_class $(CLOSE_DRIVER)
-$(ECHO_DRIVER)smooth    $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer for LCDs$(ECHO_DRIVER_DONE)
-$(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_lcdv_renderer_class $(CLOSE_DRIVER)
-$(ECHO_DRIVER)smooth    $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer for vertical LCDs$(ECHO_DRIVER_DONE)
 endef
 
 # EOF
diff --git a/src/smooth/rules.mk b/src/smooth/rules.mk
index 0153ac2..b08056f 100644
--- a/src/smooth/rules.mk
+++ b/src/smooth/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/smooth/smooth.c b/src/smooth/smooth.c
index 9c543d3..04b531c 100644
--- a/src/smooth/smooth.c
+++ b/src/smooth/smooth.c
@@ -4,7 +4,7 @@
  *
  *   FreeType anti-aliasing rasterer module component (body only).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -17,7 +17,6 @@
 
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
 
 #include "ftgrays.c"
 #include "ftsmooth.c"
diff --git a/src/tools/Jamfile b/src/tools/Jamfile
deleted file mode 100644
index 475161e..0000000
--- a/src/tools/Jamfile
+++ /dev/null
@@ -1,5 +0,0 @@
-# Jamfile for src/tools
-#
-SubDir FT2_TOP src tools ;
-
-Main  apinames : apinames.c ;
diff --git a/src/tools/afblue.pl b/src/tools/afblue.pl
index 937d4ec..bbc4f47 100644
--- a/src/tools/afblue.pl
+++ b/src/tools/afblue.pl
@@ -5,7 +5,7 @@
 #
 # Process a blue zone character data file.
 #
-# Copyright (C) 2013-2019 by
+# Copyright (C) 2013-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used,
diff --git a/src/tools/ftrandom/ftrandom.c b/src/tools/ftrandom/ftrandom.c
index ab5cfc9..ab62429 100644
--- a/src/tools/ftrandom/ftrandom.c
+++ b/src/tools/ftrandom/ftrandom.c
@@ -45,8 +45,8 @@
 #include <time.h>
 
 #include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_OUTLINE_H
+#include <freetype/freetype.h>
+#include <freetype/ftoutln.h>
 
 #define true     1
 #define false    0
diff --git a/src/tools/glnames.py b/src/tools/glnames.py
index e1b613d..a19ce17 100644
--- a/src/tools/glnames.py
+++ b/src/tools/glnames.py
@@ -6,7 +6,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/tools/make_distribution_archives.py b/src/tools/make_distribution_archives.py
new file mode 100755
index 0000000..f29eb12
--- /dev/null
+++ b/src/tools/make_distribution_archives.py
@@ -0,0 +1,208 @@
+#!/usr/bin/env python3
+"""Generate distribution archives for a given FreeType 2 release."""
+
+from __future__ import print_function
+
+import argparse
+import atexit
+import os
+import shutil
+import subprocess
+import sys
+import tempfile
+
+_TOP_DIR = os.path.abspath(os.path.join(__file__, "..", "..", ".."))
+_SCRIPT_DIR = os.path.dirname(os.path.join(_TOP_DIR, "builds", "meson", ""))
+
+
+def get_cmd_output(cmd, cwd=None):
+    """Run a command and return its output as a string."""
+    if cwd is not None:
+        out = subprocess.check_output(cmd, cwd=cwd)
+    else:
+        out = subprocess.check_output(cmd)
+    return out.decode("utf-8").rstrip()
+
+
+def is_git_dir_clean(git_dir):
+    """Return True iff |git_dir| is a git directory in clean state."""
+    out = get_cmd_output(["git", "status", "--porcelain"], cwd=git_dir)
+    return len(out) == 0
+
+
+def main():
+    parser = argparse.ArgumentParser(description=__doc__)
+
+    parser.add_argument(
+        "--source_dir", default=_TOP_DIR, help="Source directory path."
+    )
+
+    parser.add_argument(
+        "--version",
+        help=(
+            "Specify alternate FreeType version (it is otherwise extracted"
+            " from current sources by default)."
+        ),
+    )
+
+    parser.add_argument(
+        "--gnu-config-dir",
+        help=(
+            "Path of input directory containing recent `config.guess` and"
+            " `config.sub` files from GNU config."
+        ),
+    )
+
+    parser.add_argument(
+        "--build-dir",
+        help="Specify build directory. Only used for debugging this script.",
+    )
+
+    parser.add_argument(
+        "--ignore-clean-check",
+        action="store_true",
+        help=(
+            "Do not check for a clean source git repository. Only used for"
+            " debugging this script."
+        ),
+    )
+
+    parser.add_argument(
+        "output_dir", help="Output directory for generated archives."
+    )
+
+    args = parser.parse_args()
+
+    git_dir = args.source_dir if args.source_dir else _TOP_DIR
+    if not args.ignore_clean_check and not is_git_dir_clean(git_dir):
+        sys.stderr.write(
+            "ERROR: Your git repository is not in a clean state: %s\n"
+            % git_dir
+        )
+        return 1
+
+    if args.version:
+        version = args.version
+    else:
+        # Extract FreeType version from sources.
+        version = get_cmd_output(
+            [
+                sys.executable,
+                os.path.join(_SCRIPT_DIR, "extract_freetype_version.py"),
+                os.path.join(_TOP_DIR, "include", "freetype", "freetype.h"),
+            ]
+        )
+
+    # Determine the build directory. This will be a temporary file that is
+    # cleaned up on script exit by default, unless --build-dir=DIR is used,
+    # in which case we only create and empty the directory, but never remove
+    # its content on exit.
+    if args.build_dir:
+        build_dir = args.build_dir
+        if not os.path.exists(build_dir):
+            os.makedirs(build_dir)
+        else:
+            # Remove anything from the build directory, if any.
+            for item in os.listdir(build_dir):
+                file_path = os.path.join(build_dir, item)
+                if os.path.isdir(file_path):
+                    shutil.rmtree(file_path)
+                else:
+                    os.unlink(file_path)
+    else:
+        # Create a temporary directory, and ensure it is removed on exit.
+        build_dir = tempfile.mkdtemp(prefix="freetype-dist-")
+
+        def clean_build_dir():
+            shutil.rmtree(build_dir)
+
+        atexit.register(clean_build_dir)
+
+    # Copy all source files known to git into $BUILD_DIR/freetype-$VERSION
+    # with the exception of .gitignore and .mailmap files.
+    source_files = [
+        f
+        for f in get_cmd_output(["git", "ls-files"], cwd=git_dir).split("\n")
+        if os.path.basename(f) not in (".gitignore", ".mailmap")
+    ]
+
+    freetype_dir = "freetype-" + version
+    tmp_src_dir = os.path.join(build_dir, freetype_dir)
+    os.makedirs(tmp_src_dir)
+
+    for src in source_files:
+        dst = os.path.join(tmp_src_dir, src)
+        dst_dir = os.path.dirname(dst)
+        if not os.path.exists(dst_dir):
+            os.makedirs(dst_dir)
+        shutil.copy(os.path.join(git_dir, src), dst)
+
+    # Run autogen.sh in directory.
+    subprocess.check_call(["/bin/sh", "autogen.sh"], cwd=tmp_src_dir)
+    shutil.rmtree(
+        os.path.join(tmp_src_dir, "builds", "unix", "autom4te.cache")
+    )
+
+    # Copy config.guess and config.sub if possible!
+    if args.gnu_config_dir:
+        for f in ("config.guess", "config.sub"):
+            shutil.copy(
+                os.path.join(args.gnu_config_dir, f),
+                os.path.join(tmp_src_dir, "builds", "unix", f),
+            )
+
+    # Generate reference documentation under docs/
+    subprocess.check_call(
+        [
+            sys.executable,
+            os.path.join(_SCRIPT_DIR, "generate_reference_docs.py"),
+            "--input-dir",
+            tmp_src_dir,
+            "--version",
+            version,
+            "--output-dir",
+            os.path.join(tmp_src_dir, "docs"),
+        ]
+    )
+
+    shutil.rmtree(os.path.join(tmp_src_dir, "docs", "markdown"))
+    os.unlink(os.path.join(tmp_src_dir, "docs", "mkdocs.yml"))
+
+    # Generate our archives
+    freetype_tar = freetype_dir + ".tar"
+
+    subprocess.check_call(
+        ["tar", "-H", "ustar", "-chf", freetype_tar, freetype_dir],
+        cwd=build_dir,
+    )
+
+    subprocess.check_call(
+        ["gzip", "-9", "--keep", freetype_tar], cwd=build_dir
+    )
+
+    subprocess.check_call(["xz", "--keep", freetype_tar], cwd=build_dir)
+
+    ftwinversion = "ft" + "".join(version.split("."))
+    subprocess.check_call(
+        ["zip", "-qlr9", ftwinversion + ".zip", freetype_dir], cwd=build_dir
+    )
+
+    # Copy file to output directory now.
+    if not os.path.exists(args.output_dir):
+        os.makedirs(args.output_dir)
+
+    for f in (
+        freetype_tar + ".gz",
+        freetype_tar + ".xz",
+        ftwinversion + ".zip",
+    ):
+        shutil.copy(
+            os.path.join(build_dir, f), os.path.join(args.output_dir, f)
+        )
+
+    # Done!
+    return 0
+
+
+if __name__ == "__main__":
+    sys.exit(main())
diff --git a/src/tools/test_afm.c b/src/tools/test_afm.c
index 8de619b..a4b2268 100644
--- a/src/tools/test_afm.c
+++ b/src/tools/test_afm.c
@@ -2,10 +2,9 @@
  * gcc -DFT2_BUILD_LIBRARY -I../../include -o test_afm test_afm.c \
  *     -L../../objs/.libs -lfreetype -lz -static
  */
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/freetype.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/psaux.h>
 
   void dump_fontinfo( AFM_FontInfo  fi )
   {
diff --git a/src/tools/test_bbox.c b/src/tools/test_bbox.c
index 64b82c3..d9fd932 100644
--- a/src/tools/test_bbox.c
+++ b/src/tools/test_bbox.c
@@ -1,6 +1,5 @@
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_BBOX_H
+#include <freetype/freetype.h>
+#include <freetype/ftbbox.h>
 
 
 #include <time.h>    /* for clock() */
diff --git a/src/tools/test_trig.c b/src/tools/test_trig.c
index 99ac1cf..4f3410a 100644
--- a/src/tools/test_trig.c
+++ b/src/tools/test_trig.c
@@ -1,6 +1,5 @@
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_TRIGONOMETRY_H
+#include <freetype/freetype.h>
+#include <freetype/fttrigon.h>
 
 #include <math.h>
 #include <stdio.h>
diff --git a/src/tools/update-copyright-year b/src/tools/update-copyright-year
index 2ae50d6..c659bba 100755
--- a/src/tools/update-copyright-year
+++ b/src/tools/update-copyright-year
@@ -2,7 +2,7 @@
   & eval 'exec perl -wS -i "$0" $argv:q'
     if 0;
 
-# Copyright (C) 2015-2019 by
+# Copyright (C) 2015-2020 by
 # Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/truetype/Jamfile b/src/truetype/Jamfile
deleted file mode 100644
index 2de63a7..0000000
--- a/src/truetype/Jamfile
+++ /dev/null
@@ -1,37 +0,0 @@
-# FreeType 2 src/truetype Jamfile
-#
-# Copyright (C) 2001-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) truetype ;
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = ttdriver
-               ttgload
-               ttgxvar
-               ttinterp
-               ttobjs
-               ttpic
-               ttpload
-               ttsubpix
-               ;
-  }
-  else
-  {
-    _sources = truetype ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/truetype Jamfile
diff --git a/src/truetype/module.mk b/src/truetype/module.mk
index 8a841cc..2d8d39d 100644
--- a/src/truetype/module.mk
+++ b/src/truetype/module.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/truetype/rules.mk b/src/truetype/rules.mk
index df8dcd4..2f6fecf 100644
--- a/src/truetype/rules.mk
+++ b/src/truetype/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/truetype/truetype.c b/src/truetype/truetype.c
index 84928e7..41b6808 100644
--- a/src/truetype/truetype.c
+++ b/src/truetype/truetype.c
@@ -4,7 +4,7 @@
  *
  *   FreeType TrueType driver component (body only).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -17,7 +17,6 @@
 
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
 
 #include "ttdriver.c"   /* driver interface    */
 #include "ttgload.c"    /* glyph loader        */
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index ff626d5..bf830b1 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -4,7 +4,7 @@
  *
  *   TrueType font driver implementation (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,22 +16,21 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_SFNT_H
-#include FT_SERVICE_FONT_FORMAT_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/sfnt.h>
+#include <freetype/internal/services/svfntfmt.h>
 
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include FT_MULTIPLE_MASTERS_H
-#include FT_SERVICE_MULTIPLE_MASTERS_H
-#include FT_SERVICE_METRICS_VARIATIONS_H
+#include <freetype/ftmm.h>
+#include <freetype/internal/services/svmm.h>
+#include <freetype/internal/services/svmetric.h>
 #endif
 
-#include FT_SERVICE_TRUETYPE_ENGINE_H
-#include FT_SERVICE_TRUETYPE_GLYF_H
-#include FT_SERVICE_PROPERTIES_H
-#include FT_DRIVER_H
+#include <freetype/internal/services/svtteng.h>
+#include <freetype/internal/services/svttglyf.h>
+#include <freetype/internal/services/svprop.h>
+#include <freetype/ftdriver.h>
 
 #include "ttdriver.h"
 #include "ttgload.h"
diff --git a/src/truetype/ttdriver.h b/src/truetype/ttdriver.h
index 3936c6a..ee1438e 100644
--- a/src/truetype/ttdriver.h
+++ b/src/truetype/ttdriver.h
@@ -4,7 +4,7 @@
  *
  *   High-level TrueType driver interface (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
 #define TTDRIVER_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
+#include <freetype/internal/ftdrv.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/truetype/tterrors.h b/src/truetype/tterrors.h
index 5609d28..efeafd3 100644
--- a/src/truetype/tterrors.h
+++ b/src/truetype/tterrors.h
@@ -4,7 +4,7 @@
  *
  *   TrueType error codes (specification only).
  *
- * Copyright (C) 2001-2019 by
+ * Copyright (C) 2001-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -26,7 +26,7 @@
 #ifndef TTERRORS_H_
 #define TTERRORS_H_
 
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
 
 #undef FTERRORS_H_
 
@@ -34,7 +34,7 @@
 #define FT_ERR_PREFIX  TT_Err_
 #define FT_ERR_BASE    FT_Mod_Err_TrueType
 
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
 
 #endif /* TTERRORS_H_ */
 
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index a046840..1dd319d 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -4,7 +4,7 @@
  *
  *   TrueType Glyph Loader (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -17,15 +17,15 @@
 
 
 #include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 #include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_SFNT_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_OUTLINE_H
-#include FT_DRIVER_H
-#include FT_LIST_H
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/sfnt.h>
+#include <freetype/tttags.h>
+#include <freetype/ftoutln.h>
+#include <freetype/ftdriver.h>
+#include <freetype/ftlist.h>
 
 #include "ttgload.h"
 #include "ttpload.h"
@@ -60,7 +60,7 @@
 #define SAME_X          0x10
 #define Y_POSITIVE      0x20  /* two meanings depending on Y_SHORT_VECTOR */
 #define SAME_Y          0x20
-#define OVERLAP_SIMPLE  0x40  /* we ignore this value                     */
+#define OVERLAP_SIMPLE  0x40  /* retained as FT_OUTLINE_OVERLAP           */
 
 
   /**************************************************************************
@@ -77,7 +77,7 @@
 #define WE_HAVE_A_2X2              0x0080
 #define WE_HAVE_INSTR              0x0100
 #define USE_MY_METRICS             0x0200
-#define OVERLAP_COMPOUND           0x0400  /* we ignore this value */
+#define OVERLAP_COMPOUND           0x0400  /* retained as FT_OUTLINE_OVERLAP */
 #define SCALED_COMPONENT_OFFSET    0x0800
 #define UNSCALED_COMPONENT_OFFSET  0x1000
 
@@ -137,6 +137,11 @@
                                 face->horizontal.Descender );
     }
 
+#ifdef FT_DEBUG_LEVEL_TRACE
+    if ( !face->vertical_info )
+      FT_TRACE5(( "  [vertical metrics missing, computing values]\n" ));
+#endif
+
     FT_TRACE5(( "  advance height (font units): %d\n", *ah ));
     FT_TRACE5(( "  top side bearing (font units): %d\n", *tsb ));
   }
@@ -333,9 +338,9 @@
     loader->bbox.yMax = FT_NEXT_SHORT( p );
 
     FT_TRACE5(( "  # of contours: %d\n", loader->n_contours ));
-    FT_TRACE5(( "  xMin: %4d  xMax: %4d\n", loader->bbox.xMin,
+    FT_TRACE5(( "  xMin: %4ld  xMax: %4ld\n", loader->bbox.xMin,
                                             loader->bbox.xMax ));
-    FT_TRACE5(( "  yMin: %4d  yMax: %4d\n", loader->bbox.yMin,
+    FT_TRACE5(( "  yMin: %4ld  yMax: %4ld\n", loader->bbox.yMin,
                                             loader->bbox.yMax ));
     loader->cursor = p;
 
@@ -489,6 +494,10 @@
       }
     }
 
+    /* retain the overlap flag */
+    if ( n_points && outline->tags[0] & OVERLAP_SIMPLE )
+      gloader->base.outline.flags |= FT_OUTLINE_OVERLAP;
+
     /* reading the X coordinates */
 
     vec       = outline->points;
@@ -1102,9 +1111,16 @@
       }
 
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-      /* if we have a HVAR table, `pp1' and/or `pp2' are already adjusted */
-      if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ||
-           !IS_HINTED( loader->load_flags )                                 )
+      /* if we have a HVAR table, `pp1' and/or `pp2' */
+      /* are already adjusted but unscaled           */
+      if ( ( loader->face->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) &&
+           IS_HINTED( loader->load_flags )                                 )
+      {
+        loader->pp1.x = FT_MulFix( loader->pp1.x, x_scale );
+        loader->pp2.x = FT_MulFix( loader->pp2.x, x_scale );
+        /* pp1.y and pp2.y are always zero */
+      }
+      else
 #endif
       {
         loader->pp1 = outline->points[n_points - 4];
@@ -1112,9 +1128,17 @@
       }
 
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-      /* if we have a VVAR table, `pp3' and/or `pp4' are already adjusted */
-      if ( !( loader->face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ||
-           !IS_HINTED( loader->load_flags )                                 )
+      /* if we have a VVAR table, `pp3' and/or `pp4' */
+      /* are already adjusted but unscaled           */
+      if ( ( loader->face->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) &&
+           IS_HINTED( loader->load_flags )                                 )
+      {
+        loader->pp3.x = FT_MulFix( loader->pp3.x, x_scale );
+        loader->pp3.y = FT_MulFix( loader->pp3.y, y_scale );
+        loader->pp4.x = FT_MulFix( loader->pp4.x, x_scale );
+        loader->pp4.y = FT_MulFix( loader->pp4.y, y_scale );
+      }
+      else
 #endif
       {
         loader->pp3 = outline->points[n_points - 2];
@@ -2168,6 +2192,11 @@
             goto Exit;
         }
       }
+
+      /* retain the overlap flag */
+      if ( gloader->base.num_subglyphs                         &&
+           gloader->base.subglyphs[0].flags & OVERLAP_COMPOUND )
+        gloader->base.outline.flags |= FT_OUTLINE_OVERLAP;
     }
 
     /***********************************************************************/
@@ -2287,13 +2316,14 @@
       if ( face->vertical_info                   &&
            face->vertical.number_Of_VMetrics > 0 )
       {
-        top = (FT_Short)FT_DivFix( loader->pp3.y - bbox.yMax,
+        top = (FT_Short)FT_DivFix( SUB_LONG( loader->pp3.y, bbox.yMax ),
                                    y_scale );
 
         if ( loader->pp3.y <= loader->pp4.y )
           advance = 0;
         else
-          advance = (FT_UShort)FT_DivFix( loader->pp3.y - loader->pp4.y,
+          advance = (FT_UShort)FT_DivFix( SUB_LONG( loader->pp3.y,
+                                                    loader->pp4.y ),
                                           y_scale );
       }
       else
@@ -2965,8 +2995,6 @@
       error = compute_glyph_metrics( &loader, glyph_index );
     }
 
-    tt_loader_done( &loader );
-
     /* Set the `high precision' bit flag.                           */
     /* This is _critical_ to get correct output for monochrome      */
     /* TrueType glyphs at all sizes using the bytecode interpreter. */
@@ -2975,6 +3003,15 @@
          size->metrics->y_ppem < 24         )
       glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
 
+    FT_TRACE1(( "  subglyphs = %u, contours = %hd, points = %hd,"
+                " flags = 0x%.3x\n",
+                loader.gloader->base.num_subglyphs,
+                glyph->outline.n_contours,
+                glyph->outline.n_points,
+                glyph->outline.flags ));
+
+    tt_loader_done( &loader );
+
   Exit:
 #ifdef FT_DEBUG_LEVEL_TRACE
     if ( error )
diff --git a/src/truetype/ttgload.h b/src/truetype/ttgload.h
index f1324bc..8f72cd5 100644
--- a/src/truetype/ttgload.h
+++ b/src/truetype/ttgload.h
@@ -4,7 +4,7 @@
  *
  *   TrueType Glyph Loader (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,7 +20,6 @@
 #define TTGLOAD_H_
 
 
-#include <ft2build.h>
 #include "ttobjs.h"
 
 #ifdef TT_USE_BYTECODE_INTERPRETER
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index 78d87dc..b462263 100644
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -4,7 +4,7 @@
  *
  *   TrueType GX Font Variation loader
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * David Turner, Robert Wilhelm, Werner Lemberg, and George Williams.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -40,14 +40,14 @@
 
 
 #include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 #include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_SFNT_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_TRUETYPE_IDS_H
-#include FT_MULTIPLE_MASTERS_H
-#include FT_LIST_H
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/sfnt.h>
+#include <freetype/tttags.h>
+#include <freetype/ttnameid.h>
+#include <freetype/ftmm.h>
+#include <freetype/ftlist.h>
 
 #include "ttpload.h"
 #include "ttgxvar.h"
@@ -1470,6 +1470,7 @@
     FT_ULong      table_len;
     FT_ULong      gvar_start;
     FT_ULong      offsetToData;
+    FT_ULong      offsets_len;
     GX_GVar_Head  gvar_head;
 
     static const FT_Frame_Field  gvar_fields[] =
@@ -1530,9 +1531,13 @@
       goto Exit;
     }
 
-    /* rough sanity check: offsets can be either 2 or 4 bytes */
-    if ( (FT_ULong)gvar_head.glyphCount *
-           ( ( gvar_head.flags & 1 ) ? 4 : 2 ) > table_len )
+    /* offsets can be either 2 or 4 bytes                  */
+    /* (one more offset than glyphs, to mark size of last) */
+    offsets_len = ( gvar_head.glyphCount + 1 ) *
+                  ( ( gvar_head.flags & 1 ) ? 4L : 2L );
+
+    /* rough sanity check */
+    if (offsets_len > table_len )
     {
       FT_TRACE1(( "ft_var_load_gvar: invalid number of glyphs\n" ));
       error = FT_THROW( Invalid_Table );
@@ -1541,81 +1546,102 @@
 
     FT_TRACE2(( "loaded\n" ));
 
-    blend->gvar_size   = table_len;
-    blend->tuplecount  = gvar_head.globalCoordCount;
-    blend->gv_glyphcnt = gvar_head.glyphCount;
-    offsetToData       = gvar_start + gvar_head.offsetToData;
+    blend->gvar_size = table_len;
+    offsetToData     = gvar_start + gvar_head.offsetToData;
 
     FT_TRACE5(( "gvar: there %s %d shared coordinate%s:\n",
-                blend->tuplecount == 1 ? "is" : "are",
-                blend->tuplecount,
-                blend->tuplecount == 1 ? "" : "s" ));
+                gvar_head.globalCoordCount == 1 ? "is" : "are",
+                gvar_head.globalCoordCount,
+                gvar_head.globalCoordCount == 1 ? "" : "s" ));
 
-    if ( FT_NEW_ARRAY( blend->glyphoffsets, blend->gv_glyphcnt + 1 ) )
+    if ( FT_FRAME_ENTER( offsets_len ) )
       goto Exit;
 
+    /* offsets (one more offset than glyphs, to mark size of last) */
+    if ( FT_NEW_ARRAY( blend->glyphoffsets, gvar_head.glyphCount + 1 ) )
+      goto Fail2;
+
     if ( gvar_head.flags & 1 )
     {
-      FT_ULong  limit = gvar_start + table_len;
+      FT_ULong  limit      = gvar_start + table_len;
+      FT_ULong  max_offset = 0;
 
 
-      /* long offsets (one more offset than glyphs, to mark size of last) */
-      if ( FT_FRAME_ENTER( ( blend->gv_glyphcnt + 1 ) * 4L ) )
-        goto Exit;
-
-      for ( i = 0; i <= blend->gv_glyphcnt; i++ )
+      for ( i = 0; i <= gvar_head.glyphCount; i++ )
       {
         blend->glyphoffsets[i] = offsetToData + FT_GET_ULONG();
-        /* use `>', not `>=' */
-        if ( blend->glyphoffsets[i] > limit )
+
+        if ( max_offset <= blend->glyphoffsets[i] )
+          max_offset = blend->glyphoffsets[i];
+        else
         {
           FT_TRACE2(( "ft_var_load_gvar:"
-                      " invalid glyph variation data offset for index %d\n",
+                      " glyph variation data offset %d not monotonic\n",
                       i ));
-          error = FT_THROW( Invalid_Table );
-          break;
+          blend->glyphoffsets[i] = max_offset;
+        }
+
+        /* use `<', not `<=' */
+        if ( limit < blend->glyphoffsets[i] )
+        {
+          FT_TRACE2(( "ft_var_load_gvar:"
+                      " glyph variation data offset %d out of range\n",
+                      i ));
+          blend->glyphoffsets[i] = limit;
         }
       }
     }
     else
     {
-      FT_ULong  limit = gvar_start + table_len;
+      FT_ULong  limit      = gvar_start + table_len;
+      FT_ULong  max_offset = 0;
 
 
-      /* short offsets (one more offset than glyphs, to mark size of last) */
-      if ( FT_FRAME_ENTER( ( blend->gv_glyphcnt + 1 ) * 2L ) )
-        goto Exit;
-
-      for ( i = 0; i <= blend->gv_glyphcnt; i++ )
+      for ( i = 0; i <= gvar_head.glyphCount; i++ )
       {
         blend->glyphoffsets[i] = offsetToData + FT_GET_USHORT() * 2;
-        /* use `>', not `>=' */
-        if ( blend->glyphoffsets[i] > limit )
+
+        if ( max_offset <= blend->glyphoffsets[i] )
+          max_offset = blend->glyphoffsets[i];
+        else
         {
           FT_TRACE2(( "ft_var_load_gvar:"
-                      " invalid glyph variation data offset for index %d\n",
+                      " glyph variation data offset %d not monotonic\n",
                       i ));
-          error = FT_THROW( Invalid_Table );
-          break;
+          blend->glyphoffsets[i] = max_offset;
+        }
+
+        /* use `<', not `<=' */
+        if ( limit < blend->glyphoffsets[i] )
+        {
+          FT_TRACE2(( "ft_var_load_gvar:"
+                      " glyph variation data offset %d out of range\n",
+                      i ));
+          blend->glyphoffsets[i] = limit;
         }
       }
     }
 
+    blend->gv_glyphcnt = gvar_head.glyphCount;
+
     FT_FRAME_EXIT();
-    if ( error )
-      goto Exit;
 
-    if ( blend->tuplecount != 0 )
+    if ( gvar_head.globalCoordCount != 0 )
     {
+      if ( FT_STREAM_SEEK( gvar_start + gvar_head.offsetToCoord ) ||
+           FT_FRAME_ENTER( gvar_head.globalCoordCount *
+                           gvar_head.axisCount * 2L )             )
+      {
+        FT_TRACE2(( "ft_var_load_gvar:"
+                    " glyph variation shared tuples missing\n" ));
+        goto Fail;
+      }
+
       if ( FT_NEW_ARRAY( blend->tuplecoords,
-                         gvar_head.axisCount * blend->tuplecount ) )
-        goto Exit;
+                         gvar_head.axisCount * gvar_head.globalCoordCount ) )
+        goto Fail2;
 
-      if ( FT_STREAM_SEEK( gvar_start + gvar_head.offsetToCoord )         ||
-           FT_FRAME_ENTER( blend->tuplecount * gvar_head.axisCount * 2L ) )
-        goto Exit;
-
-      for ( i = 0; i < blend->tuplecount; i++ )
+      for ( i = 0; i < gvar_head.globalCoordCount; i++ )
       {
         FT_TRACE5(( "  [ " ));
         for ( j = 0; j < (FT_UInt)gvar_head.axisCount; j++ )
@@ -1628,6 +1654,8 @@
         FT_TRACE5(( "]\n" ));
       }
 
+      blend->tuplecount = gvar_head.globalCoordCount;
+
       FT_TRACE5(( "\n" ));
 
       FT_FRAME_EXIT();
@@ -1635,6 +1663,14 @@
 
   Exit:
     return error;
+
+  Fail2:
+    FT_FRAME_EXIT();
+
+  Fail:
+    FT_FREE( blend->glyphoffsets );
+    blend->gv_glyphcnt = 0;
+    goto Exit;
   }
 
 
@@ -1693,7 +1729,7 @@
 
       if ( tuple_coords[i] == 0 )
       {
-        FT_TRACE6(( "      tuple coordinate is zero, ignore\n", i ));
+        FT_TRACE6(( "      tuple coordinate is zero, ignore\n" ));
         continue;
       }
 
@@ -2127,7 +2163,7 @@
     /* `fvar' table validity check in `sfnt_init_face'          */
 
     /* the various `*_size' variables, which we also use as     */
-    /* offsets into the `mmlen' array, must be multiples of the */
+    /* offsets into the `mmvar' array, must be multiples of the */
     /* pointer size (except the last one); without such an      */
     /* alignment there might be runtime errors due to           */
     /* misaligned addresses                                     */
@@ -3037,7 +3073,7 @@
   TT_Set_Named_Instance( TT_Face  face,
                          FT_UInt  instance_index )
   {
-    FT_Error    error = FT_ERR( Invalid_Argument );
+    FT_Error    error;
     GX_Blend    blend;
     FT_MM_Var*  mmvar;
 
@@ -3057,7 +3093,10 @@
 
     /* `instance_index' starts with value 1, thus `>' */
     if ( instance_index > num_instances )
+    {
+      error = FT_ERR( Invalid_Argument );
       goto Exit;
+    }
 
     if ( instance_index > 0 )
     {
@@ -3766,7 +3805,7 @@
            blend->glyphoffsets[glyph_index + 1] )
     {
       FT_TRACE2(( "TT_Vary_Apply_Glyph_Deltas:"
-                  " no variation data for this glyph\n" ));
+                  " no variation data for glyph %d\n", glyph_index ));
       return FT_Err_Ok;
     }
 
diff --git a/src/truetype/ttgxvar.h b/src/truetype/ttgxvar.h
index 07c99b6..26e89bc 100644
--- a/src/truetype/ttgxvar.h
+++ b/src/truetype/ttgxvar.h
@@ -4,7 +4,7 @@
  *
  *   TrueType GX Font Variation loader (specification)
  *
- * Copyright (C) 2004-2019 by
+ * Copyright (C) 2004-2020 by
  * David Turner, Robert Wilhelm, Werner Lemberg and George Williams.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,7 +20,6 @@
 #define TTGXVAR_H_
 
 
-#include <ft2build.h>
 #include "ttobjs.h"
 
 
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index 70434e1..0c3cb10 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -4,7 +4,7 @@
  *
  *   TrueType bytecode interpreter (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,13 +20,12 @@
 /* issues; many thanks!                                                */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
-#include FT_TRIGONOMETRY_H
-#include FT_SYSTEM_H
-#include FT_DRIVER_H
-#include FT_MULTIPLE_MASTERS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/fttrigon.h>
+#include <freetype/ftsystem.h>
+#include <freetype/ftdriver.h>
+#include <freetype/ftmm.h>
 
 #include "ttinterp.h"
 #include "tterrors.h"
@@ -294,7 +293,7 @@
     FT_Error  error;
 
 
-    FT_TRACE1(( "Init_Context: new object at 0x%08p\n", exec ));
+    FT_TRACE1(( "Init_Context: new object at %p\n", (void *)exec ));
 
     exec->memory   = memory;
     exec->callSize = 32;
@@ -319,7 +318,7 @@
     return FT_Err_Ok;
 
   Fail_Memory:
-    FT_ERROR(( "Init_Context: not enough memory for %p\n", exec ));
+    FT_ERROR(( "Init_Context: not enough memory for %p\n", (void *)exec ));
     TT_Done_Context( exec );
 
     return error;
@@ -1956,8 +1955,8 @@
    *   distance ::
    *     The distance (not) to round.
    *
-   *   compensation ::
-   *     The engine compensation.
+   *   color ::
+   *     The engine compensation color.
    *
    * @Return:
    *   The compensated distance.
@@ -1965,12 +1964,11 @@
   static FT_F26Dot6
   Round_None( TT_ExecContext  exc,
               FT_F26Dot6      distance,
-              FT_F26Dot6      compensation )
+              FT_Int          color )
   {
+    FT_F26Dot6  compensation = exc->tt_metrics.compensations[color];
     FT_F26Dot6  val;
 
-    FT_UNUSED( exc );
-
 
     if ( distance >= 0 )
     {
@@ -2000,8 +1998,8 @@
    *   distance ::
    *     The distance to round.
    *
-   *   compensation ::
-   *     The engine compensation.
+   *   color ::
+   *     The engine compensation color.
    *
    * @Return:
    *   Rounded distance.
@@ -2009,12 +2007,11 @@
   static FT_F26Dot6
   Round_To_Grid( TT_ExecContext  exc,
                  FT_F26Dot6      distance,
-                 FT_F26Dot6      compensation )
+                 FT_Int          color )
   {
+    FT_F26Dot6  compensation = exc->tt_metrics.compensations[color];
     FT_F26Dot6  val;
 
-    FT_UNUSED( exc );
-
 
     if ( distance >= 0 )
     {
@@ -2046,8 +2043,8 @@
    *   distance ::
    *     The distance to round.
    *
-   *   compensation ::
-   *     The engine compensation.
+   *   color ::
+   *     The engine compensation color.
    *
    * @Return:
    *   Rounded distance.
@@ -2055,12 +2052,11 @@
   static FT_F26Dot6
   Round_To_Half_Grid( TT_ExecContext  exc,
                       FT_F26Dot6      distance,
-                      FT_F26Dot6      compensation )
+                      FT_Int          color )
   {
+    FT_F26Dot6  compensation = exc->tt_metrics.compensations[color];
     FT_F26Dot6  val;
 
-    FT_UNUSED( exc );
-
 
     if ( distance >= 0 )
     {
@@ -2094,8 +2090,8 @@
    *   distance ::
    *     The distance to round.
    *
-   *   compensation ::
-   *     The engine compensation.
+   *   color ::
+   *     The engine compensation color.
    *
    * @Return:
    *   Rounded distance.
@@ -2103,12 +2099,11 @@
   static FT_F26Dot6
   Round_Down_To_Grid( TT_ExecContext  exc,
                       FT_F26Dot6      distance,
-                      FT_F26Dot6      compensation )
+                      FT_Int          color )
   {
+    FT_F26Dot6  compensation = exc->tt_metrics.compensations[color];
     FT_F26Dot6  val;
 
-    FT_UNUSED( exc );
-
 
     if ( distance >= 0 )
     {
@@ -2139,8 +2134,8 @@
    *   distance ::
    *     The distance to round.
    *
-   *   compensation ::
-   *     The engine compensation.
+   *   color ::
+   *     The engine compensation color.
    *
    * @Return:
    *   Rounded distance.
@@ -2148,12 +2143,11 @@
   static FT_F26Dot6
   Round_Up_To_Grid( TT_ExecContext  exc,
                     FT_F26Dot6      distance,
-                    FT_F26Dot6      compensation )
+                    FT_Int          color )
   {
+    FT_F26Dot6  compensation = exc->tt_metrics.compensations[color];
     FT_F26Dot6  val;
 
-    FT_UNUSED( exc );
-
 
     if ( distance >= 0 )
     {
@@ -2185,8 +2179,8 @@
    *   distance ::
    *     The distance to round.
    *
-   *   compensation ::
-   *     The engine compensation.
+   *   color ::
+   *     The engine compensation color.
    *
    * @Return:
    *   Rounded distance.
@@ -2194,12 +2188,11 @@
   static FT_F26Dot6
   Round_To_Double_Grid( TT_ExecContext  exc,
                         FT_F26Dot6      distance,
-                        FT_F26Dot6      compensation )
+                        FT_Int          color )
   {
+    FT_F26Dot6  compensation = exc->tt_metrics.compensations[color];
     FT_F26Dot6  val;
 
-    FT_UNUSED( exc );
-
 
     if ( distance >= 0 )
     {
@@ -2231,8 +2224,8 @@
    *   distance ::
    *     The distance to round.
    *
-   *   compensation ::
-   *     The engine compensation.
+   *   color ::
+   *     The engine compensation color.
    *
    * @Return:
    *   Rounded distance.
@@ -2246,8 +2239,9 @@
   static FT_F26Dot6
   Round_Super( TT_ExecContext  exc,
                FT_F26Dot6      distance,
-               FT_F26Dot6      compensation )
+               FT_Int          color )
   {
+    FT_F26Dot6  compensation = exc->tt_metrics.compensations[color];
     FT_F26Dot6  val;
 
 
@@ -2286,8 +2280,8 @@
    *   distance ::
    *     The distance to round.
    *
-   *   compensation ::
-   *     The engine compensation.
+   *   color ::
+   *     The engine compensation color.
    *
    * @Return:
    *   Rounded distance.
@@ -2299,8 +2293,9 @@
   static FT_F26Dot6
   Round_Super_45( TT_ExecContext  exc,
                   FT_F26Dot6      distance,
-                  FT_F26Dot6      compensation )
+                  FT_Int          color )
   {
+    FT_F26Dot6  compensation = exc->tt_metrics.compensations[color];
     FT_F26Dot6  val;
 
 
@@ -2899,7 +2894,7 @@
   Ins_ODD( TT_ExecContext  exc,
            FT_Long*        args )
   {
-    args[0] = ( ( exc->func_round( exc, args[0], 0 ) & 127 ) == 64 );
+    args[0] = ( ( exc->func_round( exc, args[0], 3 ) & 127 ) == 64 );
   }
 
 
@@ -2913,7 +2908,7 @@
   Ins_EVEN( TT_ExecContext  exc,
             FT_Long*        args )
   {
-    args[0] = ( ( exc->func_round( exc, args[0], 0 ) & 127 ) == 0 );
+    args[0] = ( ( exc->func_round( exc, args[0], 3 ) & 127 ) == 0 );
   }
 
 
@@ -3243,10 +3238,7 @@
   Ins_ROUND( TT_ExecContext  exc,
              FT_Long*        args )
   {
-    args[0] = exc->func_round(
-                exc,
-                args[0],
-                exc->tt_metrics.compensations[exc->opcode - 0x68] );
+    args[0] = exc->func_round( exc, args[0], exc->opcode & 3 );
   }
 
 
@@ -3260,10 +3252,7 @@
   Ins_NROUND( TT_ExecContext  exc,
               FT_Long*        args )
   {
-    args[0] = Round_None(
-                exc,
-                args[0],
-                exc->tt_metrics.compensations[exc->opcode - 0x6C] );
+    args[0] = Round_None( exc, args[0], exc->opcode & 3 );
   }
 
 
@@ -3718,7 +3707,7 @@
     /* We will then parse the current table.                       */
 
     rec   = exc->FDefs;
-    limit = rec + exc->numFDefs;
+    limit = FT_OFFSET( rec, exc->numFDefs );
     n     = (FT_ULong)args[0];
 
     for ( ; rec < limit; rec++ )
@@ -3965,6 +3954,9 @@
     if ( BOUNDSL( F, exc->maxFunc + 1 ) )
       goto Fail;
 
+    if ( !exc->FDefs )
+      goto Fail;
+
     /* Except for some old Apple fonts, all functions in a TrueType */
     /* font are defined in increasing order, starting from 0.  This */
     /* means that we normally have                                  */
@@ -4062,7 +4054,7 @@
     /*                                                              */
     /* If this isn't true, we need to look up the function table.   */
 
-    def = exc->FDefs + F;
+    def = FT_OFFSET( exc->FDefs, F );
     if ( exc->maxFunc + 1 != exc->numFDefs || def->opc != F )
     {
       /* look up the FDefs table */
@@ -4070,7 +4062,7 @@
 
 
       def   = exc->FDefs;
-      limit = def + exc->numFDefs;
+      limit = FT_OFFSET( def, exc->numFDefs );
 
       while ( def < limit && def->opc != F )
         def++;
@@ -4150,7 +4142,7 @@
     /*  First of all, look for the same function in our table */
 
     def   = exc->IDefs;
-    limit = def + exc->numIDefs;
+    limit = FT_OFFSET( def, exc->numIDefs );
 
     for ( ; def < limit; def++ )
       if ( def->opc == (FT_ULong)args[0] )
@@ -5730,9 +5722,6 @@
   {
     FT_F26Dot6  dx, dy;
     FT_UShort   point;
-#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
-    FT_Int      B1, B2;
-#endif
 #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
     FT_Bool     in_twilight = FT_BOOL( exc->GS.gep0 == 0 ||
                                        exc->GS.gep1 == 0 ||
@@ -5767,8 +5756,12 @@
       }
       else
 #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
-      if ( SUBPIXEL_HINTING_INFINALITY )
+      if ( SUBPIXEL_HINTING_INFINALITY &&
+           exc->ignore_x_mode          )
       {
+        FT_Int  B1, B2;
+
+
         /*  If not using ignore_x_mode rendering, allow ZP2 move.        */
         /*  If inline deltas aren't allowed, skip ZP2 move.              */
         /*  If using ignore_x_mode rendering, allow ZP2 point move if:   */
@@ -5777,72 +5770,57 @@
         /*   - the glyph is specifically set to allow SHPIX moves        */
         /*   - the move is on a previously Y-touched point               */
 
-        if ( exc->ignore_x_mode )
+        /* save point for later comparison */
+        B1 = exc->zp2.cur[point].y;
+
+        if ( exc->face->sph_compatibility_mode )
         {
-          /* save point for later comparison */
+          if ( exc->sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES )
+            dy = FT_PIX_ROUND( B1 + dy ) - B1;
+
+          /* skip post-iup deltas */
+          if ( exc->iup_called                                          &&
+               ( ( exc->sph_in_func_flags & SPH_FDEF_INLINE_DELTA_1 ) ||
+                 ( exc->sph_in_func_flags & SPH_FDEF_INLINE_DELTA_2 ) ) )
+            goto Skip;
+
+          if ( !( exc->sph_tweak_flags & SPH_TWEAK_ALWAYS_SKIP_DELTAP ) &&
+                ( ( exc->is_composite && exc->GS.freeVector.y != 0 ) ||
+                  ( exc->zp2.tags[point] & FT_CURVE_TAG_TOUCH_Y )    ||
+                  ( exc->sph_tweak_flags & SPH_TWEAK_DO_SHPIX )      )  )
+            Move_Zp2_Point( exc, point, 0, dy, TRUE );
+
+          /* save new point */
           if ( exc->GS.freeVector.y != 0 )
-            B1 = exc->zp2.cur[point].y;
-          else
-            B1 = exc->zp2.cur[point].x;
-
-          if ( !exc->face->sph_compatibility_mode &&
-               exc->GS.freeVector.y != 0          )
           {
-            Move_Zp2_Point( exc, point, dx, dy, TRUE );
+            B2 = exc->zp2.cur[point].y;
 
-            /* save new point */
-            if ( exc->GS.freeVector.y != 0 )
-            {
-              B2 = exc->zp2.cur[point].y;
-
-              /* reverse any disallowed moves */
-              if ( ( exc->sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) &&
-                   ( B1 & 63 ) != 0                                           &&
-                   ( B2 & 63 ) != 0                                           &&
-                   B1 != B2                                                   )
-                Move_Zp2_Point( exc,
-                                point,
-                                NEG_LONG( dx ),
-                                NEG_LONG( dy ),
-                                TRUE );
-            }
+            /* reverse any disallowed moves */
+            if ( ( B1 & 63 ) == 0 &&
+                 ( B2 & 63 ) != 0 &&
+                 B1 != B2         )
+              Move_Zp2_Point( exc, point, 0, NEG_LONG( dy ), TRUE );
           }
-          else if ( exc->face->sph_compatibility_mode )
-          {
-            if ( exc->sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES )
-            {
-              dx = FT_PIX_ROUND( B1 + dx ) - B1;
-              dy = FT_PIX_ROUND( B1 + dy ) - B1;
-            }
-
-            /* skip post-iup deltas */
-            if ( exc->iup_called                                          &&
-                 ( ( exc->sph_in_func_flags & SPH_FDEF_INLINE_DELTA_1 ) ||
-                   ( exc->sph_in_func_flags & SPH_FDEF_INLINE_DELTA_2 ) ) )
-              goto Skip;
-
-            if ( !( exc->sph_tweak_flags & SPH_TWEAK_ALWAYS_SKIP_DELTAP ) &&
-                  ( ( exc->is_composite && exc->GS.freeVector.y != 0 ) ||
-                    ( exc->zp2.tags[point] & FT_CURVE_TAG_TOUCH_Y )    ||
-                    ( exc->sph_tweak_flags & SPH_TWEAK_DO_SHPIX )      )  )
-              Move_Zp2_Point( exc, point, 0, dy, TRUE );
-
-            /* save new point */
-            if ( exc->GS.freeVector.y != 0 )
-            {
-              B2 = exc->zp2.cur[point].y;
-
-              /* reverse any disallowed moves */
-              if ( ( B1 & 63 ) == 0 &&
-                   ( B2 & 63 ) != 0 &&
-                   B1 != B2         )
-                Move_Zp2_Point( exc, point, 0, NEG_LONG( dy ), TRUE );
-            }
-          }
-          else if ( exc->sph_in_func_flags & SPH_FDEF_TYPEMAN_DIAGENDCTRL )
-            Move_Zp2_Point( exc, point, dx, dy, TRUE );
         }
-        else
+        else if ( exc->GS.freeVector.y != 0 )
+        {
+          Move_Zp2_Point( exc, point, dx, dy, TRUE );
+
+          /* save new point */
+          B2 = exc->zp2.cur[point].y;
+
+          /* reverse any disallowed moves */
+          if ( ( exc->sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) &&
+               ( B1 & 63 ) != 0                                           &&
+               ( B2 & 63 ) != 0                                           &&
+               B1 != B2                                                   )
+            Move_Zp2_Point( exc,
+                            point,
+                            NEG_LONG( dx ),
+                            NEG_LONG( dy ),
+                            TRUE );
+        }
+        else if ( exc->sph_in_func_flags & SPH_FDEF_TYPEMAN_DIAGENDCTRL )
           Move_Zp2_Point( exc, point, dx, dy, TRUE );
       }
       else
@@ -5890,22 +5868,8 @@
   {
     FT_UShort   point = 0;
     FT_F26Dot6  distance;
-#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
-    FT_F26Dot6  control_value_cutin = 0;
-    FT_F26Dot6  delta;
 
 
-    if ( SUBPIXEL_HINTING_INFINALITY )
-    {
-      control_value_cutin = exc->GS.control_value_cutin;
-
-      if ( exc->ignore_x_mode                                 &&
-           exc->GS.freeVector.x != 0                          &&
-           !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
-        control_value_cutin = 0;
-    }
-#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
-
     point = (FT_UShort)args[0];
 
     if ( BOUNDS( point,       exc->zp1.n_points ) ||
@@ -5928,16 +5892,25 @@
     distance = PROJECT( exc->zp1.cur + point, exc->zp0.cur + exc->GS.rp0 );
 
 #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
-    delta = SUB_LONG( distance, args[1] );
-    if ( delta < 0 )
-      delta = NEG_LONG( delta );
-
     /* subpixel hinting - make MSIRP respect CVT cut-in; */
-    if ( SUBPIXEL_HINTING_INFINALITY  &&
-         exc->ignore_x_mode           &&
-         exc->GS.freeVector.x != 0    &&
-         delta >= control_value_cutin )
-      distance = args[1];
+    if ( SUBPIXEL_HINTING_INFINALITY &&
+         exc->ignore_x_mode          &&
+         exc->GS.freeVector.x != 0   )
+    {
+      FT_F26Dot6  control_value_cutin = exc->GS.control_value_cutin;
+      FT_F26Dot6  delta;
+
+
+      if ( !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
+        control_value_cutin = 0;
+
+      delta = SUB_LONG( distance, args[1] );
+      if ( delta < 0 )
+        delta = NEG_LONG( delta );
+
+      if ( delta >= control_value_cutin )
+        distance = args[1];
+    }
 #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
 
     exc->func_move( exc,
@@ -5984,18 +5957,10 @@
       if ( SUBPIXEL_HINTING_INFINALITY &&
            exc->ignore_x_mode          &&
            exc->GS.freeVector.x != 0   )
-        distance = SUB_LONG(
-                     Round_None( exc,
-                                 cur_dist,
-                                 exc->tt_metrics.compensations[0] ),
-                     cur_dist );
+        distance = SUB_LONG( Round_None( exc, cur_dist, 3 ), cur_dist );
       else
 #endif
-        distance = SUB_LONG(
-                     exc->func_round( exc,
-                                      cur_dist,
-                                      exc->tt_metrics.compensations[0] ),
-                     cur_dist );
+        distance = SUB_LONG( exc->func_round( exc, cur_dist, 3 ), cur_dist );
     }
     else
       distance = 0;
@@ -6021,21 +5986,10 @@
     FT_UShort   point;
     FT_F26Dot6  distance;
     FT_F26Dot6  org_dist;
-    FT_F26Dot6  control_value_cutin;
 
 
-    control_value_cutin = exc->GS.control_value_cutin;
-    cvtEntry            = (FT_ULong)args[1];
-    point               = (FT_UShort)args[0];
-
-#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
-    if ( SUBPIXEL_HINTING_INFINALITY                        &&
-         exc->ignore_x_mode                                 &&
-         exc->GS.freeVector.x != 0                          &&
-         exc->GS.freeVector.y == 0                          &&
-         !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
-      control_value_cutin = 0;
-#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
+    cvtEntry = (FT_ULong)args[1];
+    point    = (FT_UShort)args[0];
 
     if ( BOUNDS( point,     exc->zp0.n_points ) ||
          BOUNDSL( cvtEntry, exc->cvtSize )      )
@@ -6079,7 +6033,7 @@
         exc->zp0.org[point].x = TT_MulFix14( distance,
                                              exc->GS.freeVector.x );
       exc->zp0.org[point].y = TT_MulFix14( distance,
-                                           exc->GS.freeVector.y ),
+                                           exc->GS.freeVector.y );
       exc->zp0.cur[point]   = exc->zp0.org[point];
     }
 #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
@@ -6095,9 +6049,19 @@
 
     if ( ( exc->opcode & 1 ) != 0 )   /* rounding and control cut-in flag */
     {
+      FT_F26Dot6  control_value_cutin = exc->GS.control_value_cutin;
       FT_F26Dot6  delta;
 
 
+#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
+      if ( SUBPIXEL_HINTING_INFINALITY                        &&
+           exc->ignore_x_mode                                 &&
+           exc->GS.freeVector.x != 0                          &&
+           exc->GS.freeVector.y == 0                          &&
+           !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
+        control_value_cutin = 0;
+#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
+
       delta = SUB_LONG( distance, org_dist );
       if ( delta < 0 )
         delta = NEG_LONG( delta );
@@ -6109,14 +6073,10 @@
       if ( SUBPIXEL_HINTING_INFINALITY &&
            exc->ignore_x_mode          &&
            exc->GS.freeVector.x != 0   )
-        distance = Round_None( exc,
-                               distance,
-                               exc->tt_metrics.compensations[0] );
+        distance = Round_None( exc, distance, 3 );
       else
 #endif
-        distance = exc->func_round( exc,
-                                    distance,
-                                    exc->tt_metrics.compensations[0] );
+        distance = exc->func_round( exc, distance, 3 );
     }
 
     exc->func_move( exc, &exc->zp0, point, SUB_LONG( distance, org_dist ) );
@@ -6138,19 +6098,9 @@
             FT_Long*        args )
   {
     FT_UShort   point = 0;
-    FT_F26Dot6  org_dist, distance, minimum_distance;
+    FT_F26Dot6  org_dist, distance;
 
 
-    minimum_distance = exc->GS.minimum_distance;
-
-#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
-    if ( SUBPIXEL_HINTING_INFINALITY                        &&
-         exc->ignore_x_mode                                 &&
-         exc->GS.freeVector.x != 0                          &&
-         !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
-      minimum_distance = 0;
-#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
-
     point = (FT_UShort)args[0];
 
     if ( BOUNDS( point,       exc->zp1.n_points ) ||
@@ -6223,27 +6173,29 @@
       if ( SUBPIXEL_HINTING_INFINALITY &&
            exc->ignore_x_mode          &&
            exc->GS.freeVector.x != 0   )
-        distance = Round_None(
-                     exc,
-                     org_dist,
-                     exc->tt_metrics.compensations[exc->opcode & 3] );
+        distance = Round_None( exc, org_dist, exc->opcode & 3 );
       else
 #endif
-        distance = exc->func_round(
-                     exc,
-                     org_dist,
-                     exc->tt_metrics.compensations[exc->opcode & 3] );
+        distance = exc->func_round( exc, org_dist, exc->opcode & 3 );
     }
     else
-      distance = Round_None(
-                   exc,
-                   org_dist,
-                   exc->tt_metrics.compensations[exc->opcode & 3] );
+      distance = Round_None( exc, org_dist, exc->opcode & 3 );
 
     /* minimum distance flag */
 
     if ( ( exc->opcode & 8 ) != 0 )
     {
+      FT_F26Dot6  minimum_distance = exc->GS.minimum_distance;
+
+
+#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
+      if ( SUBPIXEL_HINTING_INFINALITY                        &&
+           exc->ignore_x_mode                                 &&
+           exc->GS.freeVector.x != 0                          &&
+           !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
+        minimum_distance = 0;
+#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
+
       if ( org_dist >= 0 )
       {
         if ( distance < minimum_distance )
@@ -6287,30 +6239,13 @@
     FT_F26Dot6  cvt_dist,
                 distance,
                 cur_dist,
-                org_dist,
-                control_value_cutin,
-                minimum_distance;
-#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
-    FT_Int      B1           = 0; /* pacify compiler */
-    FT_Int      B2           = 0;
-    FT_Bool     reverse_move = FALSE;
-#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
+                org_dist;
 
     FT_F26Dot6  delta;
 
 
-    minimum_distance    = exc->GS.minimum_distance;
-    control_value_cutin = exc->GS.control_value_cutin;
-    point               = (FT_UShort)args[0];
-    cvtEntry            = (FT_ULong)( ADD_LONG( args[1], 1 ) );
-
-#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
-    if ( SUBPIXEL_HINTING_INFINALITY                        &&
-         exc->ignore_x_mode                                 &&
-         exc->GS.freeVector.x != 0                          &&
-         !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
-      control_value_cutin = minimum_distance = 0;
-#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
+    point    = (FT_UShort)args[0];
+    cvtEntry = (FT_ULong)( ADD_LONG( args[1], 1 ) );
 
     /* XXX: UNDOCUMENTED! cvt[-1] = 0 always */
 
@@ -6346,12 +6281,14 @@
     /* twilight points (confirmed by Greg Hitchcock)   */
     if ( exc->GS.gep1 == 0 )
     {
-      exc->zp1.org[point].x = exc->zp0.org[exc->GS.rp0].x +
-                              TT_MulFix14( cvt_dist,
-                                           exc->GS.freeVector.x );
-      exc->zp1.org[point].y = exc->zp0.org[exc->GS.rp0].y +
-                              TT_MulFix14( cvt_dist,
-                                           exc->GS.freeVector.y );
+      exc->zp1.org[point].x = ADD_LONG(
+                                exc->zp0.org[exc->GS.rp0].x,
+                                TT_MulFix14( cvt_dist,
+                                             exc->GS.freeVector.x ) );
+      exc->zp1.org[point].y = ADD_LONG(
+                                exc->zp0.org[exc->GS.rp0].y,
+                                TT_MulFix14( cvt_dist,
+                                             exc->GS.freeVector.y ) );
       exc->zp1.cur[point]   = exc->zp1.org[point];
     }
 
@@ -6366,19 +6303,6 @@
         cvt_dist = NEG_LONG( cvt_dist );
     }
 
-#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
-    if ( SUBPIXEL_HINTING_INFINALITY                               &&
-         exc->ignore_x_mode                                        &&
-         exc->GS.freeVector.y != 0                                 &&
-         ( exc->sph_tweak_flags & SPH_TWEAK_TIMES_NEW_ROMAN_HACK ) )
-    {
-      if ( cur_dist < -64 )
-        cvt_dist -= 16;
-      else if ( cur_dist > 64 && cur_dist < 84 )
-        cvt_dist += 32;
-    }
-#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
-
     /* control value cut-in and round */
 
     if ( ( exc->opcode & 4 ) != 0 )
@@ -6388,6 +6312,9 @@
 
       if ( exc->GS.gep0 == exc->GS.gep1 )
       {
+        FT_F26Dot6  control_value_cutin = exc->GS.control_value_cutin;
+
+
         /* XXX: According to Greg Hitchcock, the following wording is */
         /*      the right one:                                        */
         /*                                                            */
@@ -6408,10 +6335,7 @@
           cvt_dist = org_dist;
       }
 
-      distance = exc->func_round(
-                   exc,
-                   cvt_dist,
-                   exc->tt_metrics.compensations[exc->opcode & 3] );
+      distance = exc->func_round( exc, cvt_dist, exc->opcode & 3 );
     }
     else
     {
@@ -6422,6 +6346,22 @@
            exc->ignore_x_mode           &&
            exc->GS.gep0 == exc->GS.gep1 )
       {
+        FT_F26Dot6  control_value_cutin = exc->GS.control_value_cutin;
+
+
+        if ( exc->GS.freeVector.x != 0                          &&
+             !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
+          control_value_cutin = 0;
+
+        if ( exc->GS.freeVector.y != 0                                 &&
+             ( exc->sph_tweak_flags & SPH_TWEAK_TIMES_NEW_ROMAN_HACK ) )
+        {
+          if ( cur_dist < -64 )
+            cvt_dist -= 16;
+          else if ( cur_dist > 64 && cur_dist < 84 )
+            cvt_dist += 32;
+        }
+
         delta = SUB_LONG( cvt_dist, org_dist );
         if ( delta < 0 )
           delta = NEG_LONG( delta );
@@ -6431,16 +6371,24 @@
       }
 #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
 
-      distance = Round_None(
-                   exc,
-                   cvt_dist,
-                   exc->tt_metrics.compensations[exc->opcode & 3] );
+      distance = Round_None( exc, cvt_dist, exc->opcode & 3 );
     }
 
     /* minimum distance test */
 
     if ( ( exc->opcode & 8 ) != 0 )
     {
+      FT_F26Dot6  minimum_distance    = exc->GS.minimum_distance;
+
+
+#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
+      if ( SUBPIXEL_HINTING_INFINALITY                        &&
+           exc->ignore_x_mode                                 &&
+           exc->GS.freeVector.x != 0                          &&
+           !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
+        minimum_distance = 0;
+#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
+
       if ( org_dist >= 0 )
       {
         if ( distance < minimum_distance )
@@ -6454,60 +6402,51 @@
     }
 
 #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
-    if ( SUBPIXEL_HINTING_INFINALITY )
+    if ( SUBPIXEL_HINTING_INFINALITY &&
+         exc->ignore_x_mode          &&
+         exc->GS.freeVector.y != 0   )
     {
+      FT_Int   B1, B2;
+
+
       B1 = exc->zp1.cur[point].y;
 
       /* Round moves if necessary */
-      if ( exc->ignore_x_mode                                          &&
-           exc->GS.freeVector.y != 0                                   &&
-           ( exc->sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES ) )
+      if ( exc->sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES )
         distance = FT_PIX_ROUND( B1 + distance - cur_dist ) - B1 + cur_dist;
 
-      if ( exc->ignore_x_mode                                      &&
-           exc->GS.freeVector.y != 0                               &&
-           ( exc->opcode & 16 ) == 0                               &&
+      if ( ( exc->opcode & 16 ) == 0                               &&
            ( exc->opcode & 8 ) == 0                                &&
            ( exc->sph_tweak_flags & SPH_TWEAK_COURIER_NEW_2_HACK ) )
         distance += 64;
-    }
-#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
 
-    exc->func_move( exc,
-                    &exc->zp1,
-                    point,
-                    SUB_LONG( distance, cur_dist ) );
+      exc->func_move( exc,
+                      &exc->zp1,
+                      point,
+                      SUB_LONG( distance, cur_dist ) );
 
-#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
-    if ( SUBPIXEL_HINTING_INFINALITY )
-    {
       B2 = exc->zp1.cur[point].y;
 
       /* Reverse move if necessary */
-      if ( exc->ignore_x_mode )
-      {
-        if ( exc->face->sph_compatibility_mode &&
-             exc->GS.freeVector.y != 0         &&
+      if ( ( exc->face->sph_compatibility_mode &&
              ( B1 & 63 ) == 0                  &&
-             ( B2 & 63 ) != 0                  )
-          reverse_move = TRUE;
-
-        if ( ( exc->sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) &&
-             exc->GS.freeVector.y != 0                                  &&
-             ( B2 & 63 ) != 0                                           &&
-             ( B1 & 63 ) != 0                                           )
-          reverse_move = TRUE;
-      }
-
-      if ( reverse_move )
+             ( B2 & 63 ) != 0                  )                          ||
+           ( ( exc->sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) &&
+             ( B1 & 63 ) != 0                                           &&
+             ( B2 & 63 ) != 0                                           ) )
         exc->func_move( exc,
                         &exc->zp1,
                         point,
                         SUB_LONG( cur_dist, distance ) );
     }
-
+    else
 #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
 
+      exc->func_move( exc,
+                      &exc->zp1,
+                      point,
+                      SUB_LONG( distance, cur_dist ) );
+
   Fail:
     exc->GS.rp1 = exc->GS.rp0;
 
@@ -7180,10 +7119,9 @@
     FT_UShort  A;
     FT_ULong   C, P;
     FT_Long    B;
+
+
 #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
-    FT_UShort  B1, B2;
-
-
     if ( SUBPIXEL_HINTING_INFINALITY                              &&
          exc->ignore_x_mode                                       &&
          exc->iup_called                                          &&
@@ -7264,6 +7202,9 @@
             /* rules, always skipping deltas in subpixel direction.     */
             else if ( exc->ignore_x_mode && exc->GS.freeVector.y != 0 )
             {
+              FT_UShort  B1, B2;
+
+
               /* save the y value of the point now; compare after move */
               B1 = (FT_UShort)exc->zp0.cur[A].y;
 
@@ -7715,7 +7656,7 @@
   Ins_UNKNOWN( TT_ExecContext  exc )
   {
     TT_DefRecord*  def   = exc->IDefs;
-    TT_DefRecord*  limit = def + exc->numIDefs;
+    TT_DefRecord*  limit = FT_OFFSET( def, exc->numIDefs );
 
 
     for ( ; def < limit; def++ )
@@ -7841,7 +7782,7 @@
         num_twilight_points = 0xFFFFU;
 
       FT_TRACE5(( "TT_RunIns: Resetting number of twilight points\n"
-                  "           from %d to the more reasonable value %d\n",
+                  "           from %d to the more reasonable value %ld\n",
                   exc->twilight.n_points,
                   num_twilight_points ));
       exc->twilight.n_points = (FT_UShort)num_twilight_points;
@@ -7867,7 +7808,7 @@
                                   FT_MAX( 50,
                                           exc->cvtSize / 10 );
     else
-      exc->loopcall_counter_max = 300 + 8 * exc->cvtSize;
+      exc->loopcall_counter_max = 300 + 22 * exc->cvtSize;
 
     /* as a protection against an unreasonable number of CVT entries  */
     /* we assume at most 100 control values per glyph for the counter */
@@ -7876,11 +7817,11 @@
       exc->loopcall_counter_max = 100 * (FT_ULong)exc->face->root.num_glyphs;
 
     FT_TRACE5(( "TT_RunIns: Limiting total number of loops in LOOPCALL"
-                " to %d\n", exc->loopcall_counter_max ));
+                " to %ld\n", exc->loopcall_counter_max ));
 
     exc->neg_jump_counter_max = exc->loopcall_counter_max;
     FT_TRACE5(( "TT_RunIns: Limiting total number of backward jumps"
-                " to %d\n", exc->neg_jump_counter_max ));
+                " to %ld\n", exc->neg_jump_counter_max ));
 
     /* set PPEM and CVT functions */
     exc->tt_metrics.ratio = 0;
@@ -7917,14 +7858,14 @@
         /* if tracing level is 7, show current code position */
         /* and the first few stack elements also             */
         FT_TRACE6(( "  " ));
-        FT_TRACE7(( "%06d ", exc->IP ));
+        FT_TRACE7(( "%06ld ", exc->IP ));
         FT_TRACE6(( "%s", opcode_name[exc->opcode] + 2 ));
         FT_TRACE7(( "%*s", *opcode_name[exc->opcode] == 'A'
                               ? 2
                               : 12 - ( *opcode_name[exc->opcode] - '0' ),
                               "#" ));
         for ( n = 1; n <= cnt; n++ )
-          FT_TRACE7(( " %d", exc->stack[exc->top - n] ));
+          FT_TRACE7(( " %ld", exc->stack[exc->top - n] ));
         FT_TRACE6(( "\n" ));
       }
 #endif /* FT_DEBUG_LEVEL_TRACE */
@@ -8567,7 +8508,7 @@
         case FT_ERR( Invalid_Opcode ):
           {
             TT_DefRecord*  def   = exc->IDefs;
-            TT_DefRecord*  limit = def + exc->numIDefs;
+            TT_DefRecord*  limit = FT_OFFSET( def, exc->numIDefs );
 
 
             for ( ; def < limit; def++ )
@@ -8642,7 +8583,7 @@
     } while ( !exc->instruction_trap );
 
   LNo_Error_:
-    FT_TRACE4(( "  %d instruction%s executed\n",
+    FT_TRACE4(( "  %ld instruction%s executed\n",
                 ins_counter,
                 ins_counter == 1 ? "" : "s" ));
     return FT_Err_Ok;
diff --git a/src/truetype/ttinterp.h b/src/truetype/ttinterp.h
index 0cb1e89..6a83705 100644
--- a/src/truetype/ttinterp.h
+++ b/src/truetype/ttinterp.h
@@ -4,7 +4,7 @@
  *
  *   TrueType bytecode interpreter (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,7 +19,6 @@
 #ifndef TTINTERP_H_
 #define TTINTERP_H_
 
-#include <ft2build.h>
 #include "ttobjs.h"
 
 
@@ -52,7 +51,7 @@
   typedef FT_F26Dot6
   (*TT_Round_Func)( TT_ExecContext  exc,
                     FT_F26Dot6      distance,
-                    FT_F26Dot6      compensation );
+                    FT_Int          color );
 
   /* Point displacement along the freedom vector routine */
   typedef void
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index e4775a5..06d4569 100644
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -4,7 +4,7 @@
  *
  *   Objects manager (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,12 +16,11 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_INTERNAL_SFNT_H
-#include FT_DRIVER_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
+#include <freetype/internal/sfnt.h>
+#include <freetype/ftdriver.h>
 
 #include "ttgload.h"
 #include "ttpload.h"
@@ -1116,10 +1115,10 @@
       /* The Apple specification says that the compensation for     */
       /* `gray' is always zero.  FreeType doesn't do any            */
       /* compensation at all.                                       */
-      tt_metrics->compensations[0] = 0;   /* gray             */
-      tt_metrics->compensations[1] = 0;   /* black            */
-      tt_metrics->compensations[2] = 0;   /* white            */
-      tt_metrics->compensations[3] = 0;   /* the same as gray */
+      tt_metrics->compensations[0] = 0;   /* gray  */
+      tt_metrics->compensations[1] = 0;   /* black */
+      tt_metrics->compensations[2] = 0;   /* white */
+      tt_metrics->compensations[3] = 0;   /* zero  */
     }
 
     /* allocate function defs, instruction defs, cvt, and storage area */
diff --git a/src/truetype/ttobjs.h b/src/truetype/ttobjs.h
index 9fc654d..d986dea 100644
--- a/src/truetype/ttobjs.h
+++ b/src/truetype/ttobjs.h
@@ -4,7 +4,7 @@
  *
  *   Objects manager (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,9 +20,8 @@
 #define TTOBJS_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_TRUETYPE_TYPES_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/tttypes.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/truetype/ttpload.c b/src/truetype/ttpload.c
index bc954c2..b1255b8 100644
--- a/src/truetype/ttpload.c
+++ b/src/truetype/ttpload.c
@@ -4,7 +4,7 @@
  *
  *   TrueType-specific tables loader (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,11 +16,10 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
 
 #include "ttpload.h"
 
@@ -124,7 +123,7 @@
 
     if ( face->num_locations != (FT_ULong)face->root.num_glyphs + 1 )
     {
-      FT_TRACE2(( "glyph count mismatch!  loca: %d, maxp: %d\n",
+      FT_TRACE2(( "glyph count mismatch!  loca: %ld, maxp: %ld\n",
                   face->num_locations - 1, face->root.num_glyphs ));
 
       /* we only handle the case where `maxp' gives a larger value */
@@ -165,7 +164,7 @@
           face->num_locations = (FT_ULong)face->root.num_glyphs + 1;
           table_len           = new_loca_len;
 
-          FT_TRACE2(( "adjusting num_locations to %d\n",
+          FT_TRACE2(( "adjusting num_locations to %ld\n",
                       face->num_locations ));
         }
         else
@@ -173,7 +172,7 @@
           face->root.num_glyphs = face->num_locations
                                     ? (FT_Long)face->num_locations - 1 : 0;
 
-          FT_TRACE2(( "adjusting num_glyphs to %d\n",
+          FT_TRACE2(( "adjusting num_glyphs to %ld\n",
                       face->root.num_glyphs ));
         }
       }
@@ -238,7 +237,7 @@
     if ( pos1 > face->glyf_len )
     {
       FT_TRACE1(( "tt_face_get_location:"
-                  " too large offset (0x%08lx) found for glyph index %ld,\n"
+                  " too large offset (0x%08lx) found for glyph index %d,\n"
                   "                     "
                   " exceeding the end of `glyf' table (0x%08lx)\n",
                   pos1, gindex, face->glyf_len ));
@@ -252,7 +251,7 @@
       if ( gindex == face->num_locations - 2 )
       {
         FT_TRACE1(( "tt_face_get_location:"
-                    " too large size (%ld bytes) found for glyph index %ld,\n"
+                    " too large size (%ld bytes) found for glyph index %d,\n"
                     "                     "
                     " truncating at the end of `glyf' table to %ld bytes\n",
                     pos2 - pos1, gindex, face->glyf_len - pos1 ));
@@ -261,7 +260,7 @@
       else
       {
         FT_TRACE1(( "tt_face_get_location:"
-                    " too large offset (0x%08lx) found for glyph index %ld,\n"
+                    " too large offset (0x%08lx) found for glyph index %d,\n"
                     "                     "
                     " exceeding the end of `glyf' table (0x%08lx)\n",
                     pos2, gindex + 1, face->glyf_len ));
@@ -429,7 +428,7 @@
       if ( FT_FRAME_EXTRACT( table_len, face->font_program ) )
         goto Exit;
 
-      FT_TRACE2(( "loaded, %12d bytes\n", face->font_program_size ));
+      FT_TRACE2(( "loaded, %12ld bytes\n", face->font_program_size ));
     }
 
   Exit:
@@ -492,7 +491,7 @@
       if ( FT_FRAME_EXTRACT( table_len, face->cvt_program ) )
         goto Exit;
 
-      FT_TRACE2(( "loaded, %12d bytes\n", face->cvt_program_size ));
+      FT_TRACE2(( "loaded, %12ld bytes\n", face->cvt_program_size ));
     }
 
   Exit:
@@ -633,7 +632,7 @@
     FT_UInt   nn;
     FT_Byte*  result      = NULL;
     FT_ULong  record_size = face->hdmx_record_size;
-    FT_Byte*  record      = face->hdmx_table + 8;
+    FT_Byte*  record      = FT_OFFSET( face->hdmx_table, 8 );
 
 
     for ( nn = 0; nn < face->hdmx_record_count; nn++ )
diff --git a/src/truetype/ttpload.h b/src/truetype/ttpload.h
index 022750e..bb669e0 100644
--- a/src/truetype/ttpload.h
+++ b/src/truetype/ttpload.h
@@ -4,7 +4,7 @@
  *
  *   TrueType-specific tables loader (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
 #define TTPLOAD_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_TRUETYPE_TYPES_H
+#include <freetype/internal/tttypes.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/truetype/ttsubpix.c b/src/truetype/ttsubpix.c
index 23a2e5b..56667de 100644
--- a/src/truetype/ttsubpix.c
+++ b/src/truetype/ttsubpix.c
@@ -4,7 +4,7 @@
  *
  *   TrueType Subpixel Hinting.
  *
- * Copyright (C) 2010-2019 by
+ * Copyright (C) 2010-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -15,14 +15,13 @@
  *
  */
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_SFNT_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_OUTLINE_H
-#include FT_DRIVER_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/sfnt.h>
+#include <freetype/tttags.h>
+#include <freetype/ftoutln.h>
+#include <freetype/ftdriver.h>
 
 #include "ttsubpix.h"
 
diff --git a/src/truetype/ttsubpix.h b/src/truetype/ttsubpix.h
index 4966800..229a6cf 100644
--- a/src/truetype/ttsubpix.h
+++ b/src/truetype/ttsubpix.h
@@ -4,7 +4,7 @@
  *
  *   TrueType Subpixel Hinting.
  *
- * Copyright (C) 2010-2019 by
+ * Copyright (C) 2010-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,7 +19,6 @@
 #ifndef TTSUBPIX_H_
 #define TTSUBPIX_H_
 
-#include <ft2build.h>
 #include "ttobjs.h"
 #include "ttinterp.h"
 
diff --git a/src/type1/Jamfile b/src/type1/Jamfile
deleted file mode 100644
index 0bcfb2e..0000000
--- a/src/type1/Jamfile
+++ /dev/null
@@ -1,35 +0,0 @@
-# FreeType 2 src/type1 Jamfile
-#
-# Copyright (C) 2001-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) type1 ;
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = t1afm
-               t1driver
-               t1gload
-               t1load
-               t1objs
-               t1parse
-               ;
-  }
-  else
-  {
-    _sources = type1 ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/type1 Jamfile
diff --git a/src/type1/module.mk b/src/type1/module.mk
index 2f48c65..cffb774 100644
--- a/src/type1/module.mk
+++ b/src/type1/module.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/type1/rules.mk b/src/type1/rules.mk
index 901169c..213e619 100644
--- a/src/type1/rules.mk
+++ b/src/type1/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/type1/t1afm.c b/src/type1/t1afm.c
index 6841184..b9cd66b 100644
--- a/src/type1/t1afm.c
+++ b/src/type1/t1afm.c
@@ -4,7 +4,7 @@
  *
  *   AFM support for Type 1 fonts (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,11 +16,10 @@
  */
 
 
-#include <ft2build.h>
 #include "t1afm.h"
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/psaux.h>
 #include "t1errors.h"
 
 
diff --git a/src/type1/t1afm.h b/src/type1/t1afm.h
index a8e6a54..edf919c 100644
--- a/src/type1/t1afm.h
+++ b/src/type1/t1afm.h
@@ -4,7 +4,7 @@
  *
  *   AFM support for Type 1 fonts (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,9 +19,8 @@
 #ifndef T1AFM_H_
 #define T1AFM_H_
 
-#include <ft2build.h>
 #include "t1objs.h"
-#include FT_INTERNAL_TYPE1_TYPES_H
+#include <freetype/internal/t1types.h>
 
 FT_BEGIN_HEADER
 
diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c
index 557733d..b786a87 100644
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -4,7 +4,7 @@
  *
  *   Type 1 driver interface (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,7 +16,6 @@
  */
 
 
-#include <ft2build.h>
 #include "t1driver.h"
 #include "t1gload.h"
 #include "t1load.h"
@@ -27,20 +26,20 @@
 #include "t1afm.h"
 #endif
 
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_HASH_H
-#include FT_INTERNAL_POSTSCRIPT_PROPS_H
-#include FT_DRIVER_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/fthash.h>
+#include <freetype/internal/ftpsprop.h>
+#include <freetype/ftdriver.h>
 
-#include FT_SERVICE_MULTIPLE_MASTERS_H
-#include FT_SERVICE_GLYPH_DICT_H
-#include FT_SERVICE_FONT_FORMAT_H
-#include FT_SERVICE_POSTSCRIPT_NAME_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-#include FT_SERVICE_POSTSCRIPT_INFO_H
-#include FT_SERVICE_PROPERTIES_H
-#include FT_SERVICE_KERNING_H
+#include <freetype/internal/services/svmm.h>
+#include <freetype/internal/services/svgldict.h>
+#include <freetype/internal/services/svfntfmt.h>
+#include <freetype/internal/services/svpostnm.h>
+#include <freetype/internal/services/svpscmap.h>
+#include <freetype/internal/services/svpsinfo.h>
+#include <freetype/internal/services/svprop.h>
+#include <freetype/internal/services/svkern.h>
 
 
   /**************************************************************************
diff --git a/src/type1/t1driver.h b/src/type1/t1driver.h
index 206f64a..e7eae0b 100644
--- a/src/type1/t1driver.h
+++ b/src/type1/t1driver.h
@@ -4,7 +4,7 @@
  *
  *   High-level Type 1 driver interface (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
 #define T1DRIVER_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
+#include <freetype/internal/ftdrv.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/type1/t1errors.h b/src/type1/t1errors.h
index b35f67a..ad03a3d 100644
--- a/src/type1/t1errors.h
+++ b/src/type1/t1errors.h
@@ -4,7 +4,7 @@
  *
  *   Type 1 error codes (specification only).
  *
- * Copyright (C) 2001-2019 by
+ * Copyright (C) 2001-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -25,7 +25,7 @@
 #ifndef T1ERRORS_H_
 #define T1ERRORS_H_
 
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
 
 #undef FTERRORS_H_
 
@@ -33,7 +33,7 @@
 #define FT_ERR_PREFIX  T1_Err_
 #define FT_ERR_BASE    FT_Mod_Err_Type1
 
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
 
 #endif /* T1ERRORS_H_ */
 
diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c
index f9b115b..d16b81f 100644
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -4,7 +4,7 @@
  *
  *   Type 1 Glyph Loader (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,15 +16,14 @@
  */
 
 
-#include <ft2build.h>
 #include "t1gload.h"
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_OUTLINE_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_CFF_TYPES_H
-#include FT_DRIVER_H
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/ftoutln.h>
+#include <freetype/internal/psaux.h>
+#include <freetype/internal/cfftypes.h>
+#include <freetype/ftdriver.h>
 
 #include "t1errors.h"
 
@@ -334,7 +333,7 @@
       else
         advances[nn] = 0;
 
-      FT_TRACE5(( "  idx %d: advance width %d font unit%s\n",
+      FT_TRACE5(( "  idx %d: advance width %ld font unit%s\n",
                   first + nn,
                   advances[nn],
                   advances[nn] == 1 ? "" : "s" ));
diff --git a/src/type1/t1gload.h b/src/type1/t1gload.h
index 8044036..9947507 100644
--- a/src/type1/t1gload.h
+++ b/src/type1/t1gload.h
@@ -4,7 +4,7 @@
  *
  *   Type 1 Glyph Loader (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,7 +20,6 @@
 #define T1GLOAD_H_
 
 
-#include <ft2build.h>
 #include "t1objs.h"
 
 
diff --git a/src/type1/t1load.c b/src/type1/t1load.c
index 5cffdfa..8498600 100644
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -4,7 +4,7 @@
  *
  *   Type 1 font loader (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -61,12 +61,12 @@
 
 
 #include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 #include FT_CONFIG_CONFIG_H
-#include FT_MULTIPLE_MASTERS_H
-#include FT_INTERNAL_TYPE1_TYPES_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_HASH_H
+#include <freetype/ftmm.h>
+#include <freetype/internal/t1types.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/fthash.h>
 
 #include "t1load.h"
 #include "t1errors.h"
@@ -309,31 +309,55 @@
     FT_UInt          i;
     FT_Fixed         axiscoords[T1_MAX_MM_AXIS];
     PS_Blend         blend = face->blend;
+    FT_UShort*       axis_flags;
+
+    FT_Offset  mmvar_size;
+    FT_Offset  axis_flags_size;
+    FT_Offset  axis_size;
 
 
     error = T1_Get_Multi_Master( face, &mmaster );
     if ( error )
       goto Exit;
-    if ( FT_ALLOC( mmvar,
-                   sizeof ( FT_MM_Var ) +
-                     mmaster.num_axis * sizeof ( FT_Var_Axis ) ) )
+
+    /* the various `*_size' variables, which we also use as     */
+    /* offsets into the `mmvar' array, must be multiples of the */
+    /* pointer size (except the last one); without such an      */
+    /* alignment there might be runtime errors due to           */
+    /* misaligned addresses                                     */
+#undef  ALIGN_SIZE
+#define ALIGN_SIZE( n ) \
+          ( ( (n) + sizeof (void*) - 1 ) & ~( sizeof (void*) - 1 ) )
+
+    mmvar_size      = ALIGN_SIZE( sizeof ( FT_MM_Var ) );
+    axis_flags_size = ALIGN_SIZE( mmaster.num_axis *
+                                  sizeof ( FT_UShort ) );
+    axis_size       = mmaster.num_axis * sizeof ( FT_Var_Axis );
+
+    if ( FT_ALLOC( mmvar, mmvar_size +
+                          axis_flags_size +
+                          axis_size ) )
       goto Exit;
 
     mmvar->num_axis        = mmaster.num_axis;
     mmvar->num_designs     = mmaster.num_designs;
     mmvar->num_namedstyles = 0;                           /* Not supported */
-    mmvar->axis            = (FT_Var_Axis*)&mmvar[1];
-                                      /* Point to axes after MM_Var struct */
-    mmvar->namedstyle      = NULL;
+
+    /* while axis flags are meaningless here, we have to provide the array */
+    /* to make `FT_Get_Var_Axis_Flags' work: the function expects that the */
+    /* values directly follow the data of `FT_MM_Var'                      */
+    axis_flags = (FT_UShort*)( (char*)mmvar + mmvar_size );
+    for ( i = 0; i < mmaster.num_axis; i++ )
+      axis_flags[i] = 0;
+
+    mmvar->axis       = (FT_Var_Axis*)( (char*)axis_flags + axis_flags_size );
+    mmvar->namedstyle = NULL;
 
     for ( i = 0; i < mmaster.num_axis; i++ )
     {
       mmvar->axis[i].name    = mmaster.axis[i].name;
       mmvar->axis[i].minimum = INT_TO_FIXED( mmaster.axis[i].minimum );
       mmvar->axis[i].maximum = INT_TO_FIXED( mmaster.axis[i].maximum );
-      mmvar->axis[i].def     = ( mmvar->axis[i].minimum +
-                                   mmvar->axis[i].maximum ) / 2;
-                            /* Does not apply.  But this value is in range */
       mmvar->axis[i].strid   = ~0U;                      /* Does not apply */
       mmvar->axis[i].tag     = ~0U;                      /* Does not apply */
 
@@ -1039,7 +1063,7 @@
         map->design_points[p] = T1_ToInt( parser );
         map->blend_points [p] = T1_ToFixed( parser, 0 );
 
-        FT_TRACE4(( " [%d %f]",
+        FT_TRACE4(( " [%ld %f]",
                     map->design_points[p],
                     (double)map->blend_points[p] / 65536 ));
       }
@@ -1731,7 +1755,7 @@
        */
 
       FT_TRACE0(( "parse_subrs: adjusting number of subroutines"
-                  " (from %d to %d)\n",
+                  " (from %d to %ld)\n",
                   num_subrs,
                   ( parser->root.limit - parser->root.cursor ) >> 3 ));
       num_subrs = ( parser->root.limit - parser->root.cursor ) >> 3;
@@ -1902,7 +1926,7 @@
     if ( num_glyphs > ( limit - cur ) >> 3 )
     {
       FT_TRACE0(( "parse_charstrings: adjusting number of glyphs"
-                  " (from %d to %d)\n",
+                  " (from %d to %ld)\n",
                   num_glyphs, ( limit - cur ) >> 3 ));
       num_glyphs = ( limit - cur ) >> 3;
     }
diff --git a/src/type1/t1load.h b/src/type1/t1load.h
index 44f835b..4396415 100644
--- a/src/type1/t1load.h
+++ b/src/type1/t1load.h
@@ -4,7 +4,7 @@
  *
  *   Type 1 font loader (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,10 +20,9 @@
 #define T1LOAD_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_MULTIPLE_MASTERS_H
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/psaux.h>
+#include <freetype/ftmm.h>
 
 #include "t1parse.h"
 
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index 741388a..3b918b7 100644
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -4,7 +4,7 @@
  *
  *   Type 1 objects manager (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -16,12 +16,11 @@
  */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_IDS_H
-#include FT_DRIVER_H
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/ttnameid.h>
+#include <freetype/ftdriver.h>
 
 #include "t1gload.h"
 #include "t1load.h"
@@ -32,8 +31,8 @@
 #include "t1afm.h"
 #endif
 
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/internal/services/svpscmap.h>
+#include <freetype/internal/psaux.h>
 
 
   /**************************************************************************
@@ -347,8 +346,8 @@
     if ( error )
       goto Exit;
 
-    FT_TRACE2(( "T1_Face_Init: %08p (index %d)\n",
-                face,
+    FT_TRACE2(( "T1_Face_Init: %p (index %d)\n",
+                (void *)face,
                 face_index ));
 
     /* if we just wanted to check the format, leave successfully now */
diff --git a/src/type1/t1objs.h b/src/type1/t1objs.h
index 2161091..536be8b 100644
--- a/src/type1/t1objs.h
+++ b/src/type1/t1objs.h
@@ -4,7 +4,7 @@
  *
  *   Type 1 objects manager (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -21,9 +21,9 @@
 
 
 #include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/ftobjs.h>
 #include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_TYPE1_TYPES_H
+#include <freetype/internal/t1types.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/type1/t1parse.c b/src/type1/t1parse.c
index 56caeb9..74cf38b 100644
--- a/src/type1/t1parse.c
+++ b/src/type1/t1parse.c
@@ -4,7 +4,7 @@
  *
  *   Type 1 parser (body).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -33,10 +33,9 @@
    */
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/psaux.h>
 
 #include "t1parse.h"
 
diff --git a/src/type1/t1parse.h b/src/type1/t1parse.h
index dab8fdd..1ea0110 100644
--- a/src/type1/t1parse.h
+++ b/src/type1/t1parse.h
@@ -4,7 +4,7 @@
  *
  *   Type 1 parser (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,9 +20,8 @@
 #define T1PARSE_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_TYPE1_TYPES_H
-#include FT_INTERNAL_STREAM_H
+#include <freetype/internal/t1types.h>
+#include <freetype/internal/ftstream.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/type1/t1tokens.h b/src/type1/t1tokens.h
index 97f2dbe..c094203 100644
--- a/src/type1/t1tokens.h
+++ b/src/type1/t1tokens.h
@@ -4,7 +4,7 @@
  *
  *   Type 1 tokenizer (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/type1/type1.c b/src/type1/type1.c
index ce8557a..cadee78 100644
--- a/src/type1/type1.c
+++ b/src/type1/type1.c
@@ -4,7 +4,7 @@
  *
  *   FreeType Type 1 driver component (body only).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -17,7 +17,6 @@
 
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
 
 #include "t1afm.c"
 #include "t1driver.c"
diff --git a/src/type42/Jamfile b/src/type42/Jamfile
deleted file mode 100644
index 6123b35..0000000
--- a/src/type42/Jamfile
+++ /dev/null
@@ -1,32 +0,0 @@
-# FreeType 2 src/type42 Jamfile
-#
-# Copyright (C) 2002-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) type42 ;
-
-{
-  local  _sources ;
-
-  if $(FT2_MULTI)
-  {
-    _sources = t42drivr
-               t42objs
-               t42parse
-               ;
-  }
-  else
-  {
-    _sources = type42 ;
-  }
-
-  Library  $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/type42 Jamfile
diff --git a/src/type42/module.mk b/src/type42/module.mk
index 9e9d154..6ef3a95 100644
--- a/src/type42/module.mk
+++ b/src/type42/module.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 2002-2019 by
+# Copyright (C) 2002-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/type42/rules.mk b/src/type42/rules.mk
index 9d71f53..f4ce91a 100644
--- a/src/type42/rules.mk
+++ b/src/type42/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 2002-2019 by
+# Copyright (C) 2002-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/type42/t42drivr.c b/src/type42/t42drivr.c
index 09ad632..90898b4 100644
--- a/src/type42/t42drivr.c
+++ b/src/type42/t42drivr.c
@@ -4,7 +4,7 @@
  *
  *   High-level Type 42 driver interface (body).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * Roberto Alameda.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -39,12 +39,12 @@
 #include "t42drivr.h"
 #include "t42objs.h"
 #include "t42error.h"
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
 
-#include FT_SERVICE_FONT_FORMAT_H
-#include FT_SERVICE_GLYPH_DICT_H
-#include FT_SERVICE_POSTSCRIPT_NAME_H
-#include FT_SERVICE_POSTSCRIPT_INFO_H
+#include <freetype/internal/services/svfntfmt.h>
+#include <freetype/internal/services/svgldict.h>
+#include <freetype/internal/services/svpostnm.h>
+#include <freetype/internal/services/svpsinfo.h>
 
 #undef  FT_COMPONENT
 #define FT_COMPONENT  t42
diff --git a/src/type42/t42drivr.h b/src/type42/t42drivr.h
index a35ca28..8bf2afc 100644
--- a/src/type42/t42drivr.h
+++ b/src/type42/t42drivr.h
@@ -4,7 +4,7 @@
  *
  *   High-level Type 42 driver interface (specification).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * Roberto Alameda.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
 #define T42DRIVR_H_
 
 
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
+#include <freetype/internal/ftdrv.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/type42/t42error.h b/src/type42/t42error.h
index 5fb2143..e48132e 100644
--- a/src/type42/t42error.h
+++ b/src/type42/t42error.h
@@ -4,7 +4,7 @@
  *
  *   Type 42 error codes (specification only).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -25,7 +25,7 @@
 #ifndef T42ERROR_H_
 #define T42ERROR_H_
 
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
 
 #undef FTERRORS_H_
 
@@ -33,7 +33,7 @@
 #define FT_ERR_PREFIX  T42_Err_
 #define FT_ERR_BASE    FT_Mod_Err_Type42
 
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
 
 #endif /* T42ERROR_H_ */
 
diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c
index d31bace..6acfcdf 100644
--- a/src/type42/t42objs.c
+++ b/src/type42/t42objs.c
@@ -4,7 +4,7 @@
  *
  *   Type 42 objects manager (body).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * Roberto Alameda.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,9 +19,9 @@
 #include "t42objs.h"
 #include "t42parse.h"
 #include "t42error.h"
-#include FT_INTERNAL_DEBUG_H
-#include FT_LIST_H
-#include FT_TRUETYPE_IDS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/ftlist.h>
+#include <freetype/ttnameid.h>
 
 
 #undef  FT_COMPONENT
diff --git a/src/type42/t42objs.h b/src/type42/t42objs.h
index 98300cf..69f5cff 100644
--- a/src/type42/t42objs.h
+++ b/src/type42/t42objs.h
@@ -4,7 +4,7 @@
  *
  *   Type 42 objects manager (specification).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * Roberto Alameda.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,15 +19,14 @@
 #ifndef T42OBJS_H_
 #define T42OBJS_H_
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_TYPE1_TABLES_H
-#include FT_INTERNAL_TYPE1_TYPES_H
+#include <freetype/freetype.h>
+#include <freetype/t1tables.h>
+#include <freetype/internal/t1types.h>
 #include "t42types.h"
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DRIVER_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdrv.h>
+#include <freetype/internal/services/svpscmap.h>
+#include <freetype/internal/pshints.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c
index c47a777..9850769 100644
--- a/src/type42/t42parse.c
+++ b/src/type42/t42parse.c
@@ -4,7 +4,7 @@
  *
  *   Type 42 font parser (body).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * Roberto Alameda.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -18,9 +18,9 @@
 
 #include "t42parse.h"
 #include "t42error.h"
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/psaux.h>
 
 
   /**************************************************************************
@@ -826,7 +826,7 @@
       if ( loader->num_glyphs > ( limit - parser->root.cursor ) >> 2 )
       {
         FT_TRACE0(( "t42_parse_charstrings: adjusting number of glyphs"
-                    " (from %d to %d)\n",
+                    " (from %d to %ld)\n",
                     loader->num_glyphs,
                     ( limit - parser->root.cursor ) >> 2 ));
         loader->num_glyphs = ( limit - parser->root.cursor ) >> 2;
diff --git a/src/type42/t42parse.h b/src/type42/t42parse.h
index 0c7bb48..2ccf052 100644
--- a/src/type42/t42parse.h
+++ b/src/type42/t42parse.h
@@ -4,7 +4,7 @@
  *
  *   Type 42 font parser (specification).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * Roberto Alameda.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -21,7 +21,7 @@
 
 
 #include "t42objs.h"
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/internal/psaux.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/type42/t42types.h b/src/type42/t42types.h
index a258144..ba0cc21 100644
--- a/src/type42/t42types.h
+++ b/src/type42/t42types.h
@@ -4,7 +4,7 @@
  *
  *   Type 42 font data types (specification only).
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * Roberto Alameda.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -20,11 +20,10 @@
 #define T42TYPES_H_
 
 
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_TYPE1_TABLES_H
-#include FT_INTERNAL_TYPE1_TYPES_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
+#include <freetype/freetype.h>
+#include <freetype/t1tables.h>
+#include <freetype/internal/t1types.h>
+#include <freetype/internal/pshints.h>
 
 
 FT_BEGIN_HEADER
diff --git a/src/type42/type42.c b/src/type42/type42.c
index 0cb7b77..012559e 100644
--- a/src/type42/type42.c
+++ b/src/type42/type42.c
@@ -4,7 +4,7 @@
  *
  *   FreeType Type 42 driver component.
  *
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -17,7 +17,6 @@
 
 
 #define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
 
 #include "t42drivr.c"
 #include "t42objs.c"
diff --git a/src/winfonts/Jamfile b/src/winfonts/Jamfile
deleted file mode 100644
index 4b92226..0000000
--- a/src/winfonts/Jamfile
+++ /dev/null
@@ -1,16 +0,0 @@
-# FreeType 2 src/winfonts Jamfile
-#
-# Copyright (C) 2001-2019 by
-# David Turner, Robert Wilhelm, and Werner Lemberg.
-#
-# This file is part of the FreeType project, and may only be used, modified,
-# and distributed under the terms of the FreeType project license,
-# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
-# indicate that you have read the license and understand and accept it
-# fully.
-
-SubDir  FT2_TOP $(FT2_SRC_DIR) winfonts ;
-
-Library  $(FT2_LIB) : winfnt.c ;
-
-# end of src/winfonts Jamfile
diff --git a/src/winfonts/fnterrs.h b/src/winfonts/fnterrs.h
index af29307..550de38 100644
--- a/src/winfonts/fnterrs.h
+++ b/src/winfonts/fnterrs.h
@@ -4,7 +4,7 @@
  *
  *   Win FNT/FON error codes (specification only).
  *
- * Copyright (C) 2001-2019 by
+ * Copyright (C) 2001-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -26,7 +26,7 @@
 #ifndef FNTERRS_H_
 #define FNTERRS_H_
 
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
 
 #undef FTERRORS_H_
 
@@ -34,7 +34,7 @@
 #define FT_ERR_PREFIX  FNT_Err_
 #define FT_ERR_BASE    FT_Mod_Err_Winfonts
 
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
 
 #endif /* FNTERRS_H_ */
 
diff --git a/src/winfonts/module.mk b/src/winfonts/module.mk
index 82fb015..4614c55 100644
--- a/src/winfonts/module.mk
+++ b/src/winfonts/module.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/winfonts/rules.mk b/src/winfonts/rules.mk
index 998d49b..e73ef5e 100644
--- a/src/winfonts/rules.mk
+++ b/src/winfonts/rules.mk
@@ -3,7 +3,7 @@
 #
 
 
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2020 by
 # David Turner, Robert Wilhelm, and Werner Lemberg.
 #
 # This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c
index 2d771be..e83312d 100644
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -4,7 +4,7 @@
  *
  *   FreeType font driver for Windows FNT/FON files
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  * Copyright 2003 Huw D M Davies for Codeweavers
  * Copyright 2007 Dmitry Timoshkov for Codeweavers
@@ -18,17 +18,16 @@
  */
 
 
-#include <ft2build.h>
-#include FT_WINFONTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_TRUETYPE_IDS_H
+#include <freetype/ftwinfnt.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/ttnameid.h>
 
 #include "winfnt.h"
 #include "fnterrs.h"
-#include FT_SERVICE_WINFNT_H
-#include FT_SERVICE_FONT_FORMAT_H
+#include <freetype/internal/services/svwinfnt.h>
+#include <freetype/internal/services/svfntfmt.h>
 
   /**************************************************************************
    *
@@ -331,7 +330,7 @@
         {
           FT_TRACE2(( "invalid alignment shift count for resource data\n" ));
           error = FT_THROW( Invalid_File_Format );
-          goto Exit;
+          goto Exit1;
         }
 
 
@@ -597,6 +596,10 @@
 
   Exit:
     return error;
+
+  Exit1:
+    FT_FRAME_EXIT();
+    goto Exit;
   }
 
 
diff --git a/src/winfonts/winfnt.h b/src/winfonts/winfnt.h
index b628ad4..3367c77 100644
--- a/src/winfonts/winfnt.h
+++ b/src/winfonts/winfnt.h
@@ -4,7 +4,7 @@
  *
  *   FreeType font driver for Windows FNT/FON files
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  * Copyright 2007 Dmitry Timoshkov for Codeweavers
  *
@@ -21,9 +21,8 @@
 #define WINFNT_H_
 
 
-#include <ft2build.h>
-#include FT_WINFONTS_H
-#include FT_INTERNAL_DRIVER_H
+#include <freetype/ftwinfnt.h>
+#include <freetype/internal/ftdrv.h>
 
 
 FT_BEGIN_HEADER
diff --git a/vms_make.com b/vms_make.com
index b5da5f8..d0f4909 100644
--- a/vms_make.com
+++ b/vms_make.com
@@ -1,6 +1,6 @@
 $! make FreeType 2 under OpenVMS
 $!
-$! Copyright (C) 2003-2019 by
+$! Copyright (C) 2003-2020 by
 $! David Turner, Robert Wilhelm, and Werner Lemberg.
 $!
 $! This file is part of the FreeType project, and may only be used, modified,