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

[macosx] Arabic character cannot be rendered on MacOS X

    Details

    • Subcomponent:
      2d
    • Introduced In Build:
      b96
    • Introduced In Version:
      9
    • Resolved In Build:
      b158
    • CPU:
      x86_64
    • OS:
      os_x

      Backports

        Description

        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);
                    }
                }
            }
        }

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  psadhukhan Prasanta Sadhukhan
                  Reporter:
                  thlenz Thomas Lenz (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Due:
                    Created:
                    Updated:
                    Resolved: