multiline text gets blurry at second line, are there workarounds?

Hi all, i'd like to use the multiline version of the text() function, to display some textfields. sadly every other second and third line looks a little blurry, whereas the first and forth line look perfectly sharp. i think it might be that the calculation that places the lines somehow does not round off to a whole number. is this intended behavior, and if so, are there workarounds?

here is a minimal example:

float roty =0; PFont myFont;
void setup() {
  size(110, 110, OPENGL);
  myFont = createFont("PT Mono", 14, true);
  textFont(myFont);
  textSize(14);
  noStroke();
}

void draw() {
  background(60);  pushMatrix();
  translate(width/2,height/2,-100);
  rotateY(roty);  fill(90);  box(width);
  popMatrix();  roty+=0.01;

  camera();
  noLights();
  hint(DISABLE_DEPTH_TEST);
  fill(255);
  text("Hey there\nthis is a\nmultiline text!\nwith\nmore\nwords",10,10,100,200);
}

Answers

  • I just tried your sketch with a pair of fonts, default and Verdana, and the last line seems as crisp as the first one.

    On Windows 7 with a low-end graphics card.

  • edited February 2014 Answer ✓

    Try to set the text leading per hand. Add the following line to the end of your setup method: textLeading(18);

  • Thanks, that worked great!

  • @bckmnn: No problem. :)

    @PhiLho: Your low-end graphics card is most probably the reason you don't experience these kind of texture filtering issues - it's the same with my girlfriend's old notebook.

Sign In or Register to comment.