Created
October 23, 2012 16:18
-
-
Save zsiegel/3939819 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