Thread View: comp.lang.postscript
2 messages
2 total messages
Started by Ken-Huang Lin
Mon, 14 Dec 1992 18:25
Need postscript library callable from C
Author: Ken-Huang Lin
Date: Mon, 14 Dec 1992 18:25
Date: Mon, 14 Dec 1992 18:25
8 lines
721 bytes
721 bytes
Is there any public domain postscript library that is callable from C? Specifically, routines like psopen(), psline(), pstext(), ..., psclose(), that can be called to generate a postscript file. Any lead would be apprecaited. Ken H. Lin khlin@uiwpls.ece.uiuc.edu
Re: Need postscript library callable from C
Author: Jonathan Monsarrat
Date: Mon, 14 Dec 1992 19:28
Date: Mon, 14 Dec 1992 19:28
54 lines
2197 bytes
2197 bytes
> Is there any public domain postscript library that is callable from C?
It depends what you want to draw. I've written programs both for:
1. drawing a picture which is to be viewed later
and 2. drawing a picture which is to be viewed while the program's running
I can email sample code to anyone who is interested in this stuff.
Basically, however, it's just a matter of sending PostScript commands
either:
1. to a file
or 2. to GhostScript, using the "flushpage" command to force the screen
to be updated
And this means that you have to know PostScript programming.
If there were some library calls, there would be a very simple mapping
to PostScript, so you either learn the library or you learn PostScript.
Learning some simple PostScript is not hard.
-------------------------------
psline(x1, y1, x2, y2)
printf("%d %d moveto %d %d lineto stroke\n", x1, y1, x2, y2);
-------------------------------
psopen() would just be either
1. opening the file
or 2. popen() to GhostScript
-------------------------------
pstext(x1, y1, str);
Would just be
printf("Times-Roman findfont 12 scalefont setfont\n");
printf("%d %d moveto (%s) show\n", x1, y1, str);
------------------------------
psclose();
Would close the file pointer to either
1. the file you opened
2. the popen()
-Jon
%! Jon Monsarrat jgm@cs.brown.edu Brown University %! Obfuscated PostScript
/p 4/f{{}forall moveto gsave{dup 32 mod dup 15 mul rotate sub p div 0 rlineto}
forall fill grestore}def 4 scale 1 def(``f`f`f)dup( )f( i).3 setgray f/p 8 def
1 setgray/h(F!6! 2477!W)def h("4)h(,C)h(6O)h(LT)h(^O)h(tC)h(~6)(7!6!"7#$&6!7 #)
(9~)(""""""""""")(}~)(fTV``Vt)(9!)(e!FR"n&44ED-w@-7&&b)(C2)11{f}repeat showpage
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads