In the next REAL Studio 2010 r3 build that beta testers will soon receive, we've added support for RTF (Rich Text Format) to the TextArea control in Cocoa. The Carbon TextArea control of course already supports RTF so this is really just for compatibility.
I tested the RTF support and what I found interesting was how the text rendering differed from Carbon to Cocoa. Consider the following two examples:
This is RTF rendered in Carbon:

You can see they are very different. The Cocoa rendered text is more condensed and harder to read. At first, I thought this was a bug. I opened the RTF file using TextEdit (which is a Cocoa application) and discovered that it's not a Cocoa bug, but a Carbon bug! Or to put it another way, the Carbon framework on Mac OS X appears to simply render RTF differently. In my case, I just chose a different font and now it looks great when I run my app under Cocoa.
By the way, the app I'm testing with is the same app I mentioned in the newsletter this month. With RTF now working, there is only one bug that would keep the app from shipping and two minor bugs that would be nice to see fixed before I ship it as a Cocoa app:
- The app prints a report and while it does print, the Print dialog doesn't close when it should.
- The about box doesn't display. Instead you get a generic Cocoa-created about box. (minor)
- The StaticText control renders its text 1 pixel too high (minor - for this app anyway).
9 comments:
how about RTF for the Windows version?
Will it support pictures, bullet points, setting tab positions, margins, highlighting etc. ?
How about a multilingual spellchecker or sample application showing how to use a third party spellchecker via ole?
john m.
I've looked at post on two Macs running Safari 5. Neither one display the images.
Keith - that's odd. I'm looking at it from Safari 5 and I can see the images.
What newsletter? I didn't get one about Cocoa...
You can sign up for the monthly newsletter here: http://www.realsoftware.com/support/listmanager/
I'm not quite sure whether the Carbon rendering bug is in the RB framework or in Mac OS X.
If it's in the RB framework, does RS plan to fix it?
If it's in Mac OS X, which version, Tiger, Leopard, Snow Leopard?
Would you clarify that, please?
If you are referring to the difference between the RTF rendering in Carbon versus Cocoa, I'm not sure if I would call it a bug. But if it IS a bug, it's a bug in the Carbon libraries of Mac OS X and there would be nothing we can do about that. The fix for those that prefer how Cocoa renders text is to wait for us to ship our Cocoa-based platform layer and then recompile your projects with that.
Thanks, Geoff. Has the difference been reported to Apple, and if so, does Apple plan to investigate it?
We haven't reported anything to Apple about it because Apple (a) knows there are differences both ways between Carbon and Cocoa and (b) has made it pretty clear that Carbon is deprecated for the most part. Cocoa is the future. That's why we are moving to Cocoa. Apple is unlikely to do much in Carbon at this point.
Post a Comment