# My text has become myopic

**URL:** https://discourse.processing.org/t/my-text-has-become-myopic/14736
**Category:** Beginners
**Created:** [October 16, 2019, 11:38am UTC](https://discourse.processing.org/t/my-text-has-become-myopic/14736 "2019-10-16T11:38:37Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Waboqueox](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/waboqueox/32/5643_2.png) [@Waboqueox](https://discourse.processing.org/u/Waboqueox)
#### Post date: [October 16, 2019, 11:38am UTC](https://discourse.processing.org/t/my-text-has-become-myopic/14736/1 "2019-10-16T11:38:37Z")

</div>

**[This is an Android Studio / P3D question]**

Hi people 👋 ;

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

```auto
int black = 0, white = 255;

```

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

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

```

Maybe I touched something more, like

```auto
        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… 🤔

And my texts have been muted from this: 🤩  
 ![Captura%20de%20pantalla%20de%202019-10-16%2013-34-08](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/f/fcdf08059e5a5ede8c0fd48e687cdae56e6d35f3.png)  
to this: 😢  
 ![Captura%20de%20pantalla%20de%202019-10-16%2013-32-50](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/0/0b40127d030c0984f6220aff6d8dfc3bcd4d1fca.png)

Someone knows how to fix it? thanks in advance 😌

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [October 16, 2019, 12:21pm UTC](https://discourse.processing.org/t/my-text-has-become-myopic/14736/2 "2019-10-16T12:21:13Z")

</div>

> [@Waboqueox](#):
>
> textMode(CENTER);

That’s weird/ wrong.

Try comment out that line

OR try SHAPE or MODEL as parameter

---

<div class="post-metadata">

### Author: ![Waboqueox](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/waboqueox/32/5643_2.png) [@Waboqueox](https://discourse.processing.org/u/Waboqueox)
#### Post date: [October 16, 2019, 1:05pm UTC](https://discourse.processing.org/t/my-text-has-become-myopic/14736/3 "2019-10-16T13:05:51Z")

</div>

@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 😅

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

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [October 16, 2019, 1:32pm UTC](https://discourse.processing.org/t/my-text-has-become-myopic/14736/4 "2019-10-16T13:32:46Z")

</div>

Do use createFont and textFont please

---

<div class="post-metadata">

### Author: ![Waboqueox](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/waboqueox/32/5643_2.png) [@Waboqueox](https://discourse.processing.org/u/Waboqueox)
#### Post date: [October 16, 2019, 1:49pm UTC](https://discourse.processing.org/t/my-text-has-become-myopic/14736/5 "2019-10-16T13:49:30Z")

</div>

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)**:

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

```

Unfixed:  
 ![Captura%20de%20pantalla%20de%202019-10-16%2013-32-50](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/0/0b40127d030c0984f6220aff6d8dfc3bcd4d1fca.png)  
**Fixed:** \* Don’t know how to put blank spaces\* **At the beginning:**  
 ![Captura%20de%20pantalla%20de%202019-10-16%2015-44-14](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/f/f3d481cf9f814972e844457bb6519e10979c825c.png) . . . . . . . . . . . . . . ![Captura%20de%20pantalla%20de%202019-10-16%2013-34-08](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/f/fcdf08059e5a5ede8c0fd48e687cdae56e6d35f3.png)

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [October 16, 2019, 2:11pm UTC](https://discourse.processing.org/t/my-text-has-become-myopic/14736/6 "2019-10-16T14:11:53Z")

</div>

text reacts to fill not to stroke by the way

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [October 16, 2019, 2:21pm UTC](https://discourse.processing.org/t/my-text-has-become-myopic/14736/7 "2019-10-16T14:21:24Z")

</div>

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

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

renderer is important

```auto
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

```

---

<div class="post-metadata">

### Author: ![Waboqueox](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/waboqueox/32/5643_2.png) [@Waboqueox](https://discourse.processing.org/u/Waboqueox)
#### Post date: [October 16, 2019, 2:35pm UTC](https://discourse.processing.org/t/my-text-has-become-myopic/14736/8 "2019-10-16T14:35:18Z")

</div>

I used this

```auto

    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

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

```

And still the same

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [October 16, 2019, 2:53pm UTC](https://discourse.processing.org/t/my-text-has-become-myopic/14736/9 "2019-10-16T14:53:42Z")

</div>

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

```auto

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++;
}
//

```

---

<div class="post-metadata">

### Author: ![Waboqueox](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/waboqueox/32/5643_2.png) [@Waboqueox](https://discourse.processing.org/u/Waboqueox)
#### Post date: [October 16, 2019, 3:00pm UTC](https://discourse.processing.org/t/my-text-has-become-myopic/14736/10 "2019-10-16T15:00:14Z")

</div>

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)

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [October 16, 2019, 5:58pm UTC](https://discourse.processing.org/t/my-text-has-become-myopic/14736/11 "2019-10-16T17:58:12Z")

</div>

I have had blurry fonts in past but no more!

> [@Blurry Text Solution](https://discourse.processing.org/t/blurry-text-solution/11293):
>
> I was using different text sizes in a recent project and was getting blurry fonts. I solve this issue by setting the largest text size in setup() and problem solved! Here is the code I used to test this: /\* Project: Blurry Text Author: GLV Date: 2019-05-15 Version: 01 \*/ void settings() { size(1024, 768, P3D); } void setup() { textSize(128); // Set to largest text size used to prevent blurring of text } void draw() { background(0); text24(); t…

Not recently…

🙂

---

<div class="post-metadata">

### Author: ![Waboqueox](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/waboqueox/32/5643_2.png) [@Waboqueox](https://discourse.processing.org/u/Waboqueox)
#### Post date: [October 17, 2019, 8:06am UTC](https://discourse.processing.org/t/my-text-has-become-myopic/14736/12 "2019-10-17T08:06:42Z")

</div>

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

> [@Chrisir](#):
>
> `myFont = createFont(fontList[ifont], 95);` with correct text size

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

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 🤔

Thanks both 🤗
