You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Even when I specify a font size via the defaultFont property, the displayed font size is affected by the desktop environment setting for the font (I'll just call it the OS font size for simplicity). The value I set in defaultFont affects it, and the OS font size also affects it.
I'm using Tweaks->Fonts->Interface to set the OS font size. Here are two screenshots taken of the same instance of the simple application I shared below, the only change is in the OS font size but you see the running application font changes size. This would be fine if I hadn't specified a certain font size in code, but I did and so don't expect it to change.
Test script:
package stuffs;
import java.net.UnknownHostException;
import java.util.Collections;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import com.formdev.flatlaf.FlatDarkLaf;
import com.formdev.flatlaf.FlatLaf;
public class SimpleLaf {
private static final String DEFAULT_FONT_KEY = "defaultFont";
private static final String DEFAULT_FONT = "\"Nimbus Roman\" ";
private static final String TEXT = "THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG";
private static final int FONTSIZE = 11;
public static void main(String[] args) throws UnknownHostException {
SwingUtilities.invokeLater(() -> {
JFrame.setDefaultLookAndFeelDecorated(true);
FlatLaf.setGlobalExtraDefaults(
Collections.singletonMap(DEFAULT_FONT_KEY, DEFAULT_FONT + FONTSIZE));
FlatDarkLaf.setup();
final JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setTitle("Some Title");
frame.setSize(350, 100);
final JPanel panel = new JPanel();
final JLabel label = new JLabel();
label.setText(TEXT);
panel.add(label);
frame.add(panel);
frame.setVisible(true);
});
}
}
11px in FlatLaf 20px in OS:
20px in FlatLaf 20px in OS:
20px in FlatLaf 11px in OS:
11px in FlatLaf 11px in OS:
Even when I specify a font size via the defaultFont property, the displayed font size is affected by the desktop environment setting for the font (I'll just call it the OS font size for simplicity). The value I set in defaultFont affects it, and the OS font size also affects it.
I'm using Tweaks->Fonts->Interface to set the OS font size. Here are two screenshots taken of the same instance of the simple application I shared below, the only change is in the OS font size but you see the running application font changes size. This would be fine if I hadn't specified a certain font size in code, but I did and so don't expect it to change.
Test script:
11px in FlatLaf 20px in OS:
20px in FlatLaf 20px in OS:
20px in FlatLaf 11px in OS:
11px in FlatLaf 11px in OS:
Environment:
Flatlaf 3.3
OpenJDK 17.0.8
AlmaLinux 8.9
Gnome 3.32.2
The text was updated successfully, but these errors were encountered: