For JabRef , we have a LaTeX to Unicode converter for display, for example. italic fonts in headers. However, on my Mac this does not display correctly, although I see the correct Unicode line inside the debugger ( problem on GitHub ). I am attaching a minimal example using the generated Unicode string. What I see on my machine (MacOS Sierra 10.12.6, Java 1.8.0_144) is as follows

while the debugger in IDEA correctly shows

Is there anyone who can share some kind of understanding of how this can be solved? I read a few SO posts that suggested using a font that supports this, or will determine the font size in a certain way. However, I do not regulate any of this here. Why does this fail in the default settings?
import java.awt.GridLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
public class SwingJLabelTester extends JPanel{
private SwingJLabelTester() {
super(new GridLayout(1,1));
final String latexString = "This is a \uD835\uDC61\uD835\uDC52\uD835\uDC60\uD835\uDC61 \uD835\uDC53\uD835\uDC5C\uD835\uDC5F \uD835\uDC56\uD835\uDC61\uD835\uDC4E\uD835\uDC59\uD835\uDC56\uD835\uDC50\uD835\uDC60 and \uD835\uDC1A \uD835\uDC2D\uD835\uDC1E\uD835\uDC2C\uD835\uDC2D \uD835\uDC1F\uD835\uDC28\uD835\uDC2B \uD835\uDC1B\uD835\uDC28\uD835\uDC25\uD835\uDC1D";
final JLabel label = new JLabel(latexString, SwingConstants.CENTER);
label.setVerticalTextPosition(SwingConstants.BOTTOM);
label.setHorizontalTextPosition(SwingConstants.CENTER);
add(label);
}
private static void createAndShowGUI() {
final JFrame frame = new JFrame("LabelDemo");
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.add(new SwingJLabelTester());
frame.setSize(400,400);
frame.setVisible(true);
}
public static void main(final String[] args) {
SwingUtilities.invokeLater(SwingJLabelTester::createAndShowGUI);
}
}
source
share