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

Skip to content

Commit 269b4ff

Browse files
committed
Small bugfix with auto-sized delimiters
svn path=/trunk/matplotlib/; revision=3667
1 parent cf513c8 commit 269b4ff

1 file changed

Lines changed: 8 additions & 18 deletions

File tree

lib/matplotlib/mathtext.py

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,20 +1412,15 @@ def __init__(self, c, height, depth, state, always=False):
14121412

14131413
state = state.copy()
14141414
target_total = height + depth
1415-
big_enough = False
14161415
for fontname, sym in alternatives:
14171416
state.font = fontname
14181417
char = Char(sym, state)
1419-
if char.height + char.depth > target_total:
1420-
big_enough = True
1418+
if char.height + char.depth >= target_total:
14211419
break
14221420

1423-
# If the largest option is still not big enough, just do
1424-
# simple scale on it.
1425-
if not big_enough:
1426-
factor = target_total / (char.height + char.depth)
1427-
state.fontsize *= factor
1428-
char = Char(sym, state)
1421+
factor = target_total / (char.height + char.depth)
1422+
state.fontsize *= factor
1423+
char = Char(sym, state)
14291424

14301425
shift = (depth - char.depth)
14311426
Hlist.__init__(self, [char])
@@ -1442,20 +1437,15 @@ def __init__(self, c, width, state, always=False, char_class=Char):
14421437
state.font, c)
14431438

14441439
state = state.copy()
1445-
big_enough = False
14461440
for fontname, sym in alternatives:
14471441
state.font = fontname
14481442
char = char_class(sym, state)
1449-
if char.width > width:
1450-
big_enough = True
1443+
if char.width >= width:
14511444
break
14521445

1453-
# If the largest option is still not big enough, just do
1454-
# simple scale on it.
1455-
if not big_enough:
1456-
factor = width / char.width
1457-
state.fontsize *= factor
1458-
char = char_class(sym, state)
1446+
factor = width / char.width
1447+
state.fontsize *= factor
1448+
char = char_class(sym, state)
14591449

14601450
Hlist.__init__(self, [char])
14611451

0 commit comments

Comments
 (0)