text won't render in iOS build

Hi everyone,

I'm not very experienced and am trying to build a very simple app with some text scrolling around. I've managed to get the thing working quite well in the OSX build, but if I try to compile the same code for iOS, no text is rendered.

the following (just a hello world) compiles and runs (in the xcode iOS simulator) but does not render text, just colors the background:

#include <allegro5/allegro.h>
#include <allegro5/allegro_color.h>
#include <allegro5/allegro_font.h>
#include <allegro5/allegro_ttf.h>
int main(void) {

ALLEGRO_DISPLAY* display = al_create_display(640, 480);
ALLEGRO_FONT* font = al_load_font("/Library/Fonts/Futura.ttc", 40, NULL);

al_draw_text(font, al_color_html("#EFEFEF"), 320, 200, ALLEGRO_ALIGN_CENTRE, "LOOK AT THIS!");

return 0;

if I build and run my original program (that's working fine on OSX) in the Xcode simulator it crashes and returns:

objc[11885]: Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x120b516f0) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x1206dfcc0). One of the two will be used. Which one is undefined.
testiramo8 was compiled with optimization - stepping may behave oddly; variables may not be available.

Is there something obvious I'm missing so that it wont even render text in the hello world one? I can provide the code for the program I'm working on, but it's basically just rendering scrolling text.

Thank you very much


My guess is that the font isn't loading. Could you try commenting out the font related code and seeing if it at least displays the background? You can also use al_create_builtin_font instead of the TTF font to test with.


Thank you very much! using the built-in font both the hello world one and my original program work well on the simulator.

How should I go about finding out why normal fonts won't load? I presume some of the libraries I've linked in the iOS build project in Xcode aren't the right ones. I've had a lot of problems setting up the freetype libraries and I've been getting the following compiler errors with the freetype 2.8 ones:

dyld: Library not loaded: /usr/local/opt/freetype/lib/libfreetype.6.dylib
Referenced from: /Users/shpar/Library/Developer/CoreSimulator/Devices/0B463CAD-39D9-4453-BFFE-189DEDD59541/data/Containers/Bundle/Application/E52BBCFB-D01D-47E3-9DAC-BFAF27B3FF61/testiramo8.app/testiramo8
Reason: no suitable image found. Did find:
/usr/local/opt/freetype/lib/libfreetype.6.dylib: mach-o, but not built for iOS simulator

The linker gives the following: ld: warning: URGENT: building for iOS simulator, but linking against dylib (/usr/local/lib/libfreetype.dylib) built for OSX. Note: This will be an error in the future.

when using the old library from here (https://github.com/cdave1/freetype2-ios), it compiles but the ttf fonts won't render...

sorry, as I've said, amateur working on a hobby project


There's two common failures when loading this in Allegro: the file isn't there or there's problem with the format. Assuming you got a functioning freetype (which appears to be the case if you're linking things right), the issue must be the file location. For iOS you basically always bundle your data inside your... bundle. You add an file copying build step and then just load your files using a relative path. There's probably a tutorial for this part somewhere.

You can check whether or not the actual file is there by doing al_fopen("your_file", "r"). If that returns NULL, then your problem is not TTF specific.

Almost certainly loading from /Library won't work though.

Thread #616955. Printed from Allegro.cc