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

Skip to content

Commit 35e7fd7

Browse files
committed
Fix autosized angle brackets in mathtext.
svn path=/trunk/matplotlib/; revision=6489
1 parent bbc5d93 commit 35e7fd7

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

lib/matplotlib/mathtext.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,9 @@ def _get_glyph(self, fontname, font_class, sym, fontsize):
737737
r'\widehat' : [('rm', '\x5e'), ('ex', '\x62'), ('ex', '\x63'),
738738
('ex', '\x64')],
739739
r'\widetilde': [('rm', '\x7e'), ('ex', '\x65'), ('ex', '\x66'),
740-
('ex', '\x67')]
740+
('ex', '\x67')],
741+
r'<' : [('cal', 'h'), ('ex', 'D')],
742+
r'>' : [('cal', 'i'), ('ex', 'E')]
741743
}
742744

743745
for alias, target in [('\leftparen', '('),
@@ -843,8 +845,7 @@ def _get_glyph(self, fontname, font_class, sym, fontsize):
843845
if fontname == 'it' and isinstance(self, StixFonts):
844846
return self._get_glyph('rm', font_class, sym, fontsize)
845847
warn("Font '%s' does not have a glyph for '%s'" %
846-
(cached_font.font.postscript_name,
847-
sym.encode('ascii', 'backslashreplace')),
848+
(fontname, sym.encode('ascii', 'backslashreplace')),
848849
MathTextWarning)
849850
warn("Substituting with a dummy symbol.", MathTextWarning)
850851
fontname = 'rm'
@@ -956,6 +957,12 @@ def get_sized_alternatives_for_symbol(self, fontname, sym):
956957
except ValueError:
957958
return [(fontname, sym)]
958959

960+
fix_ups = {
961+
ord('<'): 0x27e8,
962+
ord('>'): 0x27e9 }
963+
964+
uniindex = fix_ups.get(uniindex, uniindex)
965+
959966
for i in range(6):
960967
cached_font = self._get_font(i)
961968
glyphindex = cached_font.charmap.get(uniindex)
@@ -2068,9 +2075,9 @@ class Parser(object):
20682075
| \| / \backslash \uparrow \downarrow \updownarrow \Uparrow
20692076
\Downarrow \Updownarrow .""".split())
20702077

2071-
_leftDelim = set(r"( [ { \lfloor \langle \lceil".split())
2078+
_leftDelim = set(r"( [ { < \lfloor \langle \lceil".split())
20722079

2073-
_rightDelim = set(r") ] } \rfloor \rangle \rceil".split())
2080+
_rightDelim = set(r") ] } > \rfloor \rangle \rceil".split())
20742081

20752082
def __init__(self):
20762083
# All forward declarations are here

0 commit comments

Comments
 (0)