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

JTextPane replaces "FONT-SIZE: 10pt" tags with "font size=10pt"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 6
    • client-libs

      FULL PRODUCT VERSION :
      1.6.0_07

      ADDITIONAL OS VERSION INFORMATION :x
      Fedora 7
      Sled 10 SP2

      A DESCRIPTION OF THE PROBLEM :
      Set any html text to JTextPane with "FONT-SIZE:" tags and call .getText().
      You'll get the HTML with replaced "FONT-SIZE:" tags... So any browser will display new HTML with incorrect fonts (bigger in few times)

      JTextPane also replaces all "FONT" related tags. ("FONT-FAMILY:" with "font face="" ", etc)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1) Run small sample
      2) Create temp.html with outputted text.
      3) View this html file with any browser.

      The text in browser will be in few times bigger.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class BugTest extends JFrame
      {
      public static void main(String args[])
      {
      JFrame frame = new BugTest();
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setSize(200, 200);
      frame.setLocationRelativeTo(null);
      frame.setVisible(true);
      }


      public BugTest()
      {
      JTextPane textPane = new JTextPane();
      textPane.setEditorKit(new HTMLEditorKit());
      textPane.setText("<html> <body>" +
      "<DIV><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: Arial\"><SPAN class=471151106-26082008>Hallo Peter,</SPAN></SPAN></DIV>" +
      "</body></html> \"");

      add(textPane);
      System.out.println(textPane.getText());
      }
      }
      ---------- END SOURCE ----------

            peterz Peter Zhelezniakov
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: