Home / Phaser / P33

Phaser error: wordWrapWidth < a single character — cause and fix

After word wrapping is enabled on a text object, wordWrapWidth is set smaller than a singl

ID
P33
Engine
Phaser
Verification
源码原文(src/gameobjects/text/Text.js:491)
Frequency
未公开

Original message (verbatim)

wordWrapWidth < a single character

Placeholders such as %s / %d are kept verbatim from the engine source and are not replaced with concrete values.

Trigger

After word wrapping is enabled on a text object, wordWrapWidth is set smaller than a single character width (zero, negative, or a tiny pixel value), and the wrapping calculation throws.

Typical cause

advancedWordWrap/basicWordWrap validate the available width before splitting lines; when it is smaller than one character width no character can fit, so it throws an Error.

Step-by-step fix

  1. Set wordWrapWidth to a pixel value larger than the widest single character.
  2. Confirm the font size does not push character width beyond the container.
  3. Update wordWrapWidth whenever the container width changes.

Source links

Per-entry sources and capture date are listed at /sources#P33.

Related errors

Related Phaser errors

Need an offline quick-reference checklist?

Atlas error library Pro pack: 123 error references (110 single + 13 merged) plus a quick-fix guide, $19 one-time purchase, delivered as electronic files.

View Pro pack / order

Back to the all-errors index Checkout and buy the Pro pack — $19.00