Find center of characters in NSTextView
For each line开发者_C百科 fragment in an NSTextView, I'm placing a subview next to it for collapsing. The problem is, different fonts throw off the baselines and I can never position the view in the exact center of the text.
I've tried getting the baseline offset, but it doesn't quite seem to do the trick.
Here's the meat of the question: Assuming the "•" character is it's own view, how can I do this:
•Text
for ANY font in ANY language?
See Getting Font Metrics of the Font Handling guide. Additionally the Getting Glyph Layout and related sections give a more complete answer.
精彩评论