diff --git a/lib/matplotlib/mathtext.py b/lib/matplotlib/mathtext.py index a9f0aa3c61e9..2ccfd6c2c064 100644 --- a/lib/matplotlib/mathtext.py +++ b/lib/matplotlib/mathtext.py @@ -1146,7 +1146,7 @@ def _get_info (self, fontname, font_class, sym, fontsize, dpi, math=True): num = ord(glyph) found_symbol = True else: - warn("No TeX to built-in Postscript mapping for '%s'" % sym, + warn("No TeX to built-in Postscript mapping for {!r}".format(sym), MathTextWarning) slanted = (fontname == 'it') @@ -1156,9 +1156,8 @@ def _get_info (self, fontname, font_class, sym, fontsize, dpi, math=True): try: symbol_name = font.get_name_char(glyph) except KeyError: - warn("No glyph in standard Postscript font '%s' for '%s'" % - (font.postscript_name, sym), - MathTextWarning) + warn("No glyph in standard Postscript font {!r} for {!r}" + .format(font.get_fontname(), sym), MathTextWarning) found_symbol = False if not found_symbol: