File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -882,7 +882,8 @@ def get_window_extent(self, renderer):
882882
883883 def get_extent (self , renderer ):
884884 _ , h_ , d_ = renderer .get_text_width_height_descent (
885- "lp" , self ._text ._fontproperties , ismath = False )
885+ "lp" , self ._text ._fontproperties ,
886+ ismath = "TeX" if self ._text .get_usetex () else False )
886887
887888 bbox , info , yd = self ._text ._get_layout (renderer )
888889 w , h = bbox .width , bbox .height
Original file line number Diff line number Diff line change @@ -637,6 +637,22 @@ def test_alpha_handles():
637637 assert lh .get_edgecolor ()[:- 1 ] == hh [1 ].get_edgecolor ()[:- 1 ]
638638
639639
640+ @pytest .mark .skipif (
641+ not mpl .checkdep_usetex (True ),
642+ reason = "This test needs a TeX installation" )
643+ def test_usetex_no_warn (caplog ):
644+ mpl .rcParams ['font.family' ] = 'serif'
645+ mpl .rcParams ['font.serif' ] = 'Computer Modern'
646+ mpl .rcParams ['text.usetex' ] = True
647+
648+ fig , ax = plt .subplots ()
649+ ax .plot (0 , 0 , label = 'input' )
650+ ax .legend (title = "My legend" )
651+
652+ fig .canvas .draw ()
653+ assert "Font family ['serif'] not found." not in caplog .text
654+
655+
640656def test_warn_big_data_best_loc ():
641657 fig , ax = plt .subplots ()
642658 fig .canvas .draw () # So that we can call draw_artist later.
You can’t perform that action at this time.
0 commit comments