Buggy code:
static final int WordNext = 3009 ; static final int WordPrevious = 3010 ; static final int PREVIOUS_OFFSET_TRAILING = 0 ; static final int OFFSET_LEADING = 1 ; Color selectionBackground ; Color selectionForeground ; StyledTextContent content ; StyledTextRenderer renderer ; Listener listener ; TextChangeListener textChangeListener ; int verticalScrollOffset = 0 ; int horizontalScrollOffset = 0 ; int topIndex = 0 ; int topIndexY ; int clientAreaHeight = 0 ; int clientAreaWidth = 0 ; int tabLength = 4 ; int leftMargin ; int topMargin ; int rightMargin ; int bottomMargin ; int columnX ; int caretOffset = 0 ; int caretAlignment ; Point selection = new Point ( 0 , 0 ) ; Point clipboardSelection ; int selectionAnchor ; Point doubleClickSelection ; boolean editable = true ; boolean wordWrap = false ; boolean doubleClickEnabled = true ; boolean overwrite = false ; int textLimit = - 1 ; Hashtable keyActionMap = new Hashtable ( ) ; Color background = null ; Color foreground = null ; Clipboard clipboard ; int clickCount ; int autoScrollDirection = SWT . NULL ; int autoScrollDistance = 0 ; int lastTextChangeStart ; int lastTextChangeNewLineCount ; int lastTextChangeNewCharCount ; int lastTextChangeReplaceLineCount ; int lastTextChangeReplaceCharCount ; int lastLineBottom ; boolean isMirrored ; boolean bidiColoring = false ; Image leftCaretBitmap = null ; Image rightCaretBitmap = null ; int caretDirection = SWT . NULL ; int caretWidth = 0 ; Caret defaultCaret = null ; boolean updateCaretDirection = true ; boolean fixedLineHeight ; boolean dragDetect = true ; IME ime ; int alignment ; boolean justify ; int indent ; int lineSpacing ; static final boolean IS_CARBON ; static final boolean IS_GTK ; static final boolean IS_MOTIF ; static class Printing implements Runnable { static final int LEFT = 0 ; static final int CENTER = 1 ; static final int RIGHT = 2 ; Printer printer ; StyledTextRenderer printerRenderer ; StyledTextPrintOptions printOptions ; Rectangle clientArea ; FontData fontData ; Font printerFont ; Hashtable resources ; int tabLength ; GC gc ; int pageWidth ; int startPage ; int endPage ; int startLine ; int endLine ; boolean singleLine ; Point selection = null ; boolean mirrored ; int lineSpacing ; int printMargin ; Printing ( StyledText styledText , Printer printer , StyledTextPrintOptions printOptions ) { } void cacheLineData ( StyledText styledText ) { } StyledTextContent copyContent ( StyledTextContent original ) { } void dispose ( ) { } void init ( ) { } void print ( ) { } void printDecoration ( int page , boolean header , TextLayout layout ) { } void printDecorationSegment ( String segment , int alignment , int page , boolean header , TextLayout layout ) { } void printLine ( int x , int y , GC gc , Color foreground , Color background , TextLayout layout , TextLayout printLayout , int index ) { if ( background != null ) { Rectangle rect = layout . getBounds ( ) ; gc . setBackground ( background ) ; gc . fillRectangle ( x , y , rect . width , rect . height ) ; } if ( printOptions . printLineNumbers ) { FontMetrics metrics = layout . getLineMetrics ( 0 ) ; <START_BUG> printLayout . setAscent ( ( ( metrics . getAscent ( ) ) + ( metrics . getDescent ( ) ) ) ) ; <END_BUG> printLayout . setDescent ( metrics . getDescent ( ) ) ; String [ ] lineLabels = printOptions . lineLabels ; if ( lineLabels != null ) { if ( ( ( 0 <= index ) && ( index < ( lineLabels . length ) ) ) && ( ( lineLabels [ index ] ) != null ) ) { printLayout . setText ( lineLabels [ index ] ) ; } else { printLayout . setText ( "" ) ; } } else { printLayout . setText ( String . valueOf ( index ) ) ; } int paintX = ( x - ( printMargin ) ) - ( printLayout . getBounds ( ) . width ) ; printLayout . draw ( gc , paintX , y ) ; printLayout . setAscent ( ( - 1 ) ) ; printLayout . setDescent ( ( - 1 ) ) ; } gc . setForeground ( foreground ) ; layout . draw ( gc , x , y ) ; } public void run ( ) { } } class RTFWriter extends StyledText . TextWriter { static final int DEFAULT_FOREGROUND = 0 ; static final int DEFAULT_BACKGROUND = 1 ; Vector colorTable ; Vector fontTable ; boolean WriteUnicode ; public RTFWriter ( int start , int length ) { } public void close ( ) { } int getColorIndex ( Color color , int defaultIndex ) { } int getFontIndex ( Font font ) { } void setUnicode ( ) { } void write ( String string , int start , int end ) { } void writeHeader ( ) { } public void writeLine ( String line , int lineOffset ) { } public void writeLineDelimiter ( String lineDelimiter ) { } void writeStyledLine ( String line , int lineOffset , int [ ] ranges , StyleRange [ ] styles , Color lineBackground , int indent , int alignment , boolean justify ) { } } class TextWriter { private StringBuffer buffer ; private int startOffset ; private int endOffset ; private boolean isClosed = false ; public TextWriter ( int start , int length ) { } public void close ( ) { } public int getCharCount ( ) { } public int getStart ( ) { } public boolean isClosed ( ) { } public String toString ( ) { } void write ( String string ) { } void write ( String string , int offset ) { } void write ( int i ) { } void write ( char i ) { } public void writeLine ( String line , int lineOffset ) { }

Fix:
printLayout . setAscent ( ( ( metrics . getAscent ( ) ) + ( metrics . getLeading ( ) ) ) ) ;