[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 :
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…
And my texts have been muted from this:
to this:
Someone knows how to fix it? thanks in advance
1 Like
Chrisir
October 16, 2019, 12:21pm
2
Waboqueox:
textMode(CENTER);
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
Have tried to put that parameters and recommend it again but nothing changes
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:
Fixed: * Don’t know how to put blank spaces* At the beginning:
. . . . . . . . . . . . . .
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)
glv
October 16, 2019, 5:58pm
11
I have had blurry fonts in past but no more!
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…
2 Likes
Ohh, yeah @glv , combining the @Chrisir solution and yours it is solved .
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
2 Likes