pixijs: TextMetrics.MeasureText () handles '\n' incorrectly (4.7.1)

4.7.1 has introduced a new bug: strings using wordwrap that also include newline character are calculated incorrectly.

Looking through the code it appears the string is broken into words and measured per word (correct) but when checking for wordwrap it does not respond to a newline in the word (incorrect) by starting a new line measurement at 0 width. This leaves the the line and subsequent lines mis-measured and wrapping incorrectly. Rendering confirms this.

Repro on:

  • machine: macbook pro
  • browser: chrome 65.0.3325.162
  • I’d expect the bug on all platforms

Expected Result (4.7.0):

Rich text with a lot of
options
and across multiple lines

Actual Result (4.7.1):

Rich text with a lot of
options
and across
multiple lines

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (16 by maintainers)

Commits related to this issue

Most upvoted comments

Yes I see, I will take a look