…100 scalefont sets the font size. Fonts are, by default, defined as 1 point tall. A point is 1/72 of an inch. So at a scale factor of 100, our font should be about 1.38 inches tall. But remember that font characters have ascenders and descenders, so the actual letterform sizes will be somewhat smaller, maybe 2/3 of an inch or so typical, for a 100 point font.

Setfont specifies the font dictionary to be used by subsequent character operators. Since “Palatino-Roman” is on the stack, it is used for the setfont operator.

100 100 moveto defines the location of the “current point”. The Current Point starts out at 0,0 in Cartesian coordinates, that is the lower left corner of a piece of imaginary paper. 100 100 sets it at 1.38 inches up and 1.38 inches to the right. This is where the baseline for the following text will start.

“show” is an operator that takes a string from the stack and paints the characters identified by the elements of the string on the current page, starting at the current point, using the font face, size, and orientation specified by the most recent “setfont” call. The default character spacing is set by the character’s width, which is an X,Y displacement that is part of the character’s definition. So basically, the line paints “Hello World!” on the page.

Finally, “showpage” transmits the current page to the raster output device, causing any marks painted on the current page to appear. After that, it performs some clean-up duties, like erasing the current page and re-initializing the graphics state (resetting the current point to 0,0 and the like.)

And that, in a nutshell, is a very simple PostScript program.

As you might imagine, a typical word-processor page worth of printed text an graphics is considerably more complex. Also, PostScript “painting” occurs on a theoretical page before “showpage” actually sends it to the printer. In the PostScript world, a page is “piled up” of its elements. So for example, if you coded a circle in the middle of a page and filled it with the color black, and then you coded a smaller circle centered on the first circle, and filled the smaller circle with white, the white would “overprint” the black, and thus you’d get something that looks like a donut on your page. This is a good thing, because white is printed on paper by *NOT* printing ink, and if it didn’t work this way, you wouldn’t get a donut, because the first circle would have been inked solid. Anyway, this a just a really simple example so you can see that a “real” PostScript program has lots of elements that handle lots of different things a person might want to do…


Skip Sommer