Buggy code:
public static boolean isFontInstalled ( String name ) { } public static String getInstalledFont ( String name ) { } public static FontData getFont ( int style ) { } public static FontData getFont ( int style , int size ) { } public static Cursor createBlankCursor ( Display display ) { } private static BufferedImage g2dImg ; private static Graphics2D g2d ; public static Graphics2D getGraphics2D ( ) { } public static Path getTextShape ( Font font , String text , Rectangle bounds ) { } public static org . eclipse . swt . graphics . Rectangle getTextBounds ( Font font , String text ) { } public static ArrayList < Geometry > createTextGeometry2D ( String text , Rectangle bounds , int style , Point insets , boolean foreground ) { } public static ArrayList < Geometry > createTextGeometry2D ( FontData font , String text , Rectangle bounds , int style , Point insets , boolean foreground ) { ArrayList < Geometry > geos = new ArrayList < Geometry > ( ) ; if ( ( ( text == null ) || ( ( text . length ( ) ) == 0 ) ) || ( bounds == null ) ) return geos ; if ( insets == null ) insets = new Point ( 0 , 0 ) ; Display display = Display . getDefault ( ) ; Font thisFont = new Font ( display , font ) ; TextLayout tl = new TextLayout ( display ) ; String [ ] s = text . split ( "\n" ) ; tl . setFont ( thisFont ) ; tl . setText ( text ) ; org . eclipse . swt . graphics . Rectangle tlBnds = tl . getBounds ( ) ; int align = ( style & ( LCARS . ES_LABEL ) ) > > 4 ; if ( align > ( LCARS . ES_LABEL_SE ) ) align = ( LCARS . ES_LABEL_NW ) > > 4 ; int hAlign = align // 3 ; int tx = ( bounds . x ) + ( insets . x ) ; int ty = ( bounds . y ) + ( insets . y ) ; int w = ( bounds . width ) - ( ( insets . x ) * 2 ) ; int h = ( bounds . height ) - ( ( insets . y ) * 2 ) ; if ( ( w <= 0 ) || ( h <= 0 ) ) return geos ; switch ( hAlign ) { case 0 : tl . setAlignment ( LEFT ) ; break ; case 1 : tl . setAlignment ( CENTER ) ; tx += ( w - ( tlBnds . width ) ) // 2 ; break ; case 2 : tl . setAlignment ( RIGHT ) ; tx += ( w - ( tlBnds . width ) ) - ( insets . x ) ; break ; default : return geos ; } switch ( align % 3 ) { case 0 : break ; case 1 : ty += ( h - ( tlBnds . height ) ) // 2 ; break ; case 2 : ty += ( h - ( tlBnds . height ) ) - ( insets . y ) ; break ; default : return geos ; } int n = tl . getLineCount ( ) ; for ( int i = 0 ; i < n ; i ++ ) { org . eclipse . swt . graphics . Rectangle linBnds = tl . getLineBounds ( i ) ; if ( ( linBnds . y ) > h ) break ; int x = ( linBnds . x ) + tx ; int y = ( linBnds . y ) + ty ; <START_BUG> GText gt = new GText ( s [ i ] , new org . eclipse . swt . graphics . Rectangle ( x , y , Math . min ( linBnds . width , ( w - ( linBnds . x ) ) ) , Math . min ( linBnds . height , ( h - ( linBnds . y ) ) ) ) , font , foreground ) ; <END_BUG> geos . add ( gt ) ; } thisFont . dispose ( ) ; return geos ; } public static SwtColor interpolateColors ( SwtColor clr1 , SwtColor clr2 , float value ) { } public static AbstractList < Class < ? extends Panel > > getMainPanelClasses ( ) { } public static Vector < Class < ? > > getSpeechEngines ( ) { } public static Class < ? > [ ] getClassesInPackage ( String packageName , String regexFilter ) { } private static TreeSet < String > findClasses ( String path , String packageName , Pattern regex ) throws IOException , MalformedURLException { } public static File getResourceFile ( String pckg , String file ) throws FileNotFoundException { } public static File getResourceFile ( String file ) throws FileNotFoundException { } public static String loadTextFile ( File file ) throws FileNotFoundException { } public static String loadTextResource ( String name ) throws FileNotFoundException { } public static String abbreviate ( String string , int length , boolean left ) { } private static String hostName ; private static Registry rmiRegistry ; public static String HttpGet ( String url ) { } public static InetAddress getIP ( boolean verbose ) { } public static String getHostName ( ) { } public static int getRmiPort ( ) { } public static String getRmiName ( ) { } public static Registry getRmiRegistry ( ) throws RemoteException { } public static HashMap < String , RmiPanelAdapter > getPanelAdapters ( ) { } @ Deprecated public static void log ( String pfx , String msg ) { } @ Deprecated public static void err ( String pfx , String msg ) { }

Fix:
GText gt = new GText ( s [ i ] , x , y , font , foreground ) ;