From 577da7881122908cbcebd57416b2194e5b771247 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 15 Jul 2020 21:01:15 -0400 Subject: [PATCH] Sync Cairo's usetex measurement with base class. --- lib/matplotlib/backends/backend_cairo.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/backends/backend_cairo.py b/lib/matplotlib/backends/backend_cairo.py index 773886e56ed5..9faf19f2080b 100644 --- a/lib/matplotlib/backends/backend_cairo.py +++ b/lib/matplotlib/backends/backend_cairo.py @@ -286,10 +286,12 @@ def get_canvas_width_height(self): def get_text_width_height_descent(self, s, prop, ismath): # docstring inherited + if ismath == 'TeX': + return super().get_text_width_height_descent(s, prop, ismath) + if ismath: - width, height, descent, fonts, used_characters = \ - self.mathtext_parser.parse(s, self.dpi, prop) - return width, height, descent + dims = self.mathtext_parser.parse(s, self.dpi, prop) + return dims[0:3] # return width, height, descent ctx = self.text_ctx # problem - scale remembers last setting and font can become