I'm trying to manually size a UITextView so that it exactly fits some text. (I know this can be done with auto layout and disabled scrolling, but that doesn't work here for other reasons.) I'm correctly accounting for textContainerInset
and layoutMargins
but calculating the line height isn't working.
The pic above shows a 120pt font supposedly with a 120pt line height, but clearly the actual line height is 145pts. The question is, how do I calculate that number?
FWIW I checked and the NSParagraphStyle object set on that text view has nothing interesting, ie lineHeightMultiple
, lineSpacing
, paragraphSpacing
are all at their default of 0.0. It's created in the storyboard and none of its layout attributes are changed in code.
Edit: I should have mentioned, this doesn't happen with most fonts. The font I'm currently looking at is called Sahar.