Но я не могу найти ни одного шрифта, который мог бы отображать символы Юникода (эмодзи), например как:

Для этого я также создал очень простое тестовое приложение Java:
Код: Выделить всё
public class Main {
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
try {
// Create a JFrame
JFrame frame = new JFrame("Font Tester");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(600, 400);
// Create a JTextArea to display text
JTextArea textArea = new JTextArea();
textArea.setText("Test text: Hello, world! 🤩 🌍 🎉");
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
Font customFont = Font.createFont(Font.TRUETYPE_FONT, new File("noto.ttf"));
customFont = customFont.deriveFont(Font.PLAIN); // Set font size
customFont = customFont.deriveFont(16f); // Set font size
textArea.setFont(customFont);
// Add components to the frame
frame.setLayout(new BorderLayout());
frame.add(textArea, BorderLayout.CENTER);
// Make the frame visible
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
});
}
}
Я не ищу полностью визуализированный смайлик, но не поле.
Я делаю что-то не так, или шрифты неправильные, или Swing просто не может его вообще не отображать?
Использование Open JDK 17.
Подробнее здесь: https://stackoverflow.com/questions/793 ... java-swing
Мобильная версия