Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Text.getLocalBounds() returns strange coordinates  (Read 1275 times)

0 Members and 1 Guest are viewing this topic.

frmaurer99@gmail.com

  • Newbie
  • *
  • Posts: 1
    • View Profile
Text.getLocalBounds() returns strange coordinates
« 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

fallahn

  • Hero Member
  • *****
  • Posts: 507
  • Buns.
    • View Profile
    • Trederia
Re: Text.getLocalBounds() returns strange coordinates
« Reply #1 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