Update bundled FreeType and HarfBuzz libraries #30938
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR summary
These were released over the last couple of months but I didn't notice them. Note, I have included the new test images here, but this should not be merged until they are removed.
The main changes in HarfBuzz do appear to mostly be speedups and optimizations. Version 12 adds support for the new
VARCtable, but I don't think that's particularly widespread yet. There are various other bug fixes and rejections of invalid fonts in the smaller releases as well. The other useful change is that they've simplified the search for FreeType, so we can drop our patch for it.The main change in FreeType is an improvement in the diacritics at small sizes. This is the cause of the mathtext test image changes.
Additionally, FreeType changed the way they use HarfBuzz (yes, there's a dependency loop there) that doesn't require the headers, which makes it possible to enable support. They do support dynamically loading HarfBuzz, but I don't want to run into issues loading the wrong library, so instead I've added a small patch that allows enabling support without explicitly linking HarfBuzz to FreeType. Then the ft2font extension library links to both and this resolves all symbols. Enabling HarfBuzz support improves auto-hinting in OpenType fonts. This causes the change in the Last Resort test image since that is an OpenType font.
To compare the test images on this PR with the current state of the
text-overhaulbranch, you can use this link https://github.com/QuLogic/matplotlib/compare/text-overhaul-figures..ft214 but unfortunately it also shows all the other images, so you need to look at the few images from this PR specifically.PR checklist