Sizing text in a box
Sizing text in a box
- Subject: Sizing text in a box
- From: email@hidden
- Date: Tue, 5 Feb 2002 16:28:06 -0800
I'm using -[NSAttributedString drawInRect:] to draw a string in a rect
(surprisingly enough :->). I'd like to have the text aligned to the
*bottom* of the rect, though, and I'm a bit flummoxed. There is no
attribute or paragraph style I can find that achieves this.
So I think I have to make my rect be the right height, such that
aligned to the top is the same thing as aligned to the bottom. However,
I don't know how many lines my text will be when wrapped into the rect,
and -[NSAttributedString size] doesn't take a rect -- it seems to assume
an un-wrapped layout. I can't find a simple way to do this -- it looks
like I have to bust out NSLayoutManager. Which I know how to do, but --
ugh! Is there really no way to find out the extent my text will draw to
before I actually draw it?
I have a feeling I'm just missing the obvious, but I searched all the
Cocoa headers for methods returning NSSize and didn't hit pay dirt...
Ben Haller
Stick Software
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.