Using a layout library that puts the h2d.text to the render with width 0, then changes it width to match other contents. This causes splitRawText to hang. Checking for maxWidth <=0 fixes issue for me. But maybe it should check if maxWidth <= 2 character widths. Basically only split if it is at least 2 characters?
....
function splitRawText( text : String, leftMargin = 0., afterData = 0., ?font : Font, ?sizes:Array, ?prevChar:Int = -1 ) {
var prevChar = prevChar ?? -1;
var maxWidth = realMaxWidth;
if( maxWidth < 0 ) {
if ( sizes == null )
return text;
else
maxWidth = Math.POSITIVE_INFINITY;
} else {
maxWidth -= afterData;
}
if (maxWidth <= 0)
return text;
......
Using a layout library that puts the h2d.text to the render with width 0, then changes it width to match other contents. This causes splitRawText to hang. Checking for maxWidth <=0 fixes issue for me. But maybe it should check if maxWidth <= 2 character widths. Basically only split if it is at least 2 characters?
....
function splitRawText( text : String, leftMargin = 0., afterData = 0., ?font : Font, ?sizes:Array, ?prevChar:Int = -1 ) {
var prevChar = prevChar ?? -1;
var maxWidth = realMaxWidth;
if( maxWidth < 0 ) {
if ( sizes == null )
return text;
else
maxWidth = Math.POSITIVE_INFINITY;
} else {
maxWidth -= afterData;
}
if (maxWidth <= 0)
return text;
......