JAVAFX on ANDROID

tomas.brandalik tomas.brandalik at oracle.com
Tue Oct 15 07:26:46 PDT 2013


I would recommend to build pango by hand first. I don't think that it is 
so straightforward. It has many dependencies iconv, expat, fontconfig, 
freetype, glib at least. After a whole day of struggling my pango build 
failed somewhere in the middle at "who-knows-where-it-comes-from" macro :(

-wish you more luck
Tomas

On 10/15/2013 09:07 AM, Matthias Hänel wrote:
> Hi Felipe,
>
>
> thanks for your fast answer.
>
> Unfortunately, this is not enough information for a sufficient solution ;)
> Maybe I am too far from gradle away in my thinking (Makefiles) to understand this one fully.
>   
>
> I know where the sources are and I am pretty sure I can build a library by hand. Actually, I added
> to the android gradle script the Linux fontpango parts and the pkg-config tool.
>
> I assume that the default linux gradle script looks for the pango libs in /usr/share ...
> (default paths). Now we are in a cross platform enviornment for Android. At least I have to call
> ./configure with the android toolchain. That should not be hard to do.
>
> What I don't know is, how do I add this to the gradle script?
> I see the pkg-config in crosslibs but that relies on the assumption that pango resides
> somewhere in ${SYSROOT}.
>
> Well, I probably could build pango (haven't tried yet) for android and put it in the NDK,
> from my point of view, that wouldn't work later at run time. The .so must be linked and
> delivered with the App. Maybe someone can enlighten me how I can integrate a third party
> library build into the gradle universe ;)
>
>
> regards
> Matthias
>
>
>
> Am 14.10.2013 um 17:45 schrieb Felipe Heidrich <felipe.heidrich at oracle.com>:
>
>> Hi, I'm not familiar with the Android build process but basically this is what you need:
>>
>> Build graphics/src/main/native-font/fontpath_linux.c to a library called "javafx_font", that it will be loaded by PrismFontFactory.java (but used by FontConfigManager.java).
>> This is our fontconfig binding used to locate fonts. All references to fontconfig in the native code are dynamic, so you should only need the JNI references while building this object.
>>
>>
>> Build
>> graphics/src/main/native-font/freetype.c
>> and
>> graphics/src/main/native-font/pango.c
>> To a library named "javafx-font-pango"
>>
>> The cc flags to build them are "pkg-config --cflags pangoft2" + "-D_ENABLE_PANGO", the lib flags are pkg-config --libs pangoft2
>> (see rt/buildSrc/linux.gradle, search pangoCCFlags and pangoLinkFlags).
>>
>> This library will be used by graphics/src/main/java/com/sun/javafx/font/pango/OS.java
>>
>> During runtime you will need to explicitly set "-Dprism.text=native" so that PangoFactory.java is used (instead of T2KFactory.java).
>>
>> Note: if that is too hard to build pango.o I suppose you could link javafx-font-pango.so only with freetype.o, you should not see any unsatisfied link exception as long as PangoFactory.createGlyphLayout is not called.
>>
>> Setting -Dprism.debugfonts=true should help to see what is getting loaded, -Djavafx.verbose=true prints what library as being loaded by JFX.
>>
>> Regards,
>> Felipe
>>
>>
>> On Oct 13, 2013, at 11:49 PM, Matthias Hänel <haenel at ultramixer.com> wrote:
>>
>>> Is there a fallback? Pango doesn't work either it's not used in the android gradle scripts.
>>> I would be happy to integrate it and I am sure I can compile pango for android. I just need a pointer to how I can integrate it into the build process.
>>> I changed android.gradle but I am not sure where to put the pango sources.



More information about the openjfx-dev mailing list