mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-10 22:17:13 -06:00
copy all font attributes in FlatUIUtils.nonUIResource() and when scaling fonts (issue #75)
This commit is contained in:
@@ -121,7 +121,7 @@ public class FlatUIUtils
|
||||
}
|
||||
|
||||
public static Font nonUIResource( Font font ) {
|
||||
return (font instanceof UIResource) ? new Font( font.getName(), font.getStyle(), font.getSize() ) : font;
|
||||
return (font instanceof UIResource) ? font.deriveFont( font.getStyle() ) : font;
|
||||
}
|
||||
|
||||
public static int minimumWidth( JComponent c, int minimumWidth ) {
|
||||
|
||||
@@ -197,7 +197,7 @@ public class UIScale
|
||||
return font;
|
||||
|
||||
int newFontSize = Math.round( (font.getSize() / fontScaleFactor) * scaleFactor );
|
||||
return new FontUIResource( font.getFamily(), font.getStyle(), newFontSize );
|
||||
return new FontUIResource( font.deriveFont( (float) newFontSize ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -205,7 +205,7 @@ public class UIScale
|
||||
*/
|
||||
public static FontUIResource scaleFont( FontUIResource font, float scaleFactor ) {
|
||||
int newFontSize = Math.round( font.getSize() * scaleFactor );
|
||||
return new FontUIResource( font.getFamily(), font.getStyle(), newFontSize );
|
||||
return new FontUIResource( font.deriveFont( (float) newFontSize ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user