[macos] Font substitution does not work for supplementary characters

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 9
    • Affects Version/s: 8, 9
    • Component/s: client-libs
    • 2d
    • b150

      MacOSX supports automatic font fallback for unicode code points
      not supported by a specified font.
      JDK has implementation support to have that work in JDK too.

      However this is not working for unicode supplementaray characters represented by surrogate pairs as demonstrated
      by this test:

      import javax.swing.*;
      import java.awt.*;

      public class SurrogatesFallbackTest {
          public static void main(String[] args) {
              SwingUtilities.invokeLater(() -> {
                  JFrame frame = new JFrame();
                  JLabel label = new JLabel(new String(Character.toChars(0x1d400))); // MATHEMATICAL BOLD CAPITAL A
                  label.setFont(new Font("Menlo", Font.PLAIN, 36)); // expected to fallback to STIXGeneral
                  frame.add(label);
                  frame.pack();
                  frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
                  frame.setLocationRelativeTo(null);
                  frame.setVisible(true);
              });
          }
      }

            Assignee:
            Philip Race
            Reporter:
            Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: