mta452 / SheenFigureLegacy

A library to render arabic/urdu fonts on smartphones.
Apache License 2.0
30 stars 6 forks source link

Android - No text appearing #10

Open shaks786 opened 11 years ago

shaks786 commented 11 years ago

I've updated the SheenFigure library, and now the text doesn't seem to appear at all?

mta452 commented 11 years ago

Sorry for the inconvenience. I intended to commit only ios related code but mistakenly committed android code as well on which I'm currently working.

Please use older version for the time being.

mta452 commented 11 years ago

Just pushed a newer version with glyph cache support. Hope it solves your problems.

shaks786 commented 11 years ago

Sorry for late reply, now I keep getting the following error, 08-18 23:23:07.445: E/AndroidRuntime(807): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load SheenFigureJNI: findLibrary returned null

Any ideas? Been trying to figure it out for a few hours now (This is with the new Demo app you recently pushed out)

mta452 commented 11 years ago

It is possible that jni is not being compiled. In new version, there are two projects. The First one is SheenFigure-Android which compiles native library and the second one is demo project which loads library from first project. You'll have to configure android NDK on first project.

shaks786 commented 11 years ago

I've set it up NDK on the first project and used the demo project to add it as a library, but it just doesn't seem to compile the native code when I run the application. The NDK setup I has is shown below: screen shot 2013-08-20 at 18 36 07

mta452 commented 11 years ago

While compiling the project, look at console window to see if it tells any errors in the native code.

shaks786 commented 11 years ago

no errors in console but the console doesn't even show any of the native code compiling, like how it usually should do..

mta452 commented 11 years ago

Maybe your NDK is not being triggered. Try changing the working directory from workspace-project to absolute path.

shaks786 commented 11 years ago

NDK seems to run when I just start Eclipse, but not when I build/run the app. When Eclipse starts NDK greets me with this:

/SSText.c:235:2: warning: passing argument 7 of 'SFTextShowString' from incompatible pointer type [enabled by default] jni/../../SheenFigure/SFGraphics/SFText.h:57:5: note: expected 'SFGlyphRenderFunction' but argument is of type 'void ()(void , SFGlyph, SFFloat, SFFloat, void *)'

mta452 commented 11 years ago

Are you sure you are using latest files? SSText.c is only 183 lines long then how can there be an error at 235 line? Here is what I think you must do. 1) Delete any existing projects, download a fresh copy and import it in eclipse. 2) In eclipse, goto project menu and disable "Build Automatically". 3) Open NDK configuration. In "Main" tab, set working directory to "SheenFigure-Android". In "Build Options" tab, enable "Allocate Console", "After a Clean" and "During manual builds". 4) Right click on the project and hit "Build Project". Watch the console window and see the progress.

If you still encounter issues, use this prebuild native library: Just copy libs folder to SheenFigure-Android project. Now it should be loaded and you shouldn't have UnsatisfiedLinkError.

mta452 commented 11 years ago

Here is the link: https://www.dropbox.com/s/dqd5xzhtlr2k0fz/SheenFigureNative.zip

shaks786 commented 11 years ago

YES! Finally it works, turns out I was missing step 4 (Building the project), Thanks a lot. One final (hopefully) question - does SheenFigure at the moment only support one widget per layout? I tried having multiple instances of SheenFigure TextView widget within the same layout and got some NullPointer exception. Thanks again

shaks786 commented 11 years ago

Apologies, ignore the above, I had forgot to set the font on each TextView hence the nullpointer error. Seems to work fine!