Font sizes with bitmap fonts?

So using any of the many available tutorials on bitmap fonts, I can't find one that allows you to specify font size. The only way I can think to do it would be using scaling, but I've tried and the fonts look HORRIBLE. So if I want muliple sized fonts, is my only option to create a texture for each font size


Answer this question

Font sizes with bitmap fonts?

  • SCHRANK

    yes, for the most part. You might consider creating an enumerated collection of polygonal forms, but they won't read well at smaller sizes, will show triangulation unless the mesh is sorta dense, and depending on the number of polys, end up becoming just more geometry to render, and you almost always want to spend your poly budget on actual gameplay assets. A heavier duty solution such as rasterizing vector data in realtime is certainly possible, but is CPU intensive and I have never seen such efforts look better than a texture page.

  • MattGsy

    I generate 1024x1024, or 2048x2048, containing the characters I want to use out of the font. This means the characters are 64x64 or 128x128 in size. I make sure to generate MIP maps, and to turn on anisotropic filtering. These fonts scale pretty well from about 12 pixels tall to 200 pixels tall. If you have specific text that needs to be bigger than that, it's probably a known text (like "Game Over") which you can create in a special texture.

    On Windows, I prefer using GDI for rendering anti-aliased text into an offscreen surface, and updating that to the texture, for each line or word being drawn. However, on X-box, there appears to be no such luxury, so I go with the bitmap font on both targets.



  • Jasper22

    That's pretty much how bitmap fonts work. The best one I've seen so far is XNA Extras

    http://blogs.msdn.com/garykac/articles/749188.aspx

    You probably should know before your game gets released what size fonts you really need, and all you do is pre-generate the textures before hand. At worst, you could generate a texture from a windows font at run time if you really wanted to let the user choose any font and size on their system, but I imagine there'd be a pause or two while it generates...


  • Font sizes with bitmap fonts?