Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update FreeType to 2.13.3 #29816

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: text-overhaul
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/cibuildwheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ jobs:
name: cibw-sdist
path: dist/

- name: Purge Strawberry Perl
if: startsWith(matrix.os, 'windows-')
run: Remove-Item -Recurse C:\Strawberry

- name: Build wheels for CPython 3.14
uses: pypa/cibuildwheel@5f22145df44122af0f5a201f93cf0207171beca7 # v3.0.0
with:
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ repos:
- id: check-docstring-first
exclude: lib/matplotlib/typing.py # docstring used for attribute flagged by check
- id: end-of-file-fixer
exclude_types: [svg]
exclude_types: [diff, svg]
- id: mixed-line-ending
- id: name-tests-test
args: ["--pytest-test-first"]
- id: no-commit-to-branch # Default is master and main.
- id: trailing-whitespace
exclude_types: [svg]
exclude_types: [diff, svg]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.15.0
hooks:
Expand Down
13 changes: 11 additions & 2 deletions extern/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,20 @@ else
# 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.
LOCAL_FREETYPE_VERSION = '2.6.1'
LOCAL_FREETYPE_VERSION = '2.13.3'

freetype_proj = subproject(
f'freetype-@LOCAL_FREETYPE_VERSION@',
default_options: ['default_library=static'])
default_options: [
'default_library=static',
'brotli=disabled',
'bzip2=disabled',
'harfbuzz=disabled',
'mmap=auto',
'png=disabled',
'tests=disabled',
'zlib=internal',
])
freetype_dep = freetype_proj.get_variable('freetype_dep')
endif

Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,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 `meson.build`.
LOCAL_FREETYPE_VERSION = '2.6.1'
LOCAL_FREETYPE_VERSION = '2.13.3'

from matplotlib import ft2font
if (ft2font.__freetype_version__ != LOCAL_FREETYPE_VERSION or
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/mpl-data/matplotlibrc
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,9 @@
## ("native" is a synonym.)
## - force_autohint: Use FreeType's auto-hinter. ("auto" is a synonym.)
## - no_hinting: Disable hinting. ("none" is a synonym.)
#text.hinting: force_autohint
#text.hinting: default

#text.hinting_factor: 8 # Specifies the amount of softness for hinting in the
#text.hinting_factor: 1 # Specifies the amount of softness for hinting in the
# horizontal direction. A value of 1 will hint to full
# pixels. A value of 2 will hint to half pixels etc.
#text.kerning_factor: 0 # Specifies the scaling factor for kerning values. This
Expand Down
5 changes: 3 additions & 2 deletions lib/matplotlib/mpl-data/stylelib/_classic_test_patch.mplstyle
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# This patch should go on top of the "classic" style and exists solely to avoid
# changing baseline images.

text.kerning_factor : 6

ytick.alignment: center_baseline

hatch.color: edge

text.hinting: default
text.hinting_factor: 1
11 changes: 9 additions & 2 deletions lib/matplotlib/testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,15 @@

def set_font_settings_for_testing():
mpl.rcParams['font.family'] = 'DejaVu Sans'
mpl.rcParams['text.hinting'] = 'none'
mpl.rcParams['text.hinting_factor'] = 8
# We've changed the default for ourselves here, but for backwards-compatiblity, use
# the old setting if not called in our own tests (which would set
# `_called_from_pytest` from our `conftest.py`).
if getattr(mpl, '_called_from_pytest', False):
mpl.rcParams['text.hinting'] = 'default'
mpl.rcParams['text.hinting_factor'] = 1
else:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is for backward compatibility, can you please add a comment?

mpl.rcParams['text.hinting'] = 'none'
mpl.rcParams['text.hinting_factor'] = 8

Check warning on line 30 in lib/matplotlib/testing/__init__.py

View check run for this annotation

Codecov / codecov/patch

lib/matplotlib/testing/__init__.py#L29-L30

Added lines #L29 - L30 were not covered by tests


def set_reproducibility_for_testing():
Expand Down
3 changes: 0 additions & 3 deletions lib/matplotlib/tests/test_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,6 @@ def test_remove():

@image_comparison(["default_edges.png"], remove_text=True, style='default')
def test_default_edges():
# Remove this line when this test image is regenerated.
plt.rcParams['text.kerning_factor'] = 6

fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2)

ax1.plot(np.arange(10), np.arange(10), 'x',
Expand Down
6 changes: 3 additions & 3 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8272,8 +8272,8 @@ def test_normal_axes():

# test the axis bboxes
target = [
[123.375, 75.88888888888886, 983.25, 33.0],
[85.51388888888889, 99.99999999999997, 53.375, 993.0]
[124.0, 76.89, 982.0, 32.0],
[86.89, 100.5, 52.0, 992.0],
]
for nn, b in enumerate(bbaxis):
targetbb = mtransforms.Bbox.from_bounds(*target[nn])
Expand All @@ -8293,7 +8293,7 @@ def test_normal_axes():
targetbb = mtransforms.Bbox.from_bounds(*target)
assert_array_almost_equal(bbax.bounds, targetbb.bounds, decimal=2)

target = [85.5138, 75.88888, 1021.11, 1017.11]
target = [86.89, 76.89, 1019.11, 1015.61]
targetbb = mtransforms.Bbox.from_bounds(*target)
assert_array_almost_equal(bbtb.bounds, targetbb.bounds, decimal=2)

Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_bbox_tight.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_bbox_inches_tight(text_placeholders):

@image_comparison(['bbox_inches_tight_suptile_legend'],
savefig_kwarg={'bbox_inches': 'tight'},
tol=0 if platform.machine() == 'x86_64' else 0.02)
tol=0 if platform.machine() == 'x86_64' else 0.022)
def test_bbox_inches_tight_suptile_legend():
plt.plot(np.arange(10), label='a straight line')
plt.legend(bbox_to_anchor=(0.9, 1), loc='upper left')
Expand Down
5 changes: 3 additions & 2 deletions lib/matplotlib/tests/test_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ def test_tightbbox():
ax.set_xlim(0, 1)
t = ax.text(1., 0.5, 'This dangles over end')
renderer = fig.canvas.get_renderer()
x1Nom0 = 9.035 # inches
x1Nom0 = 8.9875 # inches
assert abs(t.get_tightbbox(renderer).x1 - x1Nom0 * fig.dpi) < 2
assert abs(ax.get_tightbbox(renderer).x1 - x1Nom0 * fig.dpi) < 2
assert abs(fig.get_tightbbox(renderer).x1 - x1Nom0) < 0.05
Expand Down Expand Up @@ -1376,7 +1376,8 @@ def test_subfigure_dpi():


@image_comparison(['test_subfigure_ss.png'], style='mpl20',
savefig_kwarg={'facecolor': 'teal'}, tol=0.02)
savefig_kwarg={'facecolor': 'teal'},
tol=0.022)
def test_subfigure_ss():
# test assigning the subfigure via subplotspec
np.random.seed(19680801)
Expand Down
6 changes: 3 additions & 3 deletions lib/matplotlib/tests/test_ft2font.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,10 +708,10 @@ def test_ft2font_get_sfnt_table(font_name, header):

@pytest.mark.parametrize('left, right, unscaled, unfitted, default', [
# These are all the same class.
('A', 'A', 57, 248, 256), ('A', 'À', 57, 248, 256), ('A', 'Á', 57, 248, 256),
('A', 'Â', 57, 248, 256), ('A', 'Ã', 57, 248, 256), ('A', 'Ä', 57, 248, 256),
('A', 'A', 57, 247, 256), ('A', 'À', 57, 247, 256), ('A', 'Á', 57, 247, 256),
('A', 'Â', 57, 247, 256), ('A', 'Ã', 57, 247, 256), ('A', 'Ä', 57, 247, 256),
# And a few other random ones.
('D', 'A', -36, -156, -128), ('T', '.', -243, -1056, -1024),
('D', 'A', -36, -156, -128), ('T', '.', -243, -1055, -1024),
('X', 'C', -149, -647, -640), ('-', 'J', 114, 495, 512),
])
def test_ft2font_get_kerning(left, right, unscaled, unfitted, default):
Expand Down
11 changes: 4 additions & 7 deletions lib/matplotlib/tests/test_legend.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,6 @@ def test_legend_expand():
@image_comparison(['hatching'], remove_text=True, style='default')
def test_hatching():
# Remove legend texts when this image is regenerated.
# Remove this line when this test image is regenerated.
plt.rcParams['text.kerning_factor'] = 6

fig, ax = plt.subplots()

