[R] problem with Hershey fonts

Ray Brownrigg ray at mcs.vuw.ac.nz
Tue Jul 26 12:51:20 CEST 2005


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
status
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
     text.
	:
          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




More information about the R-help mailing list