Buggy code:
} } if ( ( bulletsIndices ) != null ) { bullets = null ; bulletsIndices = null ; } if ( ( bullets ) != null ) { for ( int i = 0 ; i < ( bullets . length ) ; i ++ ) { if ( ( bullets [ i ] . indexOf ( lineIndex ) ) != ( - 1 ) ) { bullet = bullets [ i ] ; break ; } } } ranges = this . ranges ; styles = this . styles ; styleCount = this . styleCount ; if ( ranges != null ) { rangeStart = getRangeIndex ( lineOffset , ( - 1 ) , ( styleCount << 1 ) ) ; } else { rangeStart = getRangeIndex ( lineOffset , ( - 1 ) , styleCount ) ; } } if ( bullet != null ) { StyleRange style = bullet . style ; GlyphMetrics metrics = style . metrics ; indent += metrics . width ; } layout . setFont ( regularFont ) ; layout . setAscent ( ascent ) ; layout . setDescent ( descent ) ; layout . setText ( line ) ; layout . setOrientation ( orientation ) ; layout . setSegments ( segments ) ; layout . setWidth ( width ) ; layout . setSpacing ( lineSpacing ) ; layout . setTabs ( new int [ ] { tabWidth } ) ; layout . setIndent ( indent ) ; layout . setAlignment ( alignment ) ; layout . setJustify ( justify ) ; int lastOffset = 0 ; int length = line . length ( ) ; if ( styles != null ) { if ( ranges != null ) { int rangeCount = styleCount << 1 ; for ( int i = rangeStart ; i < rangeCount ; i += 2 ) { int start ; int end ; if ( lineOffset > ( ranges [ i ] ) ) { start = 0 ; end = Math . min ( length , ( ( ( ranges [ ( i + 1 ) ] ) - lineOffset ) + ( ranges [ i ] ) ) ) ; } else { start = ( ranges [ i ] ) - lineOffset ; end = Math . min ( length , ( start + ( ranges [ ( i + 1 ) ] ) ) ) ; } if ( start >= length ) break ; if ( lastOffset < start ) { layout . setStyle ( null , lastOffset , ( start - 1 ) ) ; } layout . setStyle ( getStyleRange ( styles [ ( i > > 1 ) ] ) , start , end ) ; lastOffset = Math . max ( lastOffset , end ) ; } } else { for ( int i = rangeStart ; i < styleCount ; i ++ ) { int start ; int end ; if ( lineOffset > ( styles [ i ] . start ) ) { start = 0 ; end = Math . min ( length , ( ( ( styles [ i ] . length ) - lineOffset ) + ( styles [ i ] . start ) ) ) ; } else { start = ( styles [ i ] . start ) - lineOffset ; end = Math . min ( length , ( start + ( styles [ i ] . length ) ) ) ; } if ( start >= length ) break ; if ( lastOffset < start ) { layout . setStyle ( null , lastOffset , ( start - 1 ) ) ; } layout . setStyle ( getStyleRange ( styles [ i ] ) , start , end ) ; lastOffset = Math . max ( lastOffset , end ) ; } } } if ( lastOffset < length ) layout . setStyle ( null , lastOffset , length ) ; <START_BUG> if ( styledText . isFixedLineHeight ( ) ) { <END_BUG> int index = - 1 ; int lineCount = layout . getLineCount ( ) ; int height = getLineHeight ( ) ; for ( int i = 0 ; i < lineCount ; i ++ ) { int lineHeight = layout . getLineBounds ( i ) . height ; if ( lineHeight > height ) { height = lineHeight ; index = i ; } } if ( index != ( - 1 ) ) { FontMetrics metrics = layout . getLineMetrics ( index ) ; ascent = ( metrics . getAscent ( ) ) + ( metrics . getLeading ( ) ) ; descent = metrics . getDescent ( ) ; if ( ( layouts ) != null ) { for ( int i = 0 ; i < ( layouts . length ) ; i ++ ) { if ( ( ( layouts [ i ] ) != null ) && ( ( layouts [ i ] ) != layout ) ) { layouts [ i ] . setAscent ( ascent ) ; layouts [ i ] . setDescent ( descent ) ; } } } if ( ( styledText . verticalScrollOffset ) != 0 ) { int topIndex = styledText . topIndex ; int topIndexY = styledText . topIndexY ; int lineHeight = getLineHeight ( ) ; if ( topIndexY >= 0 ) { styledText . verticalScrollOffset = ( ( ( topIndex - 1 ) * lineHeight ) + lineHeight ) - topIndexY ; } else { styledText . verticalScrollOffset = ( topIndex * lineHeight ) - topIndexY ; } } styledText . calculateScrollBars ( ) ; if ( styledText . isBidiCaret ( ) ) styledText . createCaretBitmaps ( ) ; styledText . caretDirection = SWT . NULL ; styledText . setCaretLocation ( ) ; styledText . redraw ( ) ; } } return layout ; } int getWidth ( ) { }

Fix:
if ( ( ( styledText ) != null ) && ( styledText . isFixedLineHeight ( ) ) ) {