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

Font Rendering on JDK 1.2 vs JDK 1.1.6 wider and shows wrong faces [regression]

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.2.0
    • client-libs
    • 2d
    • sparc
    • solaris_2.6



      Name: gsC80088 Date: 02/03/99


      Fonts render differently when run on JDK 1.2v6 vs JDK1.1.6
      on Solaris 2.6.

      Example:
      <PRE>
      import javax.swing.*;
      import java.awt.*;

      public class ButtonTest extends JFrame
      {
          private JButton myButton1 = new JButton("Helvetica Bold");
          private JButton myButton2 = new JButton("TimesRoman Bold");
          private JButton myButton3 = new JButton("Arial Bold");
          private JButton myButton4 = new JButton("Arial Plain");
          public ButtonTest(Font f1, Font f2, Font f3, Font f4)
          {
              getContentPane().setLayout(new FlowLayout());
              myButton1.setFont(f1);
              myButton1.setSize(400,400);
              getContentPane().add(myButton1);
              myButton2.setFont(f2);
              myButton2.setSize(400,400);
              getContentPane().add(myButton2);
              myButton3.setFont(f3);
              myButton3.setSize(400,400);
              getContentPane().add(myButton3);
              myButton4.setFont(f4);
              myButton4.setSize(400,400);
              getContentPane().add(myButton4);
              pack();
              validate();
              setLocation(100,100);
              setVisible(true);
          }
          public static void main(String[] args)
          {
             Font f1 = new Font("Helvetica", Font.BOLD, 12);
             Font f2 = new Font("TimesRoman", Font.BOLD, 12);
             Font f3 = new Font("Arial", Font.BOLD, 12);
             Font f4 = new Font("Arial", Font.PLAIN, 12);
             /**
             if (System.getProperty("java.version").equals("1.2"))
             {
              f1 = new Font("Helvetica Bold", Font.PLAIN, 12);
              f2 = new Font("Times", Font.PLAIN, 12);
             }
             **/
             System.out.println(f1.getFamily() + " " + f1.getSize() + " " + f1.getName());
             System.out.println(f2.getFamily() + " " + f2.getSize() + " " + f2.getName());
             new ButtonTest(f1, f2, f3, f4);
          }
      }
      </PRE>

      In the above (badly written!) example, the fonts come out
      differently on 1.1.6 vs 1.2. Specifically the vertical size
      of Helvetica is squished and the Advance is bigger. (as reported
      in Bug 4182889.

      I tried replacing font.properties used with the 1.2 JRE with
      the one with 1.1.6. but this didn't work well.

      Now if I tried using Helvetica Bold with Font.PLAIN on 1.2
      it seemed to look like Helvetica with Font.BOLD on 1.1.6.

      All in all, a big pain.
      (Review ID: 52786)
      ======================================================================

            pkejriwasunw Parry Kejriwal (Inactive)
            gstone Greg Stone
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: