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

Mapping of the CSS length units is incorrect

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 5.0
    • 1.4.0
    • client-libs
    • tiger
    • x86
    • windows_nt



      Name: sv35042 Date: 10/18/2002


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

      FULL OPERATING SYSTEM VERSION :
      Windows NT Version 4.0

      ADDITIONAL OPERATING SYSTEMS :
      Windows Me


      A DESCRIPTION OF THE PROBLEM :
      When displaying a HTML page, the text is shown approx. 1.3
      times smaller than in any kind of browser. E.g. The font
      size is set to 12pt, but in JEditorPane it is rendered as a
      9pt size font is rendered by a web browser such as Netscape
      or Internet Explorer (tested on NS 4.7, 6.2; IE 5.5).

      As far as I can see in the related javax.swing packages, it
      seems as if inner classes FontSize and LengthUnit and
      related methods in class CSS and StyleSheet cause the error.

      My suspiction is that method parseCssValue in inner class
      FontSize of class CSS sets a wrong length unit in line
      else {
        fs.lu = new LengthUnit(value, (short)1, 1f);
      }
      creating a length unit 'px' by default. As well it seems as
      if the mapping between relative and absolute font sizes is
      wrong.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Open the following HTML file and style sheet in a
      JEditorPane and in a browser and compare the displays.

      <html>
        <head>
          <link href="style.css" rel="stylesheet" type="text/css">

        </head>
        <body>
          <p style="font-size:8pt">
            Test 8pt
          </p>
          <p style="font-size:9pt">
            Test 9pt
          </p>
          <p style="font-size:10pt">
            Test 10pt
          </p>
          <p style="font-size:11pt">
            Test 11pt
          </p>
          <p style="font-size:12pt">
            Test 12pt
          </p>
          <p style="font-size:14pt">
            Test 14pt
          </p>
          <p style="font-size:18pt">
            Test 18pt
          </p>
          <p style="font-size:20pt">
            Test 20pt
          </p>
          <p style="font-size:24pt">
            Test 24pt
          </p>
          <p style="font-size:36pt">
            Test 36pt
          </p>
          <p style="font-size:48pt">
            Test 48pt
          </p>
        </body>
      </html>

      styles as in 'style.css'...

      body {font-size: 12pt;
             font-family: Arial,Sans-Serif;
             font-weight: normal;
             margin-left: 0;
             margin-right: 0;
             color: black}

      p {margin-top: 15}





      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Expected result was to see text in similar sizes in both the
      browser and the JEditorPane. Instead, JEditorPane was
      displaying smaller text than any browser.

      IMPORTANT: I have seen two bug postings (partly) referring
      to the same bug. Both were closed claiming this would have
      been solved.
      This is definitely not solved! Please try the simple test
      described above.

      This bug can be reproduced always.

      CUSTOMER WORKAROUND :
      possible work around would be to intercept method getRule in
      class StyleSheet and change any font size to a bigger one
      for display...
      (Review ID: 153446)
      ======================================================================

            sdvsunw Sdv Sdv (Inactive)
            svioletsunw Scott Violet (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: