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

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P4
    • 11
    • Affects Version/s: 11
    • Component/s: 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.

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

              Created:
              Updated:
              Resolved: