开发者

Text quality in processing

Wh开发者_JS百科y does the text quality in Processing not look as good as Flash? In general it looks slightly grainy, and hard to read.


I had this problem as well. I found that if you continually overwrite the text (in the draw loop for example) without 'wiping' the underlying surface (by calling background in the draw loop for example) the text becomes jagged.

I think this is because the semi-transparent corners on the letters due to antialiasing get written over and over until they become fully opaque.

Take a look at this example, (you will have to create a font 'ArialMT-20')


PFont fontA;

void setup() {
  size(300, 100);
  fill(0);
  fontA = loadFont("ArialMT-20.vlw");
  textFont(fontA, 20);
  // Background drawn once here
  background(255);
}

void draw() {
  // When mouse is held down, the background is wiped
  if (mousePressed) {
    background(255);
  }
  text("Hi there", 20, 50);
}


try to put the smooth() command inside the setup() method and be sure you are loading a font that exist in your system or inside your data folder.

IMHO the font rendering quality in processing is quite good :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