- PostScript
Infobox programming language
name = PostScript
paradigm = multi-paradigm:stack-based , procedural
year = 1982
designer =John Warnock &Chuck Geschke
developer =Adobe Systems
latest release version = PostScript 3
latest release date = 1997
turing-complete = Yes
typing = dynamic, strong
implementations =Adobe PostScript ,TrueImage ,Ghostscript
dialects =
influenced_by = Lisp
influenced =PDF Infobox file format
name = PostScript
icon =
extension = .ps
mime = application/postscript
type code =
uniform type = com.adobe.postscript
magic =%!
owner =Adobe Systems
genre = printing file format
container for =
contained by =
extended from =
extended to =Encapsulated PostScript
standard =PostScript (PS) is a dynamically typed concatenative
programming language created byJohn Warnock andCharles Geschke in 1982. PostScript is best known for its use as apage description language in the electronic anddesktop publishing areas.History
The concepts of the PostScript language were seeded in 1976 when
John Warnock was working atEvans & Sutherland , a famouscomputer graphics company. At that time John Warnock was developing an interpreter for a large three-dimensional graphics database ofNew York harbor. Warnock conceived the Design System language to process the graphics.Concurrently, researchers at
Xerox PARC had developed the firstlaser printer and had recognized the need for a standard means of defining page images. In 1975-76 a team led byBob Sproull developed the Press format, which was eventually used in theXerox Star system to drive laser printers. But Press, a data format rather than a language, lacked flexibility, and PARC mounted theInterPress effort to create a successor.In 1978
Evans and Sutherland asked Warnock to move from theSan Francisco Bay Area to their main headquarters inUtah , but he was not interested in moving. He then joinedXerox PARC to work with Martin Newell. They rewrote Design System to create JaM (for "John and Martin") which was used for VLSI design and the investigation of type and graphics printing. This work later evolved and expanded into theInterPress language.Warnock left with
Chuck Geschke and foundedAdobe Systems in December 1982. They created a simpler language, similar to InterPress, called PostScript, which went on the market in 1984. At about this time they were visited bySteve Jobs , who urged them to adapt PostScript to be used as the language for drivinglaser printer s.In March 1985, the Apple
LaserWriter was the first printer to ship with PostScript, sparking thedesktop publishing (DTP) revolution in the mid-1980s. The combination of technical merits and widespread availability made PostScript a language of choice for graphical output for printing applications. For a time an interpreter (sometimes referred to as a RIP -for Raster Image Processor) for the PostScript language was a common component oflaser printer s, into the 1990s.Once the "
de facto " standard for electronic distribution of final documents meant for publication, PostScript is steadily being supplanted in this area by one of its own descendants, the Portable Document Format or PDF. By 2001 there were fewer printer models which came with support for PostScript, largely due to the growing competition from much cheaper non-PostScript ink jet printers (PostScript interpreters added significantly to printer cost), and new software-based methods to render PostScript images on the computer, making them suitable for any printer (PDF provided one such method). The use of a PostScript laser printer still can, however, significantly reduce the CPU workload involved in printing documents, transferring the work of rendering PostScript images from the computer to the printer.PostScript Level 1
The PostScript language has had two major upgrades. The first version, known as PostScript Level 1, was introduced in 1984.
PostScript Level 2
PostScript Level 2 was introduced in 1991, and included several improvements: improved speed and reliability, support for in-RIP separations, image decompression (for example,
JPEG images could be rendered by a PostScript program), support for compositefonts , and the form mechanism for caching reusable content.PostScript 3
PostScript 3 (Adobe dropped the "level" terminology in favor of simple versioning) came at the end of 1997, and along with many new dictionary-based versions of older operators, introduced better color handling, and new filters (which allow in-program compression/decompression, program chunking, and advanced error-handling).
PostScript 3 was significant in terms of replacing the existing proprietary color electronic prepress systems, then widely used for magazine production, through the introduction of smooth shading operations with up to 4096 shades of grey (rather than the 256 available in PostScript 2), as well as DeviceN, a color space that allowed the addition of additional ink colors (called
spot color s) into composite color pages.Use in printing
Before PostScript
Prior to the introduction of PostScript, printers were designed to print character output given the text—typically in
ASCII —as input. There were a number of technologies for this task, but most shared the property that theglyph s were physically difficult to change, as they were stamped ontotypewriter keys, bands of metal, or optical plates.This changed to some degree with the increasing popularity of
dot matrix printer s. The characters on these systems were drawn as a series of dots, the proper dots to use defined as a font table inside the printer. As they grew in sophistication, dot matrix printers started including several built-in fonts from which the user could select, and some models allowed users to upload their own custom glyphs into the printer.Dot matrix printers also introduced the ability to print
raster graphics . The graphics were interpreted by the computer and sent as a series of dots to the printer using a series ofescape sequence s. Theseprinter control language s varied from printer to printer, requiring program authors to create numerous drivers.Vector graphics printing was left to special-purpose devices, called
plotter s. Plotters did share a common command language,HPGL , but were of limited use for anything other than printing graphics. In addition, they tended to be expensive and slow, and thus rare.PostScript printing
Laser printers combine the best features of both printers and plotters. Like plotters, laser printers offer high quality line art, and like dot-matrix printers, they are able to generate pages of text and raster graphics. Unlike either printers or plotters, however, a laser printer makes it possible to position high-quality graphics and text on the same page. PostScript made it possible to fully exploit these characteristics, by offering a single control language that could be used on any brand of printer.
PostScript went beyond the typical printer control language and was a complete programming language of its own. Many applications can transform a document into a PostScript program whose execution will result in the original document. This program can be sent to an interpreter in a printer, which results in a printed document, or to one inside another application, which will display the document on-screen. Since the document-program is the same regardless of its destination, it is called "device-independent".
PostScript is noteworthy for implementing on-the fly
rasterization ; everything, even text, is specified in terms of straight lines and cubicBézier curve s (previously found only inCAD applications), which allows arbitrary scaling, rotating and other transformations. When the PostScript program is interpreted, the interpreter converts these instructions into the dots needed to form the output. For this reason PostScript interpreters are also sometimes called PostScriptRaster Image Processor s, or RIPs.Font handling
Almost as complex as PostScript itself was its handling of fonts. The rich font system used the PS graphics primitives to draw glyphs as
line art , which could then be rendered at any resolution. Though this sounds like a reasonably straightforward concept, there were a number oftypographic issues that had to be considered.One issue is that fonts do not actually scale linearly at small sizes; features of the glyphs will become proportionally too large or small and they start to look wrong. PostScript avoided this problem with the inclusion of hints which could be saved along with the font outlines. Basically they are additional information in horizontal or vertical bands that help identify the features in each letter that are important for the rasterizer to maintain. The result was significantly better-looking fonts even at low resolution; it had formerly been believed that hand-tuned bitmap fonts were required for this task.
At the time, the technology for including these hints in fonts was carefully guarded, and the hinted fonts were compressed and encrypted into what Adobe called a
Type 1 Font (also known as "PostScript Type 1 Font", "PS1", "T1" or "Adobe Type 1"). Type 1 was effectively a simplification of the PS system to store outline information only, as opposed to being a complete language (PDF is similar in this regard). Adobe would then sell licenses to the Type 1 technology to those wanting to add hints to their own fonts. Those who did not license the technology were left with theType 3 Font (also known as, "PostScript Type 3 Font", "PS3" or "T3"). Type 3 fonts allowed for all the sophistication of the PostScript language, but without the standardized approach to hinting. Other differences further added to the confusion.Type 2 was designed to be used with the
Compact Font Format (CFF), and were implemented for a compact representation of the glyph description procedures to reduce the overall font file size. The CFF/Type2 format later became the basis for Type 1OpenType fonts.CID-keyed font format was also designed, to solve the problems in theOCF/Type 0 font s, for addressing the complex Asian-language (CJK ) encoding and very large character set issues. CID-keyed font format can be used with the Type 1 font format for standard CID-keyed fonts, or Type 2 for CID-keyed OpenType fonts.Adobe's rates were widely considered to be prohibitively high, and it was this issueFact|date=February 2007 that led Apple to design their own system,
TrueType , around 1991. Immediately following the announcement of TrueType, Adobe published the specification for the Type 1 font format. Retail tools such as AltsysFontographer (acquired byMacromedia in January 1995, owned byFontLab since May 2005) added the ability to create Type 1 fonts. Since then, many free Type 1 fonts have been released; for instance, the fonts used with theTeX typesetting system are available in this format.In the early 1990s there were several other systems for storing outline-based fonts, developed by Bitstream and
METAFONT for instance, but none included a general-purpose printing solution and they were therefore not widely used as a result.In the late 1990s, Adobe joined Microsoft in developing
OpenType , essentially a functional superset of the Type 1 and TrueType formats. When printed to a PostScript output device, the unneeded parts of the OpenType font are omitted, and what is sent to the device by the driver is the same as it would be for a TrueType or Type 1 font, depending on which kind of outlines were present in the OpenType font.Other implementations
In the 1980s, Adobe drew most of their revenue from the licensing fees for their implementation of PostScript for printers, known as a
raster image processor or "RIP". As a number of newRISC -based platforms became available in the mid 1980s, some found Adobe's support of the new machines to be lacking.This and issues of cost led to third-party implementations of PostScript becoming common, particularly in low-cost printers (where the licensing fee was the sticking point) or in high-end typesetting equipment (where the quest for speed demanded support for new platforms faster than Adobe could provide). At one point, Microsoft and Apple teamed up to try to unseat Adobe's laser printer monopoly, Microsoft licensing to Apple a PostScript-compatible interpreter it had bought called
TrueImage , and Apple licensing to Microsoft its new font format,TrueType (Apple ended up reaching an accord with Adobe and licensed genuine PostScript for its printers, but TrueType became the standardoutline font technology for both Windows and the Macintosh). Some third-party PostScript-compatible interpreters are still widely used in printers, particularlyPhoenixPage , which is standard in black-and-white Hewlett-Packard laser printers (as of 2006 ).Many basic, inexpensive laser printers don't support PostScript, instead coming with drivers that simply rasterize the platform's native graphics formats rather than converting them to PostScript first. When PostScript support is needed for such a printer, a free PostScript-compatible interpreter called
Ghostscript can be used. Ghostscript prints PostScript documents on non-PostScript printers using the CPU of the host computer to do the rasterization, sending the result as a single large bitmap to the printer. Ghostscript can also be used to preview PostScript documents on a computer monitor and to convert PostScript pages intoraster graphics such asTIFF and PNG, and vector formats such as PDF.Very high-resolution devices, such as
imagesetter s or CTPplatesetter s, in which resolutions exceeding 2500 dpi are common, still require external RIPs with large amounts of memory and hard drive space. Very high-end laser printer systems (known as digital presses) also use an external RIP to separate the more readily-upgradable computer from the specialized printing hardware. Companies such asEFI andXitron specialize in such RIP software.Use as a display system
PostScript has also been used as a display system in
NeWS . further|Display PostScript The language
PostScript is a
Turing-complete programming language, belonging to the concatenative group. Typically, PostScript programs are not produced by humans, but by other programs. However, it is possible to write computer programs in PostScript just like any other programming language.PostScript is an interpreted, stack-based language similar to Forth but with strong dynamic typing, data structures inspired by those found in Lisp,
scoped memory and, since language level 2, garbage collection. The language syntax usesreverse Polish notation , which makes the order of operations unambiguous, but reading a program requires some practice, because one has to keep the layout of the stack in mind. Most "operators" (what other languages term "functions") take their arguments from the stack, and place their results onto the stack. "Literal s" (for example numbers) have the effect of placing a copy of themselves on the stack. Sophisticated data structures can be built on the "array" and "dictionary" types, but cannot be declared to the type system, which sees them all only as arrays and dictionaries, so any further typing discipline to be applied to such user-defined "types" is left to the code that implements them.The character "%" is used to introduce comments in PostScript programs. As a general convention, every PostScript program should start with the characters "%!" so that all devices will properly interpret it as PostScript.
"Hello world"
A
Hello World program , the customary way to show a small example of a complete program in a given language, might look like this in Postscript: %!PS /Courier findfont 20 scalefont setfont 72 500 moveto (Hello world!) show showpageor if the output device has a console
%!PS (Hello world!) =
Units of length
Postscript uses a special
unit of length , called the point. This unit is related to the metric system of unit with following expression::
For example, in order to draw horizontal line of 4cm length, it is sufficient to type:
0 0 moveto 0 113.38582677165 lineto stroke
However, for draft graphics, the number of significant digits may be reduced.
See also
*
Adobe Systems
*Ghostscript
*Portable Document Format
*Document Structuring Conventions
*Vector graphics
*Typeface
*Computer font
*Display PostScript
*Encapsulated PostScript
*Reverse Polish Notation
*PostScript Printer Description References
External links
* [http://partners.adobe.com/public/developer/en/ps/PLRM.pdf "PostScript Language Reference", third edition] ("PLR3"), plus its [http://partners.adobe.com/public/developer/en/ps/PS3010and3011.Supplement.pdf "Supplement"] , is the "de facto" defining work, known as "The Red Book" on account of its covers. The first edition covered PostScript Level 1, the second edition covered a greatly expanded language known as PostScript Level 2, and includes documentation for
Display PostScript as well. The third edition covers PostScript 3 (with this version, Adobe dropped "level" from the name) but no longer includes DPS.
* [http://partners.adobe.com/public/developer/en/ps/sdk/sample/BlueBook.zip "PostScript Language Tutorial and Cookbook"] is the corresponding introductory text, known as "The Blue Book" on account of its covers.
* [http://partners.adobe.com/public/developer/en/ps/sdk/sample/GreenBook.zip "PostScript language program design"] is "The Green Book".
* [http://www.adobe.com/print/features/psvspdf/main.html Adobe: PostScript vs. PDF] - Official introductory comparison of PS, EPS vs. PDF.
* [http://partners.adobe.com/public/developer/en/font/T1_SPEC.PDF Adobe: The Type 1 Font Format] (PDF file).
* [http://www.tailrecursive.org/postscript/postscript.html "A First Guide to PostScript"]
* [http://www.math.ubc.ca/~cass/graphics/manual/ "Mathematical Illustrations: A Manual of Geometry and PostScript"] — a book by Bill Casselman.
* [http://www.rightbrain.com/pages/books.html "Thinking in PostScript"] , 1990 by Glenn Reid, Addison-Wesley — available online courtesy of the author. A thorough tutorial.
* [http://www.anastigmatix.net/postscript/direct.html Direct use of the PostScript language] , further discussion of PostScript in programming-language terms
* [http://www.geocities.com/SiliconValley/5682/HeavyDuty.html PostScript and Ghostscript Resources] - Program tools for working with PostScript
Wikimedia Foundation. 2010.