Re: boundingRectWithSize gives wrong size
Re: boundingRectWithSize gives wrong size
- Subject: Re: boundingRectWithSize gives wrong size
- From: Jens Alfke via Cocoa-dev <email@hidden>
- Date: Wed, 28 Aug 2019 14:10:12 -0700
> On Aug 28, 2019, at 12:33 PM, Gabriel Zachmann via Cocoa-dev
> <email@hidden> wrote:
>
> NSRect string_rect = CGRectIntegral( [mesg_string boundingRectWithSize:
> drawRect_.size
What is drawRect_ set to when this is called?
It's been a while since I used this, but IIRC the output width will be the same
as the input, with the height increased to account for the number of lines the
string is broken into.
With NSStringDrawingUsesLineFragmentOrigin, if the text is broken into lines,
it's not going to tell you the exact pixel width of the widest line.
In single-line mode (without NSStringDrawingUsesLineFragmentOrigin) I believe
you do get the exact dimensions of the single line of text.
—Jens
_______________________________________________
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