Buggy code:
int [ ] segments ; int tabsPtr ; int [ ] breaks ; int [ ] hardBreaks ; int [ ] lineX ; int [ ] lineWidth ; int [ ] lineHeight ; int [ ] lineAscent ; static final int TAB_COUNT = 32 ; static final char ZWS = '​' ; public TextLayout ( Device device ) { } void checkLayout ( ) { } void computeRuns ( ) { } public void dispose ( ) { } public void draw ( GC gc , int x , int y ) { } public void draw ( GC gc , int x , int y , int selectionStart , int selectionEnd , Color selectionForeground , Color selectionBackground ) { } void freeRuns ( ) { } 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 ( ) { } public int getLevel ( int offset ) { } public int [ ] getLineOffsets ( ) { } public int getLineIndex ( int offset ) { } public Rectangle getLineBounds ( int lineIndex ) { } public int getLineCount ( ) { } public FontMetrics getLineMetrics ( int lineIndex ) { } 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 ( ) { } public int getPreviousOffset ( int index , int movement ) { } public int [ ] getRanges ( ) { } public int [ ] getSegments ( ) { } public int getSpacing ( ) { } public TextStyle getStyle ( int offset ) { } public TextStyle [ ] getStyles ( ) { } public int [ ] getTabs ( ) { } public String getText ( ) { } public int getWidth ( ) { } public boolean isDisposed ( ) { } int regionToRects ( int message , int rgn , int r , int context ) { } public void setAlignment ( int alignment ) { } public void setAscent ( int ascent ) { } public void setDescent ( int descent ) { } void setLayoutControl ( int tag , int value , int size ) { } public void setFont ( Font font ) { } public void setIndent ( int indent ) { } public void setJustify ( boolean justify ) { } public void setOrientation ( int orientation ) { } public void setSegments ( int [ ] segments ) { } public void setSpacing ( int spacing ) { } public void setStyle ( TextStyle style , int start , int end ) { } public void setTabs ( int [ ] tabs ) { checkLayout ( ) ; if ( ( ( this . tabs ) == null ) && ( tabs == null ) ) return ; if ( ( ( this . tabs ) != null ) && ( tabs != null ) ) { if ( ( this . tabs . length ) == ( tabs . length ) ) { int i ; for ( i = 0 ; i < ( tabs . length ) ; i ++ ) { if ( ( this . tabs [ i ] ) != ( tabs [ i ] ) ) break ; } if ( i == ( tabs . length ) ) return ; } } freeRuns ( ) ; this . tabs = tabs ; if ( ( tabsPtr ) != 0 ) OS . DisposePtr ( tabsPtr ) ; tabsPtr = 0 ; if ( tabs == null ) { OS . ATSUSetTabArray ( layout , 0 , 0 ) ; } else { ATSUTab tab = new ATSUTab ( ) ; tab . tabPosition = OS . Long2Fix ( 0 ) ; int length = Math . max ( TextLayout . TAB_COUNT , tabs . length ) ; int ptr = tabsPtr = OS . NewPtr ( ( ( ATSUTab . sizeof ) * length ) ) ; int i ; int offset ; for ( i = 0 , offset = ptr ; i < ( tabs . length ) ; i ++ , offset += ATSUTab . sizeof ) { tab . tabType = ( ( short ) ( OS . kATSULeftTab ) ) ; <START_BUG> tab . tabPosition += OS . Long2Fix ( tabs [ i ] ) ; <END_BUG> OS . memcpy ( offset , tab , sizeof ) ; } int width = ( ( i - 2 ) >= 0 ) ? ( tabs [ ( i - 1 ) ] ) - ( tabs [ ( i - 2 ) ] ) : tabs [ ( i - 1 ) ] ; if ( width > 0 ) { for ( ; i < length ; i ++ , offset += ATSUTab . sizeof ) { tab . tabType = ( ( short ) ( OS . kATSULeftTab ) ) ; tab . tabPosition += OS . Long2Fix ( width ) ; OS . memcpy ( offset , tab , sizeof ) ; } } OS . ATSUSetTabArray ( layout , ptr , i ) ; } } public void setText ( String text ) { } public void setWidth ( int width ) { } public String toString ( ) { } int translateOffset ( int offset ) { } int untranslateOffset ( int offset ) { } }

Fix:
tab . tabPosition = OS . Long2Fix ( tabs [ i ] ) ;