al_load_font with PhysFS
Steve Silva

In my current project, im using Allegro5 and PhysFS, and so, im calling al_set_physfs_file_interface() in order to make all subsequent calls to al_fopen() on the calling thread to be handled by PHYSFS_open(). Well at this point, everything is working fine, I can load bitmaps from a zip file, i can even load samples from a zip file... BUT... the ONLY THING thats not working is loading fonts... After calling al_set_physfs_file_interface(), al_load_font() fails no matter if you try to load the font file from a zip file or even from the disk... Any clues on how to solve it?

Edgar Reynaldo

Please state which versions of allegro, compiler, and OS you are using. If you're using binaries, where did you get them from?

There was an old bug in zlib that was fixed when 3.0.0 came out. You may have caught it. It would cause ttf fonts to fail to load from inside an archive. Solution was to upgrade.

Steve Silva

allegro 5.0.10 mingw 4.7.0 got from
PhysicsFS 3.0.1 got from

OS: Windows 10 Pro
Compiler: CodeBlocks 17.12 (GNU GCC Compiler)

BTW: Heres an example code where you can test what im saying:

#include <D:\CodeBlocks\MinGW\include\physfs\physfs.h>
#include <allegro5/allegro.h>
#include <allegro5/allegro_primitives.h>
#include <allegro5/allegro_font.h>
#include <allegro5/allegro_ttf.h>
#include <allegro5/allegro_physfs.h>

int main() {
ALLEGRO_DISPLAY *display=al_create_display(100,50);
if(0) {
//Enable this block for the "not working" version
else {
return 0;


Can you load bitmap fonts?

Edit: probably irrelevant now that I've seen your code. If you're using PhysFS, you might have to use al_load_ttf_font_f instead:

ALLEGRO_FILE* f = al_fopen("Arial.ttf", "r");
ALLEGRO_FONT* arial = al_load_ttf_font_f(f, "Arial.ttf", 12, NULL);

Steve Silva

TY verymuch for the fast and friendly help, i really apreciated it, since ppl from coding forums are used to be rude with new users... BUT yesterday i just tried to download the allegro5 AGAIN, in hope they have a new version... Well, looking for the file contents, dll versions, it seems to be the same version as mine, so I even just not tested anything after it... BUT for now, when I was trying to make a better code to show you about the bugs, the font just loaded fine even using the PhysFS and al_set_physfs_file_interface()... Maybe they just fixed it but not changed the version? IDK... I just know that its working fine for now, just using al_load_ttf_font() instead of al_load_ttf_font_f() as you said to do... Anyways, ty again for the help =))))

Edgar Reynaldo

With binaries that old, zlib 3 hadn't even come out yet. :/

Please do yourself a favor and download either my binaries or SiegeLords (if you prefer MSYS2).

Find them here :

And links to SiegeLord's here :

Please don't download binaries from files page unless you know exactly what you are doing. Those files are 5 years old. :P

The font bug not loading from an archive was fixed with versions of zlib greater than 3.

Steve Silva

Ty mate, i'll check it out later =)

Doctor Cop

Edgar : I have observed that most of the new comers to Allegro 5 use 5.0.10 and this was the version I used when I started.

Its may be because the two famous YouTube channels which teach allegro 5 are using 5.0.10. Prior to Allegro I didn't know that it was possible to do so much in C/C++, it was a common misconception among freshers that it's just a terminal oriented language and when I told my friends that it's possible to do much more with Allegro 5 they were overjoyed and started learning. We all started with 5.0.10 because of video tutorials, and they are still using 5.0.10 because it works just fine and there are no video tutorials teaching you how actually this static and dynamic linking works. If someone make a post or article on on how to configure newer versions of Allegro with how to link it statically and dynamically then it will be very good. When I was a total beginner I was unable to link the new version to my project so I used 5.0.10. It will be really nice of you if you can do it. I don't know how to post an article on so...


I think it's probably because this page lists it as the latest version.

Doctor Cop

sthompson : hmm, I think whether someone goes to page or YouTube the result is going to be same. the person is led to believe that 5.0.10 is the latest version.

I think those YouTube channels also thought that it's latest version and they used it in their channels.

I will ask my friend to make a tutorial on installation of Allegro 5.2.4 on Code Blocks. He has a YouTube channel he posts videos on.


Yes please - anything new would be good :P

Edgar Reynaldo
Doctor Cop

Thanks Edgar for the links.
what does




Read The Fucking Manual. >:(

Doctor Cop

then why the '?' sign at the end of "rtfm" ?

Edgar Reynaldo

Read The Fine Manual...

The information is all out there, just no one takes the time to read it. :/

Granted, most people who start using allegro are complete newbs who don't know how to compile or link a program much less a library. is not nor is it the wiki. All the outdated content gets a little old sometimes.

So when I say rtfm? I'm asking a question. Have you read the manual?
Not you in particular Doctor Cop, you've been a very solid learner and I like your attitude. So don't take offense. It wasn't so much directed towards you as the people who are too lazy to read.


Edgar is such a good soul.

Thread #617703. Printed from