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