SFML community forums
Help => Graphics => Topic started 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
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?
-
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 ;)
-
Well, okay, sure. But is there any way to get the height of the tallest character in the string instead of the tallest possible?
-
Not directly. But if you use SFML 2, you can iterate on the glyphs (with sf::Font::GetGlyph) and compute the size yourself.