• 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
"Toll free" bridge from NSAttributedString * to CFAttributedStringRef
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"Toll free" bridge from NSAttributedString * to CFAttributedStringRef


  • Subject: "Toll free" bridge from NSAttributedString * to CFAttributedStringRef
  • From: vincent habchi <email@hidden>
  • Date: Thu, 8 Apr 2010 14:02:18 +0200

Hi there,

I've been fiddling with NSAttributedString lately, and the way to display them through Core Text. In the docs, I've read that NSAttributedString and CFAttributedStringRef were supposed to be "toll free" bridged; I assumed that meant that one could be used in lieu of the other with (or maybe even without) a simple cast.

But I found this is not true. Specifically, I was getting strange errors like "CFSet[Stroke|Fill]ColorFromColor : invalid context 0x0" each time I printed my NSAttributedString by CTLineDraw(), although I had a perfectly valid context. The glyph were drawn, but always in black, while I was attempting to get another color via the NSForegroundColorAttributeName. At the end, I had to replace the pair (NSColor, NSForeground…) by a (CGColorRef, kCTForeground…), and now it works.

Is that supposed to be a "normal" behavior, did I misunderstand the meaning of "toll free", or is it a bug?

Thanks!
Vincent

PS : conversely, I found that NSFont * and CTFontRef are really equivalent._______________________________________________

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: "Toll free" bridge from NSAttributedString * to CFAttributedStringRef
      • From: "Adam R. Maxwell" <email@hidden>
    • Re: "Toll free" bridge from NSAttributedString * to CFAttributedStringRef
      • From: glenn andreas <email@hidden>
  • Prev by Date: The right place for an importer in the document architecture
  • Next by Date: Re: [ANN] AppKiDo-for-iPhone 0.984 fixes bug with 3.2 SDK
  • Previous by thread: Re: The right place for an importer in the document architecture
  • Next by thread: Re: "Toll free" bridge from NSAttributedString * to CFAttributedStringRef
  • Index(es):
    • Date
    • Thread