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

charWidth(newline) incorrectly reports a non-zero value.

    XMLWordPrintable

Details

    • 2d
    • kestrel
    • x86
    • windows_98

    Description



      Name: wl91122 Date: 09/07/99


      A "return" character '\n' should have a width of zero, and the
      JDK1.1 correctly reports this using charWidth('\n'), but
      NOT JDK1.2! My application crashes under JDK1.2 because of
      this. This bug may be similar to bugs 4069228, 4031360, and
      4168118, but this one is more widespread: its there seemingly
      independent of font.

      Compile and run the following code under both JDK1.1 and JDK1.2
      to see the difference:

      import java.awt.*;
      import java.applet.*;
      import java.lang.*;

      public class Bug1{
          
          public static void main(String args[]){
      FontMetrics FM;
      TextArea t = new TextArea(5,40);

      FM = t.getFontMetrics(new Font("Dialog",Font.PLAIN,12));

      System.out.println("Bug1: A java 1.2 bug in charWidth(): \n");
      System.out.println("Width of \\n = "+FM.charWidth('\n'));
      System.exit(0);
          }
      }

      For JDK1.1, the output is the expected:
      Bug1: A java 1.2 bug in charWidth():

      Width of \n = 0


      But on windows98, the JDK1.2 output is
      Bug1: A java 1.2 bug in charWidth():

      Width of \n = 8


      FYI, "java -version" gives
      java version "1.2.2"
      Classic VM (build JDK-1.2.2-W, native threads, symcjit)

      "java -fullversion" gives
      JAVA.EXE full version "JDK-1.2.2-W"
      (Review ID: 94905)
      ======================================================================

      Attachments

        Activity

          People

            pkejriwasunw Parry Kejriwal (Inactive)
            wleesunw William Lee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: