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

Font sizes in JTextPane are too large

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not an Issue
    • P3
    • None
    • 5.0
    • client-libs

    Description



      Name: rmT116609 Date: 02/05/2004


      FULL PRODUCT VERSION :
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32c)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b32c, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      When displaying a html page the fonts used with 1.5 are larger than with 1.4.x.
      Running the test case code under 1.4.2 the JTextPane is 317x78 pixels large, with 1.5 beta the same JTextPane requires 402x86 pixels because larger fonts are used.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the test case under 1.4.2 and 1.5 and compare the results.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Same size on both versions of the runtime.
      ACTUAL -
      Different sizes depending on the runtime version.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;
      import javax.swing.text.html.*;

      public class Main extends JFrame
      {
      public Main()
      {
      String css = "<style type=\"text/css\">\n<!--\nh1 {font-family:Verdana; font-size:14pt; font-style:normal; font-weight:bold; }\nh2 {font-family:Verdana; font-size:10pt; font-style:normal; font-weight:normal; } \n//-->\n</style>\n";
      String html = "<html><head>"+css+"</head><body><h1>h1: ABCDEFGHIJKLMNOPQRSTUVWXYZ</h1><h2>h2: ABCDEFGHIJKLMNOPQRSTUVWXYZ</h2></body></html>";
      System.out.println(html);

      JTextPane textPane = new JTextPane();
      textPane.setEditorKit( new HTMLEditorKit() );
      textPane.setText(html);
      getContentPane().add(textPane);
      pack();
      setTitle(System.getProperty("java.vm.version")+": "+textPane.getWidth()+"x"+textPane.getHeight());
      setDefaultCloseOperation(EXIT_ON_CLOSE);
      setVisible(true);
      }
      public static void main(String[] args)
      {
      new Main();
      }

      }

      ---------- END SOURCE ----------
      (Incident Review ID: 237470)
      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              sdvsunw Sdv Sdv (Inactive)
              rmandalasunw Ranjith Mandala (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: