#5 fallback to java.runtime.name if getFontAdjustments() doesn't work
authorKevin Lamonte <kevin.lamonte@gmail.com>
Sun, 30 Apr 2017 17:49:39 +0000 (13:49 -0400)
committerKevin Lamonte <kevin.lamonte@gmail.com>
Sun, 30 Apr 2017 17:49:39 +0000 (13:49 -0400)
src/jexer/io/SwingScreen.java

index da5a42a24bd5b11c55c98b224f24a57778eb9110..24b007a3040cf1a79db1d6d146e2ee0138025b38 100644 (file)
@@ -482,13 +482,9 @@ public final class SwingScreen extends Screen {
 
             if (getFontAdjustments() == false) {
                 // We were unable to programmatically determine textAdjustX
-                // and textAdjustY, so try some guesses based on operating
-                // system.
-                if (System.getProperty("os.name").startsWith("Windows")) {
-                    textAdjustY = -1;
-                    textAdjustX = 0;
-                }
-                if (System.getProperty("os.name").startsWith("Mac")) {
+                // and textAdjustY, so try some guesses based on VM vendor.
+                String runtime = System.getProperty("java.runtime.name");
+                if ((runtime != null) && (runtime.contains("Java(TM)"))) {
                     textAdjustY = -1;
                     textAdjustX = 0;
                 }