Jump to content
  • Advertisement
  • entries
  • comments
  • views

Font fun continues

Sign in to follow this  


Still no screenshots. The little console program that compiles the bitmap font files is "finished". I can't really confirm that it is working until I try to load it into the D3D library and output some text.

It has occured to me though that I am probably approaching this the wrong way. I won't be able to scale the fonts except by scaling the quads, which won't give a very good effect I shouldn't think.

I think I need a more dynamic way of generating the fonts by letting Windows draw a font at a specific size onto a texture and generate the images that way. My only concern there though is that it would involve installing a font onto a user's system in order to be able to access it via the normal GDI so that's no good.

Perhaps another option will be to extend my font file format to include the font at various sizes, but then it is going to eat up more texture memory and involve even more clipping bitmaps out of images in Paint Shop.

Perhaps a middle way would be a seperate tool that can generate the font files by using the GDI to draw each font onto a bitmap then generate my font file from that. I'd only need the fonts installed on my system then, and if it worked I could easily generate multiple sized fonts quite easily.

I'm still a bit concerned by the amount of texture memory they would take up, although I'd probably only need one font loaded while the actual game was running and could reload other fonts when entering menu mode and so on.

Perhaps I should just try scaling the single font by resizing the quads before I worry about all that.

Surprisingly complex stuff, all this font gibberish. I'd just use D3DXFont instead, but I assume that requires a font to be installed on a system as well.

Oh well. Just nice to be working on something again after the dry spell I entered when I finished Orc.
Sign in to follow this  


Recommended Comments

At the moment I'm just using scaling for my fonts, but I'm using a large texture for the fonts (currently 1024 x 512, probably a bit on the big side) so most of the time I scale down. Given my game won't be using that many sprites it doesn't matter that much, and with the right effects and a thick font it mightn't matter if your fonts are a bit pixelated from overstretching.

Ideally you could use a font library to generate your own textured fonts, but I like to have the option of using my own handdrawn fonts and it's a bit of a hassle to make your own vector based font files (I don't know a good way to do that).

Share this comment

Link to comment
Do you reckon that as long as I only scale down, the letters will look okay then? I don't mind only having the largest size stored if that is the case. It would be a cool solution.

I'm generating the font bitmaps as solid white squares with the actual letters expressed via the alpha which I hope will make them nice and smooth and will allow for some neat dynamic colouring via the diffuse colours of the quads.

Hope so, anyway [smile].

Share this comment

Link to comment
Original post by EasilyConfused
Do you reckon that as long as I only scale down, the letters will look okay then? I don't mind only having the largest size stored if that is the case. It would be a cool solution.

As long as you don't scale too far down (as in to a few pixels wide) my fonts seem fine to me. I might have set OpenGL to automatically generate mipmaps for the textures which makes shrunken textures render correctly - I'm sure DirectX has a similar functionality. I'd give it a go and try it with a few font sizes and see how it turns out.

Share this comment

Link to comment
Why not venture into the world of TTFs? You can include them with your game to ensure the end-users have the font, and they support virtually any drawing size you'd like (along with bold, italic, etc). Reading said file is another beast, however.. :)

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!