Код: Выделить всё
package de.lesspain.ui;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.plaf.FontUIResource;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.font.TextAttribute;
import java.util.Map;
public class MacFontFallback {
private static void setupMacOsFont() {
Font defaultFont = UIManager.getDefaults().getFont("Label.font");
Map normalAttributes = Map.of(TextAttribute.FAMILY, ".AppleSystemUIFont");
Font derivedFont = defaultFont.deriveFont(normalAttributes);
FontUIResource fontUIResource = new FontUIResource(derivedFont);
UIManager.put("defaultFont", fontUIResource);
UIManager.put("Label.font", fontUIResource);
}
public static void main(String[] args) {
setupMacOsFont();
SwingUtilities.invokeLater(() -> {
JFrame frame = new JFrame("Mac Font");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JLabel label = new JLabel("Hello 😊");
frame.add(label);
frame.setSize(new Dimension(300, 80));
frame.setLocationRelativeTo(null);
frame.setVisible(true);
});
}
}
AppleSystemuifont
Подробнее здесь: https://stackoverflow.com/questions/795 ... -glyphs-su