Jump to content

Multiline BitmapText with maxWidth issue


Insi
 Share

Recommended Posts

Hi.

I'm try to use BitmapText with pixi v.3.0.9 to display multiline text and I have some problems here. Just an example:
When I use just \n symbols to word wrap it works correctly:

    _bitmapFontText = new PIXI.extras.BitmapText("12\n 34\n 56\n 78\n 90\n 21\n 43\n 65\n 87\n 09", { font: '35px Desyrel', align: 'right' });
    _bitmapFontText.updateText();

When I use just maxWidth it works correctly too:

    _bitmapFontText = new PIXI.extras.BitmapText("12 34 56 78 90 21 43 65 87 09", { font: '35px Desyrel', align: 'right' });
    _bitmapFontText.maxWidth = 30;
    _bitmapFontText.updateText();

But when I've mix them.

    _bitmapFontText = new PIXI.extras.BitmapText("12\n 34\n 56\n 78\n 90\n 21\n 43\n 65\n 87\n 09", { font: '35px Desyrel', align: 'right' });
    _bitmapFontText.maxWidth = 30;
    _bitmapFontText.updateText();

The result will be so strange. Some of chars become duplicated (screenshot attached).
Mixed variant it's what I really need to have, because text which I'll set in real application could contains any number of \n symbols, but it should be placed just in specific area (which could be limited with maxWidth) 

wordwrapissue.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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