@Test
public void testTextStyling()
                        throws Exception {

    BufferedImage img = new BufferedImage( 1000, 1000, TYPE_INT_ARGB );
    long time = currentTimeMillis();
    Graphics2D g = img.createGraphics();
    GeometryFactory geomFac = new GeometryFactory();
    Java2DRenderer r2d = new Java2DRenderer( g, img.getWidth(), img.getHeight(),
                                             geomFac.createEnvelope( new double[] { 0, 0 },
                                                                     new double[] { 5000d, 5000d }, mapcs ) );
    Java2DTextRenderer r = new Java2DTextRenderer( r2d );
    LinkedList<Point> points = new LinkedList<Point>();
    for ( int i = 0; i < 50; ++i ) {
        points.add( geomFac.createPoint( null, new double[] { 3500 - ( i + 1 ) * 100 , 4500 - ( i + 1 ) * 250 }, mapcs ) );
    }
    String text = "AbC \u00c4\u00fc\u00d6";
    TextStyling styling = new TextStyling();
    r.render( styling, text, points.poll() );
    styling.fill = new Fill();
    styling.fill.graphic = new Graphic();
    styling.fill.graphic.image = fill;
    r.render( styling, text, points.poll() );
    styling.halo = new Halo();
    styling.halo.radius = 3;
    r.render( styling, text, points.poll() );
    styling.font.fontSize = 18;
    styling.halo.fill = styling.fill;
    styling.fill = new Fill();
    styling.fill.color = black;
    r.render( styling, text, points.poll() );
    styling.halo.fill.graphic = null;
    styling.halo.fill.color = black;
    styling.halo.radius = 3;
    styling.fill.color = white;
    r.render( styling, text, points.poll() );
    styling.fill.graphic = new Graphic();
    styling.fill.graphic.image = fill;
    r.render( styling, text, points.poll() );
    styling.font.fontStyle = NORMAL;
    r.render( styling, text, points.poll() );
    styling.font.fontStyle = OBLIQUE;
    r.render( styling, text, points.poll() );
    styling.font.fontStyle = ITALIC;
    r.render( styling, text, points.poll() );
    styling.font.bold = true;
    r.render( styling, text, points.poll() );
    styling.font.fontFamily.add( "Times New Roman" );
    r.render( styling, text, points.poll() );
    r.render( styling, text, points.peek() );
    styling.rotation = 180;
    r.render( styling, text, points.poll() );
    styling.rotation = 90;
    r.render( styling, text, points.poll() );
    styling.rotation = 0;
    r.render( styling, text, points.peek() );
    styling.displacementX = -10;
    styling.displacementY = -10;
    r.render( styling, text, points.poll() );
    styling.displacementX = 0;
    styling.displacementY = 0;
    styling.anchorPointX = 0;
    r.render( styling, text, points.peek() );
    styling.anchorPointX = 1;
    r.render( styling, text, points.poll() );
    r.render( styling, text, points.poll() );
    g.dispose();
    long time2 = currentTimeMillis();
    List<String> texts = new LinkedList<String>();
    texts.add( "standard dialog font, size 10, black" );
    texts.add( "same, filled with 'image'" );
    texts.add( "same, with 3 pixel while halo" );
    texts.add( "same, size 18, color black, halo filled with 'image'" );
    texts.add( "same, black halo, white color" );
    texts.add( "same, filled with 'image'" );
    texts.add( "same" );
    texts.add( "same, italic font, warning message that 'oblique' is not supported" );
    texts.add( "same, italic font" );
    texts.add( "same, bold font" );
    texts.add( "same, Times New Roman font" );
    texts.add( "same, once normal, once rotated by 180°, should be on top on each other" );
    texts.add( "same, rotated by 90° clockwise" );
    texts.add( "same, no rotation, one normal, one displaced by 10 pixels to left and top" );
    texts.add( "same, one ending in the middle of the screen, one starting there" );
    texts.add( "same, only one ending in the middle of the screen" );
    validateImage( img, time2 - time, "textstyling" );
}