GNOME Bugzilla – Bug 755375
Fonts not copied properly on Android.
Last modified: 2015-09-23 13:22:48 UTC
I noticed that the clockoverlay only displayed 00000000 on Android. The Java code GStreamer.Init() copies from assets/fontconfig/fonts/truetype However, the single font checked in (Ubuntu-R.ttf) is in ndk-build/fontconfig/fonts. Adding the truetype folder and moving the font file there makes the clockoverlay display correctly.
To be fair, in some project I just replaced that to point to Android font directory (with manually written fontconfig index) and that work fine (and was consistent with other apps). I never had the time to write a proper patch, but it should not be hard.
(In reply to Nicolas Dufresne (stormer) from comment #1) > To be fair, in some project I just replaced that to point to Android font > directory (with manually written fontconfig index) and that work fine (and > was consistent with other apps). I never had the time to write a proper > patch, but it should not be hard. Would this work on all devices? If so, a patch would be great ;) Should we think of integrating your yet-to-be-written patch into 1.6.0, or rather just fix that path in cerbero?
(In reply to Sebastian Dröge (slomo) from comment #2) > Would this work on all devices? If so, a patch would be great ;) I'd need to test, it's likely the "standard" font sets was introduced much later then what we pretend we support. So it might mean raising up the minimum requirement (which is quite old now anyway), but that's not good for 1.6. > Should we think of integrating your yet-to-be-written patch into 1.6.0, or > rather just fix that path in cerbero? The would be to risky, if we have path issue it must be a simple regression, so let's just fix that and stick with our single font for now.
This works just fine for me as is. The <dir> directives in fonts.conf are for the top-level dir, it looks recursively in all subdirectories then. Is your application setting XDG_DATA_HOME manually to something else, or not using the GStreamer.init() Java method?
Also for reference, the font is in assets/fontconfig/fonts/truetype for me. The fonts.conf is in assets/fontconfig and pointing to $XDG_DATA_HOME/fontconfig/fonts. GStreamer.java is copying to $XDG_DATA_HOME/fontconfig/fonts/truetype
The font is in http://cgit.freedesktop.org/gstreamer/sdk/cerbero/tree/data/ndk-build/fontconfig/fonts/Ubuntu-R.ttf When I unzip the android package it goes into: share/gst-android/ndk-build/fontconfig/fonts There is no truetype sub-directory. That is the problem. When the GStreamer.init() copies the fonts, it's looking for the for "fontconfig/fonts/truetype", that doesn't exist by default. for(String filename : assetManager.list("fontconfig/fonts/truetype")) { File font = new File(fontsDir, filename); copyFile (assetManager, "fontconfig/fonts/truetype/" + filename, font); } The only thing I had to do was to create the truetype directory and move the font there. I made no other changes, not altering font.config etc. GStreamer.init() was executed and set all the paths etc as you describe. XDG_DATA_HOME is set in gstreamer_andoir-1.0.c and the method gst_android_init (called from GStreamer.init().
If you where using the provided makefile, you'd this would be copied to the right location in your project. See ndk-build/gstreamer-1.0.mk: copyfontsres_$(TARGET_ARCH_ABI): @$(call host-mkdir,assets/fontconfig) @$(call host-mkdir,assets/fontconfig/fonts/truetype/) @$(call host-cp,$(GSTREAMER_NDK_BUILD_PATH)/fontconfig/fonts.conf,assets/fontconfig) @$(call host-cp,$(GSTREAMER_NDK_BUILD_PATH)/fontconfig/fonts/Ubuntu-R.ttf,assets/fontconfig/fonts/truetype) copycacertificatesres_$(TARGET_ARCH_ABI): @$(call host-mkdir,assets/ssl/certs) @$(call host-cp,$(GSTREAMER_ROOT)/etc/ssl/certs/ca-certificates.crt,assets/ssl/certs)
Not a bug then - sorry to drag you guys though all this. Pls close.
How are you building your application?
Sebastian, it's not a bug. I didn't use the provided makefiles. :-) I copied the file structure as-is into my project. I use Android Studio 1.3.2 with a custom gradle file where I specified the needed modules/libraries. Then I did GST_PLUGINSTATIC_DECLARE and GST_PLUGIN_STATIC_REGISTER for those libraries in gstreamer_android-1.0.c. This worked great, except that I screwed up the font copying. I really like encodebin and all it does to find the HW Encoder etc. Worked like a charm on my Andorid device. Thanks to everyone that has contributed to all this great work!