Skip to content

Invalidate font manager when rcParam family lists change. #3077

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 22, 2014
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Modest performance improvement.
  • Loading branch information
mdboom committed May 19, 2014
commit 0f25c750136c8e1d620294d98ba2010a21f350c5
10 changes: 4 additions & 6 deletions lib/matplotlib/font_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,19 +963,17 @@ class TempCache(object):
"""
# A list of rcparam names that, when changed, invalidated this
# cache.
invalidating_rcparams = [
invalidating_rcparams = (
'font.serif', 'font.sans-serif', 'font.cursive', 'font.fantasy',
'font.monospace']
'font.monospace')

def __init__(self):
self._lookup_cache = {}
self._last_rcParams = self.make_rcparams_key()

def make_rcparams_key(self):
key = [id(fontManager)]
for param in self.invalidating_rcparams:
key.append(rcParams[param])
return key
return [id(fontManager)] + [
rcParams[param] for param in self.invalidating_rcparams]

def get(self, prop):
key = self.make_rcparams_key()
Expand Down