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

Font rendering and glyph spacing changed from jdk-8 to jdk-11

XMLWordPrintable

    • 2d
    • 11
    • b25
    • x86_64
    • windows_7

        A DESCRIPTION OF THE PROBLEM :
        We use swing and windows-look-and-feel. In jdk-8 and jdk-11 the default fonts are the same (Tahoma for buttons and Segoe for menus). The font-rendering for Tahoma changed in jdk-11 and gets ugly. For example 'it' has a big space between 'i' and 't'.
        Furthermore the spacing between lines changed. For example in the menu the spacing between the menu items raised.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        The example code can reproduce it.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Same rendering as with jdk-8.
        ACTUAL -
        The font rendering of Tahoma is ugly. For example the spacing of letters (e.g. "it") got wrong.
        Line spacing is too big e.g. in the menu.

        ---------- BEGIN SOURCE ----------
        import java.awt.event.ActionEvent;
        import java.awt.event.KeyEvent;

        import javax.swing.JButton;
        import javax.swing.JFrame;
        import javax.swing.JMenu;
        import javax.swing.JMenuBar;
        import javax.swing.JMenuItem;
        import javax.swing.KeyStroke;
        import javax.swing.UIManager;
        import javax.swing.UnsupportedLookAndFeelException;

        public class TestRenderer {

            public static void main(String[] args)
                    throws ClassNotFoundException, InstantiationException, IllegalAccessException,
                    UnsupportedLookAndFeelException {
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

                JFrame f = new JFrame();

                JButton b1 = new JButton("Mitarbeiterdisposition");
                //b1.setFont(UIManager.getDefaults().getFont("Button.font"));
                b1.setBounds(130, 100, 100, 40);//x axis, y axis, width, height
                f.add(b1);
                f.setSize(400, 500);
                f.setLayout(null);
                f.setVisible(true);

                JMenuBar menuBar;
                JMenu menu;
                JMenuItem menuItem;

                //Create the menu bar.
                menuBar = new JMenuBar();

                //Build the first menu.
                menu = new JMenu("A Menu");
                menu.setMnemonic(KeyEvent.VK_A);
                menu.getAccessibleContext().setAccessibleDescription("The only menu in this program that has menu items");
                menuBar.add(menu);

                //a group of JMenuItems
                menuItem = new JMenuItem("A text-only menu item", KeyEvent.VK_T);
                menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, ActionEvent.ALT_MASK));
                menuItem.getAccessibleContext().setAccessibleDescription("This doesn't really do anything");
                menu.add(menuItem);

                //a group of JMenuItems
                menuItem = new JMenuItem("A text-only menu item", KeyEvent.VK_T);
                menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, ActionEvent.ALT_MASK));
                menuItem.getAccessibleContext().setAccessibleDescription("This doesn't really do anything");
                menu.add(menuItem);

                //a group of JMenuItems
                menuItem = new JMenuItem("A text-only menu item", KeyEvent.VK_T);
                menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, ActionEvent.ALT_MASK));
                menuItem.getAccessibleContext().setAccessibleDescription("This doesn't really do anything");
                menu.add(menuItem);

                f.setJMenuBar(menuBar);
            }
        }

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

        FREQUENCY : always


          1. TestRenderer.java
            3 kB
          2. menuDiff8vs11.PNG
            menuDiff8vs11.PNG
            18 kB
          3. jdk8u201-result.PNG
            jdk8u201-result.PNG
            5 kB
          4. jdk13-result.PNG
            jdk13-result.PNG
            3 kB
          5. exampleJdk8.PNG
            exampleJdk8.PNG
            20 kB
          6. exampleJdk11.PNG
            exampleJdk11.PNG
            26 kB

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

                Created:
                Updated:
                Resolved: