|
Blocks :
|
|
|
Relates :
|
|
|
Relates :
|
Arabic character alef cannot be rendered on MacOS X
A rectangle is displayed instead.
The behavior affects Java SE 9 only.
Java SE 8 is fine: Java 1.8.0_66 was tried.
The behaviour is strictly reproducible.
Here is a reproducer:
% more FontDrawingTest.java
import javax.swing.*;
import java.awt.*;
public class FontDrawingTest {
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
JFrame frame = new JFrame("Test");
frame.add(new MyComponent());
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setSize(200, 200);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
});
}
private static class MyComponent extends JComponent {
private final Font font = new Font("Menlo", Font.ITALIC, 100);
private final String text = "\u0627"; // Arabic letter alef
@Override
protected void paintComponent(Graphics g) {
if (font.canDisplayUpTo(text) == -1) {
g.setColor(Color.black);
g.setFont(font);
g.drawString(text, 70, 110);
}
}
}
}
|