--- /dev/null
+package jalview.bin;
+
+import java.awt.Toolkit;
+
+public class HiDPISetting
+{
+ public static final int dpi;
+
+ public static final int scale;
+
+ private static final int hidpi = 110;
+
+ private static final String scaleProperty = "sun.java2d.uiScale";
+
+ private static final boolean isAMac = System.getProperty("os.name")
+ .indexOf("Mac") > -1;
+
+ private static final boolean isLinux = System.getProperty("os.name")
+ .toLowerCase().indexOf("linux") > -1;
+
+ private static final boolean isWindows = System.getProperty("os.name")
+ .toLowerCase().indexOf("windows") > -1;
+
+ static
+ {
+ dpi = Toolkit.getDefaultToolkit().getScreenResolution();
+ scale = dpi / hidpi + 1;
+ if (scale > 1 && isLinux)
+ {
+ System.out.println("DPI detected as " + dpi
+ + ". Scaling factor set to " + scale + ".");
+ }
+ }
+
+ public static String getScalePropertyArg()
+ {
+ // HiDPI setting. Just looking at Linux to start with. Test with Windows.
+ if (!isLinux)
+ {
+ return null;
+ }
+ if (scale > 1)
+ {
+ return "-D" + scaleProperty + "=" + scale;
+ }
+ return null;
+ }
+}