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

Author Topic: sf::string [1.6] is there a built in way to find height?  (Read 1977 times)

0 Members and 1 Guest are viewing this topic.

alwayslearning

  • Newbie
  • *
  • Posts: 12
    • View Profile
sf::string [1.6] is there a built in way to find height?
« on: April 14, 2010, 01:28:53 am »
What I am looking for is a means to finding the height where it includes the tail parts of symbols like q,p,g, etc.  The only way I can see doing that is to push all possible symbols onto the string and getting it from the rect.  Which doesn't sound like the right way to go about it.

Is there a simpler way?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sf::string [1.6] is there a built in way to find height?
« Reply #1 on: April 14, 2010, 08:34:42 am »
Hi

You can call Font::GetGlyph and then use the Rectangle member of the glyph to get its bounding rect.
Laurent Gomila - SFML developer

alwayslearning

  • Newbie
  • *
  • Posts: 12
    • View Profile
sf::string [1.6] is there a built in way to find height?
« Reply #2 on: April 14, 2010, 09:06:27 pm »
Ok, so this is the design, let me know if an improvement can be made:

//Iterate 1 -> 255
   // find the glyph with greatest height

//= Get String Size / Font CharacterSize * glyph height

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sf::string [1.6] is there a built in way to find height?
« Reply #3 on: April 14, 2010, 10:13:42 pm »
Looks good :)
Laurent Gomila - SFML developer

 

anything