Unstable text layout in NSLayoutManager

Hey,

Maybe someone can explain me why NSLayoutManager is giving me "unstable" layout?

It's like it decides to include line-height-multiple of 1.2 sometimes: We're doing some custom text rendering and if I change font size by a bit (or other property), then suddenly there is this extra text spacing.

What we noticed so far is that there is something special about the first font that was set on NSTextStorage, in that case text has no extra spacing. Once you change it to slightly modified font else - the extra spacing is introduced.

It's not NSParagraphStyle.lineHeightMultiple - if I set it to something non default then it acts as extra, but doesn't solve the "layout instability" issue.

Any clue what's causing this? or how to make it to be stable?

Unstable text layout in NSLayoutManager
 
 
Q