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

javax/swing/text/Utilities/8142966/SwingFontMetricsTest.java fails on windows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • 11
    • 11
    • client-libs
    • None

      javax/swing/text/Utilities/8142966/SwingFontMetricsTest.java is failing on
      windows since JDK 11 b05.

      That build introduced freetype to Oracle JDK and if run the
      test with -Dsun.java2d.font.scaler=t2k it passes.

      The core of the test is to compare the width of the text for a JLabel
      as measured by (1) The component, (2) the graphics.

                      Font font = getFont();
                      int width1 = getFontMetrics(font).stringWidth(TEXT);
                      int width2 = g.getFontMetrics(font).stringWidth(TEXT);

      The test specifies -Dsun.java2d.uiScale=2 but it even fails if
      I specify -Dsun.java2d.uiScale=1 so it is not (just) a hi dpi issue.

      Need to look at how Swing is measuring the text since the
      component should report the same as the graphics.

            psadhukhan Prasanta Sadhukhan
            prr Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: