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

Author Topic: how i can extract the size of sf::Text?  (Read 2138 times)

0 Members and 1 Guest are viewing this topic.

exafi

  • Newbie
  • *
  • Posts: 41
    • View Profile
how i can extract the size of sf::Text?
« on: March 27, 2013, 10:40:40 pm »
how i can extract the size of sf::Text?
i think maybe i can extract the size with sf:Glyph but is hard :) i dont know use that.
I need it size for create a sf::RenderTexture.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: how i can extract the size of sf::Text?
« Reply #1 on: March 27, 2013, 10:41:53 pm »
From the width and height members of sf::Text::getGlobalBounds().
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

exafi

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: how i can extract the size of sf::Text?
« Reply #2 on: March 27, 2013, 11:03:39 pm »
From the width and height members of sf::Text::getGlobalBounds().
Thank You.
Right now i am testing that.

wjomlex

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: how i can extract the size of sf::Text?
« Reply #3 on: April 05, 2013, 03:59:56 am »
I see that when you use getGlobalBounds(), or getLocalBounds(), the bounding box is too far up and to the left compared to the text. How do you fix that without hardcoding?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: