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

Skip to content

Commit 2a9b39d

Browse files
committed
hashing of FontProperties accounts current rcParams
svn path=/trunk/matplotlib/; revision=6956
1 parent 3793aaa commit 2a9b39d

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2009-02-28 hashing of FontProperties accounts current rcParams - JJL
2+
13
2009-02-28 Prevent double-rendering of shared axis in twinx, twiny - EF
24

35
2009-02-26 Add optional bbox_to_anchor argument for legend class - JJL

lib/matplotlib/font_manager.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -705,10 +705,9 @@ def _parse_fontconfig_pattern(self, pattern):
705705
return parse_fontconfig_pattern(pattern)
706706

707707
def __hash__(self):
708-
l = self.__dict__.items()
709-
l.sort()
708+
l = [(k, getattr(self, "get" + k)()) for k in sorted(self.__dict__)]
710709
return hash(repr(l))
711-
710+
712711
def __str__(self):
713712
return self.get_fontconfig_pattern()
714713

@@ -1181,7 +1180,7 @@ def findfont(self, prop, fontext='ttf'):
11811180
"""
11821181
debug = False
11831182
if prop is None:
1184-
return self.defaultFont
1183+
prop = FontProperties()
11851184
if is_string_like(prop):
11861185
prop = FontProperties(prop)
11871186
fname = prop.get_file()

0 commit comments

Comments
 (0)