- allow user scaling mode on Linux even if running in Java 9+
- update fonts (and scaling) when user changes text size or scaling in Gnome settings

(#1)
This commit is contained in:
Karl Tauber
2019-10-13 14:15:37 +02:00
parent 5e33182de3
commit 42d801f123
2 changed files with 7 additions and 3 deletions

View File

@@ -124,6 +124,11 @@ public abstract class FlatLaf
// Windows 10 allows increasing font size independent of scaling:
// Settings > Ease of Access > Display > Make text bigger (100% - 225%)
desktopPropertyName = "win.messagebox.font";
} else if( SystemInfo.IS_LINUX ) {
// Linux/Gnome allows extra scaling and larger text:
// Settings > Devices > Displays > Scale (100% or 200%)
// Settings > Universal access > Large Text (off or on, 125%)
desktopPropertyName = "gnome.Xft/DPI";
}
if( desktopPropertyName != null ) {
desktopPropertyListener = e -> {

View File

@@ -48,8 +48,7 @@ import javax.swing.plaf.UIResource;
*
* 2) user scaling mode
*
* This mode is for Java 8 compatibility and can be removed when changing minimum
* required Java version to 9.
* This mode is mainly for Java 8 compatibility, but is also used on Linux.
* The user scale factor is computed based on the used font.
* The JRE does not scale anything.
* So we have to invoke {@link #scale(float)} where necessary.
@@ -166,7 +165,7 @@ public class UIScale
}
private static boolean isUserScalingEnabled() {
if( isSystemScalingEnabled() )
if( isSystemScalingEnabled() && !SystemInfo.IS_LINUX )
return false; // disable user scaling if JRE scales
// same as in IntelliJ IDEA