-
Bug
-
Resolution: Fixed
-
P4
-
17, 18
-
macOS 12.0.1
-
b03
-
os_x
Rectangles are drawn instead of correct glyphs, if Armenian text is rendered on macOS with text layout applied (e.g. if kerning is requested). Same text is drawn as expected, if rendered 'directly'.
Reproducer:
```
import javax.swing.*;
import java.awt.*;
import java.awt.font.TextAttribute;
import java.util.Map;
public class FontFallbackIssueVisual {
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
JFrame f = new JFrame();
f.add(new MyComponent());
f.setSize(200, 200);
f.setLocationRelativeTo(null);
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
f.setVisible(true);
});
}
private static class MyComponent extends JComponent {
@Override
protected void paintComponent(Graphics g) {
String text = "\u0561\u0577\u056D\u0561\u0580\u0570"; // Armenian text
Font font = new Font(Font.SERIF, Font.PLAIN, 24);
g.setFont(font);
g.drawString(text, 50, 60);
g.setFont(font.deriveFont(Map.of(TextAttribute.KERNING, TextAttribute.KERNING_ON)));
g.drawString(text, 50, 110);
}
}
}
```
Reproducer:
```
import javax.swing.*;
import java.awt.*;
import java.awt.font.TextAttribute;
import java.util.Map;
public class FontFallbackIssueVisual {
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
JFrame f = new JFrame();
f.add(new MyComponent());
f.setSize(200, 200);
f.setLocationRelativeTo(null);
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
f.setVisible(true);
});
}
private static class MyComponent extends JComponent {
@Override
protected void paintComponent(Graphics g) {
String text = "\u0561\u0577\u056D\u0561\u0580\u0570"; // Armenian text
Font font = new Font(Font.SERIF, Font.PLAIN, 24);
g.setFont(font);
g.drawString(text, 50, 60);
g.setFont(font.deriveFont(Map.of(TextAttribute.KERNING, TextAttribute.KERNING_ON)));
g.drawString(text, 50, 110);
}
}
}
```