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.
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.
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).
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)