From ripley@stats.ox.ac.uk  Sat Apr 14 07:33:13 2001
From: ripley@stats.ox.ac.uk (Prof Brian D Ripley)
Date: Sat, 14 Apr 2001 07:33:13 +0100 (BST)
Subject: [Rd] Postscript font bugs (and a suggestion) (PR#914)
In-Reply-To: <200104140039.CAA10778@pubhealth.ku.dk>
Message-ID: <Pine.GSO.4.31.0104140722510.21140-100000@auk.stats>

On Sat, 14 Apr 2001 dmurdoch@pair.com wrote:

> Documentation and other bugs with postscript():
>
> 1.  This code crashes R (it asks for a font that isn't there):
>
>  postscript()
>  plot(0:1,0:1)
>  text(0.5,0.5,'crash',font=6)

Only on Windows, I think.  This works fine on Unix.

> The bug appears to be in the FixupFont routine in plot.c; on line 236,
> it checks that the font number is in the range 1..32.  Later this

(1..32 on Windows, 1..4 elsewhere.)

> crashes PostScriptStringWidth in devPS.c, because only fonts numbered
> 1..5 are actually defined.  I don't know how to fix it.

I've added a range check in PS_StrWidth.

> 2.  The ?postscript help topic refers to .ps.profile; the actual
> variable name is .ps.prolog.  The C source in main/devPS.c has this
> on lines 606-608, with the incorrect name in the error message:
>
>     prolog = findVar(install(".ps.prolog"), R_GlobalEnv);
>     if(!isString(prolog))
> 	error("Object .ps.profile is not a character vector");

Done.

> 3.  And this is a suggestion, not a bug:  I'd like to change the font
> definitions by changing the .ps.prolog instructions, but devPS.c puts
> the
>
>    PSEncodeFont(fp, encoding);
>
> line after the place where .ps.prolog is written to the file.  If
> .ps.prolog were last, then it could override any standard setting.
> This would mean that the font metrics would not be quite right, but it
> would be useful for experimenting.

Why not use the way which is supported, to supply a user-specifed family?
For experimenting the easiest way surely is to edit the postscript file.

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


[Rd] Postscript font bugs (and a suggestion) (PR#914)
Prof Brian D Ripley