99from matplotlib .mathtext import MathTextParser
1010
1111import matplotlib .dviread as dviread
12- from matplotlib .texmanager import TexManager
1312
1413import numpy as np
1514
@@ -31,6 +30,7 @@ def __init__(self):
3130 from matplotlib .cbook import maxdict
3231 self ._ps_fontd = maxdict (50 )
3332
33+ self ._texmanager = None
3434
3535 def _get_font (self , prop ):
3636 """
@@ -243,6 +243,15 @@ def get_glyphs_mathtext(self, prop, s):
243243 return zip (glyph_ids , xpositions , ypositions , sizes ), glyph_map , myrects
244244
245245
246+ def get_texmanager (self ):
247+ """
248+ return the :class:`matplotlib.texmanager.TexManager` instance
249+ """
250+ if self ._texmanager is None :
251+ from matplotlib .texmanager import TexManager
252+ self ._texmanager = TexManager ()
253+ return self ._texmanager
254+
246255
247256 def get_glyphs_tex (self , prop , s ):
248257 """
@@ -251,7 +260,7 @@ def get_glyphs_tex(self, prop, s):
251260
252261 # codes are modstly borrowed from pdf backend.
253262
254- texmanager = TexManager ()
263+ texmanager = self . get_texmanager ()
255264
256265 if self .tex_font_map is None :
257266 self .tex_font_map = dviread .PsfontsMap (dviread .find_tex_file ('pdftex.map' ))
0 commit comments