Search code examples
javaswingdpijava-9

Java 9 on Windows with large fonts


If you set large fonts (for example, 125%, 120 DPI) on Windows, then it looks as if Swing of Java 9 first renders into a smaller image and then scales this image to the screen.

Text is still properly displayed. But 1 pixel lines are times 1 pixel or 2 pixels strong. A diagonal line is stepped. Icons are rasterized.

Are there any command line parameters or API to change this behavior?


Example Edit:

Using MenuSelectionManagerDemo from docs.oracle.com/javase/tutorial/uiswing/examples/components/

enter image description here


Solution

  • I ran that Swing MenuSelectionManagerDemo using Java 9 and Windows 10, and the issues you raised appear to be resolved. See the two screen shots below, where I ran with scaling set to 100% and 125% respectively.

    As I pointed out in a comment to the OP, it looks like this was resolved by a JDK bug fix several months ago, which I assume was raised by the OP:

    https://bugs.openjdk.java.net/browse/JDK-8174845

    One other minor point worth noting is that changing the Windows setting from 100% to 125% is a change to "Scale and Layout", and will "Change the size of text, apps and other items". (i.e. It is far more than just a font change, as mentioned in the JDK bug response.)

    100%

    125%