Skip to content

Instantly share code, notes, and snippets.

@swillits
Created November 5, 2014 22:39
Show Gist options
  • Save swillits/eda0e08f344ea975206a to your computer and use it in GitHub Desktop.
Save swillits/eda0e08f344ea975206a to your computer and use it in GitHub Desktop.
How NSTextField determines how high the field should be based on the text font
ascender = 13.775909423828125
descender = -3.821929931640625
baseLineHeight = (descender.abs + 0.5).floor + (ascender + 0.5).floor
ascenderDelta = (baseLineHeight * 0.2 + 0.5).floor
fontHeight = ((ascenderDelta + baseLineHeight) + descender).ceil - descender.floor # 23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment