SFML community forums

Help => Graphics => Topic started by: frmaurer99@gmail.com on June 03, 2023, 09:02:03 pm

Title: Text.getLocalBounds() returns strange coordinates
Post by: frmaurer99@gmail.com on June 03, 2023, 09:02:03 pm
I have a Text object. I have the string, the font and the size set. When I call getLocalBounds() on this object it returns a rect with the following values:
left = 0.0, top = 5.0, width = 48.8 and height = 6.0

I expected both left and top to be 0.0.
Why is the top not 0?
Thanks
Title: Re: Text.getLocalBounds() returns strange coordinates
Post by: fallahn on June 04, 2023, 12:18:45 pm
Basically because taller characters can extend outside the bounding box. There's more info in this topic (and the topic it links): https://en.sfml-dev.org/forums/index.php?topic=27711.msg174750#msg174750