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

Prof Brian D Ripley ripley@stats.ox.ac.uk
Sat, 8 Apr 2000 10:08:40 +0100 (BST)


On 8 Apr 2000, Peter Dalgaard BSA wrote:

> Prof Brian D Ripley <ripley@stats.ox.ac.uk> writes:
> 
> > Are we not just discussing a xfig driver for R, and R's driver model only
> > writes single text strings at specified (x,y) locations?  So test output
> > from an R xfig driver would not be richly structured?  Yes, there is
> > kerning but there is using postscript fonts directly, surely?
> > By the time a dvixx driver is reading the dvi file the kerning has been
> > done, but the information is all there in the tfm, and the format is
> > readily available (e.g. in tftopl).
> 
> But what about plotmath? If we want to get the equivalent of
> \alpha*\text{threshold}_i (say) to come out right then we need to know
> the length of "threshold" in the relevant font... Of course you could

Do you mean *width* of "threshold"?  That's exactly what I was envisaging.
Even to plot "threshold" centred you need to know its width and height and
depth: see GText.

As I understand it plotmath computes the locations of the pieces ("alpha"
and "threshold" and "i" in the example) and outputs them as separate
strings.  And as far as I can see plotmath does not use kerning information
(look at RenderStr in plotmath.c) to find the string's bounding box, even
though the postscript renderer will.  Similar, the GStrWidth for the 
postscript device just adds up the character widths and so ignores kerning.

> (potentially) get the driver to output actual TeX, but then you have
> no inkling about the total size of the formula object, and it comes
> out as TeX code inside XFig. Xfig is pretty much geared towards
> postscript fonts, so I suppose the most practical thing to do is to
> assume PS as the final target and accept the approximations caused by
> the screen fonts while previewing. 

I think I said that in part of my posting which you omitted!


Summary: 

R currently seems to ignore kerning in computing string dimensions.

Finding char info from tfm files is easy: there is lots of example code.

For an xfig device one could (at least initially) use the existing 
information on postscript fonts, and only allow those to be used in the
device.  I think the same applies to a metapost device.

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._