# Patches
Expand Down Expand Up @@ -484,10 +481,10 @@ def test_figure_legend_outside():
todos += ['left ' + pos for pos in ['lower', 'center', 'upper']]
todos += ['right ' + pos for pos in ['lower', 'center', 'upper']]

upperext = [20.347556, 27.722556, 790.583, 545.499]
lowerext = [20.347556, 71.056556, 790.583, 588.833]
leftext = [151.681556, 27.722556, 790.583, 588.833]
rightext = [20.347556, 27.722556, 659.249, 588.833]
upperext = [20.722556, 26.722556, 790.333, 545.999]
lowerext = [20.722556, 70.056556, 790.333, 589.333]
leftext = [152.056556, 26.722556, 790.333, 589.333]
rightext = [20.722556, 26.722556, 658.999, 589.333]
axbb = [upperext, upperext, upperext,
lowerext, lowerext, lowerext,
leftext, leftext, leftext,
Expand Down
16 changes: 8 additions & 8 deletions lib/matplotlib/tests/test_mathtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,14 +568,14 @@ def test_box_repr():
_mathtext.DejaVuSansFonts(fm.FontProperties(), LoadFlags.NO_HINTING),
fontsize=12, dpi=100))
assert s == textwrap.dedent("""\
Hlist<w=9.49 h=16.08 d=6.64 s=0.00>[
Hlist<w=9.51 h=15.81 d=6.57 s=0.00>[
Hlist<w=0.00 h=0.00 d=0.00 s=0.00>[],
Hlist<w=9.49 h=16.08 d=6.64 s=0.00>[
Hlist<w=9.49 h=16.08 d=6.64 s=0.00>[
Vlist<w=7.40 h=22.72 d=0.00 s=6.64>[
HCentered<w=7.40 h=8.67 d=0.00 s=0.00>[
Hlist<w=9.51 h=15.81 d=6.57 s=0.00>[
Hlist<w=9.51 h=15.81 d=6.57 s=0.00>[
Vlist<w=7.43 h=22.38 d=0.00 s=6.57>[
HCentered<w=7.43 h=8.51 d=0.00 s=0.00>[
Glue,
Hlist<w=7.40 h=8.67 d=0.00 s=0.00>[
Hlist<w=7.43 h=8.51 d=0.00 s=0.00>[
`1`,
k2.36,
],
Expand All @@ -584,9 +584,9 @@ def test_box_repr():
Vbox,
Hrule,
Vbox,
HCentered<w=7.40 h=8.84 d=0.00 s=0.00>[
HCentered<w=7.43 h=8.66 d=0.00 s=0.00>[
Glue,
Hlist<w=7.40 h=8.84 d=0.00 s=0.00>[
Hlist<w=7.43 h=8.66 d=0.00 s=0.00>[
`2`,
k2.02,
],
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_polar.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def test_get_tightbbox_polar():
fig.canvas.draw()
bb = ax.get_tightbbox(fig.canvas.get_renderer())
assert_allclose(
bb.extents, [107.7778, 29.2778, 539.7847, 450.7222], rtol=1e-03)
bb.extents, [108.27778, 28.7778, 539.7222, 451.2222], rtol=1e-03)


@check_figures_equal()
Expand Down
7 changes: 1 addition & 6 deletions lib/matplotlib/tests/test_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,6 @@ def test_multiline():

@image_comparison(['multiline2'], style='mpl20')
def test_multiline2():
# Remove this line when this test image is regenerated.
plt.rcParams['text.kerning_factor'] = 6

fig, ax = plt.subplots()

ax.set_xlim(0, 1.4)
Expand Down Expand Up @@ -694,8 +691,6 @@ def test_annotation_units(fig_test, fig_ref):

@image_comparison(['large_subscript_title.png'], style='mpl20')
def test_large_subscript_title():
# Remove this line when this test image is regenerated.
plt.rcParams['text.kerning_factor'] = 6
plt.rcParams['axes.titley'] = None

fig, axs = plt.subplots(1, 2, figsize=(9, 2.5), constrained_layout=True)
Expand Down Expand Up @@ -732,7 +727,7 @@ def test_wrap(x, rotation, halign):


def test_mathwrap():
fig = plt.figure(figsize=(6, 4))
fig = plt.figure(figsize=(5, 4))
s = r'This is a very $\overline{\mathrm{long}}$ line of Mathtext.'
text = fig.text(0, 0.5, s, size=40, wrap=True)
fig.canvas.draw()
Expand Down
9 changes: 0 additions & 9 deletions lib/mpl_toolkits/axisartist/tests/test_axis_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ def test_ticks():

@image_comparison(['axis_artist_labelbase.png'], style='default')
def test_labelbase():
# Remove this line when this test image is regenerated.
plt.rcParams['text.kerning_factor'] = 6

fig, ax = plt.subplots()

ax.plot([0.5], [0.5], "o")
Expand All @@ -43,9 +40,6 @@ def test_labelbase():

@image_comparison(['axis_artist_ticklabels.png'], style='default')
def test_ticklabels():
# Remove this line when this test image is regenerated.
plt.rcParams['text.kerning_factor'] = 6

fig, ax = plt.subplots()

ax.xaxis.set_visible(False)
Expand Down Expand Up @@ -78,9 +72,6 @@ def test_ticklabels():

@image_comparison(['axis_artist.png'], style='default')
def test_axis_artist():
# Remove this line when this test image is regenerated.
plt.rcParams['text.kerning_factor'] = 6

fig, ax = plt.subplots()

ax.xaxis.set_visible(False)
Expand Down
6 changes: 0 additions & 6 deletions lib/mpl_toolkits/axisartist/tests/test_axislines.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@

@image_comparison(['SubplotZero.png'], style='default')
def test_SubplotZero():
# Remove this line when this test image is regenerated.
plt.rcParams['text.kerning_factor'] = 6

fig = plt.figure()

ax = SubplotZero(fig, 1, 1, 1)
Expand All @@ -30,9 +27,6 @@ def test_SubplotZero():

@image_comparison(['Subplot.png'], style='default')
def test_Subplot():
# Remove this line when this test image is regenerated.
plt.rcParams['text.kerning_factor'] = 6

fig = plt.figure()

ax = Subplot(fig, 1, 1, 1)
Expand Down
3 changes: 0 additions & 3 deletions lib/mpl_toolkits/axisartist/tests/test_floating_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ def test_curvelinear3():
# remove when image is regenerated.
@image_comparison(['curvelinear4.png'], style='default', tol=0.9)
def test_curvelinear4():
# Remove this line when this test image is regenerated.
plt.rcParams['text.kerning_factor'] = 6

fig = plt.figure(figsize=(5, 5))

tr = (mtransforms.Affine2D().scale(np.pi / 180, 1) +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,8 @@ def test_polar_box():
ax1.grid(True)


# Remove tol & kerning_factor when this test image is regenerated.
@image_comparison(['axis_direction.png'], style='default', tol=0.13)
@image_comparison(['axis_direction.png'], style='default', tol=0.04)
def test_axis_direction():
plt.rcParams['text.kerning_factor'] = 6

fig = plt.figure(figsize=(5, 5))

# PolarAxes.PolarTransform takes radian. However, we want our coordinate
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ requires-python = ">=3.11"
[project.optional-dependencies]
# Should be a copy of the build dependencies below.
dev = [
"meson-python>=0.13.1,!=0.17.*",
"meson-python>=0.13.2,!=0.17.*",
"pybind11>=2.13.2,!=2.13.3",
"setuptools_scm>=7",
# Not required by us but setuptools_scm without a version, cso _if_
Expand All @@ -72,7 +72,7 @@ build-backend = "mesonpy"
requires = [
# meson-python 0.17.x breaks symlinks in sdists. You can remove this pin if
# you really need it and aren't using an sdist.
"meson-python>=0.13.1,!=0.17.*",
"meson-python>=0.13.2,!=0.17.*",
"pybind11>=2.13.2,!=2.13.3",
"setuptools_scm>=7",
]
Expand Down
2 changes: 1 addition & 1 deletion requirements/testing/minver.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cycler==0.10
fonttools==4.22.0
importlib-resources==3.2.0
kiwisolver==1.3.2
meson-python==0.13.1
meson-python==0.13.2
meson==1.1.0
numpy==1.25.0
packaging==20.0
Expand Down
13 changes: 13 additions & 0 deletions subprojects/freetype-2.13.3.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[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

[provide]
freetype2 = freetype_dep
freetype = freetype_dep
10 changes: 0 additions & 10 deletions subprojects/freetype-2.6.1.wrap

This file was deleted.

Loading
Loading