Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a1bdd90

Browse files
committed
Fix over-zealous caching in mathtext that causes one plot's font settings to affect the next. (This resulted in bold tick labels in log_demo.py when building the docs).
svn path=/trunk/matplotlib/; revision=6212
1 parent fe5d566 commit a1bdd90

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

lib/matplotlib/mathtext.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -565,8 +565,6 @@ class TruetypeFonts(Fonts):
565565
A generic base class for all font setups that use Truetype fonts
566566
(through ft2font)
567567
"""
568-
_fonts = {}
569-
570568
class CachedFont:
571569
def __init__(self, font):
572570
self.font = font
@@ -579,13 +577,12 @@ def __repr__(self):
579577

580578
def __init__(self, default_font_prop, mathtext_backend):
581579
Fonts.__init__(self, default_font_prop, mathtext_backend)
582-
self.glyphd = {}
583-
584-
if self._fonts == {}:
585-
filename = findfont(default_font_prop)
586-
default_font = self.CachedFont(FT2Font(str(filename)))
580+
self.glyphd = {}
581+
self._fonts = {}
587582

588-
self._fonts['default'] = default_font
583+
filename = findfont(default_font_prop)
584+
default_font = self.CachedFont(FT2Font(str(filename)))
585+
self._fonts['default'] = default_font
589586

590587
def destroy(self):
591588
self.glyphd = None

0 commit comments

Comments
 (0)