• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: boundingRectWithSize gives wrong size
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >boundingRectWithSize gives wrong size (From: Gabriel Zachmann via Cocoa-dev <email@hidden>)

  • Prev by Date: Re: Cocoa-dev Digest, Vol 16, Issue 72
  • Next by Date: Re: Cocoa window messages in app being ported from Carbon
  • Previous by thread: Re: boundingRectWithSize gives wrong size
  • Index(es):
    • Date
    • Thread