Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Allegro unable to load font

This thread is locked; no one can reply to it. rss feed Print
Allegro unable to load font
Bob Keane
Member #7,342
June 2006

I am following the tutorials for allegro 5 and running into a problem. I copied this code from the guide, downloaded the font from the page and copied it to the folder with the executable per the page. When I run the program, I get the error the font could not be loaded. I assumed the download may have been corrupted so I googled and downloaded the font from the web and tried again. Still no luck. I tried using one of the fonts from my distro and it did not work. I checked the forums, and this thread suggests I may have a buggy version of allegro so I removed and reinstalled Allegro through package manager. Still no luck. Any ideas

By reading this sig, I, the reader, agree to render my soul to Bob Keane. I, the reader, understand this is a legally binding contract and freely render my soul.
"Love thy neighbor as much as you love yourself means be nice to the people next door. Everyone else can go to hell. Missy Cooper.
The advantage to learning something on your own is that there is no one there to tell you something can't be done.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

See Current Working Directory.

You have to run the exe from the folder where it is located. CB will run it from a different directory, depending on whether or not you've changed your project structure.

To fix this permanently, and to offer a more flexible solution, you can change the current working directory yourself using allegro 5 :

ALLEGRO_PATH* p = al_get_standard_path(ALLEGRO_RESOURCES_PATH);
al_change_directory(al_path_cstr(p , ALLEGRO_NATIVE_PATH_SEP));
al_destroy_path(p);
p = 0;

Bob Keane
Member #7,342
June 2006

Always something simple. Thanks.

Someone may want to take a look at the tutorial, this is what I get:

{"name":"611896","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/5\/e5ea9d6646c847bb06e84e0f39672f54.png","w":1366,"h":768,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/5\/e5ea9d6646c847bb06e84e0f39672f54"}611896

By reading this sig, I, the reader, agree to render my soul to Bob Keane. I, the reader, understand this is a legally binding contract and freely render my soul.
"Love thy neighbor as much as you love yourself means be nice to the people next door. Everyone else can go to hell. Missy Cooper.
The advantage to learning something on your own is that there is no one there to tell you something can't be done.

Go to: