Buggy code:
start = run . length ; } else { i = firstIndice ; run = allRuns [ i ] ; start = Math . max ( 1 , firstStart ) ; } } breakRun ( run ) ; while ( start < ( run . length ) ) { OS . MoveMemory ( logAttr , ( ( run . psla ) + ( start * ( SCRIPT_LOGATTR . sizeof ) ) ) , sizeof ) ; if ( ! ( logAttr . fWhiteSpace ) ) break ; start ++ ; } if ( ( 0 < start ) && ( start < ( run . length ) ) ) { TextLayout . StyleItem newRun = new TextLayout . StyleItem ( ) ; newRun . start = ( run . start ) + start ; newRun . length = ( run . length ) - start ; newRun . style = run . style ; newRun . analysis = cloneScriptAnalysis ( run . analysis ) ; run . free ( ) ; run . length = start ; OS . SelectObject ( srcHdc , getItemFont ( run ) ) ; run . analysis . fNoGlyphIndex = false ; shape ( srcHdc , run ) ; OS . SelectObject ( srcHdc , getItemFont ( newRun ) ) ; newRun . analysis . fNoGlyphIndex = false ; shape ( srcHdc , newRun ) ; TextLayout . StyleItem [ ] newAllRuns = new TextLayout . StyleItem [ ( allRuns . length ) + 1 ] ; System . arraycopy ( allRuns , 0 , newAllRuns , 0 , ( i + 1 ) ) ; System . arraycopy ( allRuns , ( i + 1 ) , newAllRuns , ( i + 2 ) , ( ( ( allRuns . length ) - i ) - 1 ) ) ; allRuns = newAllRuns ; allRuns [ ( i + 1 ) ] = newRun ; } if ( i != ( ( allRuns . length ) - 2 ) ) { run . softBreak = run . lineBreak = true ; } } lineWidth += run . width ; if ( run . lineBreak ) { lineStart = i + 1 ; lineWidth = ( run . softBreak ) ? 0 : indent ; lineCount ++ ; } } lineWidth = 0 ; runs = new TextLayout . StyleItem [ lineCount ] [ ] ; lineOffset = new int [ lineCount + 1 ] ; lineY = new int [ lineCount + 1 ] ; this . lineWidth = new int [ lineCount ] ; int lineRunCount = 0 ; int line = 0 ; int ascent = Math . max ( 0 , this . ascent ) ; int descent = Math . max ( 0 , this . descent ) ; TextLayout . StyleItem [ ] lineRuns = new TextLayout . StyleItem [ allRuns . length ] ; for ( int i = 0 ; i < ( allRuns . length ) ; i ++ ) { TextLayout . StyleItem run = allRuns [ i ] ; lineRuns [ ( lineRunCount ++ ) ] = run ; lineWidth += run . width ; ascent = Math . max ( ascent , run . ascent ) ; descent = Math . max ( descent , run . descent ) ; if ( ( run . lineBreak ) || ( i == ( ( allRuns . length ) - 1 ) ) ) { <START_BUG> if ( ( lineRunCount == 1 ) && ( i == ( ( allRuns . length ) - 1 ) ) ) { <END_BUG> TEXTMETRIC lptm = ( OS . IsUnicode ) ? ( ( TEXTMETRIC ) ( new TEXTMETRICW ( ) ) ) : new TEXTMETRICA ( ) ; OS . SelectObject ( srcHdc , getItemFont ( run ) ) ; OS . GetTextMetrics ( srcHdc , lptm ) ; run . ascent = lptm . tmAscent ; run . descent = lptm . tmDescent ; ascent = Math . max ( ascent , run . ascent ) ; descent = Math . max ( descent , run . descent ) ; } runs [ line ] = new TextLayout . StyleItem [ lineRunCount ] ; System . arraycopy ( lineRuns , 0 , runs [ line ] , 0 , lineRunCount ) ; if ( ( ( ( justify ) && ( ( wrapWidth ) != ( - 1 ) ) ) && ( run . softBreak ) ) && ( lineWidth > 0 ) ) { if ( line == 0 ) { lineWidth += indent ; } else { TextLayout . StyleItem [ ] previousLine = runs [ ( line - 1 ) ] ; TextLayout . StyleItem previousRun = previousLine [ ( ( previousLine . length ) - 1 ) ] ; if ( ( previousRun . lineBreak ) && ( ! ( previousRun . softBreak ) ) ) { lineWidth += indent ; } } int hHeap = OS . GetProcessHeap ( ) ; int newLineWidth = 0 ; for ( int j = 0 ; j < ( runs [ line ] . length ) ; j ++ ) { TextLayout . StyleItem item = runs [ line ] [ j ] ; int iDx = ( ( item . width ) * ( wrapWidth ) ) // lineWidth ; if ( iDx != ( item . width ) ) { item . justify = OS . HeapAlloc ( hHeap , HEAP_ZERO_MEMORY , ( ( item . glyphCount ) * 4 ) ) ; if ( ( item . justify ) == 0 ) SWT . error ( ERROR_NO_HANDLES ) ; OS . ScriptJustify ( item . visAttrs , item . advances , item . glyphCount , ( iDx - ( item . width ) ) , 2 , item . justify ) ; item . width = iDx ; } newLineWidth += item . width ;

Fix:
if ( ( lineRunCount == 1 ) && ( ( i == ( ( allRuns . length ) - 1 ) ) || ( ! ( run . softBreak ) ) ) ) {