mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27: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 ) {
|
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 ) {
|
public static int minimumWidth( JComponent c, int minimumWidth ) {
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ public class UIScale
|
|||||||
return font;
|
return font;
|
||||||
|
|
||||||
int newFontSize = Math.round( (font.getSize() / fontScaleFactor) * scaleFactor );
|
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 ) {
|
public static FontUIResource scaleFont( FontUIResource font, float scaleFactor ) {
|
||||||
int newFontSize = Math.round( font.getSize() * 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