tangrams / tangram-es

2D and 3D map renderer using OpenGL ES
MIT License
813 stars 236 forks source link

Android App text Disappears #873

Open FarazKhalidZaki opened 8 years ago

FarazKhalidZaki commented 8 years ago

Application text disappears in android versions below 5.0 (lollipop) both in Eraser map (latest installed from play store) and in my own sample app in which tangram is integrated. Below is the video link in which a random behavior of Eraser map is observed, in first test app runs fine and in 2nd test app text disappeared on navigate click. https://www.youtube.com/watch?v=KcZkGEu8Sck&feature=youtu.be

One more interesting thing: I was testing GPU stats using "Profile GPU Rendering" developer option whenever app text disappears GPU bars go flat as if GPU has gone dead for the application. :smile: Here it is.. screenshot_2016-07-27-15-24-56

Problem is faced while testing on both devices below: 1- Galaxy s3 (v 4.3 jellybean ) it has GPU mali-400 2- Huawei honor 4c (v 4.4.2 kitkat) it has GPU mali-450

similar issues https://github.com/tangrams/tangram-es/issues/792#issue-160345928 https://github.com/mapzen/android/issues/121#issuecomment-235419016 https://github.com/mapzen/eraser-map/issues/599#issue-157695489

matteblair commented 8 years ago

Hi, thanks for the detailed report and for collecting the related issues. We still don't have an answer about this behavior, but the device configurations that you've listed here adds to my suspicion that this is a bug (or at least an oddity) in the Mali GPU drivers in certain versions of Android.

FarazKhalidZaki commented 8 years ago

See if it is helpful..

Both TextView and android.text are high-level implementations on top of Paint and Canvas. Up until Android 3.0, both Paint and Canvas were implemented directly on top of Skia, a software rendering library. Skia provides a nice abstraction of Freetype, a popular Open Source font rasterizer. Android software text rendering

As of Android 4.4 things are a little bit more complicated. Both Paint and Canvas use an internal JNI API called TextLayoutCache that handles complex text layouts (CTL). This API relies on Harfbuzz, an Open Source text shaping engine. The input of TextLayoutCache is a font and a Java UTF-16 string and its output is a list of glyph identifiers with their x/y positions.

I found it here. https://medium.com/@romainguy/androids-font-renderer-c368bbde87d9#.g63qv2fb8