1 week ago 🤯 for day 254, with 475 words.

Languages 14/n (Postscript)

Part 13 is here

I'm not sure if I ever really did any programming in Forth so I'm going to skip it. Forth for those that don't know is a stack based language in the same way that Reverse Polish Notation (RPN) calculators are. There is another very popular stack based language that I did learn and that is:

Postscript

Apple released the original LaserWriter which turned out to be the first printer that was driven by Postscript. Our research lab had one and I discovered that you could send your own postscript programs to it for processing.

Even the Wikipedia page for Postscript states that programs are not normally generated by humans but by other computer programs. It goes on to say that while this is normally the case, it doesn't preclude you hand writing postscript so that is what I did. I found a book on the subject and got to work.

The postscript language is a graphics markup language to discribe the contents of a page and later became the basis for the popular PDF format. If you treat a page as pure graphics you can draw text, boxes, circles and other shapes just as you could on a plotter and that is what postscript could do for you.

To move the pen on the page you issued instructions like:

72 500 moveto

To draw some text..

(Hello world!) show

To draw a line...

0 113.385827 lineto stroke

There were commands for almost every graphics operation you could think of plus you could write whole new functions yourself. It had variables and the usual concepts that made a language useful.

Other than playing with different graphics operators to see what they could do I remember writing a program to re-create the research labs logo. I coded it by hand. Afterwards I wrapped it in a function so you could call it with a position and size and it would place the logo on the page for you. If you had the ability to include pure postscript in your word processing or page layout program you could drop it in.

Postscript allowed you to specify sizes in multiple different units, inches, millimeters, points, pixels etc and it was experimenting with this language that I learnt about points and a lot of other printer and page layout terminology.

I also learnt a lot about dealing with the stack and the consequences of either poping one item too many off the stack or not enough. It would result in all sorts of wierd executions.

Plus there was no debugger. It was write, download and hope the printed page came out the way you wanted. Trial and error and a lot of paper and laser toner.

Next up, sort of Pascal

User Photo

By Yorick Phoenix 🤯

Chief WriteTogether Bug Finder & character stringer. Generally to create computer code, but sometimes actual words and paragraphs. Listens to lots of music, takes lots of photos, & invests in stocks for the long haul.

Get Yorick Phoenix's newsletter

Almost there! Check your inbox and click the link to confirm.

Subscribe to Yorick Phoenix's latest writing to get it right in your inbox.