Re: Line spacing in NSTextView

2009-02-14 Thread Slava Pestov
On Sun, Feb 15, 2009 at 12:26 AM, Aki Inoue wrote: > The most simple logic for getting the default line height can be accessible > via -[NSLayoutManager defaultLineHeightForFont:]. > AppKit puts descent + leading below the baseline, so you should be able to > calculate the line spacing delta on to

Re: Line spacing in NSTextView

2009-02-14 Thread Aki Inoue
On Sat, Feb 14, 2009 at 9:58 PM, Aki Inoue wrote: The Text System encapsulates the logic to determine the ideal layout. It's not just queried from a font instance. It requires the context of an entire line. What if the line is rendered with a single font? Which font attributes are invo

Re: Line spacing in NSTextView

2009-02-14 Thread Slava Pestov
On Sat, Feb 14, 2009 at 9:58 PM, Aki Inoue wrote: > The Text System encapsulates the logic to determine the ideal layout. It's > not just queried from a font instance. It requires the context of an entire > line. What if the line is rendered with a single font? Which font attributes are involve

Re: Line spacing in NSTextView

2009-02-14 Thread Aki Inoue
Slava, Calculating an optimal vertical layout is pretty involved. At least, the Cocoa Text System has sophisticated logic to determine the ideal layout because of the numerous and varying design target for different fonts. For example, as you found out, many fonts designed in 80s have pr

Re: Line spacing in NSTextView

2009-02-14 Thread Slava Pestov
Is there a way to compute what the default leading would be for a font? This is for a Mac OS backend of a cross-platform GUI toolkit, so I can't really just use NSTextView here. Slava On Fri, Feb 13, 2009 at 9:16 PM, Graham Cox wrote: > Line spacing (or to be more precise, leading) is an attribu

Re: Line spacing in NSTextView

2009-02-13 Thread Graham Cox
On 14 Feb 2009, at 1:15 pm, Slava Pestov wrote: Hi all, Can someone enlighten me, how does NSTextView compute line spacing? When I display a piece of text in stickies, with Helvetica 12 (or any other font, really), and the same piece of text in my application, stickies adds another 2 pixels o

Line spacing in NSTextView

2009-02-13 Thread Slava Pestov
Hi all, Can someone enlighten me, how does NSTextView compute line spacing? When I display a piece of text in stickies, with Helvetica 12 (or any other font, really), and the same piece of text in my application, stickies adds another 2 pixels of spacing between every line, and the result looks m