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

Undesired line breaks in html formatted text with unicode characters 0900–097F

    Details

    • Subcomponent:
    • Introduced In Version:
      10
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10 Pro, V1803

      java version "10.0.1" 2018-04-17
      Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
      Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      The undesired additional line breaks occur only when the screen scaling of Windows-10 differs from 100 %.

      REGRESSION : Last worked in version 8u161

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the code below with a screen scaling of 125 %.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Same output as when OS screen scaling is set to 100 %, i.e. top and middle button have the same text and bottom button has two lines only.
      ACTUAL -
      Non programmed line breaks occur on middle and bottom button.

      ---------- BEGIN SOURCE ----------
      import java.awt.*;
      import javax.swing.*;

      public class UndesiredLineBreak extends JFrame {
        public static final long serialVersionUID = 1L;

        public UndesiredLineBreak() {
          setSize(800, 230);
          setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
          setLayout(new GridLayout(0, 2, 3, 3));
          String s=
      "\u0905\u0902\u0924\u093F\u092E "+
      "\u0936\u092C\u094D\u0926 \u0915\u0947 \u091A\u0941\u0928\u093E\u0935 "+
      "\u0915\u0947 \u092C\u093E\u0926 \u0935\u093F\u0902\u0921\u094B "+
      "\u0915\u094B "+
      "\u092C\u0928\u094D\u0926 \u0915\u0930\u0928\u0947 \u0915\u0940 "+
      "\u0906\u0935\u0936\u094D\u092F\u0915\u0924\u093E "+
      "\u0939\u0948\u0964";
          add(new JButton(s));
          add(new JLabel("OK"));
          String s1= "<html>"+s+"</html>";
          add(new JButton(s1));
          add(new JLabel("Html moves last character."));
      // Insert <br>
          int i= s1.indexOf("\u092C\u0928");
          s1= s1.substring(0, i-1) + "<br>" + s1.substring(i);
          add(new JButton(s1));
          add(new JLabel("<br> moves preceding word."));
          setVisible(true);
        }


        public static void main(String args[]) {
          SwingUtilities.invokeLater(UndesiredLineBreak::new);
        }

      }
      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

        1. Scale-Affect.png
          46 kB
          Pardeep Sharma
        2. UndesiredLineBreak.java
          1 kB
          Pardeep Sharma

          Activity

            People

            • Assignee:
              serb Sergey Bylokhov
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: