Adventures in Font Engineering

Started by
4 comments, last by owl 19 years, 8 months ago
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.
__________________________We're all Dumb And Jaded
Advertisement
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 :]
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
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...
__________________________We're all Dumb And Jaded
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.
damn. Last post is mine.
[size="2"]I like the Walrus best.

This topic is closed to new replies.

Advertisement