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

Telford Tendys telford@progsoc.uts.edu.au
Tue, 11 Apr 2000 11:32:15 +1000


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

Admittedly, just being able to centre-justify a string doesn't solve
the problem of plotting an equation but it might help in a few cases...

Also, there is a ghostscript operator for getting the width of a string:

stringwidth

     * USAGE:   str stringwidth
     * RESULTS   x y

     calculates the change in the current point which would occur using
     "show", but doesn't actually draw the string
  
[http://www.colorado.edu/ITS/docs/scientific/gs/GSO.html]

Running up gs in the background in order to do font calculations
seems a bit messy but it would be easy to achieve and it kind of fits
with the unix philosophy of each program does it's own job well and
doesn't try to overlap its neighbour. Maybe it is fair to presume that
the win-32 users don't want xfig output? They probably want ms-draw or
something...

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

Yeah, I've noticed that some of the R outputs don't look quite as good as
latex but they still look better than just about any other plotter. Sometimes
I get latex to splat the formulas down onto the diagrams which is a dirty
trick but the reader of the printed copy only sees the end result not the
method.

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

Which would make the xfig-device depend on having tex installed which seems
kind of illogical but no worse than insisting that gs in installed. Most
people who use xfig also use both tex and gs. Perhaps R could look around
for tfm files, use them if it finds them, and resort to counting the
characters if it can't think of anything better to do (i.e. some output
with small kerning errors is better than no output at all).

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