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

Swing text rendering issue, letters either with spaces or stuck together

    XMLWordPrintable

    Details

    • Subcomponent:
      2d
    • Introduced In Version:
      11
    • CPU:
      x86_64
    • OS:
      windows_8

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows 8.1 (but reproducable on Windows 7/10)
      OracleJDK 11.0.1 or OpenJDL 11.0.1

      A DESCRIPTION OF THE PROBLEM :
      In Java 11 JComponent text contains letter spacing issues in all JComponents. It is visible mostly with a capital letter followed up by non capital letter.
      There were no such issues using Java 8.

      I suspect this might be the cause of T2K -> FreeType scaler change.
      Can be reproduced on Dialog, Arial and other fonts.

      REGRESSION : Last worked in version 8u192

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      One sample: create a JLabels(or a JButtons) in a panel containing text "Editing", "Symbol styles", "Default", "Keyboard", "Active".

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      There should be no additional spaces.
      Behavior should be at least comparable to Java 8.
      ACTUAL -
      In text "Editing" there is a space between "E" and "d".
      In text "Symbol styles" there is a space between "y" and "m", and between "y" and "l"
      etc.
      In text "dwedwedwe" each "w" and "e" have no space at all, they are stuck together.

      Both Java 11 and Java 8 use same font:
      javax.swing.plaf.FontUIResource[family=Dialog,name=Dialog,style=bold,size=12]

      ---------- BEGIN SOURCE ----------
      public class TestSwingTexts
      {
      public static void main(String[] args)
      {
      JFrame frame = new JFrame("Java 11 example");

      JPanel panel = new JPanel();
      panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

      JLabel label = new JLabel("Symbol styles");
      JLabel label2 = new JLabel("Default");
      JLabel label3 = new JLabel("Keyboard");
      JLabel label4 = new JLabel("Active");
      JButton button = new JButton("Editing");
      JButton button2 = new JButton("dwedwedwedwe");

      panel.add(label);
      panel.add(label2);
      panel.add(label3);
      panel.add(label4);
      panel.add(button);
      panel.add(button2);

      frame.add(panel);
      frame.setSize(300, 300);
      frame.setLocationRelativeTo(null);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setVisible(true);
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      There are no workarounds.

      FREQUENCY : always


        Attachments

        1. results.png
          results.png
          13 kB
        2. results-marked.png
          results-marked.png
          13 kB
        3. TestSwingTexts.java
          0.9 kB

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: