JDK-8335273 : [macos] irregular rendering of mixed text in RTL orientation
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 11,17,21
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: os_x
  • Submitted: 2024-06-27
  • Updated: 2024-06-30
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.
Other
tbdUnresolved
Related Reports
Relates :  
Description
Run the attached program on macOS (first reproduced on M1 Pro 14.5).

- slowly make the frame width larger by dragging the right edge of the window to the right

observe the following failure modes:
1. a space appears between "::" and "Arabic" on the first line
2. when this happens, the cursor stops blinking (either stays on or disappears)
3. when the Arabic word appears on the first line, the space between "::" and "Arabic" disappears (the text gets rendered correctly) but the part of the cursor's direction indicator sometimes remains on screen permanently

(see the screenshots)

This issue is similar to https://bugs.openjdk.org/browse/JDK-8330559 in JavaFX, or it might be caused by the same macOS bug.

The phantom space seems to appears when the CTRunGetPositions native call populates the positions array with negative values.

For reference, the text string is

"Arabic:: " +
 "\u0627\u0644\u0639\u0631\u0628\u064a\u0629" +
"\n" +
"Hebrew: " +
"\u05e2\u05d1\u05e8\u05d9\u05ea"

Apple API https://developer.apple.com/documentation/coretext/1508678-ctrungetpositions