Re: [Rd] incorrect linetype with pdf device (PR#14128)

From: baptiste auguie <baptiste.auguie_at_googlemail.com>
Date: Thu, 17 Dec 2009 14:22:59 +0100


Dear list,

A small follow up on this issue. The same behavior is observed for postscript() and pdf(), so I suspect the erroneous code is in grDevices/src/devPS.c. In particular, this macro,

static void
PostScriptSetLineTexture(FILE *fp, const char *dashlist, int nlty, double lwd) {
/* use same macro for Postscript and PDF */

#define PP_SetLineTexture(_CMD_)						\
    double dash;								\
    int i;									\
    fprintf(fp,"[");								\
    for (i = 0; i < nlty; i++) {						\
	dash = (lwd >= 1 ? lwd: 1) *						\

((i % 2) ? dashlist[i] + 1 \
:((nlty == 1 && dashlist[i] == 1.) ? 1. : dashlist[i] - 1)); \ if (dash < 0) dash = 0; \ fprintf(fp," %.2f", dash); \ } \

    fprintf(fp,"] 0 %s\n", _CMD_)

    PP_SetLineTexture("setdash");
}

I think the dash pattern should be

dash = (lwd >= 1 ? lwd: 1) *						\

((i % 2) ? dashlist[i] \
:((nlty == 1 && dashlist[i] == 1.) ? 1. : dashlist[i] ));

instead (but I don't know C well enough to be sure).

Best regards,

baptiste



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu 17 Dec 2009 - 13:25:50 GMT

This archive was generated by hypermail 2.2.0 : Sat 19 Dec 2009 - 14:11:10 GMT