Revision: 6347
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6347&view=rev
Author: mdboom
Date: 2008-10-29 17:15:32 +0000 (Wed, 29 Oct 2008)
Log Message:
-----------
Fix caching of findfont results.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/font_manager.py
Modified: trunk/matplotlib/lib/matplotlib/font_manager.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/font_manager.py 2008-10-29 16:43:05 UTC
(rev 6346)
+++ trunk/matplotlib/lib/matplotlib/font_manager.py 2008-10-29 17:15:32 UTC
(rev 6347)
@@ -705,7 +705,9 @@
return parse_fontconfig_pattern(pattern)
def __hash__(self):
- return hash(repr(self.__dict__))
+ l = self.__dict__.items()
+ l.sort()
+ return hash(repr(l))
def __str__(self):
return self.get_fontconfig_pattern()
@@ -1192,7 +1194,7 @@
font_cache = self.ttf_lookup_cache
fontlist = self.ttflist
- cached = font_cache.get(prop)
+ cached = font_cache.get(hash(prop))
if cached:
return cached
@@ -1223,7 +1225,7 @@
(prop, best_font.name, best_font.fname, best_score))
result = best_font.fname
- font_cache[prop] = result
+ font_cache[hash(prop)] = result
return result
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins