TextKit 1 anti-aliasing on macOS Sonoma

I've run into a very strange bug on macOS Sonoma, and I'm guessing it's caused by TextKit 1/2 compatibility issues.

Whenever the caret is drawn on the last line of NSTextView, the anti-aliasing or drawing rect or something changes, causing the text in the current line fragment rect to wiggle up and down. See the example below:


(Note that in this image, I'm using custom caret drawing to test that if that would solve something — it didn't.)

The effect is more apparent on non-Retina displays, but still present on Retina screens as well. I'm using TextKit 1 because I'm maintaining compatibility with older systems, and can't move away just yet. The behavior can't be reproduced on any other OS than Sonoma.

My NSTextView is scaled using scaleUnitSquareToSize but no matter the scale, the issue seems to be present. Text view also has custom input attributes, which includes line height, but drawing doesn't appear to be affected by that.

Has anyone else encountered similar issues on Sonoma, and do you have any suggestions on how to proceed with debugging this?

Can you reproduce this using a non-subclassed NSTextView? If so, I'd suggest a bug report via Feedback Assistant.

If not, you might want to consider code-level support, providing a sample project.

There is a similar (maybe?) issue that is replicable for example by opening Safari info window, and clicking on the Version or on the Copyright textfield. When clicked, the text will become blurry.

TextKit 1 anti-aliasing on macOS Sonoma
 
 
Q