From murdoch at stats.uwo.ca  Wed Jan 31 15:12:09 2007
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Wed, 31 Jan 2007 09:12:09 -0500
Subject: [Rd] PGF Device
In-Reply-To: <Pine.LNX.4.64.0701311328150.17807@gannet.stats.ox.ac.uk>
References: <693732970701301750x5b4b2daai62380bdf28417158@mail.gmail.com>
	<45C08BC7.4030305@stats.uwo.ca>
	<Pine.LNX.4.64.0701311328150.17807@gannet.stats.ox.ac.uk>
Message-ID: <45C0A3B9.2070808@stats.uwo.ca>

On 1/31/2007 8:49 AM, Prof Brian Ripley wrote:
> On Wed, 31 Jan 2007, Duncan Murdoch wrote:
> 
>> On 1/30/2007 8:50 PM, jtxx000 wrote:
>>> Greetings all,
>>> PGF is a package for LaTeX which works with both ps
>>> and pdf output without any nasty hacks like pictex.
>>> Is there any technical reason why there could not be a
>>> PGF graphic device for R?  If not, I'm going to try to
>>> throw one together.  Any tips for getting started?
>>
>> The existing drivers are in the grDevices package.  I would start with
>> one of those (the picTeX driver would probably be most similar) and go
>> from there.  Alternatively, start from devNULL.c and fill in the blanks.
> 
> Please don't start from pictex (it is only half implemented, including no 
> real font metrics).  If you need Type1 fonts, I suggest you start from the 
> postscript/PDF driver.
> 
>> Someone else may be able to offer advice about whether you should be
>> targetting this to be your own package, or for inclusion in the R
>> source.  In the past it's been impossible to create a driver in a
>> package, and there's been talk about adding enough to the API to allow
>> this, but I don't know whether that's in place yet.
> 
> There are several devices in packages, and this has been possible since at 
> least R 1.4.0 (from 2001).  There used to be gtkDevice (still on CRAN, but 
> old Gtk), GNOMEdevice (never finished) and an SVG driver 
> (http://www.darkridge.com/~jake/RSvg/), and there are now cairoDevice on 
> CRAN, the quartz device in the R.app front-end, and others.

Yes, I must have been thinking about connections.  Just for the record, 
is it possible to create a new connection type in a package?

Duncan Murdoch

> 
> Paul Murrell used to have a list of known graphics devices, but I was 
> unable to locate it quickly.
> 
> I've written several devices, including pdf(), xfig() and versions of 
> png() etc.  The hard part is getting text and font metrics working: also 
> nowadays you need to be prepared to handle UTF-8 text and CJK locales, 
> which many graphic systems are not up to speed on (including postscript, 
> pdf and latex).
>



[Rd] PGF Device
Duncan Murdoch