 |
CS 3723/3721
Programming Languages
Postscript
References and Access
|
|
Using Postscript on the Sun System:
Here is a sample postscipt file, stored using the filename
abc.ps:
%!PS-Adobe-2.0
/Times-Bold findfont 200 scalefont setfont
100 300 moveto (ABC) show
showpage
You can create Postscipt files just using any editor.
The names of such files should always end with ".ps".
If such files
are directly sent to a Postscipt printer, the printer will follow
the Postscript page description commands, rather than print it as
a text file. The printer uses the first line to decide
that this is a Postscript file. Otherwise you do not need
this first line. You can also convert the file to .pdf format as
illustrated below.
This conversion produces error messages
that can be very helpful in debugging.
Finally, you can put a link to either the
Postscipt file or the PDF file and open it through many browsers.
% vi abc.ps -- create the file using some editor
% ps2pdf abc.ps abc.pdf -- convert to PDF, produce error messages
% lp -d tub abc.ps -- print on a Postscript printer
Open a link to this file as:
.ps, or as .pdf
Instead of using ps2pdf a better choice is
ps2pdf13, in spite of
the weird name, since it targets Acrobat 4-and-later readers.
Postscript Interactive
Development Environment:
Mr. John Whipple (a student in the Spring 2005 course) has
called attention to a "Very nice PostScript IDE/Debugger".
It is free to download and runs on all environments.
(I haven't tried it out yet.) Whipple:
"It's called IdePS. You can step through your program and see what's on
the stack. Very helpful!"
http://sourceforge.net/projects/wxghostscript/.
Postscript references
(recommended sources are in
red:
- Postscript ``Blue'' book (by far the best introductory tutorial)
Local copy (PDF, 847k)
Remote copy (PDF, 847k)
- Programs from the Blue book
Bluebook programs
- Postscript ``Green'' Book (help for serious Postscript programmers)
Local copy (PDF, 934K)
Remote copy (PDF, 934K)
- Postscript Language Reference Manual (heavy duty, but the best reference)
Local copy (PDF, 7.9 meg)
Remote copy (PDF, 7.9 meg)
- First Guide to Postscript (a simple introduction)
First Guide
- Thinking in Postscript (another tutorial)
Local copy (PDF, 847k)
Remote copy (PDF, 847k)
- Postscript for Mathematicians (another good book, with
helpful links)
Remote Link to Book
- Postscript Sources and Links
Sources and Links
PDF references:
Basic Topics (from the Blue Book):
- Three types of graphics objects:
- Text: characters in many fonts, positioned and oriented in any way.
- Geometric figures: Drawn using powerful 2-dimensional graphics
operators, using lines, curves, filled regions, color.
- Images: anything that can be digitized.
(See Blue Book, pages 1-2.)
- The imaging model:
- Current page: can place anything anywhere, overwriting old stuff
- Current path: a set of connected lines and curves making a path,
often closed.
- Current clipping path: a closed path within which all drawing occurs.
(See Blue Book, pages 2-3.)
- Initial graphics: (See Blue Book, pages 3-4.)
- The Stack: used for all computations and operators. Postfix notation.
(See Blue Book, page 4, 7-15.)
- Coordinate systems:
x (horizontal) and y (vertical) coordinates,
with (0, 0) in the lower left corner.
Units are Postscipt points, where 1 point =
1/72 inch (in actual publishing, 1 point = 1/72.27 inch.)
(See Blue Book, Chapter 3, pages 17-25.)
- Variables and procedures: (It's getting harder now.)
(See Blue Book, Chapter 4, pages 27-33.)
- Text: (See Blue Book, Chapter 5, pages 35-46.)
- More graphics: (See Blue Book, Chapter 6, pages 47-60.)
- Conditionals and for loops: (See Blue Book, Section 7.1 and
first page of 7.2, pages 61-68.)
- Outline fonts: (See Blue Book, Section 9.4, pages 97-99.)
- Clipping: (See Blue Book, Section 10.1, pages 101-104.)
Revision date: 2005-04-11.
(Please use ISO 8601,
the International Standard Date and Time Notation.)