On Tue, Dec 11, 2012, at 02:17 AM, jonat...@mugginsoft.com wrote:
> 
> On 10 Dec 2012, at 19:13, Kyle Sluder <k...@ksluder.com> 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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to