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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 11
    • Fix Version/s: 11
    • Component/s: client-libs
    • Labels:
      None

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: