bitmap font (using ttf2pcx) using alpha channel
Eviral Derf

Hello,

Is there a way to draw bitmap font (using ttf2pcx) using alpha channel ?
I know pcx do not handle alpha channel so using a 32 bits tga+alpha or a 256 colors BMP with another grayscale BMP file as alpha channel.

Thanks

Eviral

Steve Terry

The allergo font and text routines are very flexible, so yes you could rewrite your vtables to output alpha channel fonts, however you would have to write your own routines to piggy back on top of the existing ones for backwards compatibility, this means you will (I think) have to write a loader (I'm not sure if PCX stores additional information that TGA may not support). You will also have to override the vtables (this isn't as hard as it seems). Basically make font->data point to your data containing all the loaded alpha glyphs and font->vtable point to your custom vtable for rendering these glyphs, this can all be done in a load_alpha_font function or whatever you wish to call it. If you want any more assistance you can either poke around font.c in the allergro source directory for clues (I think aintern.c/.h also has a few clues on how to do this as well). Hope this helps.

Gnatinator

If you are using OpenGL/AllegroGL you can use my TGA font lib. (Attached)

If not, you could create your own tga font blitter. My code should be simple enough to give you an idea of what to do.

Kirr

If you are making fonts with ttf2pcx, you might try using using ttf font directly in your program. You can get alpha-transparent glyphs with my font lib, like in this example.

Thread #431118. Printed from Allegro.cc