From 15364867da403c8fa9e82ea5c5bf53413efc39cc Mon Sep 17 00:00:00 2001 From: Kevin Lamonte Date: Sun, 30 Apr 2017 13:49:39 -0400 Subject: [PATCH] #5 fallback to java.runtime.name if getFontAdjustments() doesn't work --- src/jexer/io/SwingScreen.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/jexer/io/SwingScreen.java b/src/jexer/io/SwingScreen.java index da5a42a..24b007a 100644 --- a/src/jexer/io/SwingScreen.java +++ b/src/jexer/io/SwingScreen.java @@ -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; } -- 2.27.0