R-alpha: Postscript bug ...

Ross Ihaka ihaka@stat.auckland.ac.nz
Thu, 24 Apr 1997 21:11:51 +1200 (NZST)


Jeez I dunno - it compiles perfectly and you guys get excited just because
it doesn't work :-)

I have to admit to being baffled about what happened (I'm SURE this was
working not long ago), but here is a quick fix.  The problem is in the
function "GetCharInfo" in the file src/unix/PostScript.c.

The fix is to change the statement

	if(nchar < 0)
		return 0;

to
	if(nchar < 0)
		return 1;

as indicated in the #ifdefs below.  I will make a patch file and put
it the archive with the .tgz file.

We seem to have enough problem reports to justfy getting a new 0.50 out
pretty soon in any case.

	Ross

- - - replacement - - GetCharInfo - - -

static int GetCharInfo(char *buf, FontMetricInfo *metrics)
{
	char *p = buf;
	int nchar;

	if(!MatchKey(buf, "C "))
		return 0;
	p = SkipToNextItem(p);
	sscanf(p, "%d", &nchar);
	if(nchar < 0)
#ifdef OLD
		return 0;
#else
		return 1;
#endif
	p = SkipToNextKey(p);

	if(!MatchKey(p, "WX"))
		return 0;
	p = SkipToNextItem(p);
	sscanf(p, "%hd", &(metrics->CharInfo[nchar].WX));
	p = SkipToNextKey(p);

	if(!MatchKey(p, "N "))
		return 0;
	p = SkipToNextKey(p);

	if(!MatchKey(p, "B "))
		return 0;
	p = SkipToNextItem(p);
	sscanf(p, "%hd %hd %hd %hd",
		&(metrics->CharInfo[nchar].BBox[0]),
		&(metrics->CharInfo[nchar].BBox[1]),
		&(metrics->CharInfo[nchar].BBox[2]),
		&(metrics->CharInfo[nchar].BBox[3]));

#ifdef DEBUG
	printf("nchar = %d %d %d %d %d %d\n", nchar,
		metrics->CharInfo[nchar].WX,
		metrics->CharInfo[nchar].BBox[0],
		metrics->CharInfo[nchar].BBox[1],
		metrics->CharInfo[nchar].BBox[2],
		metrics->CharInfo[nchar].BBox[3]);
#endif
	return 1;
}
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-