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 a22a954

Browse filesBrowse files
authored
Merge pull request #24179 from oscargus/refactor_get_text_whd
MNT: Refactor `Renderer.get_text_width_height_descent`
2 parents 2b446af + 7f5b7e8 commit a22a954
Copy full SHA for a22a954

File tree

Expand file treeCollapse file tree

3 files changed

+4
-13
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+4
-13
lines changed

‎lib/matplotlib/backend_bases.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,8 +609,8 @@ def get_text_width_height_descent(self, s, prop, ismath):
609609
fontsize = prop.get_size_in_points()
610610

611611
if ismath == 'TeX':
612-
# todo: handle props
613-
return TexManager().get_text_width_height_descent(
612+
# todo: handle properties
613+
return self.get_texmanager().get_text_width_height_descent(
614614
s, fontsize, renderer=self)
615615

616616
dpi = self.points_to_pixels(72)

‎lib/matplotlib/backends/_backend_pdf_ps.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/_backend_pdf_ps.py
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,7 @@ def get_canvas_width_height(self):
104104
def get_text_width_height_descent(self, s, prop, ismath):
105105
# docstring inherited
106106
if ismath == "TeX":
107-
texmanager = self.get_texmanager()
108-
fontsize = prop.get_size_in_points()
109-
w, h, d = texmanager.get_text_width_height_descent(
110-
s, fontsize, renderer=self)
111-
return w, h, d
107+
return super().get_text_width_height_descent(s, prop, ismath)
112108
elif ismath:
113109
parse = self._text2path.mathtext_parser.parse(s, 72, prop)
114110
return parse.width, parse.height, parse.depth

‎lib/matplotlib/backends/backend_agg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_agg.py
+1-6Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,7 @@ def get_text_width_height_descent(self, s, prop, ismath):
226226

227227
_api.check_in_list(["TeX", True, False], ismath=ismath)
228228
if ismath == "TeX":
229-
# todo: handle props
230-
texmanager = self.get_texmanager()
231-
fontsize = prop.get_size_in_points()
232-
w, h, d = texmanager.get_text_width_height_descent(
233-
s, fontsize, renderer=self)
234-
return w, h, d
229+
return super().get_text_width_height_descent(s, prop, ismath)
235230

236231
if ismath:
237232
ox, oy, width, height, descent, font_image = \

0 commit comments

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