mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-15 08:17:12 -06:00
Added option for downscaling
This commit is contained in:
@@ -44,6 +44,14 @@ public interface FlatSystemProperties
|
||||
*/
|
||||
String UI_SCALE_ENABLED = "flatlaf.uiScale.enabled";
|
||||
|
||||
/**
|
||||
* Specifies whether values smaller than 1.0f are allowed for the custom scale factor.
|
||||
* <p>
|
||||
* <strong>Allowed Values</strong> {@code false} and {@code true}<br>
|
||||
* <strong>Default</strong> {@code false}
|
||||
*/
|
||||
String UI_DOWNSCALE_ENABLED = "flatlaf.uiDowncale.enabled";
|
||||
|
||||
/**
|
||||
* Specifies whether Ubuntu font should be used on Ubuntu Linux.
|
||||
* By default, if not running in a JetBrains Runtime, the Liberation Sans font
|
||||
|
||||
@@ -258,6 +258,10 @@ public class UIScale
|
||||
return FlatSystemProperties.getBoolean( FlatSystemProperties.UI_SCALE_ENABLED, true );
|
||||
}
|
||||
|
||||
private static boolean isDownscalingEnabled() {
|
||||
return FlatSystemProperties.getBoolean( FlatSystemProperties.UI_DOWNSCALE_ENABLED, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies a custom scale factor given in system property "flatlaf.uiScale"
|
||||
* to the given font.
|
||||
@@ -323,7 +327,7 @@ public class UIScale
|
||||
* Sets the user scale factor.
|
||||
*/
|
||||
private static void setUserScaleFactor( float scaleFactor ) {
|
||||
if( scaleFactor <= 1f )
|
||||
if( ( !isDownscalingEnabled() && scaleFactor <= 1f ) || scaleFactor <= 0f )
|
||||
scaleFactor = 1f;
|
||||
else // round scale factor to 1/4
|
||||
scaleFactor = Math.round( scaleFactor * 4f ) / 4f;
|
||||
|
||||
Reference in New Issue
Block a user