Share via


using SpriteFont's in XNA

So the quesiton of the day is when creating a SpriteFont to use for displaying text in an XNA app, is there a way to change the size or does a new SpriteFont have to be created for each desired size.

What I'm trying to do is have a single SpriteFont object exposed to all the child windows of a main window manager class, but for some windows I want the text displayed in a smaller size than others.  I suppose what I could do to work around this is to create a generic collection of SpriteFont objects, one for each size that I want available...but I was hoping I didn't have to create multiple objects.

If anyone knows, let me know.  If I figure out a definate answer I'll post an update.  :)

UPDATE:
Well, after I did some asking around...I found that a SpriteFont must be created for each individual size that is disired to be displayed in the game...so I'll have to make the generic collection as I was guessing.  :(  Ah well.  hehehe.

Comments

  • Anonymous
    February 18, 2008
    spriteBatch.DrawString(spriteFont, text, new Vector2(66, 66), Color.Black, 0.0f, new Vector2(0, 0), 0.8f, SpriteEffects.None, 0); There is an overload to spriteBatch.DrawString() which has a scale argument (here 0.8f for shrinking it down).