Skip to content

Word wrapping doesn't wrap the long words. #5321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
8o8inCodes opened this issue Jun 17, 2021 · 3 comments
Closed

Word wrapping doesn't wrap the long words. #5321

8o8inCodes opened this issue Jun 17, 2021 · 3 comments
Labels

Comments

@8o8inCodes
Copy link

8o8inCodes commented Jun 17, 2021

Most appropriate sub-area of p5.js?

  • [x ] Typography

Details about the bug:

  • p5.js version: latest
  • Web browser and version: Chrome
  • Operating System: Windows 10
  • Steps to reproduce this:
let s = "It was the best of times, it was the worst of times. Only 90s kids will remember these times. Alf and Growning Pains remember that. fkdjshfkasjdhfkasdjhflkasdjfhalsdkjfhasdlkfjhasdlkfjhsadlkfjhasdklfjhasdlkfjhaklsdjfhaslkdfhalskdjfhaslkdjhfasdkljhfaskdlfhaskdlhfksadhfaskdfhaksdlhfaksdjfhsadklfjhaslkfjhasldkjfhalskdfhasdlkfhasdlkfhasdklfjhasdklfhaskdljfhaklsjdhf";
function setup() {
  createCanvas(400, 400);
}

function draw() {
  background(220);
  let size = map(mouseX, 0 , width, 10, 72)
  textSize(size);
  textLeading(size*1.1); //goes AFTER TEXT

  fill(0);
  text(s, 50, 50, 250, 250);
  noFill();
  rect(50, 50, 250, 250);
}

It doesn't word wrap long words and these words escape the wrapping box.
And I have no way of containing such text.

Here is an quick editor example that I've found, you can add a very long word there
https://editor.p5js.org/gfm262/sketches/TGK6Th4Xr

@8o8inCodes 8o8inCodes added the Bug label Jun 17, 2021
@welcome
Copy link

welcome bot commented Jun 17, 2021

Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already.

@limzykenneth
Copy link
Member

This has been address by #5146 with the addition of the textWrap() function. It will be available in the next release of p5.js.

@8o8inCodes
Copy link
Author

This has been address by #5146 with the addition of the textWrap() function. It will be available in the next release of p5.js.

Thank you! Will be waiting for it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants