• 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: NSAttributedString drawing and NSText drawing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSAttributedString drawing and NSText drawing


  • Subject: Re: NSAttributedString drawing and NSText drawing
  • From: email@hidden
  • Date: Wed, 31 May 2006 11:17:18 +0200

Dear Joshua,

Thanks very much, fiddling with the typesetter behavior completely
solved the problem, and my project is now back on track. Thanks a
million for the help, one question, how did you find out about this,
I mean where should I go read so that I do not run into issues like
this again ?

Thanks

Vincent
>
>
>
>---- Original Message ----
>From: email@hidden
>To: email@hidden
>Subject: Re: NSAttributedString drawing and NSText drawing
>Date: Mon, 29 May 2006 12:53:55 -0500
>
>>> When I draw the text with drawAtPoint: method of
>NSAttributedString
>>> it's spacing is marginally different from when the equivalent RTF
>is
>>> drawn by the NSText or NSTextView.
>>
>>I just had this problem. It boils down to the fact that
>>NSTypesetter's behavior has been updated over the years as each new
>
>>version of OS X has been released. But, for compatibility's sake,
>>it's behavior can be changed to mimic older typesetting
>>implementations via
>>-[NSLayoutManager setTypesetterBehavior:(NSTypesetterBehavior)]
>>or
>>-[NSTypesetter setTypesetterBehavior:(NSTypesetterBehavior)]
>>
>>The trick is, drawing convenience methods like -drawAtPoint: are set
>
>>to use NSTypesetterBehavior_10_2_WithCompatibility. If your
>>NSTextView's layout manager is set to use something else (I think
>>it's set to use NSTypesetterLatestBehavior by default[???] which on
>
>>Tiger resolves to NSTypesetterBehavior_10_4), then your line
>spacings
>>are subtly different.
>>
>>The solution is to make sure both your text view and your -
>>drawAtPoint: are using the same behavior. Seeing as it's not
>possible
>>to change -drawAtPoint:, it's probably best to do a
>>[[myTextView layoutManager]
>>setTypeSetterBehavior:NSTypesetterBehavior_10_2_WithCompatibility];
>>
>>That, or don't use -drawAtPoint:. If you if you already have a
>layout
>>manager with the text laid out in it (as you should in your
>>NSTextView), you ought to be able to draw directly from that (-
>>drawGlyphsForGlyphRange:atPoint:???). Then you won't have to worry
>>about different layouts, because the same layout manager is doing
>the
>>drawing in both cases.
>>
>>
>>Cheers,
>>-Joshua Emmons


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSAttributedString drawing and NSText drawing
      • From: Joshua Scott Emmons <email@hidden>
  • Prev by Date: Click on a URL in WebKit
  • Next by Date: Re: Exposing Methods in a Framework
  • Previous by thread: Re: NSAttributedString drawing and NSText drawing
  • Next by thread: Re: NSAttributedString drawing and NSText drawing
  • Index(es):
    • Date
    • Thread