import java.applet.*; 
import java.awt.*; 

    public class FontMetricsExample extends Applet
      { 
      public void paint (Graphics g)
        {
        Font fFont;                      
        FontMetrics fm;
        int x, y;

        fFont = new Font ("Helvetica", Font.ITALIC | Font.BOLD, 120);
        g.setFont (fFont);

        fm = g.getFontMetrics ();
        System.out.println ("font            = " + fm.getFont ());
        System.out.println ("font height     = " + fm.getHeight ()     + " pixels");
        System.out.println ();
        System.out.println ("font leading    = " + fm.getLeading ()    + " pixels");
        System.out.println ("font ascent     = " + fm.getAscent ()     + " pixels");
        System.out.println ("font descent    = " + fm.getDescent ()    + " pixels");
        System.out.println ();
        System.out.println ("char width 'm'  = " + fm.charWidth ('m')  + " pixels");
        System.out.println ("max advance     = " + fm.getMaxAdvance () + " pixels");
        System.out.println ("max ascent      = " + fm.getMaxAscent ()  + " pixels");
        System.out.println ("max descent     = " + fm.getMaxDescent () + " pixels");

        x = 10;
        y = fm.getHeight ();
        g.drawString ("Java", x, y);
        }
      } 

