Skip to content

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

Closed
@8o8inCodes

Description

@8o8inCodes

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions