CTFramesetter fails to correctly lay out text containing tabs

Number:rdar://FB9036971 Date Originated:2021-03-09
Status:Open Resolved:
Product:Core Text Product Version:
Classification: Reproducible:
When attempting to use CTFramesetter to layout text containing tabs, things get... weird.

I've run into this bug a few different ways; I've included a swift playground showing one of them. I don't want to speculate too much, but the basic gist is that when a string contains tabs, the CTFrame object can end up with missing lines, and the lines can return unexpected results for CTLineGetStringRange.

In the provided example I would expect the line to be broken at the whitespace, and to see two visual lines, "a", and "bb"; I do see two CTLine objects but their ranges do not make sense.

I encountered this error on macOS 10.14 & 10.15, and can reproduce on the simulator as well.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!