"Toll free" bridge from NSAttributedString * to CFAttributedStringRef
"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