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

Skip to content

Commit 2ad10de

Browse files
committed
Remove _mathtext.Node.grow.
It has never been used, and the implementation was in fact buggy (if one calls `shrink` many times beyond num_size_levels, `.size` would continue to decrease while `.width` would not; if one then calls `grow`, `.size` and `.width` would then both increase, but get out of sync with one another). I can't find a reference to grow() in the TeXbook or "TeX the program" either(?)
1 parent b52b2a0 commit 2ad10de

File tree

1 file changed

+1
-43
lines changed

1 file changed

+1
-43
lines changed

lib/matplotlib/_mathtext.py

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -923,10 +923,8 @@ def get_underline_thickness(self, font, fontsize, dpi):
923923
# Note that (as TeX) y increases downward, unlike many other parts of
924924
# matplotlib.
925925

926-
# How much text shrinks when going to the next-smallest level. GROW_FACTOR
927-
# must be the inverse of SHRINK_FACTOR.
926+
# How much text shrinks when going to the next-smallest level.
928927
SHRINK_FACTOR = 0.7
929-
GROW_FACTOR = 1 / SHRINK_FACTOR
930928
# The number of different sizes of chars to use, beyond which they will not
931929
# get any smaller
932930
NUM_SIZE_LEVELS = 6
@@ -1059,13 +1057,6 @@ def shrink(self):
10591057
"""
10601058
self.size += 1
10611059

1062-
def grow(self):
1063-
"""
1064-
Grows one level larger. There is no limit to how big
1065-
something can get.
1066-
"""
1067-
self.size -= 1
1068-
10691060
def render(self, x, y):
10701061
pass
10711062

@@ -1086,12 +1077,6 @@ def shrink(self):
10861077
self.height *= SHRINK_FACTOR
10871078
self.depth *= SHRINK_FACTOR
10881079

1089-
def grow(self):
1090-
super().grow()
1091-
self.width *= GROW_FACTOR
1092-
self.height *= GROW_FACTOR
1093-
self.depth *= GROW_FACTOR
1094-
10951080
def render(self, x1, y1, x2, y2):
10961081
pass
10971082

@@ -1185,13 +1170,6 @@ def shrink(self):
11851170
self.height *= SHRINK_FACTOR
11861171
self.depth *= SHRINK_FACTOR
11871172

1188-
def grow(self):
1189-
super().grow()
1190-
self.fontsize *= GROW_FACTOR
1191-
self.width *= GROW_FACTOR
1192-
self.height *= GROW_FACTOR
1193-
self.depth *= GROW_FACTOR
1194-
11951173

11961174
class Accent(Char):
11971175
"""
@@ -1210,10 +1188,6 @@ def shrink(self):
12101188
super().shrink()
12111189
self._update_metrics()
12121190

1213-
def grow(self):
1214-
super().grow()
1215-
self._update_metrics()
1216-
12171191
def render(self, x, y):
12181192
"""
12191193
Render the character to the canvas.
@@ -1276,13 +1250,6 @@ def shrink(self):
12761250
self.shift_amount *= SHRINK_FACTOR
12771251
self.glue_set *= SHRINK_FACTOR
12781252

1279-
def grow(self):
1280-
for child in self.children:
1281-
child.grow()
1282-
super().grow()
1283-
self.shift_amount *= GROW_FACTOR
1284-
self.glue_set *= GROW_FACTOR
1285-
12861253

12871254
class Hlist(List):
12881255
"""A horizontal list of boxes."""
@@ -1551,11 +1518,6 @@ def shrink(self):
15511518
g = self.glue_spec
15521519
self.glue_spec = g._replace(width=g.width * SHRINK_FACTOR)
15531520

1554-
def grow(self):
1555-
super().grow()
1556-
g = self.glue_spec
1557-
self.glue_spec = g._replace(width=g.width * GROW_FACTOR)
1558-
15591521

15601522
class HCentered(Hlist):
15611523
"""
@@ -1603,10 +1565,6 @@ def shrink(self):
16031565
if self.size < NUM_SIZE_LEVELS:
16041566
self.width *= SHRINK_FACTOR
16051567

1606-
def grow(self):
1607-
super().grow()
1608-
self.width *= GROW_FACTOR
1609-
16101568

16111569
class SubSuperCluster(Hlist):
16121570
"""

0 commit comments

Comments
 (0)