[R-SIG-Mac] The diff as promised

Byron Ellis bellis at hsph.harvard.edu
Wed Aug 4 07:38:41 CEST 2004

Cool, it was a lot more complex but it eventually got to the point 
where it would become a maintenance nightmare, so I backed it out and 
just had Cocoa take complete control of the graphics device. More work 
for me in some sense, but easier to maintain I think.

Do you mean R will run without having to use the Cocoa bundle to 
bootstrap the code? I'd be curious to see how that worked. I guess I 
will in August :-)

I've got my quartz device mostly working. I think my font layout code 
is still slightly off for rotated text (R and Cocoa seem to have 
different ideas of where the baseline is located), but its basically 
all there and completely written in Cocoa--it uses NSLayoutManagers for 
the layout and NSFontManagers for font selection and so on. 
Additionally, I haven't figured out how/where to set fontfamily in 
R_GE_gcontext, which devPS seems to use so it defaults to Helvetica no 
matter which family is used so far. At any rate, I've checked the 
entire project into the StatPaper CVS repository:

  cvs -z3 -d:pserver:anonymous at cvs.sourceforge.net:/cvsroot/statpaper co 

or browse at


most of the device is implemented in GraphicsDeviceManager.m with 
support in *+R.h/.m for handling R<->NSColor and R<->NSBezierPath. 
Since I just checked it in, I haven't updated the licensing block 
properly in the code nor given proper credit to yourself and Simon yet, 
hope you aren't too offended ;-)

On Aug 3, 2004, at 4:15 PM, stefano iacus wrote:

> Byron,
> thanks. I'll have a look.
> I've been able to embed R inside a pure Cocoa app with Simon's 
> suggestions but without using threads and controlling over the R event 
> loop.
> At this point all the widgets (workspace browser etc) will be 
> rewritten in Cocoa.
> Sometime in august I'll release the xcode project so that other people 
> can contribute with their work.
> I'm also thinking about entirely replace the quartz device witha  pure 
> cocoa one, so if you have already some code ready it would be nice to 
> look at it as well.
> stefano
> On Aug 3, 2004, at 9:49 PM, Byron Ellis wrote:
>> Here is my diff for the cocoa interface that lets the Cocoa bundle 
>> take over the graphics device. I ended up taking the "most effort" 
>> route with respect to the Cocoa developer and overriding 
>> innerQuartzDeviceDriver rather than the individual functions as I had 
>> originally intended. The reason for this is that I won't necessarily 
>> be allocating an entire view to rendering the graphics. I may be 
>> using an NSCell as my Device, which would share its context with its 
>> parent NSView. You also might want to do something amusing like 
>> composite onto a Quicktime movie for something.
>> I also wired up the various little widgets (like the workspace 
>> browser) so that Cocoa can take control of those as well.
>> The diff is against a subversion checkout from yesterday I believe. 
>> My bundle that works against this diff be posted soon. Details to 
>> follow.
>> <cocoa.diff>
>> ---
>> Byron Ellis (bellis at hsph.harvard.edu)
>> "Oook" -- The Librarian
>> _______________________________________________
>> R-SIG-Mac mailing list
>> R-SIG-Mac at stat.math.ethz.ch
>> https://www.stat.math.ethz.ch/mailman/listinfo/r-sig-mac
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://www.stat.math.ethz.ch/mailman/listinfo/r-sig-mac
Byron Ellis (bellis at hsph.harvard.edu)
"Oook" -- The Librarian

More information about the R-SIG-Mac mailing list