xfig device (was [Rd] Re: [R] MetaPost device?)

Telford Tendys telford@progsoc.uts.edu.au
Tue, 11 Apr 2000 17:21:44 +1000

On Tue, Apr 11, 2000 at 07:25:50AM +0100, Prof Brian D Ripley wrote:
> On Tue, 11 Apr 2000, Telford Tendys wrote:
> > > Even to plot "threshold" centred you need to know its width and height and
> > > depth: see GText.
> > 
> > In xfig you can choose for a string to be centered and then give it
> > the string and the centre-point and it figures out the rest, it also
> > outputs this correctly centred despite font variations.
> Eh?  R allows proportional centring (adj can be between 0 and 1) and my
> point was that the R driver model *requires* the knowledge. As I said, see
> the code for GText.

Hmm, OK xfig only supports left, right and centre, and now I look closer
at the drivers I see that there is a slot for a string width function.
I also notice the PS driver supports the string width function by simply
summing up the character widths from the afm (see the PostScriptStringWidth
function in devPS.c).

So I agree, make the assumption that all xfig fonts are postscript fonts and
share code with the PS driver for string width.

There should be a fancier implementation of the string width calculation
inside the GNU ghostscript source somewhere. Since that is GPL code it
should be OK to paste into R (adapting it should not be too difficult),
this would include all kerning stuff and would guarantee compatability
between the R driver and the printout (if I remember rightly, gs is built
from lots and lots of little source files, each one implementing one function).

> My point, which you seem to have missed, is that existing code for font
> metric information could be used in an xfig driver.

Yup, I'm with you now.

	- Tel
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch