NEURON
epsprint.cpp
Go to the documentation of this file.
1
#include <../../nrnconf.h>
2
#if HAVE_IV
// to end of file
3
4
#include <
ivstream.h
>
5
#include "
epsprint.h
"
6
7
// ps_prolog copied from InterViews's printer.cpp
8
static
const
char
* ps_prolog =
9
"\
10
save 20 dict begin\n\
11
\n\
12
/sf { % scale /fontName => - (set current font)\n\
13
{findfont} stopped {pop /Courier findfont} if\n\
14
exch scalefont setfont\n\
15
} def\n\
16
\n\
17
/ws {\n\
18
4 index 6 4 roll moveto sub\n\
19
2 index stringwidth pop sub\n\
20
exch div 0 8#40 4 3 roll\n\
21
widthshow\n\
22
} def\n\
23
\n\
24
/as {\n\
25
4 index 6 4 roll moveto sub\n\
26
2 index stringwidth pop sub\n\
27
exch div 0 3 2 roll\n\
28
ashow\n\
29
} def\n\
30
\n\
31
"
;
32
33
EPSPrinter::EPSPrinter
(ostream*
o
)
34
:
Printer
(
o
) {}
35
36
EPSPrinter::~EPSPrinter
() {}
37
38
void
EPSPrinter::eps_prolog
(ostream& out,
Coord
width,
Coord
height,
const
char
* creator) {
39
int
bbw = int(width);
40
int
bbh = int(height);
41
// need to describe it as EPSF = "encapsulated postscript"
42
out <<
"%!PS-Adobe-2.0 EPSF-1.2\n"
;
43
44
out <<
"%%Creator: "
<< creator <<
"\n"
;
45
out <<
"%%Pages: atend\n"
;
46
47
// adding a bounding box makes this "encapsulated"
48
// bbw and bbh are the width and height of the bounding box 1/72 of an inch
49
out <<
"%%BoundingBox: 0 0 "
<< bbw <<
" "
<< bbh <<
"\n"
;
50
51
out <<
"%%EndComments\n"
;
52
out << ps_prolog;
53
out <<
"%%EndProlog\n"
;
54
}
55
56
#endif
Coord
#define Coord
Definition:
_defines.h:19
Printer
#define Printer
Definition:
_defines.h:211
EPSPrinter::EPSPrinter
EPSPrinter(ostream *)
EPSPrinter::eps_prolog
virtual void eps_prolog(ostream &, Coord width, Coord height, const char *creator="InterViews")
EPSPrinter::~EPSPrinter
virtual ~EPSPrinter()
epsprint.h
ivstream.h
o
o
Definition:
seclist.cpp:175
src
ivoc
epsprint.cpp