Differences between version 12 and predecessor to the previous major change of PostScript.
Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 12 | Last edited on Tuesday, November 2, 2004 2:53:42 am | by AristotlePagaltzis | Revert |
Older page: | version 4 | Last edited on Sunday, November 2, 2003 7:35:54 pm | by CraigBox | Revert |
@@ -1,28 +1,13 @@
-A programming language for printers
, based on forth
. See ghostscript (a linux implementation) (gs(1))
+A stack-based ProgrammingLanguage that resembles [Forth], but mixes in some functional
programming principles to allow a considerably higher level of abstraction. Although a complete, general purpose
language, it was developed
for typesetting and is accompanied by a complex
, powerful graphical model. [Apple]'s [MacOSX] uses an PostScript in an extended version called ~DisplayPostscript to render all of the user interface
.
-The following
is copied from the
[HowToPrintingHOWTO
]
-----
-Unix
software, and
the publishing industry in general
, have standardized upon Postscript
as the printer control
language of choice
. This happened for several reasons:
+PostScript programs come in __.ps__ files. GhostScript
is a
[Free
] software-only implementation of
the language and graphics model
, allowing users to view such files onscreen
as well as send them to cheap printers that do not understand PostScript natively. PostScript is also
the language used at the core
of [PDF]
.
-!Timing
+The [Printing HOWTO | http://www.tldp.org/HOWTO/Printing-HOWTO/] explains why PostScript happened to become so well established.
-Postscript arrived as part of the Apple Laserwriter,
a perfect companion to the Macintosh, the system largely responsible for the desktop publishing revolution
of the 80s.
+Here's
a simple example
of what PostScript code looks like:
-!It's device-independent
-
-Postscript programs can be run to generate output on a pixel screen, a vector screen, a fax machine, or almost any sort of printer mechanism, without the original program needing to be changed. Postscript output will look the same on any Postscript device, at least within the limits of the device's capabilities. Before the creation of PDF, people exchanged complex documents online as Postscript files. The only reason this standard didn't "stick" was because Windows machines didn't usually include a Postscript previewer, so Adobe specified hyperlinks and compression for Postscript, called the result PDF, distributed previewers for it, and invented a market for their "distiller" tools (the functionality of which is also provided by ghostscript's ps2pdf and pdf2ps programs).
-
-!It's a real programming language
-
-Postscript is a complete programming language; you can write software to do most anything in it. This is mostly useful for defining subroutines at the start of your program to reproduce complex things over and over throughout your document, like a logo or a big "DRAFT" in the background. But there's no reason you couldn't compute #960 in a Postscript program.
-
-!It's open
-
-Postscript is fully specified in a publically available series of books (which you can find at any good bookstore). Although Adobe invented it and provides the dominant commercial implementation, other vendors like Aladdin produce independently coded implementations as well.
----
-
-Here is a very simple PostScript file that hopefully demonstrates very basic postscript commands and functionality:
<verbatim>
%!PS-Adobe-2.0
%%BoundingBox: 0 0 400 400
@@ -121,9 +106,9 @@
exch % swap the top 2 values
%%% - now have reversed the order of the 3 numbers from vmstatus
200 204 moveto
-/Times-Roma
findfont 12 scalefont setfont
+/Times-Roman
findfont 12 scalefont setfont
(Min(?): ) show
10 string % create a 10-byte string
cvs % fill the string with the previous number on the stack
show ( bytes) show
@@ -131,18 +116,31 @@
(Used: ) show
10 string cvs show ( bytes) show
200 180 moveto
(Max: ) show 10 string cvs show ( bytes) show
+
+%% draw a small irregular polygon
+0 setlinewidth %
+newpath
+260 300 moveto
+270 315 lineto
+300 315 lineto
+310 280 lineto
+300 260 lineto
+closepath % back to the origin
+1 0 1 setrgbcolor % red + blue = purple
+fill
% print something to gv's pop-up informative window, or stdout for gs
(Example simple postscript commands\n) print
flush % cause it to be sent (from buffered)
-
-
%%EndPage
showpage % render the page
%%EOF
</verbatim>
+
+----
+CategoryProgrammingLanguages, CategorySpecialPurposeProgrammingLanguages