Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4271502

FontMetrics.getHeight() method doesn't return correct height.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P1 P1
    • None
    • 1.2.3
    • client-libs
    • 2d
    • x86
    • generic



      Name: clC74495 Date: 09/14/99

      =20
      The applet made by using JDK1.1.2 dosen't work properly when=20
      using Java plug-in(ver1.2.2), in the following case;
      The height of cell which is obtained by FontMetrics.getHeight()=20
      method is not correct.
      Also FontMetrics.getDescent(),FontMetrics.getAscent() is not
      correct.

      Here are examples of behavior of getXXX() method.

                                     NetcapeJDK1.1 JavaPlug-in1.2.2
               schemeFM.getHeight() 14(true) 20=81ifalse=81j
               schemeFM.getDescent() =81@2(true) 5=81ifalse=81j
               schemeFM.getAscent() 2(true) 5=81ifalse=81j

      Sample source code which includes getHeight() method is below;

      public class getHeightApplet extends Applet {

        public static final Font LIST_FONT =3D new Font("monospaced", Font.PLAIN,=
       14);
        private final Font SCHEMEFONT =3D LIST_FONT; // font for cell
        // metrics of font for cell
        private FontMetrics schemeFM =3D this.getFontMetrics(SCHEMEFONT);
        private Label label1 =3D new Label( "Font Size =3D 14" );
        private Label lblHeight =3D new Label();

        //architect of applet
        public getHeightApplet() {
              add( label1 );
              add( lblHeight );

              lblHeight.setText( "getHeight()=3D" + schemeFM.getHeight() );

        }

        //initialize applet
        public void init() {
        }

      }
      (Review ID: 95227)=20
      ======================================================================

            pkejriwasunw Parry Kejriwal (Inactive)
            clucasius Carlos Lucasius (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: