[Main topics] [Navigation]

PostScript

PostScript claims to be a simple interpretive programming language with powerful graphics primitives. The primary application of PostScript is to describe the appearance of text, images and graphic material on printed pages. PostScript may be said to admit no distinction between text and graphics.

Normally, PostScript source code is generated by word processing programs, CAD programs and other composition programs. Programmers may write PostScript directly when setting up applications. So PostScript also defines a standard, extensible print file format.

A program that generates a PostScript source file needed not be complicated or maintain a large amount of state information. A program can stream PostScript source incrementally to a file. This attribute of the language allows even small machines to generate complex PostScript sources.

Compared to Interpress the interpretation of PostScript needs more resources. In the long run, Adobe is counting on increased computer processing power. They decided early that it would emphasize full functionality and the highest possible output quality, even if this means taking somewhat of a "hit" on performance.

Adobe also feels that it is important that any PostScript printer be able to print any PostScript page - no matter how complex. The argument is that the user would rather have the page print slowly than not to be able print it at all.

Because PostScript is a programming language, it its possible to write very inefficient or very efficient PostScript output drivers. So substantial improvements to the performance of (current) PostScript raster image processors has to be made.

Functions

The PostScript imaging model is a unified view of two-dimensional graphics. An image is built up by placing ink on a page in selected areas. The ink may be in the form of letter shapes, general filled shapes, lines, or halftone representations of photographs. The ink itself may be in colour or in black, white or any shade of gray. Any of these elements may be cropped to within any shape as they are placed onto the page.

PostScript has no fixed lexical structure, it is just a stream of tokens to be processed by the interpreter. It prints a page whenever the showpage operator is executed. If this operator is located in a loop of 10 cycles then 10 pages are produced.

The imaging operators are fill (mark an area on paper), stroke to produce lines, image to paint a halftone gray-scale scanned image onto the current page, and show to paint character shapes.

Path operators set up polygonal or curved paths, which act on the imaging operators. Generally speaking a PostScript program contain many instances of the following pattern:

Beside that PostScript maintains a current clipping path that outlines the area of the current page that may be imaged upon. Initially this is the total imageable area of the page. This area can be modified by a clip operator.

PostScript provides a much richer set of general purpose processing capabilities than Interpress. It provides a programmer with a rich set of arithmetic, control, looping, string processing, conversion between object types, signalling etc. operations. Use of these capabilities can impose heavy processing loads on the printer.

PostScript supports colour images. On a seminar at US (August 1986) Adobe has shown the first colour picture imaged on the Linotronic 300 typesetter. It was a 120-line-screen, four-colour picture and colour pattern with unconventional screen angles to avoid moire patterns.

A PostScript program is able to generate an array of PostScript operators and have it executed just like any other PostScript operator.

So called late binding of shapes permits a defined operator to be used for varying effects in varying contexts. This virtue can be used to isolate pages by "enveloping" their definitions. So a PostScript file may become an inner part of another file. Combining pages on a sheet of paper is common use of this technique.

By default object properties are measured in 1/72 inch (approx a printers point). Of course this can be adjusted to any other unit (see example).

Text Objects

If Text objects try to use undefined fonts, a fall back mechanism allows use of default fonts. Spacing may be corrected in these cases, as long as words or characters are not positioned explicitely on the page.

All transformations (scaling, rotation, slanting, texturizing) may be applied to text elements, since text is only a special form of graphic.

PostScript has mechanisms to "format" lines of text (justify). Inherent restrictions of these mechanisms can be overcome by explicitly placing every word or symbol on the page.

Graphic Objects

Besides straight lines and polygons PostScript supports circles and arcs as well as Bezier curves (splines) and conic curves. Paths (trajectories) may be constructed using all of these. These elements can be represented both in solid or dashed, they can be viewed through masks, filled with gray scale. Ending and joining points can be of various shapes (more kinds than in Interpress).

Filled areas are created by filling a closed path of any complexity. Filling may be by winding rule or by even-odd rule.

Image Objects

PostScript has more powerful facilities for halftones and images than any of the other languages described here. These include multiple bits per screen ("printer's screen"), sophisticated control of the screen shape and size, colour and gray scale. Not every PostScript printer is guaranteed to support all of these features, but even the low-end LaserWriter does a quite good job.

Bit images depend on the resolution at which they are digitized. However the power of PostScript allows arbitrary transformations. In our example the 'smoke' is a scaled bitmap.

Data Representation

PostScript is entirely human readable. All input comes from the printable 7-bit ASCII character set plus the newline marker (LF) and can probably be transmitted by any communication medium. Characters outside this range must be encoded as hexadecimal or octal constants, or a few special constants escaped with a backslash in the style of the C language:
(foo \t bar \n) print
\t stands for a TAB, \n for a LF. As seen in this example, strings of characters are enclosed in parentheses. A parenthese itself is represented by \) and \ is represented by \\.

PostScript is defined in terms of character sequences. The character tokens are separated by white space characters. A comment facility provides for pre-processing and debugging.

Miscellaneous

Error Handling,, nonum

When a PostScript error occurs, an error operator is executed. There is a set of built-in error operators provided as part of PostScript. A PostScript user can change this error handling by changing the dictionary entry for the relevant error operator. Depending on the relative position of that redefinition with respect to save and restore the redefinition will have a certain lifetime.

Font Specifics

PostScript's default font treatment is its most controversial feature. PostScript interpreters rasterize fonts on demand from outlines known to the interpreter. But normally a printer has often used fonts in some sizes ready in read only memory. There are two levels of compression for the bitmaps.

For the latin alphabet the fonts hold a common set of graphics (characters, ligatures, special symbols). Within PostScript all graphics have a unique name, so codepages can be set up. Also existing shapes within fonts can be selectively replaced.

Printer Instructions

PostScript does not define printer instructions in a standard way. However an implementation may introduce special operators and values in the status dictionary for that purpose. For example the LaserWriter supports multiple copies, select paper bin etc.

PostScript comments according to file structuring conventions can be used for pre-processing the PostScript file. This can serve for printing of selected pages, combining pages on a sheet etc.

Sample Definitions

The following PostScript file contains computations which normally would be performed by a formatter. Comments are introduced by the %% sign. It also tries to conform to the 'PostScript File Structuring Conventions' described in Appendix J of [7]. The comments starting with %% (and %] for the first line) have been inserted for that purpose.

%]PS-Adobe-1.0
%%Title: PostScript drawing example: Retort1.psc
%%DocumentFonts: Symbol Helvetica
%%Creator: A.Hoppler
%%CreationDate: 29-Sep-86
%%Pages: 1
%%For: OBRZ/DTA
%%EndComments
%-------------------------------------------------- PostScript Prolog

% Define the Jobname to the Apple LaserWriter
  statusdict /jobname (PostScript Example) put

% Define scale factors
  /inch { 72 mul } def
  /mm   { 2.83465 mul } def

%%EndProlog

%%Page i 1 % 'i'is document-defined page no, 1 is sequence number
% global offset of lower left corner of picture 1.2 inch 2 inch translate
% write Text /Helvetica findfont 12 scalefont setfont % Helvetica-12 15 mm 9 mm moveto % lower left corner (Sigma Chemistry, Somewhere round the Corner) show
/Symbol findfont 1.2 inch scalefont setfont % large 'Symbol' 30 mm 20 mm moveto % lower center (S) % greek sigma dup stringwidth % char width -0.5 mul exch -0.5 mul exch % calc. half rmoveto % adjust show % output character % define 'vector length' operator /vlen { dup mul % calculate y**2 exch dup mul % calculate x**2 add % add sqrt % sqrt (x**2+y**2) } def
% draw retort 0.6 mm setlinewidth % line width (of course) 1 setlinecap % round line caps 1 setlinejoin % joins ditto newpath % start a new 'path' 74 mm 33 mm moveto % move to first point of path 43 mm 35 mm lineto % line to 2nd point /savedmatrix matrix currentmatrix def % save coord. system % translate the coordinate system so that center of arc will be % at [0,0]. This simplifies the subsequent calculations. 30 mm 30 mm translate % center 0 0 % center (transformed) currentpoint vlen % radius currentpoint exch atan % angle of start point 90 % angle of endpoint arcn % arc (clockwise) savedmatrix setmatrix % get back coordinate system 73 mm 37 mm lineto % last line segment
stroke % outputs the entire path built above
% draw bitmap /imgstr 8 string def % define work string gsave % save coord. system, etc. % transform coord. system so unit square will be mapped to % desired output aerea. 80 mm 16 mm translate 18 mm 32 mm scale /filemask { % define proc to transfer bitmap from file { % reader proc currentfile imgstr readhexstring pop } imagemask } def 64 95 % scanlength, scanlines true % invert [64 0 0 -95 0 95] % matrix % generate image. The following hex data may contain any % number of spaces and newlines, but NO commments. Also it % needn't be arranged corresponding to the rasterlines.
filemask
0000 0000 0000 0000 0000 0100 0080 0000 0000 0010 0008 0000 0000 2080 1040 0000 .... etc ......... giving a total of 95 scanlines 0000 0067 7200 0000 0000 0012 4C40 0000 0000 0008 8100 0000 0000 0002 8800 0000 0000 0000 2000 0000 0000 0000 0000 0000
grestore
showpage % output the page % %%Trailer %----------------------------------------------------PostScript Epilog
% (no epilog commands)

Software and Hardware

Best known software to produce PostScript files are Macintosh applications like MS-Word or MacDraw. In fact they produce an intermediate file in 'Quick Draw' which in turn is converted to PostScript by Mac's basic services. A font editor "Fontographer" produces PostScript directly. As for Interpress there are also numerous announcements to support PostScript, e.g.:
WIPS+
DEC's workstation and host based document processing software
Interleaf TPS
Technical Publishing Software from Interleaf corp.
Interleaf WPS
Workstation Publishing Software from Interleaf corp. running on several workstations.
Susi
Text formatter of OBRZ
An encreasing number of hardware supporting PostScript is available. Since PostScript is a language without subsets defined, all of the mentioned printers can print very complex pages.
Printer/controller Resolution (dots/inch) Page size Marking engine
Adobe Atlas Controller (Motorola 68020 based) adjustable depends on resolution  
AGFA P400 with Atlas Controller 400 A4 AGFA Gaevert
Apple LaserWriter 300 approx. A4 Canon
Dataproducts LZR-2660 300 approx. A4 Toshiba
Dataproducts LZR-2665 300 up to A3 Toshiba
Linotronic 100 up to 1448 297 • 575 mm photo typesetter
Linotronic 300 up to 2540 305 • 655 mm photo typesetter
Mergenthaler P101 up to 1270 ??? photo typesetter
Mergenthaler P300 up to 2540 ??? photo typesetter
Laser Connection PS jet (controller board based on M68000) 300 approx. A4 Canon CX
QMS PS 800 300 approx. A4 Canon
QMS PS 1200 300 approx. A4 Xerox
QMS PS 2400 300 approx. A4 Xerox
Ricoh 4020 300 approx. A4 Ricoh
Texas Instruments Omnilaser 2115 and 2108 300 approx. A4 TI

[Main topics] [Navigation]

 URL:  Created: 2003-09-17  Updated:
© Docu+Design Daube, Zürich    
  Business of Docu + Design Daube Documentation issues Sharing information Klaus Daube's personal opinions Guests on this site Home of Docu + Design Daube To main page in this category To first page in series To previous page in series To next page in series To bottom of page To top of page Search this site Site map Mail to webmaster To bottom of page To top of page