UIScale: added system property "flatlaf.uiScale.enabled" (replaces "hidpi" property) to disable user scaling mode

This commit is contained in:
Karl Tauber
2020-08-02 14:08:18 +02:00
parent 4eb4ddf5d8
commit 30747b7776
2 changed files with 12 additions and 2 deletions

View File

@@ -39,6 +39,14 @@ public interface FlatSystemProperties
*/
String UI_SCALE = "flatlaf.uiScale";
/**
* Specifies whether user scaling mode is enabled.
* <p>
* <strong>Allowed Values</strong> {@code false} and {@code true}<br>
* <strong>Default</strong> {@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

View File

@@ -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 )