Buggy code:
public int getAlignment ( ) { } public int getAscent ( ) { } public Rectangle getBounds ( ) { } public Rectangle getBounds ( int start , int end ) { } public int getDescent ( ) { } public Font getFont ( ) { } public int getIndent ( ) { } public boolean getJustify ( ) { } int getItemFont ( TextLayout . StyleItem item ) { } public int getLevel ( int offset ) { } public Rectangle getLineBounds ( int lineIndex ) { } public int getLineCount ( ) { } int getLineIndent ( int lineIndex ) { } public int getLineIndex ( int offset ) { } public FontMetrics getLineMetrics ( int lineIndex ) { } public int [ ] getLineOffsets ( ) { } public Point getLocation ( int offset , boolean trailing ) { } public int getNextOffset ( int offset , int movement ) { } int _getOffset ( int offset , int movement , boolean forward ) { } public int getOffset ( Point point , int [ ] trailing ) { } public int getOffset ( int x , int y , int [ ] trailing ) { } public int getOrientation ( ) { } void getPartialSelection ( TextLayout . StyleItem run , int selectionStart , int selectionEnd , RECT rect ) { } public int getPreviousOffset ( int offset , int movement ) { } public int [ ] getRanges ( ) { } public int [ ] getSegments ( ) { } String getSegmentsText ( ) { } public int getSpacing ( ) { } public TextStyle getStyle ( int offset ) { } public TextStyle [ ] getStyles ( ) { } public int [ ] getTabs ( ) { } public String getText ( ) { } public int getWidth ( ) { } public boolean isDisposed ( ) { } TextLayout . StyleItem [ ] itemize ( ) { } TextLayout . StyleItem [ ] merge ( int items , int itemCount ) { if ( ( styles . length ) > ( stylesCount ) ) { TextLayout . StyleItem [ ] newStyles = new TextLayout . StyleItem [ stylesCount ] ; System . arraycopy ( styles , 0 , newStyles , 0 , stylesCount ) ; styles = newStyles ; } int count = 0 ; int start = 0 ; int end = segmentsText . length ( ) ; int itemIndex = 0 ; int styleIndex = 0 ; TextLayout . StyleItem [ ] runs = new TextLayout . StyleItem [ itemCount + ( stylesCount ) ] ; SCRIPT_ITEM scriptItem = new SCRIPT_ITEM ( ) ; int itemLimit = - 1 ; int nextItemIndex = 0 ; boolean linkBefore = false ; while ( start < end ) { TextLayout . StyleItem item = new TextLayout . StyleItem ( ) ; item . start = start ; item . style = styles [ styleIndex ] . style ; runs [ ( count ++ ) ] = item ; OS . MoveMemory ( scriptItem , ( items + ( itemIndex * ( SCRIPT_ITEM . sizeof ) ) ) , sizeof ) ; item . analysis = scriptItem . a ; scriptItem . a = new SCRIPT_ANALYSIS ( ) ; if ( linkBefore ) { item . analysis . fLinkBefore = true ; linkBefore = false ; } char ch = segmentsText . charAt ( start ) ; switch ( ch ) { case '\r' : case '\n' : item . lineBreak = true ; break ; case '\t' : item . tab = true ; break ; } if ( itemLimit == ( - 1 ) ) { nextItemIndex = itemIndex + 1 ; OS . MoveMemory ( scriptItem , ( items + ( nextItemIndex * ( SCRIPT_ITEM . sizeof ) ) ) , sizeof ) ; itemLimit = scriptItem . iCharPos ; <START_BUG> if ( ( ch == '\r' ) && ( ( segmentsText . charAt ( itemLimit ) ) == '\n' ) ) { <END_BUG> nextItemIndex = itemIndex + 2 ; OS . MoveMemory ( scriptItem , ( items + ( nextItemIndex * ( SCRIPT_ITEM . sizeof ) ) ) , sizeof ) ; itemLimit = scriptItem . iCharPos ; } } int styleLimit = translateOffset ( styles [ ( styleIndex + 1 ) ] . start ) ; if ( styleLimit <= itemLimit ) { styleIndex ++ ; start = styleLimit ; if ( ( ( start < itemLimit ) && ( 0 < start ) ) && ( start < end ) ) { char pChar = segmentsText . charAt ( ( start - 1 ) ) ; char tChar = segmentsText . charAt ( start ) ; if ( ( Compatibility . isLetter ( pChar ) ) && ( Compatibility . isLetter ( tChar ) ) ) { item . analysis . fLinkAfter = true ; linkBefore = true ; } } } if ( itemLimit <= styleLimit ) { itemIndex = nextItemIndex ; start = itemLimit ; itemLimit = - 1 ; } item . length = start - ( item . start ) ; } TextLayout . StyleItem item = new TextLayout . StyleItem ( ) ; item . start = end ; OS . MoveMemory ( scriptItem , ( items + ( itemCount * ( SCRIPT_ITEM . sizeof ) ) ) , sizeof ) ; item . analysis = scriptItem . a ; runs [ ( count ++ ) ] = item ; if ( ( runs . length ) != count ) { TextLayout . StyleItem [ ] result = new TextLayout . StyleItem [ count ] ; System . arraycopy ( runs , 0 , result , 0 , count ) ; return result ; } return runs ; } TextLayout . StyleItem [ ] reorder ( TextLayout . StyleItem [ ] runs , boolean terminate ) { } public void setAlignment ( int alignment ) { }

Fix:
if ( ( ( nextItemIndex < itemCount ) && ( ch == '\r' ) ) && ( ( segmentsText . charAt ( itemLimit ) ) == '\n' ) ) {