Bad kerning when using - [NSString drawInRect: withAttributes:]

When using - [NSString drawInRect: withAttributes:], mainly when using the built-in Helvetica Neue, but also with other fonts, kerning is really bad. However, when the same line is displayed in Text Edit (which uses NSTextView), kerning is great. Consider these two lines:

Bad kerning

Good kerning

For small dot sizes, the first case (displayed in Cocoa) is almost illegible, and the second case (from Text Editing) is much better. I don't think kerning information is used here at all. If I use NSKernAttribute with a value of 0.0 (which, according to the documentation, disables kerning), I get the same result that is at the top.

Core Text CTLineDraw, . : - , , Cocoa? , NSTextView ?

+5
1

" ", - "", . -[NSTextView tightenKerning], -[NSTextView loosenKerning]. Apple , "" "", .. ( ), , " ", , , , .

"" "" , , OSX, .

, , , : "AV" : "A" , , "V".

OSX Helvetica HelveticaNeue ( ) , , .

, " Cocoa?" , , (?).

+1

All Articles