-
-
Save qtxie/a16717f74bc2f6c83b9ba922367cddc9 to your computer and use it in GitHub Desktop.
Core Text - Calculating line height
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CGFloat GetLineHeightForFont(CTFontRef iFont) | |
{ | |
CGFloat lineHeight = 0.0; | |
check(iFont != NULL); | |
// Get the ascent from the font, already scaled for the font's size | |
lineHeight += CTFontGetAscent(iFont); | |
// Get the descent from the font, already scaled for the font's size | |
lineHeight += CTFontGetDescent(iFont); | |
// Get the leading from the font, already scaled for the font's size | |
lineHeight += CTFontGetLeading(iFont); | |
return lineHeight; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment