The Gri header:
fprintf(fp, "%%!PS-Adobe-2.0 EPSF-1.2\n");
unconditionally output in gr.cc causes problems for
multipage output. In particular, printers we have will
squash all pages of output onto a single output page.
Suggestion:
- Add a -noepsf.
- If -noepsf is present, then emit the header:
"%%!PS-Adobe-2.0\n"
I suppose one could filter the output through gri-unpage
and then print it.. but I think a switch would be useful.
Thanks for this very useful package.
Ron Fox
NSCL
Michigan State University
East Lansing, MI 48824-1321
Sorry no quote today. Visit QLiner.com.
Logged In: YES
user_id=31559
Thanks. Since you're obviously quite adept at this, I assume you can do a
local patch, while I re-read my books. It's been a long time since I thought
about that first line of the output! To be honest, I'm not even sure why I put
the EPSF-1.2 token in the output; I guess I did that long ago, to make latex
understand the file when I included graphs in publications.
With best regards, and thanks, Dan.
Logged In: YES
user_id=281846
No problem and thank >you<,
Basically already done...in my old version of gri (if I were
current I'd send the diffs): I added a switch -postscript
(-p) which, when present just
emits "%%!PS-Adobe-2.0\n" as the header.
Modifications are to:
gri.cc (declared a bool for this initted to false so that
the default behavior is as is).
startup.cc - Modified the argument parsing to set the flag
when -p or -postscript is present.
gr.cc - modified the postscript header code to check the
flag to decide which header to emit.
It's legal to include bounding boxes in plain postscript, so
that's the only thing I changed. The EPSF does make good
sense in preparing the plots for inclusion into other
documents LaTeX, MS-Word and others. I was actually
surprised to see that the printers squashed that...evidently
our other EPSF generators don't have EPSF in the header..
usually inclusion software is just looking for the bounding
box, in order to know how to scale the embedding to the page
area provided.
Ron Fox
NSCL
Michigan State University
East Lansing, MI 48824-1321
In politics an absurdity is not a handicap. - Napoleon
Bonaparte
Logged In: YES
user_id=1674791
Originator: NO
According to the information given here, I wrote this patch for 2.12.13:
diff -ur gri-2.12.13/src/extern.hh gri-2.12.13-nocc/src/extern.hh
--- gri-2.12.13/src/extern.hh 2003-06-07 19:37:55.000000000 +0200
+++ gri-2.12.13-nocc/src/extern.hh 2006-12-22 14:51:51.000000000 +0100
@@ -137,6 +137,7 @@
extern int _arrow_type;
extern bool _warn_offpage;
+extern bool _export_postscript;
extern std::vector<double> _dash;
diff -ur gri-2.12.13/src/gr.cc gri-2.12.13-nocc/src/gr.cc
--- gri-2.12.13/src/gr.cc 2006-08-22 14:08:49.000000000 +0200
+++ gri-2.12.13-nocc/src/gr.cc 2006-12-22 14:51:51.000000000 +0100
@@ -365,8 +365,11 @@
/*
* write conforming postscript prolog
*/
- /* fprintf(fp, "%%!PS-Adobe-1.0\n"); */
- fprintf(fp, "%%!PS-Adobe-2.0 EPSF-1.2\n");
+ extern bool _export_postscript;
+ if (_export_postscript)
+ fprintf(fp, "%%!PS-Adobe-2.0\n");
+ else
+ fprintf(fp, "%%!PS-Adobe-2.0 EPSF-1.2\n");
if (privacy)
fprintf(fp, "%%%%Creator: %s\n", "");
else
diff -ur gri-2.12.13/src/gri.cc gri-2.12.13-nocc/src/gri.cc
--- gri-2.12.13/src/gri.cc 2006-06-17 01:18:40.000000000 +0200
+++ gri-2.12.13-nocc/src/gri.cc 2006-12-22 14:51:51.000000000 +0100
@@ -35,6 +35,7 @@
// Globals used elsewhere (variables begin with _).
int _arrow_type;
bool _warn_offpage;
+bool _export_postscript;
std::vector<double> _dash;
std::vector<DataFile> _dataFILE;
std::vector<CmdFile> _cmdFILE;
diff -ur gri-2.12.13/src/startup.cc gri-2.12.13-nocc/src/startup.cc
--- gri-2.12.13/src/startup.cc 2006-11-06 19:11:08.000000000 +0100
+++ gri-2.12.13-nocc/src/startup.cc 2006-12-22 14:51:51.000000000 +0100
@@ -188,6 +188,7 @@
_axes_offset = 0.0;
_use_default_for_query = false;
_warn_offpage = true;
+ _export_postscript = false;
PUT_VAR("..use_default_for_query..", 0.0);
PUT_VAR("..words_in_dataline..", 0.0); // just in case tested
PUT_VAR("..batch..", 0.0);
@@ -678,6 +679,7 @@
#define FLAG_PUBLICATION 1009
#define FLAG_SUPERUSER 1010
#define FLAG_WARN_OFFPAGE 1011
+#define FLAG_POSTSCRIPT 1012
// I use the 'FLAG_...' numbers for options that lack single-character abbreviations.
static struct poptOption optionsTable[] = {
{ "batch", 'b', POPT_ARG_NONE | POPT_ARGFLAG_ONEDASH, NULL, 'b' },
@@ -700,6 +702,7 @@
{ "version", 'v', POPT_ARG_NONE | POPT_ARGFLAG_ONEDASH, NULL, 'v' },
{ "warn_offpage", '\0', POPT_ARG_NONE | POPT_ARGFLAG_ONEDASH, NULL, FLAG_WARN_OFFPAGE },
{ "yes", 'y', POPT_ARG_NONE | POPT_ARGFLAG_ONEDASH, NULL, 'y' },
+ { "postscript", '\0', POPT_ARG_NONE | POPT_ARGFLAG_ONEDASH, NULL, FLAG_POSTSCRIPT
},
{ 0, 0, 0, 0, 0 }
};
const poptContext optCon =
@@ -867,6 +870,8 @@
printf("Gri cannot read in '%s'\n",optArg);
}
break;
+ case FLAG_POSTSCRIPT
+ _export_postscript = true;
default:
printf("Unknown option\n");
break;
@@ -1052,6 +1057,8 @@
} else if (!strcmp(argv[i], "-y") || !strcmp(argv[i], "-yes")) {
_use_default_for_query = true;
PUT_VAR("..use_default_for_query..", 1.0);
+ } else if (!strcmp(argv[i], "-postscript")){
+ _export_postscript = true;
#if 0
} else if (!strcmp(argv[i], "-e")) {
// User wants to do cmd in argv[i+1]
@@ -1184,6 +1191,8 @@
gr_textput(" Makes Gri print out command lines as they are executed.\n");
gr_textput(" -true or -y\n");
gr_textput(" Makes Gri think the answer to all `query's is RETURN.\n");
+ gr_textput(" -postscript\n");
+ gr_textput(" Export a PostScript file in stead of an EPS file.\n");
#if 0
gr_textput(" -e cmd\n");
gr_textput(" BUG: NOT IMPLEMENTED YET!\n");
Any chance we will see this patch in a next version?
@zwartoog -- do you have the same problem as Ron Fox? (In other words, do I have 2 votes for fixing this bug?) Thanks, Dan.