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.

How do I make spritefonts not blurry when I make them bigger? I have searched Google and haven't found any useful answer.

share|improve this question
    
Sample the texture with TextureFilter.Point, this will make the texture pixelated, not blurry. –  Byte56 Nov 10 '12 at 15:35
add comment

3 Answers

The problem with resizing spritefonts is that when you make the spritefont, a file is made with an image of the font at the size you specify in the xml file. Because of this, you are not going to get the scalability of vector fonts, meaning that when you make your fonts bigger they will be blurry. The only way around this is to create several sprite fonts of varying sizes that you can switch between when the quality starts to get too bad. Alternatively you can check out the Nuclex Framework which has support for vector fonts.

share|improve this answer
add comment

Bitmap fonts can be rendered less blurry by using bilinear filtering to sample the texture with alpha testing. In shaders alpha testing means that discarding any fragments where the alpha value is less than some constant, e.g 0.5.

See for example the middle image in the first page of this paper. With distance fields you could get even better looking results, but that requires different bitmap font data. With alpha testing you can already improve the rendering of normal bitmap fonts considerably.

share|improve this answer
add comment

If you want to make a single font bigger, just double click it on the Solution explorer search for

<Size>14</Size>

and change 14 for a bigger number such:

<Size>32</Size>

If you want to have multiple size fonts, you can follow ssb answer and use Nuclex. Another option, is making the font pretty large (72 pt seems a good size, you probably won't go bigger than this) and then just scaling down when you need smaller fonts. Never scaling up.

The trick here is that the loss when you scale down is more negligible that when you scale up. Still it's just a bitmap, and the quality won't be the best, but surely get the job done.

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.