Fonts behaving unpredictably (Android)

edited March 2016 in Android Mode

Mode: Android Mode 0232 Renderer: P3D TextMode: PConstants.SHAPE


Issue 1: Some letters not displaying at all

The issue is shown here:

http://imgur.com/a/8iVjy

I am using createFont() in setup with smooth turned on and textFont(), then using textSize() at different points.

The problem appears on some Android devices, on some not. I have tried to look for the problem. I created the following table:

http://imgur.com/8RQNQlA

Could not draw conclusions from it apart from the observation that most vowels display and most consonants don't. Most signs display.


Issue 2: Some letters displayed with stroke

The issue is shown here:

http://imgur.com/uCC54D1

On devices on which the font actually displays, some letters are rendered with stroke, some not. In the picture above, notice how "b" and "d" display differently than the rest. I tried calling noStroke() before text(), but to no avail. Switching from P3D to OPENGL does not solve the problem. Changing the font did not solve the issue either.


Issue 3: textFont not changing the font when called second and all consecutive times.

Since in P3D and OPENGL the fonts are generated as bitmaps in the setup(), different fonts must be instantiated to accomodate for different font sizes. Then, in draw(), textFont() should be used depending on the dimensions of the text which needs to be displayed. That is the way it should work in theory. In practice, however, in my case, calling textFont() works only once, at the beginning. Consecutive calls bear no effect.


Neither issue is, to my knowledge, present with the JAVA2D renderer.

Could anybody point me to the right direction to solve any of the problems?

Thank you in advance.

Answers

  • are you calling background? because issue 2 might by a buildup of semi-transparent pixels (anti-aliasing)

    https://forum.processing.org/two/discussion/8075/why-are-text-and-graphics-so-ugly-and-blocky

    show us some code.

  • @koogs Thanks for your reply. I can post the code but I am not sure what value added that could provide. The draw() method effectively calls methods from numerous classes. Essentially, it does the following:

    public void draw(){
        gameMode.display(); 
        }
    

    Where gameMode is a superclass of subclasses that override display() according to what they should do. Each of those sub classes does call background() at the beginning of its display() method. The arguments passed to background() (namely, RGB values) are governed by rules dependent on the mode, hence they are placed in the gameModes' display() methods, and not explicitly in draw(). The way of handling text display is described under Issue 1. "I am using createFont() in setup with smooth turned on and textFont(), then using textSize() at different points." Then I am using the regular text() method, sometimes the three arguments one, sometimes the 5 arguments one. But, if you still think it is better to post that code, let me know and I will...

    As per the link you posted, thanks. However, if the issue was really the one described there, how come some letters are displayed properly, whereas others are not? As I imagine, background is applied to the entire screen. I doubt background() selectively chooses which letters should be erased and redrawn again and which ones should be redrawn constantly on ones from previous frames.

    I think the problem should be laying somewhere else, which is supported by the existence of Issue 1: some letters being displayed, some not at all.

  • For your information, reverting to an older version of the library worked. Perhaps upgrading to a newer one would have also worked.

  • Which library? Which version?

  • The 0217 version in https://github.com/processing/processing-android/releases Anything between 0228 inclusive and 0239 inclusive does not work. I have not tried anything above 0239.

Sign In or Register to comment.