Re: Font Size Problem in NSTableView
Re: Font Size Problem in NSTableView
- Subject: Re: Font Size Problem in NSTableView
- From: "Michael J.Bergin" <email@hidden>
- Date: Tue, 2 May 2006 17:16:51 -0400
How are you retrieving the ascender, descender and leading values?
-
Michael J. Bergin
email@hidden
Odology, inc.
www.odology.com
Launch any app, anywhere, in under a second
Launcher by Odology
www.odology.com/launcher
On May 2, 2006, at 1:32 PM, David Emme wrote:
I have an NSTableView with two text columns, both set to Lucida Grande
11 in IB. The first column is not user-modifiable and the font does
not
change. The second column is user-modifiable, via a separate
NSTextField, and the user is allowed to change the font, font size,
and
color of these attributed strings.
I am trying to get the NSTableView to respond "properly" to these
attributed strings with differing font properties. I go thru each
attributed string, getting the font information for each range and
computing a row height for that string as MAX(ascender - descender +
leading) (plus 1 for good measure :-). I then send the NSTableView a
setRowHeight: with the largest computed row height (since I can't see
how to set the row heights for individual rows).
This seems (by eye) to produce row heights of an appropriate size.
However, the baseline seems too low for some non-Lucida-Grande
rows, and
some fonts, especially those larger than the default 11 point, have
their descenders clipped, while having what seems to be more than
enough
white space at the top of the NSTableView cell. The strings with
Lucida
Grande 11 stay at the tops of their cells, but those with other fonts
seem to move too far to the bottoms of their cells.
I'm not doing any custom drawing in the problem cells; I'm just
setting
the cell contents to the NSAttributedString in a datasource method:
- (id)tableView:(NSTableView *)tableView
objectValueForTableColumn:(NSTableColumn *)column row:(int)row
{
NSString * identifier = [column identifier];
Reminder * rem = [reminderDoc reminderAtIndex:row];
id answer = [rem valueForKey:identifier];
return answer;
}
Is there something I can do to have these attributed strings drawn
without this clipping?
TIA,
-Dave
--
That is jargon -- the practice of never calling a spade a spade
when you might instead call it a manual earth-restructuring
implement -- and it is one of the great curses of modern English.
-Bill Bryson
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden