Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

up vote 11 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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