[R] problem with Hershey fonts

From: Ray Brownrigg <ray_at_mcs.vuw.ac.nz>
Date: Tue 26 Jul 2005 - 20:51:20 EST

This was reported to me by a colleague in China, so I may not be reproducing exactly what they are seeing (which I suspect is rw2011), but this is what I see:
> version

platform i386--netbsdelf

arch     i386
os       netbsdelf

system i386, netbsdelf
major 2
minor 1.1
year 2005
month 06
day 20
language R
> help(Hershey)
     If the 'vfont' argument to one of the text-drawing functions
     ('text', 'mtext', 'title', 'axis', and 'contour') is a character
     vector of length 2, Hershey vector fonts are used to render the
          The other useful escape sequences all begin with '\\'.  These
          are described below. Remember that backslashes have to be
          doubled in R character strings, so they need to be entered
          with _four_ backslashes.

> plot(runif(100)) # to get something on the screen
> text(0, 1, '\\Re', vfont=c('serif', 'plain')) # works
> title(main = '\\Re', vfont=c('serif','plain')) # doesn't work, and...
Warning message:
parameter "vfont" could not be set in high-level plot() function
> mtext('\\Re', 2, vfont=c('serif','plain')) # doesn't work, but...
Warning message:
Hershey fonts not yet implemented for mtext() in: mtext(text, side, line, outer, at, adj, padj, cex, col, font,
> axis(3, at=50, tick=F, labels='\\Re', vfont=c('serif','plain')) # doesn't work

Now at least mtext() 'redeems' itself with its Warning, but title() contradicts the help(Hershey), and axis() just gets it wrong by printing the characters "\Re" (or "\\Re" when the string is specified as '\\\\Re' as alluded to in the Hershey documentation - but somewhat contradicted by the success of the text() call above).

Now perhaps the problem is just with the Hershey documentation (or my reading of it), but I don't know what is supposed to work. Or is there some combination that I haven't tried?

Ray Brownrigg

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Jul 26 20:55:51 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:34:01 EST