Re: What rect does NSTextFieldCell use to draw its contents?
Re: What rect does NSTextFieldCell use to draw its contents?
- Subject: Re: What rect does NSTextFieldCell use to draw its contents?
- From: Kyle Sluder <email@hidden>
- Date: Thu, 13 Dec 2012 15:17:47 -0800
On Tue, Dec 11, 2012, at 02:17 AM, email@hidden wrote:
>
> On 10 Dec 2012, at 19:13, Kyle Sluder <email@hidden> wrote:
>
> > It's my understanding that the intent of NSStringDrawing is to provide
> > the exact same drawing as NSTextFieldCell.
> Is that stated anywhere?
I swear it was stated somewhere… it might have been in a WWDC video. But
I know that NSStringDrawing and NSTextFieldCell both go through the same
core hunk of code (_NSStringDrawingCore).
From the disassembly I'm reading, it really looks like NSTextFieldCell
is calling -titleRectForBounds: to compute the frame to draw within, but
that's just not happening.
> Have you confirmed that the issue occurs with an NSString instance?
Yes.
>
> In the past I have experienced layout differences when calling either
> drawAtPoint: or drawWithRect:options.
> I would experiment with calling drawAtPoint: and drawInRect:
Tried it; there's no difference here.
>
> The Text Layout Programming Guide says:
>
> String Drawing and Typesetter Behaviors
>
> There are differences among Cocoa’s three ways to draw text with regard
> to typesetter behavior, which is described in “Typesetter Behaviors and
> Versions.” By default, the string-drawing convenience methods and NSCell
> objects supplied by the Application Kit
> useNSTypesetterBehavior_10_2_WithCompatibility, whereas NSLayoutManager
> objects use NSTypesetterLatestBehavior. It is important to use the same
> typesetter behavior when both measuring and rendering text, to avoid
> differences in paragraph spacing, line spacing, and head indent handling.
Since I'm comparing the string-drawing methods to NSTextFieldCell
drawing, according to this documentation there should be no difference.
--Kyle Sluder
_______________________________________________
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