Jump to content

Method to fit text within a box


bluedot
 Share

Recommended Posts

It really depends on the use case.

If the text changes often, you might want to extend the Text prototype and loop over ctx.measureText(..).width instead of drawing the text until you find a fitting size.

Since the box also has a height, I would wrap at box.width and loop until the height fits into the box.

(Not sure if the current version of phaser i using a pixi version with fixed wordwrap issue)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...