Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Allegro git: freetype error loading ttg fonts after android build changes

This thread is locked; no one can reply to it. rss feed Print
Allegro git: freetype error loading ttg fonts after android build changes
Pho75_
Member #12,377
November 2010

After the latest change to the android build configuration,
allegro won't load TTF fonts for me. al_load_font() fails.

log is attached, but I keep getting this error: Freetype error code 85

I/allegro ( 1321): font E 1329: ttf.c:760 al_load_ttf_font_stretch_f [ 0.52383] Reading DejaVuSans.ttf failed. Freetype error code 85

I rebuilt freetype library (2.4.12) just in case, but nothing was ever wrong with it, because if I revert to the old android build, everything works fine.
I also tried with+without <nocompress> in the build.xml, but no change.

Has anyone encountered this?

Thanks,
Pho75

Trent Gamblin
Member #261
April 2000
avatar

To load ttf on Android, you have to store it in your APK uncompressed. I don't really know why yet, it's possibly a bug in Allegro but everything else loads fine. The "best" way I found to do that was to give it one of the "supported" extensions (this is really ridiculous, but that's the way it seems to be.) Then you have to open the file with al_fopen after setting the apk file interface, and load the ttf with al_load_ttf_font_f. This is sort of explained here, with the list of file extensions you can use (I know it's crazy, but my ttfs have a .gif extension ::) android.)

http://ponystyle.com/blog/2010/03/26/dealing-with-asset-compression-in-android-apps/

The other way to do it is to use a lower SDK, but Allegro's increase the minimum Android version to 2.3... so I don't know if that's possible. You would then use the <aapt> section from the bottom of the project.properties file found in the last 5.1.x source release (or back in git history.)

Pho75_
Member #12,377
November 2010

That worked.
Not sure why it suddenly stopped working. ???
Thanks Trent,
Pho75.

Trent Gamblin
Member #261
April 2000
avatar

It stopped working because that bit I mentioned in the last paragraph from project.properties was removed because it was incompatible with the 2.3+ SDK. There might be a way to fix that and add it back, but in the end I think it's better not to. Without it, your APK gets compressed which is a good thing.

Go to: