al_load_bitmap
CodeStepper

Hello everyone.

How to create bitmap with font for allegro?
I tried FontEditor (from here), but it displays black box instead of characters. FontBuilder export image with description (xml)... I tried even Bitmap Font Generator (.fnt... ARGH...), and Irrlicht Font Maker (draw dots in bitmap)...
I know that I can load TTF/OTF..., but I'm interested in bitmap fonts.

Thanks in advance.

beoran

You need to link and initialize the font addon, then use al_grab_font_from_bitmap()
to load a bitmap to a font. Look at the documentation of this function to learn about the required format.

CodeStepper

Hmm... I know...
I mean... not how to LOAD. I mean how to CREATE/PREPARE bitmap. For example with selected ttf/otf font.

beoran

You could make the font bitmap with any image editor or image tool you like, as long as the format is correct. Basically, the background (transparent) color is at the top left hand corner ((0,0) coordinates) of the bitmap, and every glyph needs a rectangular border of that color around it. Look at this thread for a few example bitmap fonts that can be used together with Allegro:

https://www.allegro.cc/forums/thread/610576

CodeStepper

Thanks, that's what I mean!
:)

Thread #615689. Printed from Allegro.cc