Suppose the SpriteFont you are using is called x.spritefont. Follow these steps to create a new SpriteFont for each size.
- Open the x.spritefont file from Solution Explorer.
- Scroll to the tag and edit it to the desired size.
- To make a large font, duplicate the file and change accordingly. Rename files with added size, finally, for easy memorization.
Now create some instances of SpriteFont and load them accordingly.
SpriteFont sf_s10; SpriteFont sf_s14; protected override void LoadContent() { sf_s10 = Content.Load<SpriteFont>("x_10"); sf_s14 = Content.Load<SpriteFont>("x_14");
To dynamically change fontSize follow these steps:
SpriteFont current_font; protected override void Update(GameTime gameTime) { if() current_font=sf_s10; if() current_font=sf_s14; }
source share