• entries
    743
  • comments
    1924
  • views
    579576

Fun with fonts

Sign in to follow this  
Aardvajk

121 views

After Trapper Zoid's handy link to Aenigma Fonts recently, I've decided to try to implement a font engine in the new game before attempting anything else. Seems like the kind of feature it would be easier to add in at the start than at the end.

Well, actually I'm trying to add font support to my D3D wrapper library rather than the game itself, but same difference. I reckon font support would be really handy for in-game debugging as well as a game feature and I can't quite face the game writing bits at the moment, so at least it's got me programming again.

I've just spent far too long cutting all the individual letters and numbers out of the alphabet into seperate bitmaps and now need to write a little command line tool to convert them into some kind of font file I can use.

I'm thinking the letters, which I currently have as shades of red on black to be used as the alpha, over solid white squares, can be stored in the same simple format as my sprites and I have some code to assist that bit.

I'm thinking about prefixing the file with 256 bytes, all of which are set to -1 or something except those whose ASCII values correspond with characters provided by the font file. Those will contain the index in the image array of the letter image.

That will mean that the font engine could be queried to see if it supports letters at run time, any non-supported letters can be drawn as a solid rectangle or something and the font files can be replaced at whim and not need to change the code. I'm hoping it will be a flexible enough format that once it is written, it will work for any of my D3D apps in the future. We shall see.

Aenigma Fonts is an amazing resource that I highly recommend. Trapper Zoid said he's confirmed with the guy that we can all use his fonts in freeware games and there is a stunning collection of work on his site - stunning both in quality and the sheer number of fonts he's created and made available.

It's always nice to find someone on the web really passionate about their particular niche of choice and making such great resources available for free. Anyone looking for some original font artwork would be well advised to go and take a look.

For clarity, same applies here in relation to D3DXFont as applied to D3DXSprite when I decided to roll out my own sprite framework. I'm not trying to compete with the existing framework provided by d3dx. I just want to implement it myself to gain a better understanding of what is involved, and because I find it very satisfying.
Sign in to follow this  


2 Comments


Recommended Comments

Ughhh, I hate writing bitmap font stuff. Or any font stuff, for that matter. Its one of those things which, for me, the bare minimum almost always suffices.

*shudder*

It makes me wonder how people actually sit down and write extravagent parsers and stuff which allow one to render crazy well-formatted strings to the screen with ease. :(

Share this comment


Link to comment
I prefer to write my own systems as they're extendable, more flexible, and I understand them better. They're usually a bit slower, but I can deal with that.

Quote:
Original post by Mushu
Ughhh, I hate writing bitmap font stuff. Or any font stuff, for that matter. Its one of those things which, for me, the bare minimum almost always suffices.

*shudder*

It makes me wonder how people actually sit down and write extravagent parsers and stuff which allow one to render crazy well-formatted strings to the screen with ease. :(


My bitmap font system took less than 4 hours to write. Though, I guess it doesn't support "crazy well-formatted strings", but it supports left, right, center, top, bottom, and v-center alignment as well as color formatting.

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