My text has become myopic

[This is an Android Studio / P3D question]

Hi people :wave: ;

I wanted to add a “night mode” to my app, so I made a pair of variables :sunglasses: :

int black = 0, white = 255;

And changed all my strokes, fill, background with a value of 255 to white and 0 to black:

stroke(white,125); <---- stroke(255,125);
fill(black);       <---- fill(0);
background(black); <---- background(0);

Maybe I touched something more, like

        textAlign(CENTER);
        imageMode(CENTER);
        textMode(CENTER);
        rectMode(CENTER);

I put higher in my setup but I brought again to the same place, but maybe I touched more things that I don’t remember… :thinking:

And my texts have been muted from this: :star_struck:
Captura%20de%20pantalla%20de%202019-10-16%2013-34-08
to this: :cry:
Captura%20de%20pantalla%20de%202019-10-16%2013-32-50

Someone knows how to fix it? thanks in advance :relaxed:

1 Like

That’s weird/ wrong.

Try comment out that line

OR try SHAPE or MODEL as parameter

1 Like

@Chrisir Thanks for answer;
I noticed that textMode(); isn’t useful, so I commented it, but in order to restore the harmony of my texts I added again :sweat_smile:

Have tried to put that parameters and recommend it again but nothing changes :cry:

Do use createFont and textFont please

1 Like

Loading a font the little texts are fixed, the big one (WHEEL) still have some issues, but by the way it can stay like is (unless someone knows a better solution):

        myFont = createFont("Georgia", 32, true);
        textFont(myFont);

Unfixed:
Captura%20de%20pantalla%20de%202019-10-16%2013-32-50
Fixed: * Don’t know how to put blank spaces* At the beginning:
Captura%20de%20pantalla%20de%202019-10-16%2015-44-14 . . . . . . . . . . . . . .Captura%20de%20pantalla%20de%202019-10-16%2013-34-08

text reacts to fill not to stroke by the way

1 Like

very important is the use of background() at start of draw()

textMode(SHAPE); is only for certain renderers (not 2D).

renderer is important

PFont myFont; 

void setup() {
  // init
  size(1200, 600);
  background(255);

  myFont = createFont("Georgia", 55);
  textFont(myFont);
} // func 

void draw() {
  // runs on and on 
  background(255);

  textAlign(CENTER);
  imageMode(CENTER);
  textMode(MODEL);
  rectMode(CENTER);

  fill(255, 0, 0);
  text ("Take the Wheel", 
    width/2, height/2);
} // func
1 Like

I used this


    String[] fontList;
    PFont myFont;
    int ifont =0;
    String[] fontList;

public void setup() {
        myFont = createFont("Laksaman Bold", 32, true);
        textFont(myFont);
        fontList = PFont.list();
}

    public void draw() {
        background(black);
// [things over here ] - with the 
        textSize(95);
        text("WHEEL", posX, posY + 20);
}

void mousePressed(){
        if(ifont >= fontList.length)
           ifont=0;
        myFont = createFont(fontList[ifont], 32);
        textFont(myFont);
        println("Font: "+myFont.getName());
        println(" ifont: " + ifont);
        ifont++;
}

to try all fonts, and happens with all of them; I tried with

textMode(MODEL); //& later changed to
textMode(SHAPE);

And still the same

I recommend to use size() at start of setup()

also use

myFont = createFont(fontList[ifont], 95); with correct text size

and don’t use textSize(95);

this looks crisp on my Win 10




String[] fontList;

PFont myFont;
int ifont =0;

void setup() {
  size(800, 800, P2D);

  myFont = createFont("Laksaman Bold", 95);
  textFont(myFont);
  fontList = PFont.list();
  //  noSmooth();
}

void draw() {
  background(0);

  // [things over here ] - with the 
  //textSize(95);
  text("WHEEL", 333, 444 + 20);
}

void mousePressed() {
  if (ifont >= fontList.length)
    ifont=0;

  myFont = createFont(fontList[ifont], 95);
  textFont(myFont);
  println("Font: "+myFont.getName());
  println(" ifont: " + ifont);
  ifont++;
}
//

2 Likes

Ops, sorry, I didn’t mentioned that I’m in android -> android Studio in fact; and using P3D ( the size is done in the public void settings() {size(displayWidth, displayHeight, P3D);}), I also have tried to use:

    hint(DISABLE_DEPTH_TEST);

and

    DISABLE_OPTIMIZED_STROKE

But still nothing changes (well, with this last one, the fps drops to 1.67 too)

I have had blurry fonts in past but no more!

Not recently…

:slight_smile:

2 Likes

Ohh, yeah @glv, combining the @Chrisir solution and yours it is solved :dancer:.

Also the solution from @Chrisir was correct :smiley: (But the correct size for that text was that, but for other texts was other different size :sweat_smile:)

But I really don’t know why the blurry fonts appeared in that moment, I mean… I didn’t touch anything referring to the fonts or texts when they became myopic :thinking:

Thanks both :hugs:

2 Likes