Skip to content

Conversation

@radarhere
Copy link
Member

@radarhere radarhere commented Feb 17, 2024

Resolves #7802

The user in the issue thinks that the documentation could use further detail about the transition from font.getsize() to font.getbbox().

I've amended the deprecations and release notes documentation with the following

Previously, the size methods returned a height that included the vertical offset of the text, while the new bbox methods explicitly distinguish this as a top offset.

While here, I also noticed that some of the example code didn't use the font declared earlier, so I've fixed that.

Copy link

@stweil stweil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's better, thank you!

offset.

.. image:: ./example/size_vs_bbox.png
:alt: Demonstration of size height vs bbox top and bottom
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than saying what the image is, could you describe what the image conveys?

Imagine it read aloud to you when you can't see the image.

https://accessibility.huit.harvard.edu/describe-content-images

Copy link
Member Author

@radarhere radarhere Feb 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pushed a commit.

In bbox methods, top measures the vertical distance above the text, while bottom measures that plus the vertical distance of the text itself. In size methods, height also measures the vertical distance above the text plus the vertical distance of the text itself.

I don't really like it, but it was a struggle to explain the meaning of 'height', 'top' and 'bottom' without using those words in the definitions of those terms themselves.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! It can be a challenge to write good alt text.

I read it through and understood the difference without looking at the image. 👍

Copy link
Contributor

@nulano nulano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created radarhere#23 to also show how anchors can be used to align text, which I have seen to be a common source of confusion with this change.

I originally wanted to write this back when these functions were being deprecated, but I didn't have time to get to it then and forgot to get back to it until now.

radarhere and others added 3 commits February 20, 2024 21:37
Co-authored-by: Ondrej Baranovič <[email protected]>
Show how to use anchors to align text in ImageFont deprecations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Misleading deprecations documentation for getsize

4 participants