8000 Slightly tighten the _get_layout_cache_key API. by anntzer · Pull Request #21985 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Slightly tighten the _get_layout_cache_key API. #21985

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 1 commit into from
Dec 21, 2021
Merged
Changes from all commits
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
7 changes: 3 additions & 4 deletions lib/matplotlib/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,14 @@ def update_from(self, other):
self._linespacing = other._linespacing
self.stale = True

def _get_layout_cache_key(self, renderer=None):
def _get_layout_cache_key(self, renderer):
"""
Return a hashable tuple of properties that lets `_get_layout` know
whether a previously computed layout can be reused.
"""
x, y = self.get_unitless_position()
renderer = renderer or self._renderer
return (
x, y, self.get_text(), hash(self._fontproperties),
self.get_unitless_position(), self.get_text(),
hash(self._fontproperties),
self._verticalalignment, self._horizontalalignment,
self._linespacing,
self._rotation, self._rotation_mode, self._transform_rotates_text,
Expand Down
0