Search code examples
macoscocoaappkitcjk

NSTextView line height changes when using CJK characters


I use NSTextView to render NSAttributedStrings that may contain non-Latin characters, and it seems that lines containing any CJK character are always 6 pixels taller than lines without those. Even setting the NSParagraphStyle's minimumLineHeight property to a much higher value (e.g. 32 pixels, when using the standard system font size) retains this problem (Lines with CJK characters a rendered as 38 pixels).

Moreover, NSAttributedString's boundingRectWithSize seems to report the wrong ("correct") size (without the extra 6 pixels).

What am I missing?


Solution

  • Setting layoutManager.usesFontLeading to NO solved this problem.