6
\$\begingroup\$

I have some text in a spritefont and I need to know the height in pixels.

I would have thought that MeasureString() would get me close to it, but it seems to just be about length.

\$\endgroup\$
12
\$\begingroup\$

MeasureString() returns to you a Vector2 where the X is the width and Y is the height of the text.

Also the SpriteFont class has a LineSpacing member that gives you the height of a line, including text and blank space.

http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.graphics.spritefont_members.aspx

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.