Line Spacing: NSTextField ~10% > NSTextView for same font
Line Spacing: NSTextField ~10% > NSTextView for same font
- Subject: Line Spacing: NSTextField ~10% > NSTextView for same font
- From: Jerry Krinock <email@hidden>
- Date: Sun, 17 Feb 2008 21:24:31 -0800
For a couple years, I've been calculating text height for
programmatically-created text using the Apple-recommended procedure
[1]. But the height that it gave me was sometimes too small unless I
added a 10% fudge factor.
Today, I found that the fudge factor is only needed for text drawn in
NSTextFields. The problem is that the line spacing in a wrapped
NSTextField is about 10% higher than for text drawn in an NSTextView
of the same font. Here's a screenshot of a demo:
http://sheepsystems.com/engineering/SGDemo.png
The Apple-recommended procedure is apparently only good for
NSTextViews, not NSTextFields.
Does anyone know why a wrapped NSTextField has a slightly larger line
spacing than NSTextView with the same font?
What is a good way to predict the required string height for text
which will be drawn in a wrapped NSTextField?
Thanks,
Jerry Krinock
[1] http://developer.apple.com/documentation/Cocoa/Conceptual/TextLayout/Tasks/StringHeight.html
I believe that the following line in there causes an additional error
so I currently don't use it:
[textContainer setLineFragmentPadding:0.0] ;
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden