I've just recently started programming a game in Allegro.pas (I chose the Pascal version because Pascal is the only programming language I'm familiar with so far). Right now I'm working on setting up all the mandatory stuff (Allegro initilization, config file etc.). Here I'm have encountered a problem with using a Bitmap Font, which I can't solve. First of all the font itself (created with an Allegro font editor):
The pink part is color 0, the yellow part color 255 and it's saved as 256-color-BMP-image (even though ImageShack seems to automatically convert it to PNG when uploading). At first I tried the "simple" version:
FUNCTION al_load_bitmap_font (filename: STRING; palette: AL_PALETTEptr; p: POINTER): POINTER;
Here I had the problem that I didn't even know what the pointer p is supposed to be. It's not mentioned in the documentation. Additionally it crashed (I just tried to use "nil" for p). Next I tried the method with first loading a bmp and then grabbing a font from it.
FUNCTION al_load_bmp (filename: STRING; palette: AL_PALETTEptr): AL_BITMAPptr; CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'load_bmp';
FUNCTION al_grab_font_from_bitmap (bmp: AL_BITMAPptr): AL_FONTptr; CDECL; EXTERNAL ALLEGRO_SHARED_LIBRARY_NAME NAME 'grab_font_from_bitmap';
Loading the BMP file works just fine. Even displaying it using the al_blit function works as expected. However, whenever my program gets to the grab_font part of my code it crashes, displaying random errors messages I don't understand. I've read the according entries in the documentation over and over again, but I just couldn't find the mistake. Can someone help out? Here are the portions of my code that (I think) matter.
function GameInit :
Game initilization function}
Allegro initilization routines, including al_set_gfx_mode, go here]
ParamStr(0)) + '\bitmap\RPG_Hacker-Font_RMG2000.bmp';
This here is where the crash occures *)
FontRMG2000 := al_grab_font_from_bitmap(
The error says "Project [Projectname].exe raised exception class 'External: SIGSEGV'." This seems to be the default error I get whenever something goes wrong.
Problem solved. Turned out from some color editing in an external program the format of my font changed to a format unreadable by Allegro. Can't really explain this, but oh well. At least it works now!