Skip to content

Commit b8d482f

Browse files
committed
Set text hinting to defaults
Namely, `text.hinting` is now `default` instead of `force_autohint` (or `none` for classic tests) and `text.hinting_factor` is now 1, not 8.
1 parent 41a5adf commit b8d482f

File tree

8 files changed

+23
-16
lines changed

8 files changed

+23
-16
lines changed

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

lib/matplotlib/mpl-data/stylelib/_classic_test_patch.mplstyle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
ytick.alignment: center_baseline
55

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

lib/matplotlib/testing/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,12 @@
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+
if getattr(mpl, '_called_from_pytest', False):
23+
mpl.rcParams['text.hinting'] = 'default'
24+
mpl.rcParams['text.hinting_factor'] = 1
25+
else:
26+
mpl.rcParams['text.hinting'] = 'none'
27+
mpl.rcParams['text.hinting_factor'] = 8
2428

2529

2630
def set_reproducibility_for_testing():

lib/matplotlib/tests/test_axes.py

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

81468146
# test the axis bboxes
81478147
target = [
8148-
[123.375, 75.88888888888886, 983.25, 33.0],
8149-
[85.51388888888889, 99.99999999999997, 53.375, 993.0]
8148+
[124.0, 76.89, 982.0, 32.0],
8149+
[86.89, 100.5, 52.0, 992.0],
81508150
]
81518151
for nn, b in enumerate(bbaxis):
81528152
targetbb = mtransforms.Bbox.from_bounds(*target[nn])
@@ -8166,7 +8166,7 @@ def test_normal_axes():
81668166
targetbb = mtransforms.Bbox.from_bounds(*target)
81678167
assert_array_almost_equal(bbax.bounds, targetbb.bounds, decimal=2)
81688168

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

lib/matplotlib/tests/test_figure.py

Lines changed: 1 addition & 1 deletion
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.9375 # 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

lib/matplotlib/tests/test_legend.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -469,10 +469,10 @@ def test_figure_legend_outside():
469469
todos += ['left ' + pos for pos in ['lower', 'center', 'upper']]
470470
todos += ['right ' + pos for pos in ['lower', 'center', 'upper']]
471471

472-
upperext = [20.347556, 27.722556, 790.583, 545.499]
473-
lowerext = [20.347556, 71.056556, 790.583, 588.833]
474-
leftext = [151.681556, 27.722556, 790.583, 588.833]
475-
rightext = [20.347556, 27.722556, 659.249, 588.833]
472+
upperext = [20.722556, 26.722556, 790.333, 545.999]
473+
lowerext = [20.722556, 70.056556, 790.333, 589.333]
474+
leftext = [152.056556, 26.722556, 790.333, 589.333]
475+
rightext = [20.722556, 26.722556, 658.999, 589.333]
476476
axbb = [upperext, upperext, upperext,
477477
lowerext, lowerext, lowerext,
478478
leftext, leftext, leftext,

lib/matplotlib/tests/test_polar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ def test_get_tightbbox_polar():
328328
fig.canvas.draw()
329329
bb = ax.get_tightbbox(fig.canvas.get_renderer())
330330
assert_allclose(
331-
bb.extents, [107.7778, 29.2778, 539.7847, 450.7222], rtol=1e-03)
331+
bb.extents, [108.27778, 28.7778, 539.7222, 451.2222], rtol=1e-03)
332332

333333

334334
@check_figures_equal()

lib/matplotlib/tests/test_text.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -711,14 +711,14 @@ def test_wrap(x, rotation, halign):
711711
s = 'This is a very long text that should be wrapped multiple times.'
712712
text = subfig.text(x, 0.7, s, wrap=True, rotation=rotation, ha=halign)
713713
fig.canvas.draw()
714-
assert text._get_wrapped_text() == ('This is a very long\n'
715-
'text that should be\n'
714+
assert text._get_wrapped_text() == ('This is a very long text\n'
715+
'that should be\n'
716716
'wrapped multiple\n'
717717
'times.')
718718

719719

720720
def test_mathwrap():
721-
fig = plt.figure(figsize=(6, 4))
721+
fig = plt.figure(figsize=(5, 4))
722722
s = r'This is a very $\overline{\mathrm{long}}$ line of Mathtext.'
723723
text = fig.text(0, 0.5, s, size=40, wrap=True)
724724
fig.canvas.draw()

0 commit comments

Comments
 (0)