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

Author Topic: Text height  (Read 4454 times)

0 Members and 1 Guest are viewing this topic.

Mina66

  • Newbie
  • *
  • Posts: 29
    • View Profile
    • Email
Text height
« on: October 22, 2014, 11:24:02 am »
How to measure the height of a pin

« Last Edit: October 22, 2014, 12:28:17 pm by Mina66 »

Raincode

  • Full Member
  • ***
  • Posts: 118
    • View Profile
Re: Text height
« Reply #1 on: October 22, 2014, 03:08:39 pm »
Is this supposed to be a question, a tutorial, ... ?
Can you be more specific?

EDIT: My suggested solution doesn't work. The above still applies though imho.

If you want the height of an sf::Text Object simply call sf::Text::getLocalBounds().height.
« Last Edit: October 22, 2014, 06:07:57 pm by Raincode »

Mina66

  • Newbie
  • *
  • Posts: 29
    • View Profile
    • Email
Re: Text height
« Reply #2 on: October 22, 2014, 04:07:35 pm »
If you want the height of an sf::Text Object simply call sf::Text::getLocalBounds().height.

No. It will be up to the base line.


wintertime

  • Sr. Member
  • ****
  • Posts: 255
    • View Profile
Re: Text height
« Reply #3 on: October 22, 2014, 05:01:48 pm »
If you want the maximum height independent of the actual text string it should be same as getCharacterSize/setCharacterSize.

Mina66

  • Newbie
  • *
  • Posts: 29
    • View Profile
    • Email
Re: Text height
« Reply #4 on: October 23, 2014, 02:43:10 am »
If you want the maximum height independent of the actual text string it should be same as getCharacterSize/setCharacterSize.

If you want the height of an sf::Text Object simply call sf::Text::getLocalBounds().height.

No. It will be up to the base line.



Mina66

  • Newbie
  • *
  • Posts: 29
    • View Profile
    • Email
Re: Text height
« Reply #5 on: October 23, 2014, 03:07:07 am »
Maybe it will be clearer
I need to define a yellow question (??)


Gambit

  • Sr. Member
  • ****
  • Posts: 283
    • View Profile
Re: Text height
« Reply #6 on: October 23, 2014, 09:00:32 am »
You could use getGlobalBounds().height.

wintertime

  • Sr. Member
  • ****
  • Posts: 255
    • View Profile
Re: Text height
« Reply #7 on: October 24, 2014, 12:39:56 pm »
getLocalBounds can be different depending on the text string. If you actually had a "p" in the string it should reach further down to include the bar-part reaching below the o-part. getGlobalBounds is the same, just transformed into a global coordinate system.
getCharactersize should be the maximum allowed height that cant be drawn outside of when using any character, including "ÂÖgq|".

 

anything