I have the following code that is adapted from an online example to rotate text. The code works great because it rotates the text at the right angle, but I would like to know if there is a way to improve the accuracy and clarity of the rotated text. On my display, it seems that the rotated text is "stepped" rather than smooth.
PFont f;
String message = "abcdefghijklmnopqrstuvwxyz";
float theta, x;
void setup() {
size(800, 200);
f = createFont("Arial",20,true);
}
void draw() {
fill(0);
textFont(f);
translate(x,height/2);
rotate(theta);
textAlign(LEFT);
text(message,0,0);
theta += 0.1;
x += textWidth(message);
if (x>800){noLoop(); }
}
I changed the example to show the difference. In the new code, I change the text to an underline and draw a reference line in red. If it runs on your machine, you will see a stunning black line created by underscores.
String message = "________";
float theta, x;
PFont f;
void setup() {
size(800, 200);
f = loadFont("ArialMT-20.vlw");
smooth();
}
void draw() {
fill(0);
textFont(f);
translate(x,height/2);
rotate(theta);
text(message,0,0);
stroke(255,0,0);
strokeWeight(2);
line(0,0,textWidth(message),0);
theta += 0.1;
x += textWidth(message);
if (x>800){noLoop(); }
}
For me, it gives the following output, but I know that it will be different when run on Mac:

source
share