From a16165863e751b2d604bfaf036eb1a9d83580678 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 4 Jan 2026 15:57:38 -0500 Subject: [PATCH 1/3] Update bundled FreeType to 2.14.1 --- .circleci/config.yml | 6 ++-- lib/matplotlib/__init__.py | 2 +- subprojects/freetype2.wrap | 20 +++++------ ...d655f1696da774b5cdd4c5effb312153232f.patch | 36 ------------------- 4 files changed, 12 insertions(+), 52 deletions(-) delete mode 100644 subprojects/packagefiles/freetype-34aed655f1696da774b5cdd4c5effb312153232f.patch diff --git a/.circleci/config.yml b/.circleci/config.yml index 40ba933cf0d9..2810d542c2af 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -67,7 +67,7 @@ commands: fonts-install: steps: - restore_cache: - key: fonts-4 + key: fonts-5 - run: name: Install custom fonts command: | @@ -80,7 +80,7 @@ commands: -O ~/.local/share/fonts/xkcd-Script.ttf || true fc-cache -f -v - save_cache: - key: fonts-4 + key: fonts-5 paths: - ~/.local/share/fonts/ @@ -125,7 +125,7 @@ commands: --no-build-isolation --editable .[dev] fi - save_cache: - key: build-deps-2 + key: build-deps-3 paths: - subprojects/packagecache diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index d7a3bf4f0fd7..00da911a4bad 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -1335,7 +1335,7 @@ def _val_or_rc(val, *rc_names): def _init_tests(): # The version of FreeType to install locally for running the tests. This must match # the value in `subprojects/freetype2.wrap`. - LOCAL_FREETYPE_VERSION = '2.13.3' + LOCAL_FREETYPE_VERSION = '2.14.1' from matplotlib import ft2font if (ft2font.__freetype_version__ != LOCAL_FREETYPE_VERSION or diff --git a/subprojects/freetype2.wrap b/subprojects/freetype2.wrap index e1d0fb112ca9..f68ce88bcafe 100644 --- a/subprojects/freetype2.wrap +++ b/subprojects/freetype2.wrap @@ -1,16 +1,12 @@ -# This is the version of FreeType to use when building a local version. It -# must match the value in `lib/matplotlib.__init__.py`. Also update the docs -# in `docs/devel/dependencies.rst`. Bump the cache key in -# `.circleci/config.yml` when changing requirements. +# This is the version of FreeType to use when building a local version. It must match +# the `LOCAL_FREETYPE_VERSION` value in `lib/matplotlib/__init__.py`. Bump the cache key +# in `.circleci/config.yml` when changing requirements. [wrap-file] -directory = freetype-2.13.3 -source_url = https://download.savannah.gnu.org/releases/freetype/freetype-2.13.3.tar.xz -source_fallback_url = https://downloads.sourceforge.net/project/freetype/freetype2/2.13.3/freetype-2.13.3.tar.xz -source_filename = freetype-2.13.3.tar.xz -source_hash = 0550350666d427c74daeb85d5ac7bb353acba5f76956395995311a9c6f063289 - -# https://gitlab.freedesktop.org/freetype/freetype/-/commit/34aed655f1696da774b5cdd4c5effb312153232f -diff_files = freetype-34aed655f1696da774b5cdd4c5effb312153232f.patch +directory = freetype-2.14.1 +source_url = https://download.savannah.gnu.org/releases/freetype/freetype-2.14.1.tar.xz +source_fallback_url = https://downloads.sourceforge.net/project/freetype/freetype2/2.14.1/freetype-2.14.1.tar.xz +source_filename = freetype-2.14.1.tar.xz +source_hash = 32427e8c471ac095853212a37aef816c60b42052d4d9e48230bab3bdf2936ccc [provide] freetype2 = freetype_dep diff --git a/subprojects/packagefiles/freetype-34aed655f1696da774b5cdd4c5effb312153232f.patch b/subprojects/packagefiles/freetype-34aed655f1696da774b5cdd4c5effb312153232f.patch deleted file mode 100644 index c00baa702f65..000000000000 --- a/subprojects/packagefiles/freetype-34aed655f1696da774b5cdd4c5effb312153232f.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 34aed655f1696da774b5cdd4c5effb312153232f Mon Sep 17 00:00:00 2001 -From: Benoit Pierre -Date: Sat, 12 Oct 2024 10:49:46 +0000 -Subject: [PATCH] * meson.build: Fix `bzip2` option handling. - ---- - meson.build | 11 ++++++++--- - 1 file changed, 8 insertions(+), 3 deletions(-) - -diff --git a/meson.build b/meson.build -index 72b7f9900..2e8d5355e 100644 ---- a/meson.build -+++ b/meson.build -@@ -320,11 +320,16 @@ else - endif - - # BZip2 support. --bzip2_dep = dependency('bzip2', required: false) -+bzip2_dep = dependency( -+ 'bzip2', -+ required: get_option('bzip2').disabled() ? get_option('bzip2') : false, -+) - if not bzip2_dep.found() -- bzip2_dep = cc.find_library('bz2', -+ bzip2_dep = cc.find_library( -+ 'bz2', - has_headers: ['bzlib.h'], -- required: get_option('bzip2')) -+ required: get_option('bzip2'), -+ ) - endif - - if bzip2_dep.found() --- -GitLab - From 57e1c85702275a18319151b06bf809ff957e4ffe Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 4 Jan 2026 22:14:55 -0500 Subject: [PATCH 2/3] Update bundled HarfBuzz to 12.3.0 --- extern/meson.build | 10 +++++- subprojects/harfbuzz.wrap | 15 ++++---- .../harfbuzz-11.2.0-bundle-freetype.patch | 36 ------------------- 3 files changed, 15 insertions(+), 46 deletions(-) delete mode 100644 subprojects/packagefiles/harfbuzz-11.2.0-bundle-freetype.patch diff --git a/extern/meson.build b/extern/meson.build index 2723baa47505..967f0321b313 100644 --- a/extern/meson.build +++ b/extern/meson.build @@ -30,17 +30,25 @@ else subproject('harfbuzz', default_options: [ 'default_library=static', + 'benchmark=disabled', 'cairo=disabled', + 'chafa=disabled', 'coretext=disabled', 'directwrite=disabled', + 'docs=disabled', + 'doc_tests=false', 'fontations=disabled', 'freetype=enabled', 'gdi=disabled', 'glib=disabled', 'gobject=disabled', - 'harfruzz=disabled', + 'harfrust=disabled', 'icu=disabled', + 'introspection=disabled', + 'kbts=disabled', 'tests=disabled', + 'utilities=disabled', + 'wasm=disabled', ] ) subproject('sheenbidi', default_options: ['default_library=static']) diff --git a/subprojects/harfbuzz.wrap b/subprojects/harfbuzz.wrap index cc5e227f0ca2..da0f7590a589 100644 --- a/subprojects/harfbuzz.wrap +++ b/subprojects/harfbuzz.wrap @@ -1,13 +1,10 @@ [wrap-file] -directory = harfbuzz-11.2.1 -source_url = https://github.com/harfbuzz/harfbuzz/releases/download/11.2.1/harfbuzz-11.2.1.tar.xz -source_filename = harfbuzz-11.2.1.tar.xz -source_hash = 093714c8548a285094685f0bdc999e202d666b59eeb3df2ff921ab68b8336a49 -source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/harfbuzz_11.2.1-1/harfbuzz-11.2.1.tar.xz -wrapdb_version = 11.2.1-1 - -# This patch allows using our bundled FreeType. -diff_files = harfbuzz-11.2.0-bundle-freetype.patch +directory = harfbuzz-12.3.0 +source_url = https://github.com/harfbuzz/harfbuzz/releases/download/12.3.0/harfbuzz-12.3.0.tar.xz +source_filename = harfbuzz-12.3.0.tar.xz +source_hash = 8660ebd3c27d9407fc8433b5d172bafba5f0317cb0bb4339f28e5370c93d42b7 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/harfbuzz_12.3.0-1/harfbuzz-12.3.0.tar.xz +wrapdb_version = 12.3.0-1 [provide] dependency_names = harfbuzz, harfbuzz-cairo, harfbuzz-gobject, harfbuzz-icu, harfbuzz-subset diff --git a/subprojects/packagefiles/harfbuzz-11.2.0-bundle-freetype.patch b/subprojects/packagefiles/harfbuzz-11.2.0-bundle-freetype.patch deleted file mode 100644 index fa7be0b54afd..000000000000 --- a/subprojects/packagefiles/harfbuzz-11.2.0-bundle-freetype.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff -uPNr harfbuzz-11.2.0.orig/meson.build harfbuzz-11.2.0/meson.build ---- harfbuzz-11.2.0.orig/meson.build 2025-04-28 08:56:32.000000000 -0400 -+++ harfbuzz-11.2.0/meson.build 2025-05-03 03:25:39.602646412 -0400 -@@ -115,31 +115,7 @@ - # Sadly, FreeType's versioning schemes are different between pkg-config and CMake - - # Try pkg-config name -- freetype_dep = dependency('freetype2', -- version: freetype_min_version, -- method: 'pkg-config', -- required: false, -- allow_fallback: false) -- if not freetype_dep.found() -- # Try cmake name -- freetype_dep = dependency('Freetype', -- version: freetype_min_version_actual, -- method: 'cmake', -- required: false, -- allow_fallback: false) -- # Subproject fallback -- if not freetype_dep.found() -- freetype_proj = subproject('freetype2', -- version: freetype_min_version_actual, -- required: get_option('freetype'), -- default_options: ['harfbuzz=disabled']) -- if freetype_proj.found() -- freetype_dep = freetype_proj.get_variable('freetype_dep') -- else -- freetype_dep = dependency('', required: false) -- endif -- endif -- endif -+ freetype_dep = dependency('freetype2', version: freetype_min_version) - endif - - glib_dep = dependency('glib-2.0', version: glib_min_version, required: get_option('glib')) From 9619bcc8ab1c1e2a8908b51f70c9f7566969ad1f Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 4 Jan 2026 22:31:24 -0500 Subject: [PATCH 3/3] Enable HarfBuzz support in bundled FreeType Due to the circular dependency between FreeType and HarfBuzz, this requires a small patch to make FreeType not look for HarfBuzz, allowing it to come from the superproject linkage. While FreeType does support dynamically loading HarfBuzz, this should be a bit safer at avoiding any chance of mixing system with bundled libraries. --- extern/meson.build | 2 +- subprojects/freetype2.wrap | 3 ++ .../freetype-2.14.1-static-harfbuzz.patch | 29 +++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 subprojects/packagefiles/freetype-2.14.1-static-harfbuzz.patch diff --git a/extern/meson.build b/extern/meson.build index 967f0321b313..d2b5f0427573 100644 --- a/extern/meson.build +++ b/extern/meson.build @@ -15,7 +15,7 @@ else 'default_library=static', 'brotli=disabled', 'bzip2=disabled', - 'harfbuzz=disabled', + get_option('system-libraqm') ? 'harfbuzz=disabled' : 'harfbuzz=static', 'mmap=auto', 'png=disabled', 'tests=disabled', diff --git a/subprojects/freetype2.wrap b/subprojects/freetype2.wrap index f68ce88bcafe..4a131cf45270 100644 --- a/subprojects/freetype2.wrap +++ b/subprojects/freetype2.wrap @@ -8,6 +8,9 @@ source_fallback_url = https://downloads.sourceforge.net/project/freetype/freetyp source_filename = freetype-2.14.1.tar.xz source_hash = 32427e8c471ac095853212a37aef816c60b42052d4d9e48230bab3bdf2936ccc +# This patch allows using our bundled HarfBuzz. +diff_files = freetype-2.14.1-static-harfbuzz.patch + [provide] freetype2 = freetype_dep freetype = freetype_dep diff --git a/subprojects/packagefiles/freetype-2.14.1-static-harfbuzz.patch b/subprojects/packagefiles/freetype-2.14.1-static-harfbuzz.patch new file mode 100644 index 000000000000..c09416a6e155 --- /dev/null +++ b/subprojects/packagefiles/freetype-2.14.1-static-harfbuzz.patch @@ -0,0 +1,29 @@ +diff -uPNr freetype-2.14.1.orig/meson.build freetype-2.14.1/meson.build +--- freetype-2.14.1.orig/meson.build 2025-09-11 07:12:24.000000000 -0400 ++++ freetype-2.14.1/meson.build 2026-01-04 15:49:14.198061441 -0500 +@@ -364,6 +364,13 @@ + endif + endif + ++if harfbuzz_opt == 'static' ++ harfbuzz_dep = declare_dependency() ++ harfbuzz_opt = 'YES' ++ ftoption_command += ['--enable=FT_CONFIG_OPTION_USE_HARFBUZZ'] ++ ft2_deps += [harfbuzz_dep] ++endif ++ + if not harfbuzz_dep.found() and \ + (harfbuzz_opt == 'dynamic' or harfbuzz_opt == 'auto') + # On Windows we don't need libdl, but on other platforms we need it. +diff -uPNr freetype-2.14.1.orig/meson_options.txt freetype-2.14.1/meson_options.txt +--- freetype-2.14.1.orig/meson_options.txt 2025-09-07 22:48:18.000000000 -0400 ++++ freetype-2.14.1/meson_options.txt 2026-01-04 15:49:30.087034418 -0500 +@@ -24,7 +24,7 @@ + + option('harfbuzz', + type: 'combo', +- choices: ['auto', 'enabled', 'dynamic', 'disabled'], ++ choices: ['auto', 'enabled', 'dynamic', 'static', 'disabled'], + value: 'auto', + description: 'Use Harfbuzz library to improve auto-hinting;' + + ' if available, many glyphs not directly addressable'