I wonder if it is possible to just load a font from user's system resources, e.g Arial - right now, I have to copy the .ttf file into my program's directory; otherwise, the font won't load. I tried to find functions allowing this behaviour in official documentation of Allegro5, but with no success. Am I not understanding something, or do I have to distribute my program along with the font file? Below I include code line I use for loading the font, if it is of any help:
font=al_load_font("arial.ttf",24,0);
Remember that Allegro is a cross-platform library, and there is no cross-platform way to access system fonts.
An option you can use is to #include the allegro windows (maybe its winalleg.h
) header and then access that functionality (Windows API calls) to provide system fonts to the program. But that would limit your portability.
Additionaly, you can acces fonts from a hardcoded path, such as c:/windows/fonts/
the system fonts but there are some problems with that:
Allegro wa not designed to load fonts from a common font repo. It expects everything to be where you tell it and nowhere else. Go and do it on a platform-case basis.