On Dec 12, 2011, at 4:04 PM, Graham Cox wrote:

> I'm drawing objects into a bitmap rep and a context created from it.
> 
> The y axis extends downwards (i.e. it's flipped).
> 
> Normal objects render correctly.
> 
> Text is inverted.
> 
> 
> 
> This problem keeps rearing its ugly head. I'm still not sure I really 
> understand it.
> 
> When I set up the context from the bitmap, I create a transform that flips 
> the context. Paths and so forth appear the right way up. I'm rendering text 
> using the built-in text rendering engine (NSLayoutManager) and it fails to 
> notice that the context is flipped, so it appears to add its own flipping 
> transform and so text is inverted. I need to let the context I create from 
> the bitmap know that it is flipped, but there is no -setFlipped: method on 
> NSGraphicsContext, and the method that creates a context from a bitmap 
> doesn't let me pass the flippedness, as the method for creating a context 
> from a graphicsPort does.
> 
> How do I inform the context that it is flipped, so that text is rendered 
> correctly?

IIRC, NSLayoutManager expects that the view it is drawing in is flipped 
(-isFlipped returns YES). If it isn't, it will draw text inverted. Soooo.. I 
think all you need is to implement isFlipped returning YES.

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

_______________________________________________

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

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

Reply via email to