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

Method equals works incorrectly for FontMetrics instances

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.5.1

      Description



      Name: aaC67449 Date: 07/30/98


       
      The method equals returns false for identically initialized instances of FontMetrics. It happens only when JAVA2D_USEPLATFORMFONT enviroment variable is not seted.
       
       See the example and its output.
       

      This bug is introduced in JDK1.2-beta4 and later, all works correctly in JDK1.2-beta3.

      ------------------Example-----------------------------------

      import java.awt.*;

      public class Test{
          public static void main(String argv[]) {
                Button c= new Button();
                Font f = new Font("test",Font.BOLD,12);
      if(!c.getFontMetrics(f).equals(c.getFontMetrics(f)))
      System.out.println("Failed:"+c.getFontMetrics(f)+"!="+c.getFontMetrics(f));
                else
      System.out.println("OKAY");


          }
      }

      -------------------Output------------------------------------
      Failed:sun.awt.font.FontDesignMetrics[font=java.awt.Font[family=Times,name=test,style=bold,size=12]ascent=9, descent=3, height=14]!=sun.awt.font.FontDesignMetrics[font=java.awt.Font[family=Times,name=test,style=bold,size=12]ascent=9, descent=3, height=14]
       

      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            ehawkessunw Eric Hawkes (Inactive)
            Reporter:
            aalievsunw Artem Aliev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: