#5 fallback to java.runtime.name if getFontAdjustments() doesn't work
[nikiroo-utils.git] / 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;
                 }