Sign in to follow this  
A_Primetime_Fool

Adventures in Font Engineering

Recommended Posts

Enough about sprite movement... I'm about to add a font engine to my 2D engine. I'd like to load any TrueType font into a game, but looking into some of the TrueType files, I can see some complications I didn't initially see. I was thinking of just going through the file like a bitmap and parsing out each letter. I was assuming that each letter is spaced evenly, or at least has its own seperate block I could copy. But with different fonts you've got little inconsistancies, such as the lowercase j hanging under the i in most fonts, or italic letters having no easily defined boundaries. Also the fonts given in these files are very small. There's plenty of ways to get around these issues with some messy parsing and scaling, I'm sure, but something is telling me that I'm missing something fundamental in the way that Windows works with fonts. There just seems like there should be a much easier way to get a reasonably sized font with letters very clearly separated from which I could load all of my individual letter surfaces. Thanks in advance for any input.

Share this post


Link to post
Share on other sites
Heh, use D3DXFont, it will save you many exceptionally LARGE headaches, and only give you a few tiny ones in return.

My font code is perhaps 20 lines of my current 2D engine.

If you're using GDI, there's a similar interface. If you're using OGL, I've no clue :]

Share this post


Link to post
Share on other sites
I use freetype.
Also, if you go to NeHe's site, there's a program in the downloads section called Bitmap Font Builder which I used when I was using 2d SDL.

http://www.freetype.org/
http://nehe.gamedev.net/data/downloads/download.asp?letter=B

Share this post


Link to post
Share on other sites
Thanks. I suppose some headaches aren't worth it, no matter how ambitious you're feeling. And it definitely seemed like this task would've been a migraine, heh.

Anyway, I'm still open to any other suggestions or tools if anyone has anything else to add...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by RolandofGilead
I use freetype.
Also, if you go to NeHe's site, there's a program in the downloads section called Bitmap Font Builder which I used when I was using 2d SDL.

http://www.freetype.org/
http://nehe.gamedev.net/data/downloads/download.asp?letter=B


This is the answer to your problem.

Share this post


Link to post
Share on other sites

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

Sign in to follow this