SFML community forums

Help => Graphics => Topic started by: evilgoto on December 18, 2011, 06:08:13 pm

Title: Drawed sfString too small
Post by: evilgoto 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?
Title: Drawed sfString too small
Post by: Laurent 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 ;)
Title: Drawed sfString too small
Post by: evilgoto 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?
Title: Drawed sfString too small
Post by: Laurent 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.