Bitmap fonts & bitmap font generators (SOLVED)
It's come time for me to revamp my font engine in OpenGL for an upcoming project. I am currently using bitmapped fonts but I really hate them. After a good day or so of screwing with FTGL and a few other half-baked libraries I think I've settled on bitmap fonts again unfortunately. (If I'm missing some great new font library someone please clue me in [smile])
Anyway, I realized that since I switched to Linux, one of the things I haven't done is generate a bitmap font. What cross-platform (preferably, but I'll take linux-only) bitmap font generators are there. The only decent one I had is Windows only, and while I could possibly get it running under Cedega, I'd really like to have a native solution.
EDIT: I ended up writing my own solution, feel free to check it out.
[Edited by - cozman on July 1, 2005 1:37:13 PM]
take a look at TXF fonts for mip-mapped bitmap texture fonts... the page even includes a utility for converting .bdf fonts to .txf fonts. And, since you're running Linux, you probably already have a lot of .bdf fonts on your system.
The code is all straight C and even makes room for older implementations of OpenGL (it only assumes OpenGL v1.0 but uses texture objects if they're in the library you compile with). The code is really understandable and I found it easy to convert to C++ and my own (extended) file format. TXF is my top suggestion. (Even though I don't think his coloring extensions are really that useful (I removed them in my implementation) -- but they're a good example of how you can extend the font library). Oh, and you could also change the rasterization step so that it doesn't do an availability lookup for each character *every_time* the text is drawn.
There is also SDL_ttf (if you want to distribute .ttf fonts with your game, but then you're limited to using copyright-free fonts) and PLib has its own font rendering (but I think it's based off of TXF, anyway). I agree that bitmap fonts are probably a better solution than rasterized fonts, and almost certainly a better solution than 3D (polygonal) fonts... (depends on what you're using the font for). In the end it might be best to just write your own, tailored to how you will be using it.
HTH
The code is all straight C and even makes room for older implementations of OpenGL (it only assumes OpenGL v1.0 but uses texture objects if they're in the library you compile with). The code is really understandable and I found it easy to convert to C++ and my own (extended) file format. TXF is my top suggestion. (Even though I don't think his coloring extensions are really that useful (I removed them in my implementation) -- but they're a good example of how you can extend the font library). Oh, and you could also change the rasterization step so that it doesn't do an availability lookup for each character *every_time* the text is drawn.
There is also SDL_ttf (if you want to distribute .ttf fonts with your game, but then you're limited to using copyright-free fonts) and PLib has its own font rendering (but I think it's based off of TXF, anyway). I agree that bitmap fonts are probably a better solution than rasterized fonts, and almost certainly a better solution than 3D (polygonal) fonts... (depends on what you're using the font for). In the end it might be best to just write your own, tailored to how you will be using it.
HTH
I've recently completed porting my utility, glFont (http://students.cs.byu.edu/~bfish/glfont.php), to wxWidgets, and it is now fully cross-platform. I'm actually open sourcing it very soon. If you're interested, however, I can get you an early copy :-). Just drop me a line at brad.fish@gmail.com.
personally I plan on pulling something together using Freetype 2 (raw, not using a wrappin lib, I did look at some of them but they looked.. insane.. ).
I admit, it took me a couple of days to get things going, but it did give wonderful output (properly positions and kerned text just like Windows makes.. hmmm lovely [wink]), although i need todo some more work on the caching side of things as my solution is a tad.. suboptimial.. to say the least [grin]
Basically, the hardest bit of using FT2 raw is that you have to manage the finer glyth details yourself, however once the stuff is in memory one glsubtex upload later and you have some nice, antialised, fonts.
Example output from my Multi-thread game loop test, and I waffle abit about it in my journal on here.
I admit, it took me a couple of days to get things going, but it did give wonderful output (properly positions and kerned text just like Windows makes.. hmmm lovely [wink]), although i need todo some more work on the caching side of things as my solution is a tad.. suboptimial.. to say the least [grin]
Basically, the hardest bit of using FT2 raw is that you have to manage the finer glyth details yourself, however once the stuff is in memory one glsubtex upload later and you have some nice, antialised, fonts.
Example output from my Multi-thread game loop test, and I waffle abit about it in my journal on here.
Cozman,
While I'm afraid I can't help you with the Linux stuff, I was compelled to say that Ray Smuckles is d'man! :)
While I'm afraid I can't help you with the Linux stuff, I was compelled to say that Ray Smuckles is d'man! :)
thanks for the great replies guys,
One thing that I want from my font system is for it to be usable by people other than me, so I want the fonts to be relatively easy to create. Truetype fonts are the most common, and the nicest since they can be scaled, etc.
I'd looked into txf earlier and of the three options txf is the most obscure and
glFont looks really good, I stumbled upon it earlier in my searches but like the rest noticed it didn't run under Linux, if this post didn't turn up something similar, I was planning on writing something similar in wxPython. I sent you an email, I'd love to give it a try.
something custom using Freetype 2 was my ideal plan, but for the time being isn't practical since I don't have a ton of time to spend on the font system. (Also, as for the wrapper libs being 'insane' I'd have to agree, I'd like to see/make an effort to design a simpler approach to using TTF fonts in OpenGL)
edit: Just saw your post sergeant_x, and I concur although in the future I'd recommend using the Private Message system to let me know you're a fan (to those not in the know he was referencing my avatar)
One thing that I want from my font system is for it to be usable by people other than me, so I want the fonts to be relatively easy to create. Truetype fonts are the most common, and the nicest since they can be scaled, etc.
I'd looked into txf earlier and of the three options txf is the most obscure and
glFont looks really good, I stumbled upon it earlier in my searches but like the rest noticed it didn't run under Linux, if this post didn't turn up something similar, I was planning on writing something similar in wxPython. I sent you an email, I'd love to give it a try.
something custom using Freetype 2 was my ideal plan, but for the time being isn't practical since I don't have a ton of time to spend on the font system. (Also, as for the wrapper libs being 'insane' I'd have to agree, I'd like to see/make an effort to design a simpler approach to using TTF fonts in OpenGL)
edit: Just saw your post sergeant_x, and I concur although in the future I'd recommend using the Private Message system to let me know you're a fan (to those not in the know he was referencing my avatar)
Thanks for sending that strtok, if I end up going with bitmapped fonts it will almost certainly be due to glfont.
I came upon what seems to be a not-so-insane FreeType wrapper library that for some reason wasn't coming up in my earlier searches. OGLFT seems like it might be worth checking out.
I came upon what seems to be a not-so-insane FreeType wrapper library that for some reason wasn't coming up in my earlier searches. OGLFT seems like it might be worth checking out.
AngelCode's bitmap generator is an awesome piece of software, if you have not yet seen it. The bitmap fonts generated come with a description file, which when used correctly, allows you to draw characters with varying sizes making it look more natural.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement