diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatSystemProperties.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatSystemProperties.java index c8a6d858..3144dab1 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatSystemProperties.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatSystemProperties.java @@ -39,6 +39,14 @@ public interface FlatSystemProperties */ String UI_SCALE = "flatlaf.uiScale"; + /** + * Specifies whether user scaling mode is enabled. + *
+ * Allowed Values {@code false} and {@code true}
+ * Default {@code true}
+ */
+ String UI_SCALE_ENABLED = "flatlaf.uiScale.enabled";
+
/**
* Specifies whether Ubuntu font should be used on Ubuntu Linux.
* By default, if not running in a JetBrains Runtime, the Liberation Sans font
diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/util/UIScale.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/util/UIScale.java
index f49cd285..d3bea4cd 100644
--- a/flatlaf-core/src/main/java/com/formdev/flatlaf/util/UIScale.java
+++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/util/UIScale.java
@@ -195,8 +195,7 @@ public class UIScale
}
private static boolean isUserScalingEnabled() {
- // same as in IntelliJ IDEA
- return FlatSystemProperties.getBoolean( "hidpi", true );
+ return FlatSystemProperties.getBoolean( FlatSystemProperties.UI_SCALE_ENABLED, true );
}
/**
@@ -204,6 +203,9 @@ public class UIScale
* to the given font.
*/
public static FontUIResource applyCustomScaleFactor( FontUIResource font ) {
+ if( !isUserScalingEnabled() )
+ return font;
+
String uiScale = System.getProperty( FlatSystemProperties.UI_SCALE );
float scaleFactor = parseScaleFactor( uiScale );
if( scaleFactor <= 0 )