eirikbakke edited a comment on issue #1446: An alternate solution to horrendous default font sizes and antialiasing on Linux URL: https://github.com/apache/netbeans/pull/1446#issuecomment-556372689 Some comments regarding font size on HiDPI screens. I looked through https://github.com/apache/netbeans/pull/1415 as well. Recentish JDK versions (9 and above) handle HiDPI screens very well on both Windows and MacOS, including in multi-monitor setups. Each monitor gets assigned a DPI scaling factor (e.g. 1x, 2x, 1.5x), and GraphicsConfiguration.getDefaultTransform() will be scaled accordingly. No need to change font sizes at the Swing level. Dragging a window from a regular screen (1x) to a HiDPI screen (e.g. 2x) will cause fonts to be rendered with a higher device resolution, but does not change the logical size of the font. Are you sure this does not work on Linux as well? For example, could you configure your Linux multi-monitor setup with one screen at 2x scaling and one at 1x scaling, and then run the following? What output do you get? ``` import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; public class ShowDPIScaling { public static final void main(String args[]) { for (GraphicsDevice gd : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) System.out.println(gd.getDefaultConfiguration().getDefaultTransform().getScaleX()); } } ``` This is not really related to what the monitor reports at a hardware level--it's just an OS-level setting (though on Windows and MacOS, the OS may take its _default_ from monitor hardware). Is there not an equivalent setting somewhere on Linux? If there is, then perhaps NetBeans should show a message explaining to the user how to configure this OS-level setting, for each individual monitor, rather than changing a single setting that applies to all monitors? As you have probably discovered, Toolkit.getScreenResolution() should not be relied on. It has no meaningful semantics in a world of multi-monitor setups and HiDPI scalings. This is true on Windows and MacOS as well. On Windows, it behaves differently depending on whether the user has logged out and back in again since the last time the monitor setup was changed and so on. The correct way to detect HiDPI scaling factors is through GraphicsConfiguration.getDefaultTransform()--though this is normally handled transparently by Swing/Java2D.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
