Buggy code:
void checkLayout ( ) { } void computeRuns ( GC gc ) { } void destroy ( ) { } 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 ) { } public void draw ( GC gc , int x , int y , int selectionStart , int selectionEnd , Color selectionForeground , Color selectionBackground , int flags ) { } void drawLines ( boolean advance , int graphics , int x , int lineBaseline , int lineUnderlinePos , int lineBottom , TextLayout . StyleItem [ ] line , int index , int color , RECT clipRect , int alpha ) { } RECT drawBorder ( boolean advance , int graphics , int x , int y , int lineHeight , int color , int selectionColor , boolean fullSelection , RECT clipRect , RECT rect , int alpha , TextLayout . StyleItem [ ] line , int index , int selectionStart , int selectionEnd ) { } int [ ] computePolyline ( int left , int top , int right , int bottom ) { } 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 ( ) { } 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 ( ) { } 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 ) { } TextLayout . StyleItem [ ] reorder ( TextLayout . StyleItem [ ] runs , boolean terminate ) { } public void setAlignment ( int alignment ) { } public void setAscent ( int ascent ) { } public void setDescent ( int descent ) { } 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 ) { } public void setText ( String text ) { } public void setWidth ( int width ) { } boolean shape ( int hdc , TextLayout . StyleItem run , char [ ] chars , int [ ] glyphCount , int maxGlyphs ) { int hr = OS . ScriptShape ( hdc , run . psc , chars , chars . length , maxGlyphs , run . analysis , run . glyphs , run . clusters , run . visAttrs , glyphCount ) ; run . glyphCount = glyphCount [ 0 ] ; if ( hr != ( OS . USP_E_SCRIPT_NOT_IN_FONT ) ) { SCRIPT_FONTPROPERTIES fp = new SCRIPT_FONTPROPERTIES ( ) ; fp . cBytes = SCRIPT_FONTPROPERTIES . sizeof ; OS . ScriptGetFontProperties ( hdc , run . psc , fp ) ; short [ ] glyphs = new short [ glyphCount [ 0 ] ] ; OS . MoveMemory ( glyphs , run . glyphs , ( ( glyphs . length ) * 2 ) ) ; int i ; for ( i = 0 ; i < ( glyphs . length ) ; i ++ ) { <START_BUG> if ( ( glyphs [ i ] ) == ( fp . wgDefault ) ) <END_BUG> break ; } if ( i == ( glyphs . length ) ) return true ; } if ( ( run . psc ) != 0 ) { OS . ScriptFreeCache ( run . psc ) ; glyphCount [ 0 ] = 0 ; OS . MoveMemory ( run . psc , new int [ 1 ] , PTR_SIZEOF ) ; } run . glyphCount = 0 ; return false ; } void shape ( final int hdc , final TextLayout . StyleItem run ) { } int validadeOffset ( int offset , int step ) { } public String toString ( ) { } int translateOffset ( int offset ) { } int untranslateOffset ( int offset ) { } }

Fix:
if ( ( ( glyphs [ i ] ) == ( fp . wgDefault ) ) || ( ( glyphs [ i ] ) == ( fp . wgInvalid ) ) )