The text "Line Height" calculation on iOS/Mac is THE rocket science 🔬

There is literally one public method that can calculate it right: `NSLayoutManager.defaultLineHeight(for:)`. The logic behind it does not consistently match CoreText
CTLine, CTFramesetter, or a plain (ascent + descent + leading) calculation 🍿

Literal rocket science build on top of years of assumptions, mistakes, historic use. why? becasue reasons. magic delta values depends on the font name/style/size.

one may naively think: font provide all the metrics needed to correctly calculate the size. WRONG. It provides some of information, the other part is either deducted, hardcoded or yoyo. Example, Helvetica at one point ha

lineHeight = ascent + ((ascent + descent) * 0.15) + descent, then there's language aware adjustment on top of that.

I can't make this shit up.

@krzyzanowskim I asked about this while I was at Apple and the answer tracks, a lot of it was “Steve thought it didn’t look right unless we adjusted it a couple points this way”
@MyLittleMetroid oh, I didn't expect it was god intervention involved 😉

@krzyzanowskim from everything I hear second hand (not third) he was far more invested in doing design reviews than most of his other CEO work.

So early 00s little showed on a Mac screen that he hadn’t ok, same for the iPhone after. The fact that it was all 1x screens back then didn’t help, all sorts of tweaks for antialiasing to look right.