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

Skip to content

Commit 07d119f

Browse files
committed
Fix font.size from being saved in the fontManager.cache
svn path=/trunk/matplotlib/; revision=3861
1 parent ba9ebb0 commit 07d119f

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

lib/matplotlib/font_manager.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,7 @@ def set_size(self, size):
773773
else:
774774
if is_string_like(size):
775775
parent_size = fontManager.get_default_size()
776+
print "parent_size", parent_size, size
776777
scaling = font_scalings.get(size)
777778
if scaling is not None:
778779
size = parent_size * scaling
@@ -843,10 +844,9 @@ class FontManager:
843844
"""
844845

845846
def __init__(self, size=None, weight='normal'):
846-
if not size : size = rcParams['font.size']
847-
self.__default_size = size
848847
self.__default_weight = weight
849-
848+
self.default_size = size
849+
850850
paths = [os.path.join(rcParams['datapath'],'fonts','ttf'),
851851
os.path.join(rcParams['datapath'],'fonts','afm')]
852852

@@ -899,7 +899,9 @@ def get_default_weight(self):
899899

900900
def get_default_size(self):
901901
"Return the default font size."
902-
return self.__default_size
902+
if self.default_size is None:
903+
return rcParams['font.size']
904+
return self.default_size
903905

904906
def set_default_weight(self, weight):
905907
"Set the default font weight. The initial value is 'normal'."
@@ -1085,6 +1087,7 @@ def _rebuild():
10851087

10861088
try:
10871089
fontManager = pickle_load(_fmcache)
1090+
fontManager.default_size = None
10881091
verbose.report("Using fontManager instance from %s" % _fmcache)
10891092
except:
10901093
_rebuild()

0 commit comments

Comments
 (0)