mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-14 07:47:12 -06:00
UIScale: added system property "flatlaf.uiScale.enabled" (replaces "hidpi" property) to disable user scaling mode
This commit is contained in:
@@ -39,6 +39,14 @@ public interface FlatSystemProperties
|
|||||||
*/
|
*/
|
||||||
String UI_SCALE = "flatlaf.uiScale";
|
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.
|
* Specifies whether Ubuntu font should be used on Ubuntu Linux.
|
||||||
* By default, if not running in a JetBrains Runtime, the Liberation Sans font
|
* By default, if not running in a JetBrains Runtime, the Liberation Sans font
|
||||||
|
|||||||
@@ -195,8 +195,7 @@ public class UIScale
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isUserScalingEnabled() {
|
private static boolean isUserScalingEnabled() {
|
||||||
// same as in IntelliJ IDEA
|
return FlatSystemProperties.getBoolean( FlatSystemProperties.UI_SCALE_ENABLED, true );
|
||||||
return FlatSystemProperties.getBoolean( "hidpi", true );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -204,6 +203,9 @@ public class UIScale
|
|||||||
* to the given font.
|
* to the given font.
|
||||||
*/
|
*/
|
||||||
public static FontUIResource applyCustomScaleFactor( FontUIResource font ) {
|
public static FontUIResource applyCustomScaleFactor( FontUIResource font ) {
|
||||||
|
if( !isUserScalingEnabled() )
|
||||||
|
return font;
|
||||||
|
|
||||||
String uiScale = System.getProperty( FlatSystemProperties.UI_SCALE );
|
String uiScale = System.getProperty( FlatSystemProperties.UI_SCALE );
|
||||||
float scaleFactor = parseScaleFactor( uiScale );
|
float scaleFactor = parseScaleFactor( uiScale );
|
||||||
if( scaleFactor <= 0 )
|
if( scaleFactor <= 0 )
|
||||||
|
|||||||
Reference in New Issue
Block a user