Revision: 8315 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8315&view=rev Author: mdboom Date: 2010-05-12 17:58:17 +0000 (Wed, 12 May 2010)
Log Message: ----------- Minor improvement to font_manager -- don't cache directory-specific 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 2010-05-12 15:28:12 UTC (rev 8314) +++ trunk/matplotlib/lib/matplotlib/font_manager.py 2010-05-12 17:58:17 UTC (rev 8315) @@ -1193,10 +1193,7 @@ <http://www.w3.org/TR/1998/REC-CSS2-19980512/>`_ documentation for a description of the font finding algorithm. """ - debug = False - if prop is None: - prop = FontProperties() - if is_string_like(prop): + if not isinstance(prop, FontProperties): prop = FontProperties(prop) fname = prop.get_file() if fname is not None: @@ -1210,9 +1207,10 @@ font_cache = self.ttf_lookup_cache fontlist = self.ttflist - cached = font_cache.get(hash(prop)) - if cached: - return cached + if directory is None: + cached = font_cache.get(hash(prop)) + if cached: + return cached best_score = 1e64 best_font = None @@ -1258,7 +1256,8 @@ (prop, best_font.name, best_font.fname, best_score)) result = best_font.fname - font_cache[hash(prop)] = result + if directory is None: + 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. ------------------------------------------------------------------------------ _______________________________________________ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins