Skip navigation.
 
mlRe: Changing the line height of an NSTextField?
FROM : Douglas Davidson
DATE : Wed Mar 26 23:17:51 2008

On Mar 26, 2008, at 3:10 PM, Nicholas J Humfrey wrote:

> In the end I subclased the NSTextField class and overrid the 
> drawRect function. I then split the string up into its lines and 
> drew them myself using drawRect. This is some of the first Cocoa 
> code I have written, so please don't hurt me if what I am doing is 
> crazy!


Well, what you're doing is using only explicit line breaks, rather 
than allowing wrapping, and you're taking into account only \n as a 
line separator, rather than handling all of the line and paragraph 
break characters.  What you're doing will work, more or less, but it's 
not sufficiently general to be a real solution.

I missed the initial question, but in general line heights are 
controlled by an NSParagraphStyle, which is used as the value of the 
NSParagraphStyleAttributeName attribute.  This is the same object that 
controls most paragraph-level styling, including line breaking, 
alignment, etc.

Douglas Davidson

Related mailsAuthorDate
mlChanging the line height of an NSTextField? Nicholas J Humfrey Mar 26, 11:41
mlRe: Changing the line height of an NSTextField? John Stiles Mar 26, 17:58
mlRe: Changing the line height of an NSTextField? Nicholas J Humfrey Mar 26, 23:10
mlRe: Changing the line height of an NSTextField? Douglas Davidson Mar 26, 23:17
mlRe: Changing the line height of an NSTextField? Nicholas J Humfrey Mar 26, 23:48