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

Author Topic: Drawed sfString too small  (Read 1095 times)

0 Members and 1 Guest are viewing this topic.

evilgoto

  • Newbie
  • *
  • Posts: 2
    • View Profile
Drawed sfString too small
« on: December 18, 2011, 06:08:13 pm »
Hey,

I have a sfString with a size of 13px. I try to get the string's height via

Code: [Select]
string_h = rect.Bottom - rect.Top;
The result is - as the string's size - 13px.

Now, I draw the string via sfRenderWindow_DrawString() and take a screenshot of the running application; if I zoom in the screenshot via gimp, there is no char higher than 10px.

How can I get a string that is really 13px tall instead of 10px?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Drawed sfString too small
« Reply #1 on: December 18, 2011, 06:09:54 pm »
The character size (13 px) is the size of the tallest possible character. It doesn't mean that all your characters will be 13 px high. It wouldn't make sense ;)
Laurent Gomila - SFML developer

evilgoto

  • Newbie
  • *
  • Posts: 2
    • View Profile
Drawed sfString too small
« Reply #2 on: December 18, 2011, 09:06:35 pm »
Well, okay, sure. But is there any way to get the height of the tallest character in the string instead of the tallest possible?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Drawed sfString too small
« Reply #3 on: December 18, 2011, 10:33:23 pm »
Not directly. But if you use SFML 2, you can iterate on the glyphs (with sf::Font::GetGlyph) and compute the size yourself.
Laurent Gomila - SFML developer