改善旋转文本的显示

use*_*655 5 java processing text rotation

我有以下代码改编自旋转文本的在线示例.代码工作正常,因为它将文本旋转到正确的角度,但我想知道是否有办法提高旋转文本的准确性和清晰度.在我的显示器上看起来好像旋转的文本是"步进"而不是平滑.

PFont f;
String message = "abcdefghijklmnopqrstuvwxyz";
float theta, x;

void setup() {
  size(800, 200);
  f = createFont("Arial",20,true);
}

void draw() { 
 // background(255);
  fill(0);
  textFont(f);    // Set the font
  translate(x,height/2);  // Translate to the center
  rotate(theta);                // Rotate by theta
  textAlign(LEFT);            
  text(message,0,0);            
  theta += 0.1;                // Increase rotation
  x += textWidth(message);
  if (x>800){noLoop(); }
}
Run Code Online (Sandbox Code Playgroud)

我通过示例进行了修改,以帮助显示差异.在新代码中,我将文本更改为一串下划线,并以红色绘制参考线.如果它在您的机器上运行相同,您应该会看到由下划线创建的黑线中的交错.

String message = "________";
float theta, x;
PFont f;

void setup() {
  size(800, 200);
  f = loadFont("ArialMT-20.vlw");
  smooth();
}

void draw() { 
  fill(0);
  textFont(f);    // Set the font

  translate(x,height/2);  // Translate to the center
  rotate(theta);                // Rotate by theta

  text(message,0,0);

  stroke(255,0,0);
  strokeWeight(2);
  line(0,0,textWidth(message),0);

  theta += 0.1;                // Increase rotation
  x += textWidth(message);
  if (x>800){noLoop(); }
}
Run Code Online (Sandbox Code Playgroud)

对我来说它提供了以下输出,但我知道如果在Mac上运行会有所不同:

在此输入图像描述

MvG*_*MvG 1

尝试调整RenderingHints