Skip to content

Commit 2a265c8

Browse files
committed
Merge commit 'ea59d3a30547cc3c1e707a405d668a54de541d4e' into text-overhaul-figures-per-commit
2 parents a1f1c86 + ea59d3a commit 2a265c8

29 files changed

+105
-1960
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ repos:
2020
- id: check-docstring-first
2121
exclude: lib/matplotlib/typing.py # docstring used for attribute flagged by check
2222
- id: end-of-file-fixer
23-
exclude_types: [svg]
23+
exclude_types: [diff, svg]
2424
- id: mixed-line-ending
2525
- id: name-tests-test
2626
args: ["--pytest-test-first"]
2727
- id: no-commit-to-branch # Default is master and main.
2828
- id: trailing-whitespace
29-
exclude_types: [svg]
29+
exclude_types: [diff, svg]
3030
- repo: https://github.com/pre-commit/mirrors-mypy
3131
rev: v1.15.0
3232
hooks:

extern/meson.build

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,20 @@ else
1313
# must match the value in `lib/matplotlib.__init__.py`. Also update the docs
1414
# in `docs/devel/dependencies.rst`. Bump the cache key in
1515
# `.circleci/config.yml` when changing requirements.
16-
LOCAL_FREETYPE_VERSION = '2.6.1'
16+
LOCAL_FREETYPE_VERSION = '2.13.3'
1717

1818
freetype_proj = subproject(
1919
f'freetype-@LOCAL_FREETYPE_VERSION@',
20-
default_options: ['default_library=static'])
20+
default_options: [
21+
'default_library=static',
22+
'brotli=disabled',
23+
'bzip2=disabled',
24+
'harfbuzz=disabled',
25+
'mmap=auto',
26+
'png=disabled',
27+
'tests=disabled',
28+
'zlib=internal',
29+
])
2130
freetype_dep = freetype_proj.get_variable('freetype_dep')
2231
endif
2332

lib/matplotlib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,7 @@ def _val_or_rc(val, *rc_names):
13291329
def _init_tests():
13301330
# The version of FreeType to install locally for running the tests. This must match
13311331
# the value in `meson.build`.
1332-
LOCAL_FREETYPE_VERSION = '2.6.1'
1332+
LOCAL_FREETYPE_VERSION = '2.13.3'
13331333

13341334
from matplotlib import ft2font
13351335
if (ft2font.__freetype_version__ != LOCAL_FREETYPE_VERSION or

lib/matplotlib/mpl-data/matplotlibrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,9 @@
301301
## ("native" is a synonym.)
302302
## - force_autohint: Use FreeType's auto-hinter. ("auto" is a synonym.)
303303
## - no_hinting: Disable hinting. ("none" is a synonym.)
304-
#text.hinting: force_autohint
304+
#text.hinting: default
305305

306-
#text.hinting_factor: 8 # Specifies the amount of softness for hinting in the
306+
#text.hinting_factor: 1 # Specifies the amount of softness for hinting in the
307307
# horizontal direction. A value of 1 will hint to full
308308
# pixels. A value of 2 will hint to half pixels etc.
309309
#text.kerning_factor: 0 # Specifies the scaling factor for kerning values. This
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# This patch should go on top of the "classic" style and exists solely to avoid
22
# changing baseline images.
33

4-
text.kerning_factor : 6
5-
64
ytick.alignment: center_baseline
75

86
hatch.color: edge
7+
8+
text.hinting: default
9+
text.hinting_factor: 1

lib/matplotlib/testing/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,15 @@
1919

2020
def set_font_settings_for_testing():
2121
mpl.rcParams['font.family'] = 'DejaVu Sans'
22-
mpl.rcParams['text.hinting'] = 'none'
23-
mpl.rcParams['text.hinting_factor'] = 8
22+
# We've changed the default for ourselves here, but for backwards-compatiblity, use
23+
# the old setting if not called in our own tests (which would set
24+
# `_called_from_pytest` from our `conftest.py`).
25+
if getattr(mpl, '_called_from_pytest', False):
26+
mpl.rcParams['text.hinting'] = 'default'
27+
mpl.rcParams['text.hinting_factor'] = 1
28+
else:
29+
mpl.rcParams['text.hinting'] = 'none'
30+
mpl.rcParams['text.hinting_factor'] = 8
2431

2532

2633
def set_reproducibility_for_testing():

lib/matplotlib/tests/test_artist.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,6 @@ def test_remove():
217217

218218
@image_comparison(["default_edges.png"], remove_text=True, style='default')
219219
def test_default_edges():
220-
# Remove this line when this test image is regenerated.
221-
plt.rcParams['text.kerning_factor'] = 6
222-
223220
fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2)
224221

225222
ax1.plot(np.arange(10), np.arange(10), 'x',

lib/matplotlib/tests/test_axes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8272,8 +8272,8 @@ def test_normal_axes():
82728272

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

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

lib/matplotlib/tests/test_bbox_tight.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_bbox_inches_tight(text_placeholders):
4747

4848
@image_comparison(['bbox_inches_tight_suptile_legend'],
4949
savefig_kwarg={'bbox_inches': 'tight'},
50-
tol=0 if platform.machine() == 'x86_64' else 0.02)
50+
tol=0 if platform.machine() == 'x86_64' else 0.022)
5151
def test_bbox_inches_tight_suptile_legend():
5252
plt.plot(np.arange(10), label='a straight line')
5353
plt.legend(bbox_to_anchor=(0.9, 1), loc='upper left')

lib/matplotlib/tests/test_figure.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ def test_tightbbox():
814814
ax.set_xlim(0, 1)
815815
t = ax.text(1., 0.5, 'This dangles over end')
816816
renderer = fig.canvas.get_renderer()
817-
x1Nom0 = 9.035 # inches
817+
x1Nom0 = 8.9875 # inches
818818
assert abs(t.get_tightbbox(renderer).x1 - x1Nom0 * fig.dpi) < 2
819819
assert abs(ax.get_tightbbox(renderer).x1 - x1Nom0 * fig.dpi) < 2
820820
assert abs(fig.get_tightbbox(renderer).x1 - x1Nom0) < 0.05
@@ -1376,7 +1376,8 @@ def test_subfigure_dpi():
13761376

13771377

13781378
@image_comparison(['test_subfigure_ss.png'], style='mpl20',
1379-
savefig_kwarg={'facecolor': 'teal'}, tol=0.02)
1379+
savefig_kwarg={'facecolor': 'teal'},
1380+
tol=0.022)
13801381
def test_subfigure_ss():
13811382
# test assigning the subfigure via subplotspec
13821383
np.random.seed(19680801)

0 commit comments

Comments
 (0)