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

Rotated text does not italicize correctly in JDK 11 with added Fonts folder with lucida fonts

XMLWordPrintable

    • 2d
    • x86_64
    • windows_10

      A DESCRIPTION OF THE PROBLEM :
      Rotated text does not italicize correctly in 11.0.4 but works good in 11.0.3

      REGRESSION : Last worked in version 8

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Please execute the sample code given

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Text should be italicized
      ACTUAL -
      Text is italicized but lost alignment

      ---------- BEGIN SOURCE ----------
      package org.kodejava.example.geom;
       
      import javax.swing.*;
      import java.awt.*;
      import java.awt.geom.AffineTransform;
       
      public class CheckFontRotation extends JPanel {
          @Override
          public void paint(Graphics g) {
              Graphics2D g2 = (Graphics2D) g;
       
              // Define rendering hint, font name, font style and font size
              //g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
              g2.setFont(new Font("Lucida Sans", Font.ITALIC, 22));
              g2.setColor(Color.RED);
       
              // Rotate 90 degree to make a vertical text
              AffineTransform at = new AffineTransform();
              at.setToRotation(Math.toRadians(90), 80, 100);
              g2.setTransform(at);
              g2.drawString("This is a vertical text", 10, 10);
          }
       
          public static void main(String[] args) {
              JFrame frame = new JFrame();
              frame.setTitle("Draw Vertical Text Demo");
              frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
              frame.add(new CheckFontRotation());
              frame.pack();
              frame.setSize(420, 350);
              frame.setVisible(true);
          }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


        1. CheckFontRotation.java
          1 kB
        2. fonts.zip
          1.16 MB
        3. Result-AddedFonts.jpg
          Result-AddedFonts.jpg
          175 kB

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

              Created:
              Updated:
              Resolved: