Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Android and Freetype

Credits go to Elias, Thomas Fjellstrom, and Trent Gamblin for helping out!
This thread is locked; no one can reply to it. rss feed Print
Android and Freetype
Todd Cope
Member #998
November 2000
avatar

I am having a problem with the TTF add-on on the Android port. Any time I try to load a TTF font I get this error:

Reading data/fonts/my_font.ttf failed. Freetype error code 85

I looked up the error code to see if I could figure out what went wrong. It is defined as Invalid_Stream_Operation but I have no idea what that means. Google doesn't return any useful discussion of this error. Has anyone else successfully used the TTF add-on on Android?

Trent Gamblin
Member #261
April 2000
avatar

I have. It works with git head for me. Are you loading it from the filesystem or from the apk? Any more details?

Todd Cope
Member #998
November 2000
avatar

I am loading from APK. I just downloaded the latest stable Freetype. Image files load just fine.

How did you build Freetype. Here is what I used:

./configure --host=arm-linux-androideabi --prefix=$TC --without-zlib \
   --enable-shared=no CFLAGS="-std=gnu99 -fPIC -mthumb -Wno-psabi \
   -march=armv7-a -mfloat-abi=softfp"
make install

I copied this from some random site on the Internet so it may be wrong.

Elias
Member #358
May 2000

Did you disable compression on the .apk? There's still a (somewhat serious) bug in Allegro's file routines which makes it not work on files inside a compressed .apk.

--
"Either help out or stop whining" - Evert

Trent Gamblin
Member #261
April 2000
avatar

I'd call it an Android bug myself. :P

But that's correct, apks must be uncompressed for the time being. There's one way around that and that's to use physfs directly on the APK (it's just a zip file). That's what I do in my latest game, and I find it's much better.

Thomas Fjellstrom
Member #476
June 2000
avatar

At some point I want to try out the file stream interface to the APK's contents. One would hope that they decompress on the fly via that interface.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Todd Cope
Member #998
November 2000
avatar

Elias said:

Did you disable compression on the .apk?

No. I just followed the instructions in README_android.txt. Didn't see anything in there about the compression. How exactly would I go about disabling it? I wouldn't mind having an uncompressed APK since most of my data already use compressed file types.

Trent Gamblin
Member #261
April 2000
avatar

You can find instructions on how to do it by Googling. Basically you add some lines of text to an XML file.

[I could Google it, but there is an old way and a new way, I'm not sure which is which anymore... and it depends on which SDK you're using.]

Todd Cope
Member #998
November 2000
avatar

Cool! I ended up modifying sdk-root/ant/build.xml. Just had to add a <nocompress/> to the package-resources target. Most of my game is working now! Thanks everyone!

Go to: