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

HiDPI with non-integer scale factor - SPANs in HTML are rendered overlapping each other

XMLWordPrintable

    • b34
    • x86
    • other

      FULL PRODUCT VERSION :
      java 9-ea
      Java(TM) SE Runtime Environment (build 9-ea+163)
      Java HotSpot(TM) 64-Bit Server VM (build 9-ea+163, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 10.0.14393]

      A DESCRIPTION OF THE PROBLEM :
      When using a non-integer resolution (e.g. 225%) for a HiDPI display, the Swing HTML rendering incorrectly calculates the width of SPAN elements which results in SPANs being incorrectly positioned and overlapping with each other.

      I assume this is a bug in the implementation of http://openjdk.java.net/jeps/263 as it worked correctly in Java 8.

      REGRESSION. Last worked in version 8u121

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.8.0_121"
      Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the attached code


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I expect the displayed text to show "A few words to get started before the bugoverlapping text"


      ACTUAL -
      The 'g' at the end of the word "bug" is rendered over the top of the 'o' in the start of "overlapping text"

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package bugDemo;

      import javax.swing.*;
      import java.awt.*;

      public class Java9BugTest {
          public static void main(String[] args) {
              JLabel label = new JLabel("<html><span>A few words to get started before the bug</span><span>overlapping text</span></html>");
              JFrame frame = new JFrame("");
              frame.getContentPane().add(label, BorderLayout.CENTER);
              frame.setSize(500,500);
              frame.setVisible(true);
          }
      }
      ---------- END SOURCE ----------

            psadhukhan Prasanta Sadhukhan
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: