+
+ // try and get screen size height
+ try
+ {
+ height = Toolkit.getDefaultToolkit().getScreenSize().height;
+ } catch (Throwable t)
+ {
+ System.err.println("Cannot get screen size height");
+ }
+
+ if (forceHiDPISetting && forceHiDPISettingScale > 0)
+ {
+ scale = forceHiDPISettingScale;
+ }
+ else
+ {
+ // attempt at a formula for scaling based on screen dpi and height. scale
+ // will be an integer >=1
+ scale = Math.min(dpi / hidpiThreshold, height / tallScreenThreshold)
+ + 1;
+ }
+
+ allowScalePropertyArg = (scale > 1 && isLinux) || forceHiDPISetting;
+
+ if (allowScalePropertyArg)
+ {
+ System.out.println("boolean forceHiDPISetting=" + forceHiDPISetting);
+ System.out.println("DPI detected as " + dpi
+ + ". Scaling factor set to " + scale + ".");
+ }
+
+ doneInit = true;
+ }
+
+ public static synchronized String getScalePropertyArg()
+ {
+ // HiDPI setting. Just looking at Linux to start with. Test with Windows.
+ return allowScalePropertyArg ? "-D" + scalePropertyName + "=" + scale
+ : null;