Font font = FontUtil.getFont( c ); LineMetrics lm = font.getLineMetrics( text, ( (Graphics2D)c.getGraphics() ).getFontRenderContext() ); int w = FontUtil.len( c, text, font ); int h = FontUtil.lineHeight( c );
Font font = style.getFont(c.getCtx()); LineMetrics lm = font.getLineMetrics(text, ((Graphics2D) c.getGraphics()).getFontRenderContext()); int w = FontUtil.len(c, text, font); int h = FontUtil.lineHeight(c);
    private static void drawText( Context c, Box box, IdentValue listStyle ) {        String text = "";        if ( listStyle == IdentValue.DECIMAL ) {            text = box.list_count + ".";        }        if ( listStyle == IdentValue.LOWER_LATIN ) {            text = toLatin( box.list_count ).toLowerCase() + ".";        }        if ( listStyle == IdentValue.UPPER_LATIN ) {            text = toLatin( box.list_count ).toUpperCase() + ".";        }        if ( listStyle == IdentValue.LOWER_ROMAN ) {            text = toRoman( box.list_count ).toLowerCase() + ".";        }        if ( listStyle == IdentValue.UPPER_ROMAN ) {            text = toRoman( box.list_count ).toUpperCase() + ".";        }        CalculatedStyle style = c.getCurrentStyle();        Font font = FontUtil.getFont( c );        LineMetrics lm = font.getLineMetrics( text, ( (Graphics2D)c.getGraphics() ).getFontRenderContext() );        int w = FontUtil.len( c, text, font );        int h = FontUtil.lineHeight( c );        int x = box.x - w - 2;        int y = box.y + h;        y -= (int)lm.getDescent();        c.getGraphics().setFont( font );        c.getGraphics().drawString( text, x, y );    }