Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

FreeType fonts with Android-NDK : Not loading ttf file!

$
0
0
Hi guys, So I've been having some trouble with loading fonts in Android (using the NDK). I've successfully (I believe) compiled the FreeType library as a shared-object library next to some other libraries I am using plus my game/framework code. I am using the following commands to get things initialised. FT_Library ft; FT_Face face; FT_Init_FreeType(&ft); FT_New_Face(ft, filename.c_str(), 0, &face); This is what the FreeType tutorials (plus other various online pages) suggest using to get things going. When I run this code on my Linux laptop, it runs fine but if I run it on Android, it fails on the fourth line loading in the font. So I know the library is probably compiled and linked correctly or it would fail on the first or third line right? The other issue is where to put the ttf file. I've put it in the assets subdirectory, which is again where (almost) everyone online suggests putting it. Some suggest putting it in assets/fonts sub-directory which I tried (and didn't work) and also res/font (which ndk-build complained about while compiling so definitely doesn't work). I'm a little stuck now since I feel like I've exhausted all the obvious options so if someone with experience using FreeType on the NDK can tell me the magic formula for getting this to work, I'll be very grateful :-) . Thanks

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>