Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f83daa7

Browse filesBrowse files
committed
Only check _metrics of subsuper nucleus if available
Fixes #5444
1 parent d6354b8 commit f83daa7
Copy full SHA for f83daa7

File tree

Expand file treeCollapse file tree

2 files changed

+5
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+5
-2
lines changed

‎lib/matplotlib/mathtext.py

Copy file name to clipboardExpand all lines: lib/matplotlib/mathtext.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2859,10 +2859,12 @@ def subsuper(self, s, loc, toks):
28592859
new_children = nucleus.children
28602860
if len(new_children):
28612861
# remove last kern
2862-
if isinstance(new_children[-1],Kern):
2862+
if (isinstance(new_children[-1],Kern) and
2863+
hasattr(new_children[-2], '_metrics')):
28632864
new_children = new_children[:-1]
28642865
last_char = new_children[-1]
2865-
last_char.width = last_char._metrics.advance
2866+
if hasattr(last_char, '_metrics'):
2867+
last_char.width = last_char._metrics.advance
28662868
# create new Hlist without kerning
28672869
nucleus = Hlist(new_children, do_kern=False)
28682870
else:

‎lib/matplotlib/tests/test_mathtext.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_mathtext.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
r'testing$^{123}$',
105105
' '.join('$\\' + p + '$' for p in sorted(mathtext.Parser._snowflake)),
106106
r'$6-2$; $-2$; $ -2$; ${-2}$; ${ -2}$; $20^{+3}_{-2}$',
107+
r'$\overline{\omega}^x \frac{1}{2}_0^x$', # github issue #5444
107108
]
108109

109110
digits = "0123456789"

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.