-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Remove outdated docstring section in RendererBase.draw_text. #28380
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
Conversation
lib/matplotlib/backend_bases.py
Outdated
@@ -604,6 +590,9 @@ def get_text_width_height_descent(self, s, prop, ismath): | |||
|
|||
Whitespace at the start and the end of *s* is included in the reported width. | |||
""" | |||
# Note: Using the ``bbox`` property of Text objects, backend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unclear how this relates to the context.
What exactly do backend implementors implement? Do they reimplement this function?
Also, how do they check? Do they draw a text and additionally its bbox? Would a minimal example be helpful?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, like most renderer methods get_text_width_height_descent can be reimplemented by third-party backends (or not, depending on how exactly they do their text rendering). Drawing the bbox (via text.set_bbox(...)) lets them check that get_text_width_height_descent indeed returns the right value.
I'm not really sure a full example would be very useful, and even if it is, it would only be useful for rendering backend authors (of which there may be 10 or so right now in the world) so I would not bother. Alternatively we could just completely remove the comment...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO the comment is not useful as is. Either you already know the context and then likely don't need it, or it's too terse and you still don't know how to apply it. I'm fine going either way, removing or expanding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just kill it, then. Amended the commit.
The line of code mentioned in the docstring has been removed since e50ff69, back in 2004...
…ndererBase.draw_text.
…380-on-v3.9.x Backport PR #28380 on branch v3.9.x (Remove outdated docstring section in RendererBase.draw_text.)
The line of code mentioned in the docstring has been removed since e50ff69, back in 2004...
Replace with a comment in the code, closer to the place relevant for metrics calculations.
PR summary
PR checklist