Skip to content

h2d text.hx splitRawText can hang #1347

@hoseyjoe

Description

@hoseyjoe

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;
......

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions