PostScript
Fail:PostScript 3.svg | |
Paradigma | Berbilang paradigma: berasaskan tindanan, tatacara |
---|---|
Muncul pada | 1982 |
Direka oleh | John Warnock & Chuck Geschke |
Pembangun | Adobe Systems |
Lepasan stabil | PostScript 3 (1997) |
Disiplin penjenisan | Dinamik, kuat |
Pelaksanaan utama | Adobe PostScript, TrueImage, Ghostscript, InterPress |
Dipengaruhi | Lisp |
Mempengaruhi |
PostScript | |
---|---|
Sambungan fail: | .ps |
Jenis media Internet: | application/postscript |
Pengecam Jenis Seragam: | com.adobe.postscript |
Magik: | %! |
Dibangunkan oleh: | Adobe Systems |
Jenis format: | Format fail pencetakan |
Diperluas kepada: | PostScript Berkapsul |
PostScript (PS) is a dynamically typed concatenative programming language created by John Warnock and Charles Geschke in 1982. PostScript is best known for its use as a page description language in the electronic and desktop publishing areas.
Sejarah
The concepts of the PostScript language were seeded in 1976 when John Warnock was working at Evans & Sutherland, a famous computer graphics company. At that time John Warnock was developing an interpreter for a large three-dimensional graphics database of New York harbor. Warnock conceived the Design System language to process the graphics.
Concurrently, researchers at Xerox PARC had developed the first laser printer and had recognized the need for a standard means of defining page images. In 1975-76 a team led by Bob Sproull developed the Press format, which was eventually used in the Xerox Star system to drive laser printers. But Press, a data format rather than a language, lacked flexibility, and PARC mounted the InterPress effort to create a successor.
In 1978 Evans and Sutherland asked Warnock to move from the San Francisco Bay Area to their main headquarters in Utah, but he was not interested in moving. He then joined Xerox 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 the InterPress language.
Warnock left with Chuck Geschke and founded Adobe 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 by Steve Jobs, who urged them to adapt PostScript to be used as the language for driving laser printers.
In March 1985, the Apple LaserWriter was the first printer to ship with PostScript, sparking the desktop 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 of laser printers, into the 1990s.
However, the cost of implementation was high; computers output raw PS code that would be interpreted by the printer into a raster image at the printer's natural resolution. This required high performance microprocessors and ample memory. The LaserWriter used a 12 MHz Motorola 68000, making it faster than any of the Macintosh computers it attached to. When the laser printer engines themselves cost over a thousand dollars the added cost of PS was worthwhile, but as printer mechanisms fell in price, the cost of implementing PS became increasingly expensive.
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, 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. PS is still an option on most "high end" models.
Use as a display system
PostScript became commercially successful due to the introduction of the graphical user interface, allowing designers to directly lay out pages for eventual output on laser printers. However, the GUI's own graphics systems were generally much less sophisticated than PostScript; Apple's QuickDraw, for instance, supported only basic lines and arcs, not the complex B-splines and advanced region filling options of PostScript. In order to take full advantage of PostScript printing, applications on the computers had to re-implement those features using the host platform's own graphics system. This led to numerous issues where the on-screen layout would not exactly match the printed output, due to differences in the implementation of these features.
As computer power grew, it became possible to host the PS system in the computer rather than the printer. This led to the natural evolution of PS from a printing system to one that could also be used as the host's own graphics language. There were numerous advantages to this approach; not only did it help eliminate the possibility of different output on screen and printer, but it also provided a powerful graphics system for the computer, and allowed the printers to be "dumb" at a time when the cost of the laser engines was falling. In a production setting, using PostScript as a display system meant that the host computer could render low-resolution to the screen, higher resolution to the printer, or simply send the PS code to a smart printer for offboard printing.
However, PostScript was written with printing in mind, and had numerous features that made it unsuitable for direct use in an interactive display system. In particular, PS was based on the idea of collecting up PS commands until the showpage
command was seen, at which point all of the commands read up to that point were interpreted and output. In an interactive system this was clearly not appropriate. Nor did PS have any sort of interactivity built in, supporting hit detection for mouse interactivity obviously did not apply when it was being used on a printer.
When Steve Jobs left Apple and started NeXT, he pitched Adobe (a company he had much to do with creating) on the idea of using PS as the display system for his new workstation computers. The result was Display PostScript, or DPS. DPS added basic functionality to improve performance by changing many string lookups into 32 bit integers, adding support for direct output with every command, and adding functions to allow the GUI to inspect the diagram. Additionally, a set of "bindings" was provided to allow PS code to be called directly from the C programming language. NeXT used these bindings in their NeXTStep system to provide an object oriented graphics system. Although DPS was written in conjunction with NeXT, Adobe sold it commercially and it was a common feature of most Unix workstations in the 1990s.
Sun Microsystems took another approach, creating NeWS. Instead of DPS's concept of allowing PS to interact with C programs, NeWS instead extended PS into a language suitable for running the entire GUI of a computer. Sun added a number of new commands for timers, mouse control, interrupts and other systems needed for interactivity, and added data structures and language elements to allow it to be completely object oriented internally. A complete GUI, three in fact, were written in NeWS and provided for a time on their workstations. However, the ongoing efforts to standardize the X11 system led to its introduction and widespread use on Sun systems, and NeWS never became widely used.
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 uses reverse 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. Literals (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 showpage
or if the output device has a console
%!PS (Hello world!) =
Units of length
Postscript uses the point as its unit of length. However, unlike some other versions of the point, PostScript uses exactly 72 points to the inch. Thus:
For example, in order to draw horizontal line of 4cm length, it is sufficient to type:
0 0 moveto 0 113.385827 lineto stroke
PostScript uses single-precision reals (24-bit mantissa), so it is not meaningful to use more than 9 decimal digits to specify a real number. For draft graphics, the number of significant digits may be reduced.
Lihat juga
![]() |
Wikibuku mempunyai sebuah buku berkenaan topik: PostScript |
- Adobe Systems
- Ghostscript
- Portable Document Format
- Document Structuring Conventions
- Vector graphics
- Typeface
- Computer font
- Encapsulated PostScript
- Reverse Polish notation
- PostScript Printer Description
- InterPress
- PCL
- List of computer standards
Nota
=Rujukan
Rencana ini pada asalnya berdasarkan bahan daripada Free On-line Dictionary of Computing yang dilesenkan di bawah GFDL.
Pautan luar
![]() |
Wikibuku mempunyai sebuah buku berkenaan topik: PostScript |
- PostScript Language Reference, third edition (PLR3), plus its 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.
- PostScript Language Tutorial and Cookbook is the corresponding introductory text, known as "The Blue Book" on account of its covers.
- PostScript language program design is "The Green Book".
- Adobe: PostScript vs. PDF - Official introductory comparison of PS, EPS vs. PDF.
- Adobe: The Type 1 Font Format (PDF file).
- A First Guide to PostScript
- Mathematical Illustrations: A Manual of Geometry and PostScript — a book by Bill Casselman.
- Thinking in PostScript - 1990 by Glenn Reid, Addison-Wesley — available online courtesy of the author. A thorough tutorial.