Font fun continues

Published December 08, 2006
Advertisement
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.
Previous Entry Fun with fonts
0 likes 4 comments

Comments

Trapper Zoid
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).
December 08, 2006 03:10 AM
Aardvajk
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].
December 08, 2006 03:35 AM
Trapper Zoid
Quote: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.
December 08, 2006 04:42 AM
HopeDagger
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.. :)
December 08, 2006 09:04 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement