3 #include <libps/pslib.h>
5 // A Postscript document as used in pslib
7 extern bool postscript_started;
17 PostScript(const char * filename)
19 if (!postscript_started)
22 postscript_started = true;
25 PS_open_file(psdoc, filename);
26 //PS_set_info(psdoc, "BoundingBox", "0 0 842 596");
27 PS_set_parameter(psdoc, "SearchPath", "/usr/lib/openoffice/basis3.1/share/psprint/fontmetric");
28 PS_set_parameter(psdoc, "SearchPath", "/usr/lib/openoffice/basis3.2/share/psprint/fontmetric");
29 psfont = PS_findfont(psdoc, "Courier", NULL, 0);
43 void NewPage(float page_width, float page_height)
49 if (page_width > page_height)
51 PS_begin_page(psdoc, page_height, page_width);
52 // Rotate for landscape.
54 PS_translate(psdoc, 600, 0);
59 PS_begin_page(psdoc, page_width, page_height);
62 PS_setfont(psdoc, psfont, 10.0);
65 void FontSize(float size)
67 PS_setfont(psdoc, psfont, size);
70 void LineAttributes(float width, float dash_on, float dash_off)
72 PS_setlinewidth(psdoc, width);
73 PS_setdash(psdoc, dash_on, dash_off);
76 void Line(float x1, float y1, float x2, float y2)
78 PS_moveto(psdoc, x1, y1);
79 PS_lineto(psdoc, x2, y2);
83 void Rectangle(float x, float y, float width, float height)
85 PS_setcolor(psdoc, "fill", "rgb", 0.8, 1.0, 0.8, 0.0);
86 PS_rect(psdoc, x, y, width, height);
90 void Text(float x, float y, const char * text)
92 PS_show_xy(psdoc, text, x, y);