8000 Merge pull request #18798 from jkseppan/deprecate-afm-mathtext · matplotlib/matplotlib@2e75ed0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2e75ed0

Browse files
authored
Merge pull request #18798 from jkseppan/deprecate-afm-mathtext
Deprecate ps.useafm for mathtext
2 parents 22c6cce + 18ef741 commit 2e75ed0

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
``ps.useafm`` deprecated for mathtext
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
Outputting mathtext using only standard PostScript fonts has likely
5+
been broken for a while (issue `#18722
6+
<https://github.com/matplotlib/matplotlib/issues/18722>`_). In
7+
Matplotlib 3.5, the setting ``ps.useafm`` will have no effect on
8+
mathtext.

lib/matplotlib/mathtext.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,19 @@ def parse(self, s, dpi=72, prop=None, *, _force_standard_ps_fonts=False):
433433
The results are cached, so multiple calls to `parse`
434434
with the same expression should be fast.
435435
"""
436+
if _force_standard_ps_fonts:
437+
cbook.warn_deprecated(
438+
"3.4",
439+
removal="3.5",
440+
message=(
441+
"Mathtext using only standard PostScript fonts has "
442+
"been likely to produce wrong output for a while, "
443+
"has been deprecated in %(since)s and will be removed "
444+
"in %(removal)s, after which ps.useafm will have no "
445+
"effect on mathtext."
446+
)
447+
)
448+
436449
# lru_cache can't decorate parse() directly because the ps.useafm and
437450
# mathtext.fontset rcParams also affect the parse (e.g. by affecting
438451
# the glyph metrics).

lib/matplotlib/tests/test_backend_ps.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import matplotlib.pyplot as plt
1010
from matplotlib import cbook, patheffects
1111
from matplotlib.testing.decorators import image_comparison
12+
from matplotlib.cbook import MatplotlibDeprecationWarning
1213

1314

1415
needs_ghostscript = pytest.mark.skipif(
@@ -59,6 +60,8 @@ def test_savefig_to_stringio(format, use_log, rcParams, orientation):
5960
allowable_exceptions.append(mpl.ExecutableNotFoundError)
6061
if rcParams.get("text.usetex"):
6162
allowable_exceptions.append(RuntimeError)
63+
if rcParams.get("ps.useafm"):
64+
allowable_exceptions.append(MatplotlibDeprecationWarning)
6265
try:
6366
fig.savefig(s_buf, format=format, orientation=orientation)
6467
fig.savefig(b_buf, format=format, orientation=orientation)

0 commit comments

Comments
 (0)
0