Skip to content

Commit 4b2b829

Browse files
committed
fix a bug in Text._get_layout that returns an incorrect information for an empty string
svn path=/branches/v0_99_maint/; revision=8135
1 parent 24ccb6e commit 4b2b829

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/matplotlib/text.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,11 @@ def _get_layout(self, renderer):
275275
baseline = None
276276
for i, line in enumerate(lines):
277277
clean_line, ismath = self.is_math_text(line)
278-
w, h, d = renderer.get_text_width_height_descent(
279-
clean_line, self._fontproperties, ismath=ismath)
278+
if clean_line:
279+
w, h, d = renderer.get_text_width_height_descent(
280+
clean_line, self._fontproperties, ismath=ismath)
281+
else:
282+
w, h, d = 0, 0, 0
280283
if baseline is None:
281284
baseline = h - d
282285
whs[i] = w, h

0 commit comments

Comments
 (0)