JDK-8170552 : [macosx] Wrong rendering of diacritics on macOS
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 7u40,8,8u112,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-11-30
  • Updated: 2017-11-29
  • Resolved: 2017-02-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10 JDK 8 JDK 9
10Fixed 8u152Fixed 9 b161Fixed
Description
Wrong rendering of diacritics on macOS

Reproduced on 8u112 on a Mac running Sierra (10.12.1)

public class LabelWithDiacriticTest {
    public static void main(String[] args) {
        SwingUtilities.invokeLater(() -> {
            JLabel label = new JLabel("au0300"); // a with grave accent
            label.setFont(new Font("Menlo", Font.PLAIN, 24));
            JFrame frame = new JFrame();
            frame.add(label);
            frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        });
    }
}

To reproduce the issue, run the attached sample program. It's expected to
show text label with 'a' character, with grave accent applied. Instead it
shows label with 'a' and grave accent rendered separately.


Comments
It looks like the problem with unicode character in the test was introduced by SBT, since the test inside BugDB has unicode properly escaped. I will let SBT team know about this possible problem. BTW, can you take a look at the fix suggested by the submitter of the bug (see macDiacriticsDrawingFix.patch in the attachment), please?
02-02-2017

It is not hard to fix so why do we keep getting partial code as test cases ? Why can't the imports be added ? And the unicode properly escaped ? import javax.swing.*; import java.awt.*; public class LabelWithDiacriticTest { public static void main(String[] args) { SwingUtilities.invokeLater(() -> { JLabel label = new JLabel("a\u0300"); // a with grave accent label.setFont(new Font("Menlo", Font.PLAIN, 24)); JFrame frame = new JFrame(); frame.add(label); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); }); } }
01-12-2016

I can reproduce this on 9 - even with harfbuzz. And its not new in 8u112. So it affects all releases. Also it reproduces on Yosemite.
01-12-2016