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

Styles "white-space:pre-wrap; text-align:justify;" does not justify text

    Details

    • Subcomponent:
      web
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10 64bit, JDK 12 64bit, JFX 13 64bit

      A DESCRIPTION OF THE PROBLEM :
      Using styles "white-space:pre-wrap; text-align:justify;" does not justify texts in WebView. But all classic browsers can justify text with pre-wrap used as white-space.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create some html page with text element with styles "white-space:pre-wrap; text-align:justify;"

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Text must be justified.
      ACTUAL -
      Text is not justified.

      ---------- BEGIN SOURCE ----------
      package test;

      import java.awt.image.BufferedImage;

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.paint.Color;
      import javafx.scene.web.WebEngine;
      import javafx.scene.web.WebView;
      import javafx.stage.Stage;

      public class WhiteSpacePreWrap extends Application
      {
      WebView webView;
      WebEngine webEngine;
      static String html = "<html><head><body><p style=\"white-space:pre-wrap; text-align:justify;\">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.<br> Signature</p></body></html>";

      public BufferedImage renderedImage;
      public boolean snapshotEnabled = false;
      public Browser browser;

      class Browser // extends StackPane //Region
      {
      public Browser()
      {
      webView = new WebView();
      webEngine = webView.getEngine();
      }

      void navigateContent(String html)
      {
      webEngine.loadContent(html);
      }
      }

      @Override
      public void start(Stage mainStage) throws Exception
      {
      browser = new Browser();
      Scene scene = new Scene(webView, 300, 300, Color.TRANSPARENT);

      mainStage.setScene(scene);
      mainStage.show();

      browser.navigateContent(html);
      }

      public static void main(String args[]) throws Exception
      {
      WhiteSpacePreWrap.launch(args);
      }

      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Not found.

      FREQUENCY : always


        Attachments

          Activity

            People

            • Assignee:
              ghb Guru Hb
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: