Incomplete text rendering of strings with consecutive line breaks #3736

Closed
jwmatthys opened this Issue Aug 28, 2015 · 4 comments

Comments

Projects
None yet
4 participants
@jwmatthys

When using the 5-argument version of text(), if there are multiple consecutive line breaks, the text after the line break is not rendered. Minimal example:

void draw() {
  background(0);
  String s = "Hello\n\nWorld.";
  fill(255);
  text(s,10,10,100,100);
}

Output only shows "Hello"

This bug appears to have been introduced after 3.0b3, where the text is rendered correctly.

Tested with Processing 3.0b4 on OSX, Linux, and Windows,, and 3.0b5 on OSX.

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Aug 28, 2015

Member

Bummer, sounds like a problem introduced by fixing #211 (or #3487). Thanks for the report.

Member

benfry commented Aug 28, 2015

Bummer, sounds like a problem introduced by fixing #211 (or #3487). Thanks for the report.

@kasperkamperman

This comment has been minimized.

Show comment
Hide comment
@kasperkamperman

kasperkamperman Oct 14, 2015

The code below still gives a "zero length string passed to TextLayout constructor" error. Removing the textAlign(CENTER, CENTER) solves it or adding a space behind the \n.

In Android mode this code just works normally (discovered it when working with the Ketai library.

void setup() {
  size(800,480);

  textAlign(CENTER, CENTER);
  textSize(48);
}

void draw() {
  background(128);
  text("x: " + nfp(100, 1, 0) + "\n" , 20, 0, width, height);
}

The code below still gives a "zero length string passed to TextLayout constructor" error. Removing the textAlign(CENTER, CENTER) solves it or adding a space behind the \n.

In Android mode this code just works normally (discovered it when working with the Ketai library.

void setup() {
  size(800,480);

  textAlign(CENTER, CENTER);
  textSize(48);
}

void draw() {
  background(128);
  text("x: " + nfp(100, 1, 0) + "\n" , 20, 0, width, height);
}
@LotteM

This comment has been minimized.

Show comment
Hide comment
@LotteM

LotteM Dec 28, 2015

I'm having the same problem in 3.0.1.
Removing the first CENTER solves it..
(but I need my text centered..)

  • I'm not sure if it's best to reopen it, or start another bug report

LotteM commented Dec 28, 2015

I'm having the same problem in 3.0.1.
Removing the first CENTER solves it..
(but I need my text centered..)

  • I'm not sure if it's best to reopen it, or start another bug report
@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Feb 13, 2016

Member

The original problem was fixed, so open a new report.

Member

benfry commented Feb 13, 2016

The original problem was fixed, so open a new report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment