PDA

View Full Version : Plataform Independent Text raster



OldMan
01-14-2003, 06:03 AM
Does anyone knows a free toolkit, or lib to draw text (with different fonts and sizes) that is Independent of plataform (ie. no X or win GL extensions needed to load fonts to textures)?

It is going to be very boring to make thousands of textures .. one for each character of each font I wanna use.

Korval
01-14-2003, 08:25 AM
It is going to be very boring to make thousands of textures .. one for each character of each font I wanna use.

You're smarter than that. You're a programmer. That means you solve the problem via a program. Just draw out the characters onto an image (in your OS of choice) and save that image. Instant font.

As far as a library for drawing text, I was working on one for a little while (it assumes nothing at all about the output device; it doesn't even assume OpenGL or anything of that nature). But, I got sidetracked due to loss of interest.

jwatte
01-14-2003, 09:43 AM
FreeType is platform independent. It'll let you draw TrueType fonts into a bitmap, which you can upload as a texture. I think there's already a wrapper for it, too (FTGL, perhaps?)

I would, however, recommend using the platform-dependent font rendering API and render the entire text you want to display into a texture, which you upload to display on a single quad, rather than using a zillion little quads. I find that you usually get better looks, better kerning, and better performance (as long as the text doesn't change every frame, at least).

OldMan
01-14-2003, 12:22 PM
I really cant use any plataform dependent code.. that is the main target of the project.

I can make it work easily but only in monospaced fonts (like courrier) so that I can use texture coordinates to get a specific char form a large texture. But I cant think how to do it with non monospaced fonts (when I dont know how many pixeles to advance between chars)

OneSadCookie
01-14-2003, 12:31 PM
http://homepages.paradise.net.nz/henryj/code/index.html#FTGL

OldMan
01-14-2003, 12:44 PM
Will give a try. I just wonder.. this problem cannot be so uncommon... should be lots of solutions for it.

Thanks in advance.