Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8278050

Armenian text isn't rendered on macOS if text layout is performed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 19
    • 17, 18
    • client-libs
    • macOS 12.0.1

    • 2d
    • 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);
              }
          }
      }
      ```

            dbatrak Dmitry Batrak
            dbatrak Dmitry Batrak
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: