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

Rotated and clipped Text object a printed blurred.

XMLWordPrintable

    • x86_64
    • windows_10

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10, JDK 10.0.2

      A DESCRIPTION OF THE PROBLEM :
      If you print a Text instance that rotated and clipped, then the result is blurred.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a Text instance.
      Create a clip for that instance, e.g. with the bounds of the text.
      Rotate the text e.g. about 80 degree.
      Print the text with the JavaFX printer capability.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The text should be printed without blur as non-clipped text.
      ACTUAL -
      The result is blurred.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.geometry.Bounds;
      import javafx.print.PrinterJob;
      import javafx.scene.Group;
      import javafx.scene.Scene;
      import javafx.scene.shape.Rectangle;
      import javafx.scene.text.Text;
      import javafx.stage.Stage;

      public class PrintClippedAndRotatedText extends Application {
        @Override
        public void start(Stage stage) throws Exception {
          Text text1 = new Text(100, 100, "Rotated and clipped Text is blurred.");
          Bounds bounds1 = text1.getLayoutBounds();
          text1.setClip(new Rectangle(bounds1.getMinX(), bounds1.getMinY(), bounds1.getWidth(), bounds1.getHeight()));
          text1.setRotate(80);

          Text text2 = new Text(0, 100, "Rotated Text is not blurred.");
          text2.setRotate(80);

          Group root = new Group(text1, text2);

          stage.setScene(new Scene(root, 300, 300));
          stage.show();

          PrinterJob job = PrinterJob.createPrinterJob();
          if (job != null) {
            job.showPrintDialog(stage);
            boolean success = job.printPage(root);
            if (success) {
              job.endJob();
            }
          }
        }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


            prr Philip Race
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: