If I have an NSAttributedString that I draw with [str drawAtPoint:p], how can I construct a frame rectangle around p for an NSTextView that will let me edit that text without it appearing to shift in any way?
How to position NSTextView identically to drawn text?
So what is your problem ? To calculate the rect that matches the string ?
If so, this could help
https://stackoverflow.com/questions/24265986/calculating-the-size-of-attributed-text-with-custom-font-in-ios
If so, this could help
https://stackoverflow.com/questions/24265986/calculating-the-size-of-attributed-text-with-custom-font-in-ios
Don't try and draw the string that just won't work. They won't always or ever match up. I learned that the hard way. This was sheepishly confirmed by Apple DTS. One way to solve it is to use a NSTextView everywhere you want the editable string and set isEditable = false and isSelectable = false and let that do your drawing. When you want to edit it, either set it as editable or create a new NSTextView that has the same size and feed it your NSAttributedString.