PostScript 101, continued

…Here is a classic little PostScript program:
% Hello World in Postscript
%!PS
/Palatino-Roman findfont
100 scalefont
setfont
100 100 moveto
(Hello World!) show
showpage

% is a comment character, meaning the line will be ignored. Although we have some codes we use after a comment sometimes that we don’t ignore, which we use to gather various information about a print job, like determining up front what fonts are to be used in the document, so we can see if the fonts exist on the printer, or if they are in the PostScript file itself.

%!PS is the universal signifier that a PostScript program is about to follow. Some printers will ignore a print job unless they see it. We verbally say this as “Percent Bang P S”. The “!” is called the “bang” character.

/Palatino-Roman findfont tells the interpreter to find the Palatino Roman font on the printer. We used to put fonts in the printer, because fonts take up a bit of memory, and RAM was expensive. Also, networks were slow, so you wanted to have the font handy on the printer, rather than having to send the font to it. Nowdays, RAM is cheap and networks scream, so we prefer to send the font from the computer to the printer. One thing that they didn’t incorporate into fonts was the idea of font “Versioning.” So back in 1990 you might have bought an expensive laser printer that had Palatino-Roman version 1.0 in it. Later on, Palatino-Roman might get updated. Because face it, things change in life. For example, the Europeans got together to form an economic bloc and invented a common currency they named the “Euro” and gave it a symbol that looks like a big letter C with an = stuck though the side of it. Well we didn’t have that character before, so they had to update the font and add it. And then they might have even found a bug in their font and fixed that. And they might have added some upper-ascii characters. You never know. And so today you’ll be using a much-updated version of Palatino Roman on your computer, let’s call it version 6.0, and you use it in Microsoft Word or whatever, and you see your document on screen and it all looks well. But you print it to the 1990 laser printer and use the printer’s font, and your Euro characters don’t get printed, and your bugs aren’t fixed, and you don’t have your new upper-ascii characters. Well that tends to piss people off. So these days we have a complete 180 degree about-face: Now it is vastly better to have no font on the printer, and send the font in the print job. (Or otherwise work out a way to ignore the font on the printer and send the computer’s font to the printer.)

Still, some fonts are huge. Like Japanese fonts with over 4000 characters. So you don’t REALLY want to send the entire font. You’d much rather send just the 7 characters used in the phrase “Hello World” which are: HeloWrd. So we do that, we call it “Character indexing” and we build a new, tiny font file on the fly and call it a CID font, for “Character InDexed font” and it keeps things nice and fast. And that causes problems like if you make your document into a PDF and embed the CID font in it, and later someone wants to edit the font and make it say “Hello Bad World” and you don’t have the B or the a character. Anyway, you can see that font slinging is no easy business, and that’s what I wanted to impress upon you. But I digressed…

to be continued…

Skip

PostScript 101

As does happen on occasion, I ponder things to a ridiculously detailed level. The other day I was looking at large format plotters and *KNEW* that I wanted one with PostScript but suddenly didn’t know *WHY* I needed one with PostScript. Having my curiosity peaked, I decided I needed to know what all the fuss was about, so I called one of my Guru’s, Mark Barnes over at Adobe…

In this multi-part series, I will share with you the information that Mark sent me. So for all of you who have heard of, used, and knew the importance of PostScript but not necessarily why…. this is for you.

“What is PostScript?”
A: It is both a Programming Language, and a Page Description Language (PDL).

As a Programming Language, it is stack based, and uses Postfix notation, similar to a Reverse Polish Notation Calculator. In an RPN calculator, you enter the equation 2+2= as: 2 [enter] 2 [enter] +. It has the advantage of eliminating the need for parentheses in a calculation. For example 3 x (4+7) would be entered: 3 [enter] 4 [enter] 7 [enter] + x. The way it would be processed is as follows: You imagine each entry being stacked on top of each other. So you get a 3 at the base, with a 4 on top of it, and a 7 on top of that. Then you process the “plus” operation. Plus takes the first thing off the stack, (7 in this case) and “plusses” it with the next thing it takes off the stack (4) and pushes the answer 11 onto the stack. Then it processes the “times” operator, by taking the 11 off the stack, and “times” it with the next thing it takes off the stack (3) and pushes the answer 33 onto the stack.

For more on RPN, visit: Wikipedia

PostScript is an “interpreted” programming language. Meaning it isn’t Assembly language, it isn’t a string of ones and zeros. It is human-readable and gets interpreted by a PostScript Interpreter, which is a high-level chunk of computing code that typically lives in the ROM of a printer’s marking engine. As a Page Description Language, it exists to describe the appearance of printed pages. It is both Resolution Independent and Device Independent. (Although devices differ a lot, and it is relatively easy to produce PostScript code that will produce expected results on one device and not on another device, but in general, the language itself is device independent. What you *do* with it is another matter.)…

To be continued.