From: Kevin Lamonte Date: Sun, 30 Apr 2017 17:49:39 +0000 (-0400) Subject: #5 fallback to java.runtime.name if getFontAdjustments() doesn't work X-Git-Url: http://git.nikiroo.be/?a=commitdiff_plain;h=15364867da403c8fa9e82ea5c5bf53413efc39cc;hp=8a632d71fde904c0a9f49259105aa90f5fbe2fea;p=nikiroo-utils.git #5 fallback to java.runtime.name if getFontAdjustments() doesn't work --- 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; }