Saved Custom Font data to UIFont.
UIFont* font = [UIFont fontWithName:@"SourceHanSans-Medium" size:nEmSize];
Now I want to get the height of a string.
However, the value of nEmSize, which is the size of the font, is returned for the height of the string.
NSDictionary *userAttributes = @{NSFontAttributeName: font, NSForegroundColorAttributeName: [UIColor blackColor]};
const CGSize textSize = [strText sizeWithAttributes: userAttributes];
return (NSInteger)(floor(textSize.height));
So I thought of doing a descent - ascent on the FontMetrics data.
But I did a search and looked up the documentation, but couldn't find a way to get a value from UIFont.
Is there a way to get the descent value and ascent value of a specific string with font applied?