flixel icon indicating copy to clipboard operation
flixel copied to clipboard

FlxBitmapText doesn't split words longer than the fieldWidth

Open Geokureli opened this issue 3 years ago • 0 comments

example

var monospaceLetters:String = " !\"#$%&'()*+,-.\\0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[/]^_`abcdefghijklmnopqrstuvwxyz{|}~";
var charSize = FlxPoint.get(7, 10);
var fontMonospace = FlxBitmapFont.fromMonospace("assets/images/RetroMedievalV3.png", monospaceLetters, charSize);
var text:FlxBitmapText = new FlxBitmapText(fontMonospace);
text.scrollFactor.set(0, 0);
text.setPosition(0, 100);
text.autoSize = false;
text.width = text.fieldWidth = 84;
text.letterSpacing = -1;
text.multiLine = true;
text.text = "The quick brown fox jumps over the lazy dog, supercalaphra\ngalisticexpia\nladocious";
add(text);

font (hard to see on night mode): image

How it appears: Screen Shot 2022-04-08 at 11 28 39 PM

when wrapByWord is false: image

How the original code should look by default: Screen Shot 2022-04-08 at 11 29 49 PM

We should add a new field called something like wrapLongWords, or maybe make wordWrap an enum

enum abstract WordWrap(Int)
{
    var CHAR;
    var WORD_SPLIT_LONG;
    var WORD;
}

found by @chosenCharacters

Geokureli avatar Apr 09 '22 18:04 Geokureli