[Rd] Re: [R] Problems using Computer Modern fonts

Prof Brian Ripley ripley@stats.ox.ac.uk
Fri, 29 Jun 2001 15:53:16 +0100 (BST)

[Moved to R-devel, as this is not a help issue but a development one.]

On Fri, 29 Jun 2001, Brian D'Urso wrote:

> I have been trying to use the Computer Modern fonts in postscript output
> from R, but I have run into a few problems and limitations. I did read and
> follow the instructions in the documentation.
> The first problem is that R sometimes needs to use a minus sign in the
> text in plots, but the non-symbol computer modern fonts contain only a
> hyphen. There is no way that I can find to tell R to use a hyphen for
> labeling axis ticks with negative numbers instead of a minus. This makes
> the computer modern fonts unusable in many situations.

The facility was not put in for Computer Modern, but for other more
normally encoded fonts (specifically Monotone Times and Lucida).  The
postscript help page does say

     It is the user's responsibility to check that suitable fonts are
     made available, and that they contain the needed characters when

and latter

     ###  ---- Use TeX's Computer Modern fonts ---
     ## Only use alphanumeric chars here.

> The second problem is that I would prefer to use the computer modern
> symbols as well, but R seems to have the symbol font hard coded in
> devPS.c (and perhaps elsewhere). Also the computer modern symbols are
> spread across many fonts.

R has the encoding hard-coded in plotmath.c, which is *much* more
serious, and is why Symbol is hardcoded.

> Both of these are really the same problem: font encodings are not always
> divided up the same way between fonts as AdobeStandard and AdobeSymbol, so
> re-encoding the fonts the way R tries to doesn't always work. I could
> think of two ways to generalize the fonts to allow full use of the
> computer modern fonts:
> To just fix the postscript output, afm files could be manually assembled
> from several fonts so that they look like AdobeStandard or AdobeSymbol
> encodings. Then if the prolog in the ps file output could be completely
> customized, the many computer modern fonts could be rearranged to look
> like the fonts that were given in the afm files. The hard coding of the
> symbol font would of course also have to be removed, but it could be set
> just like the other fonts in the ps driver.

I don't follows this. Only a single driver users afm files, and it has
several versions (ps, pdf, xfig).  How would the below be relevant to the
Windows drivers, say.

> To give a more driver independent fix, one would have to give R a list of
> fonts instead of a single font for each style. Then R would look through
> those fonts (via the afm files) until it found the character it was
> looking for. The nice part about this is that it would eliminate the hard
> coded separation of the symbols from the alphanumeric characters since any
> character can be found by this procedure and it could allow for symbols of
> different styles, for example bold, italic, etc to be used if the fonts
> are available. The downside of this is that it almost surely requires more
> changes to R.

`Patches will be accepted' I think sums this up.  No other program I know
allows the flexibility that is already in R, and that took a lot of hard
work, which I am not sure you have appreciated.

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