diff --git a/doc/api/mathtext_api.rst b/doc/api/mathtext_api.rst index c0f4941414ed..295ed0382c61 100644 --- a/doc/api/mathtext_api.rst +++ b/doc/api/mathtext_api.rst @@ -9,4 +9,3 @@ :members: :undoc-members: :show-inheritance: - :exclude-members: Box, Char, ComputerModernFontConstants, DejaVuSansFontConstants, DejaVuSerifFontConstants, FontConstantsBase, Fonts, Glue, Kern, Node, Parser, STIXFontConstants, STIXSansFontConstants, Ship, StandardPsFonts, TruetypeFonts diff --git a/doc/api/next_api_changes/removals/22107-OG.rst b/doc/api/next_api_changes/removals/22107-OG.rst new file mode 100644 index 000000000000..8bf4569da34e --- /dev/null +++ b/doc/api/next_api_changes/removals/22107-OG.rst @@ -0,0 +1,40 @@ +Removal of deprecated ``mathtext`` APIs +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The following `matplotlib.mathtext` APIs have been removed: +- ``Fonts`` and all its subclasses, +- ``FontConstantsBase`` and all its subclasses, +- ``Node`` and all its subclasses, +- ``Ship``, ``ship``, +- ``Error``, +- ``Parser``, +- ``SHRINK_FACTOR``, ``GROW_FACTOR``, +- ``NUM_SIZE_LEVELS``, +- ``latex_to_bakoma``, ``latex_to_cmex``, ``latex_to_standard``, +- ``stix_virtual_fonts``, +- ``tex2uni`` + +Removal of various ``mathtext`` helpers +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The following `matplotlib.mathtext` classes: +- ``MathtextBackendPdf``, +- ``MathtextBackendPs``, +- ``MathtextBackendSvg``, +- ``MathtextBackendCairo``, +and the ``.mathtext_parser`` attributes on +- `.RendererPdf`, +- `.RendererPS`, +- `.RendererSVG`, +- `.RendererCairo` +have been removed. The `.MathtextBackendPath` class can be used instead. + +The methods ``get_depth``, ``parse``, ``to_mask``, ``to_rgba``, and ``to_png`` +of `.MathTextParser` have been removed. Use `.mathtext.math_to_image` instead. + +The unused ``StandardPsFonts.pswriter`` has been removed. + +``ps.useafm`` removed for ``mathtext`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The setting :rc:`ps.useafm` no longer has any effect on `matplotlib.mathtext`. diff --git a/doc/sphinxext/math_symbol_table.py b/doc/sphinxext/math_symbol_table.py index 3041b15b36a8..6609f91bbd10 100644 --- a/doc/sphinxext/math_symbol_table.py +++ b/doc/sphinxext/math_symbol_table.py @@ -1,6 +1,6 @@ from docutils.parsers.rst import Directive -from matplotlib import mathtext +from matplotlib import _mathtext, _mathtext_data symbols = [ @@ -103,9 +103,9 @@ def run(state_machine): def render_symbol(sym): if sym.startswith("\\"): sym = sym[1:] - if sym not in {*mathtext.Parser._overunder_functions, - *mathtext.Parser._function_names}: - sym = chr(mathtext.tex2uni[sym]) + if sym not in (_mathtext.Parser._overunder_functions | + _mathtext.Parser._function_names): + sym = chr(_mathtext_data.tex2uni[sym]) return f'\\{sym}' if sym in ('\\', '|') else sym lines = [] @@ -149,7 +149,6 @@ def setup(app): if __name__ == "__main__": # Do some verification of the tables - from matplotlib import _mathtext_data print("SYMBOLS NOT IN STIX:") all_symbols = {} diff --git a/lib/matplotlib/_mathtext.py b/lib/matplotlib/_mathtext.py index 58033fbfd7fe..c58340c3804e 100644 --- a/lib/matplotlib/_mathtext.py +++ b/lib/matplotlib/_mathtext.py @@ -5,7 +5,6 @@ from collections import namedtuple import enum import functools -from io import StringIO import logging import os import types @@ -92,14 +91,6 @@ def __init__(self, default_font_prop, mathtext_backend): self.mathtext_backend = mathtext_backend self.used_characters = {} - @_api.deprecated("3.4") - def destroy(self): - """ - Fix any cyclical references before the object is about - to be destroyed. - """ - self.used_characters = None - def get_kern(self, font1, fontclass1, sym1, fontsize1, font2, fontclass2, sym2, fontsize2, dpi): """ @@ -203,11 +194,6 @@ def get_results(self, box): """ result = self.mathtext_backend.get_results( box, self.get_used_characters()) - if self.destroy != TruetypeFonts.destroy.__get__(self): - destroy = _api.deprecate_method_override( - __class__.destroy, self, since="3.4") - if destroy: - destroy() return result def get_sized_alternatives_for_symbol(self, fontname, sym): @@ -235,11 +221,6 @@ def __init__(self, default_font_prop, mathtext_backend): self._fonts['default'] = default_font self._fonts['regular'] = default_font - @_api.deprecated("3.4") - def destroy(self): - self.glyphd = None - super().destroy() - def _get_font(self, font): if font in self.fontmap: basename = self.fontmap[font] @@ -803,8 +784,6 @@ def __init__(self, default_font_prop, mathtext_backend=None): self.fonts['default'] = default_font self.fonts['regular'] = default_font - pswriter = _api.deprecated("3.4")(property(lambda self: StringIO())) - def _get_font(self, font): if font in self.fontmap: basename = self.fontmap[font] diff --git a/lib/matplotlib/backends/_backend_pdf_ps.py b/lib/matplotlib/backends/_backend_pdf_ps.py index 3224fb90e3a9..f6545d88c6af 100644 --- a/lib/matplotlib/backends/_backend_pdf_ps.py +++ b/lib/matplotlib/backends/_backend_pdf_ps.py @@ -104,12 +104,7 @@ def get_text_width_height_descent(self, s, prop, ismath): s, fontsize, renderer=self) return w, h, d elif ismath: - # Circular import. - from matplotlib.backends.backend_ps import RendererPS - parse = self._text2path.mathtext_parser.parse( - s, 72, prop, - _force_standard_ps_fonts=(isinstance(self, RendererPS) - and mpl.rcParams["ps.useafm"])) + parse = self._text2path.mathtext_parser.parse(s, 72, prop) return parse.width, parse.height, parse.depth elif mpl.rcParams[self._use_afm_rc_name]: font = self._get_font_afm(prop) diff --git a/lib/matplotlib/backends/backend_cairo.py b/lib/matplotlib/backends/backend_cairo.py index 07a510c48350..2e688573e4d7 100644 --- a/lib/matplotlib/backends/backend_cairo.py +++ b/lib/matplotlib/backends/backend_cairo.py @@ -31,7 +31,6 @@ _Backend, FigureCanvasBase, FigureManagerBase, GraphicsContextBase, RendererBase) from matplotlib.font_manager import ttfFontProperty -from matplotlib.mathtext import MathTextParser from matplotlib.path import Path from matplotlib.transforms import Affine2D @@ -123,9 +122,6 @@ def attr(field): class RendererCairo(RendererBase): - mathtext_parser = _api.deprecated("3.4")( - property(lambda self: MathTextParser('Cairo'))) - def __init__(self, dpi): self.dpi = dpi self.gc = GraphicsContextCairo(renderer=self) diff --git a/lib/matplotlib/backends/backend_pdf.py b/lib/matplotlib/backends/backend_pdf.py index e0d04a56eb33..42d3c3f7909c 100644 --- a/lib/matplotlib/backends/backend_pdf.py +++ b/lib/matplotlib/backends/backend_pdf.py @@ -39,7 +39,6 @@ import matplotlib.dviread as dviread from matplotlib.ft2font import (FIXED_WIDTH, ITALIC, LOAD_NO_SCALE, LOAD_NO_HINTING, KERNING_UNFITTED, FT2Font) -from matplotlib.mathtext import MathTextParser from matplotlib.transforms import Affine2D, BboxBase from matplotlib.path import Path from matplotlib.dates import UTC @@ -1900,11 +1899,6 @@ def __init__(self, file, image_dpi, height, width): self.gc = self.new_gc() self.image_dpi = image_dpi - @_api.deprecated("3.4") - @property - def mathtext_parser(self): - return MathTextParser("Pdf") - def finalize(self): self.file.output(*self.gc.finalize()) diff --git a/lib/matplotlib/backends/backend_ps.py b/lib/matplotlib/backends/backend_ps.py index 33c41202dbb4..1de2f21b0773 100644 --- a/lib/matplotlib/backends/backend_ps.py +++ b/lib/matplotlib/backends/backend_ps.py @@ -7,12 +7,11 @@ from enum import Enum import functools import glob -from io import StringIO, TextIOWrapper +from io import StringIO import logging import math import os import pathlib -import tempfile import re import shutil from tempfile import TemporaryDirectory @@ -30,7 +29,6 @@ from matplotlib.font_manager import get_font from matplotlib.ft2font import LOAD_NO_HINTING, LOAD_NO_SCALE, FT2Font from matplotlib._ttconv import convert_ttf_to_ps -from matplotlib.mathtext import MathTextParser from matplotlib._mathtext_data import uni2type1 from matplotlib.path import Path from matplotlib.texmanager import TexManager @@ -263,9 +261,6 @@ class RendererPS(_backend_pdf_ps.RendererPDFPSBase): _afm_font_dir = cbook._get_data_path("fonts/afm") _use_afm_rc_name = "ps.useafm" - mathtext_parser = _api.deprecated("3.4")(property( - lambda self: MathTextParser("PS"))) - def __init__(self, width, height, pswriter, imagedpi=72): # Although postscript itself is dpi independent, we need to inform the # image code about a requested dpi to generate high resolution images @@ -689,9 +684,7 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None): def draw_mathtext(self, gc, x, y, s, prop, angle): """Draw the math text using matplotlib.mathtext.""" width, height, descent, glyphs, rects = \ - self._text2path.mathtext_parser.parse( - s, 72, prop, - _force_standard_ps_fonts=mpl.rcParams["ps.useafm"]) + self._text2path.mathtext_parser.parse(s, 72, prop) self.set_color(*gc.get_rgb()) self._pswriter.write( f"gsave\n" diff --git a/lib/matplotlib/backends/backend_svg.py b/lib/matplotlib/backends/backend_svg.py index 57cfec238941..e38af2541d45 100644 --- a/lib/matplotlib/backends/backend_svg.py +++ b/lib/matplotlib/backends/backend_svg.py @@ -20,7 +20,6 @@ from matplotlib.backends.backend_mixed import MixedModeRenderer from matplotlib.colors import rgb2hex from matplotlib.dates import UTC -from matplotlib.mathtext import MathTextParser from matplotlib.path import Path from matplotlib import _path from matplotlib.transforms import Affine2D, Affine2DBase @@ -318,11 +317,6 @@ def __init__(self, width, height, svgwriter, basename=None, image_dpi=72, self._write_metadata(metadata) self._write_default_style() - @_api.deprecated("3.4") - @property - def mathtext_parser(self): - return MathTextParser('SVG') - def finalize(self): self._write_clips() self._write_hatches() diff --git a/lib/matplotlib/mathtext.py b/lib/matplotlib/mathtext.py index 7957f94f2e45..f9bc3f4faac4 100644 --- a/lib/matplotlib/mathtext.py +++ b/lib/matplotlib/mathtext.py @@ -17,34 +17,17 @@ from collections import namedtuple import functools -from io import StringIO import logging -import types import numpy as np -from PIL import Image -from matplotlib import ( - _api, colors as mcolors, rcParams, _mathtext, _mathtext_data) +from matplotlib import _api, rcParams, _mathtext from matplotlib.ft2font import FT2Image, LOAD_NO_HINTING from matplotlib.font_manager import FontProperties _log = logging.getLogger(__name__) -@_api.caching_module_getattr -class __getattr__: - locals().update({ - name: _api.deprecated("3.4")( - property(lambda self, _mod=mod, _name=name: getattr(_mod, _name))) - for mod, names in [ - (_mathtext, ["SHRINK_FACTOR", "GROW_FACTOR", "NUM_SIZE_LEVELS"]), - (_mathtext_data, [ - "latex_to_bakoma", "latex_to_cmex", "latex_to_standard", - "stix_virtual_fonts", "tex2uni"])] - for name in names}) - - get_unicode_index = _mathtext.get_unicode_index get_unicode_index.__module__ = __name__ @@ -179,122 +162,6 @@ def get_hinting_type(self): return backend_agg.get_hinting_flag() -@_api.deprecated("3.4", alternative="`.mathtext.math_to_image`") -class MathtextBackendBitmap(MathtextBackendAgg): - def get_results(self, box, used_characters): - ox, oy, width, height, depth, image, characters = \ - super().get_results(box, used_characters) - return image, depth - - -@_api.deprecated("3.4", alternative="`.MathtextBackendPath`") -class MathtextBackendPs(MathtextBackend): - """ - Store information to write a mathtext rendering to the PostScript backend. - """ - - _PSResult = namedtuple( - "_PSResult", "width height depth pswriter used_characters") - - def __init__(self): - super().__init__() - self.pswriter = StringIO() - self.lastfont = None - - def render_glyph(self, ox, oy, info): - oy = self.height - oy + info.offset - postscript_name = info.postscript_name - fontsize = info.fontsize - - if (postscript_name, fontsize) != self.lastfont: - self.lastfont = postscript_name, fontsize - self.pswriter.write( - f"/{postscript_name} findfont\n" - f"{fontsize} scalefont\n" - f"setfont\n") - - self.pswriter.write( - f"{ox:f} {oy:f} moveto\n" - f"/{info.symbol_name} glyphshow\n") - - def render_rect_filled(self, x1, y1, x2, y2): - ps = "%f %f %f %f rectfill\n" % ( - x1, self.height - y2, x2 - x1, y2 - y1) - self.pswriter.write(ps) - - def get_results(self, box, used_characters): - _mathtext.ship(0, 0, box) - return self._PSResult(self.width, - self.height + self.depth, - self.depth, - self.pswriter, - used_characters) - - -@_api.deprecated("3.4", alternative="`.MathtextBackendPath`") -class MathtextBackendPdf(MathtextBackend): - """Store information to write a mathtext rendering to the PDF backend.""" - - _PDFResult = namedtuple( - "_PDFResult", "width height depth glyphs rects used_characters") - - def __init__(self): - super().__init__() - self.glyphs = [] - self.rects = [] - - def render_glyph(self, ox, oy, info): - filename = info.font.fname - oy = self.height - oy + info.offset - self.glyphs.append( - (ox, oy, filename, info.fontsize, - info.num, info.symbol_name)) - - def render_rect_filled(self, x1, y1, x2, y2): - self.rects.append((x1, self.height - y2, x2 - x1, y2 - y1)) - - def get_results(self, box, used_characters): - _mathtext.ship(0, 0, box) - return self._PDFResult(self.width, - self.height + self.depth, - self.depth, - self.glyphs, - self.rects, - used_characters) - - -@_api.deprecated("3.4", alternative="`.MathtextBackendPath`") -class MathtextBackendSvg(MathtextBackend): - """ - Store information to write a mathtext rendering to the SVG - backend. - """ - def __init__(self): - super().__init__() - self.svg_glyphs = [] - self.svg_rects = [] - - def render_glyph(self, ox, oy, info): - oy = self.height - oy + info.offset - - self.svg_glyphs.append( - (info.font, info.fontsize, info.num, ox, oy, info.metrics)) - - def render_rect_filled(self, x1, y1, x2, y2): - self.svg_rects.append( - (x1, self.height - y1 + 1, x2 - x1, y2 - y1)) - - def get_results(self, box, used_characters): - _mathtext.ship(0, 0, box) - svg_elements = types.SimpleNamespace(svg_glyphs=self.svg_glyphs, - svg_rects=self.svg_rects) - return (self.width, - self.height + self.depth, - self.depth, - svg_elements, - used_characters) - - class MathtextBackendPath(MathtextBackend): """ Store information to write a mathtext rendering to the text path @@ -324,59 +191,10 @@ def get_results(self, box, used_characters): self.rects) -@_api.deprecated("3.4", alternative="`.MathtextBackendPath`") -class MathtextBackendCairo(MathtextBackend): - """ - Store information to write a mathtext rendering to the Cairo - backend. - """ - - def __init__(self): - super().__init__() - self.glyphs = [] - self.rects = [] - - def render_glyph(self, ox, oy, info): - oy = oy - info.offset - self.height - thetext = chr(info.num) - self.glyphs.append( - (info.font, info.fontsize, thetext, ox, oy)) - - def render_rect_filled(self, x1, y1, x2, y2): - self.rects.append( - (x1, y1 - self.height, x2 - x1, y2 - y1)) - - def get_results(self, box, used_characters): - _mathtext.ship(0, 0, box) - return (self.width, - self.height + self.depth, - self.depth, - self.glyphs, - self.rects) - - -for _cls_name in [ - "Fonts", - *[c.__name__ for c in _mathtext.Fonts.__subclasses__()], - "FontConstantsBase", - *[c.__name__ for c in _mathtext.FontConstantsBase.__subclasses__()], - "Node", - *[c.__name__ for c in _mathtext.Node.__subclasses__()], - "Ship", "Parser", -]: - globals()[_cls_name] = _api.deprecated("3.4")( - type(_cls_name, (getattr(_mathtext, _cls_name),), {})) - - class MathTextWarning(Warning): pass -@_api.deprecated("3.4") -def ship(ox, oy, box): - _mathtext.ship(ox, oy, box) - - ############################################################################## # MAIN @@ -385,13 +203,13 @@ class MathTextParser: _parser = None _backend_mapping = { - 'bitmap': MathtextBackendBitmap, + 'bitmap': MathtextBackendPath, 'agg': MathtextBackendAgg, - 'ps': MathtextBackendPs, - 'pdf': MathtextBackendPdf, - 'svg': MathtextBackendSvg, + 'ps': MathtextBackendPath, + 'pdf': MathtextBackendPath, + 'svg': MathtextBackendPath, 'path': MathtextBackendPath, - 'cairo': MathtextBackendCairo, + 'cairo': MathtextBackendPath, 'macosx': MathtextBackendAgg, } _font_type_mapping = { @@ -407,7 +225,7 @@ def __init__(self, output): """Create a MathTextParser for the given backend *output*.""" self._output = output.lower() - def parse(self, s, dpi=72, prop=None, *, _force_standard_ps_fonts=False): + def parse(self, s, dpi=72, prop=None): """ Parse the given math expression *s* at the given *dpi*. If *prop* is provided, it is a `.FontProperties` object specifying the "default" @@ -416,33 +234,18 @@ def parse(self, s, dpi=72, prop=None, *, _force_standard_ps_fonts=False): The results are cached, so multiple calls to `parse` with the same expression should be fast. """ - if _force_standard_ps_fonts: - _api.warn_deprecated( - "3.4", - removal="3.5", - message=( - "Mathtext using only standard PostScript fonts has " - "been likely to produce wrong output for a while, " - "has been deprecated in %(since)s and will be removed " - "in %(removal)s, after which ps.useafm will have no " - "effect on mathtext." - ) - ) - # lru_cache can't decorate parse() directly because the ps.useafm and # mathtext.fontset rcParams also affect the parse (e.g. by affecting # the glyph metrics). - return self._parse_cached(s, dpi, prop, _force_standard_ps_fonts) + return self._parse_cached(s, dpi, prop) @functools.lru_cache(50) - def _parse_cached(self, s, dpi, prop, force_standard_ps_fonts): + def _parse_cached(self, s, dpi, prop): if prop is None: prop = FontProperties() - fontset_class = ( - _mathtext.StandardPsFonts if force_standard_ps_fonts - else _api.check_getitem( - self._font_type_mapping, fontset=prop.get_math_fontfamily())) + fontset_class = _api.check_getitem( + self._font_type_mapping, fontset=prop.get_math_fontfamily()) backend = self._backend_mapping[self._output]() font_output = fontset_class(prop, backend) @@ -457,111 +260,6 @@ def _parse_cached(self, s, dpi, prop, force_standard_ps_fonts): font_output.set_canvas_size(box.width, box.height, box.depth) return font_output.get_results(box) - @_api.deprecated("3.4", alternative="`.mathtext.math_to_image`") - def to_mask(self, texstr, dpi=120, fontsize=14): - r""" - Convert a mathtext string to a grayscale array and depth. - - Parameters - ---------- - texstr : str - A valid mathtext string, e.g., r'IQ: $\sigma_i=15$'. - dpi : float - The dots-per-inch setting used to render the text. - fontsize : int - The font size in points - - Returns - ------- - array : 2D uint8 alpha - Mask array of rasterized tex. - depth : int - Offset of the baseline from the bottom of the image, in pixels. - """ - assert self._output == "bitmap" - prop = FontProperties(size=fontsize) - ftimage, depth = self.parse(texstr, dpi=dpi, prop=prop) - return np.asarray(ftimage), depth - - @_api.deprecated("3.4", alternative="`.mathtext.math_to_image`") - def to_rgba(self, texstr, color='black', dpi=120, fontsize=14): - r""" - Convert a mathtext string to an RGBA array and depth. - - Parameters - ---------- - texstr : str - A valid mathtext string, e.g., r'IQ: $\sigma_i=15$'. - color : color - The text color. - dpi : float - The dots-per-inch setting used to render the text. - fontsize : int - The font size in points. - - Returns - ------- - array : (M, N, 4) array - RGBA color values of rasterized tex, colorized with *color*. - depth : int - Offset of the baseline from the bottom of the image, in pixels. - """ - alpha, depth = self.to_mask(texstr, dpi=dpi, fontsize=fontsize) - rgba = np.zeros((alpha.shape[0], alpha.shape[1], 4), dtype=np.uint8) - rgba[:] = 255 * np.asarray(mcolors.to_rgba(color)) - rgba[:, :, 3] = alpha - return rgba, depth - - @_api.deprecated("3.4", alternative="`.mathtext.math_to_image`") - def to_png(self, filename, texstr, color='black', dpi=120, fontsize=14): - r""" - Render a tex expression to a PNG file. - - Parameters - ---------- - filename - A writable filename or fileobject. - texstr : str - A valid mathtext string, e.g., r'IQ: $\sigma_i=15$'. - color : color - The text color. - dpi : float - The dots-per-inch setting used to render the text. - fontsize : int - The font size in points. - - Returns - ------- - int - Offset of the baseline from the bottom of the image, in pixels. - """ - rgba, depth = self.to_rgba( - texstr, color=color, dpi=dpi, fontsize=fontsize) - Image.fromarray(rgba).save(filename, format="png") - return depth - - @_api.deprecated("3.4", alternative="`.mathtext.math_to_image`") - def get_depth(self, texstr, dpi=120, fontsize=14): - r""" - Get the depth of a mathtext string. - - Parameters - ---------- - texstr : str - A valid mathtext string, e.g., r'IQ: $\sigma_i=15$'. - dpi : float - The dots-per-inch setting used to render the text. - - Returns - ------- - int - Offset of the baseline from the bottom of the image, in pixels. - """ - assert self._output == "bitmap" - prop = FontProperties(size=fontsize) - ftimage, depth = self.parse(texstr, dpi=dpi, prop=prop) - return depth - def math_to_image(s, filename_or_obj, prop=None, dpi=None, format=None, *, color=None): diff --git a/lib/matplotlib/tests/test_mathtext.py b/lib/matplotlib/tests/test_mathtext.py index 6cfef7f5b14f..d0e66cae32b4 100644 --- a/lib/matplotlib/tests/test_mathtext.py +++ b/lib/matplotlib/tests/test_mathtext.py @@ -10,7 +10,7 @@ import matplotlib as mpl from matplotlib.testing.decorators import check_figures_equal, image_comparison import matplotlib.pyplot as plt -from matplotlib import _api, mathtext +from matplotlib import mathtext, _mathtext # If test is removed, use None as placeholder @@ -109,7 +109,7 @@ r'${xyz}^k{x}_{k}{x}^{p}{y}^{p-2} {d}_{i}^{j}{b}_{j}{c}_{k}{d} {x}^{j}_{i}{E}^{0}{E}^0_u$', r'${\int}_x^x x\oint_x^x x\int_{X}^{X}x\int_x x \int^x x \int_{x} x\int^{x}{\int}_{x} x{\int}^{x}_{x}x$', r'testing$^{123}$', - ' '.join('$\\' + p + '$' for p in sorted(mathtext.Parser._accentprefixed)), + ' '.join('$\\' + p + '$' for p in sorted(_mathtext.Parser._accentprefixed)), r'$6-2$; $-2$; $ -2$; ${-2}$; ${ -2}$; $20^{+3}_{-2}$', r'$\overline{\omega}^x \frac{1}{2}_0^x$', # github issue #5444 r'$,$ $.$ $1{,}234{, }567{ , }890$ and $1,234,567,890$', # github issue 5799 @@ -376,13 +376,6 @@ def test_math_to_image(tmpdir): mathtext.math_to_image('$x^2$', io.BytesIO(), color='Maroon') -def test_mathtext_to_png(tmpdir): - with _api.suppress_matplotlib_deprecation_warning(): - mt = mathtext.MathTextParser('bitmap') - mt.to_png(str(tmpdir.join('example.png')), '$x^2$') - mt.to_png(io.BytesIO(), '$x^2$') - - @image_comparison(baseline_images=['math_fontfamily_image.png'], savefig_kwarg={'dpi': 40}) def test_math_fontfamily():