Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 55998c6

Browse files
committed
Minor mathtext improvements
svn path=/trunk/matplotlib/; revision=5557
1 parent 7d19bab commit 55998c6

1 file changed

Lines changed: 7 additions & 13 deletions

File tree

lib/matplotlib/mathtext.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -725,15 +725,8 @@ def _get_glyph(self, fontname, font_class, sym, fontsize):
725725
cached_font.charmap[num])
726726

727727
if symbol_name is None:
728-
return self._stix_fallback._get_glyph(fontname, font_class, sym, fontsize)
729-
warn("Unrecognized symbol '%s'. Substituting with a dummy symbol."
730-
% sym.encode('ascii', 'backslashreplace'), MathTextWarning)
731-
fontname = 'it'
732-
cached_font = self._get_font(fontname)
733-
num = 0x3F # currency character, for lack of anything better
734-
gid = cached_font.charmap[num]
735-
symbol_name = cached_font.font.get_glyph_name(gid)
736-
slanted = False
728+
return self._stix_fallback._get_glyph(
729+
fontname, font_class, sym, fontsize)
737730

738731
return cached_font, num, symbol_name, fontsize, slanted
739732

@@ -865,10 +858,7 @@ def _get_glyph(self, fontname, font_class, sym, fontsize):
865858
glyphindex = cached_font.charmap[uniindex]
866859
found_symbol = True
867860
except KeyError:
868-
warn("Font '%s' does not have a glyph for '%s'" %
869-
(cached_font.font.postscript_name,
870-
sym.encode('ascii', 'backslashreplace')),
871-
MathTextWarning)
861+
pass
872862

873863
if not found_symbol:
874864
if self.cm_fallback:
@@ -879,6 +869,10 @@ def _get_glyph(self, fontname, font_class, sym, fontsize):
879869
else:
880870
if fontname == 'it' and isinstance(self, StixFonts):
881871
return self._get_glyph('rm', font_class, sym, fontsize)
872+
warn("Font '%s' does not have a glyph for '%s'" %
873+
(cached_font.font.postscript_name,
874+
sym.encode('ascii', 'backslashreplace')),
875+
MathTextWarning)
882876
warn("Substituting with a dummy symbol.", MathTextWarning)
883877
fontname = 'rm'
884878
new_fontname = fontname

0 commit comments

Comments
 (0)