• 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: Business as usual: Flipped context causing grief
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Business as usual: Flipped context causing grief


  • Subject: Re: Business as usual: Flipped context causing grief
  • From: Keary Suska <email@hidden>
  • Date: Mon, 12 Dec 2011 18:00:37 -0700

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 (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

  • Follow-Ups:
    • Re: Business as usual: Flipped context causing grief
      • From: Graham Cox <email@hidden>
References: 
 >Business as usual: Flipped context causing grief (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Web Kit - playing HTML5 video in a separate window
  • Next by Date: Re: Business as usual: Flipped context causing grief
  • Previous by thread: Business as usual: Flipped context causing grief
  • Next by thread: Re: Business as usual: Flipped context causing grief
  • Index(es):
    • Date
    • Thread