A postscript library is called a prologue- in that it’s just some boilerplate that you stick at the begining of every one of your postscript programs to setup the dsl you will be using for your real document. For example, jpeg support was added to postscript by adding a base64 and jpeg decoder function to the prologue of every postscript file with jpegs in it. Postscript fonts are nothing more than elements of a prologue. unicode support comes from prologues, not native features.

at some point it became standard practice to include something like this at the tippy top of every postscript prologue:

/M {moveto} bind def
/L {lineto} bind def
/R {rmoveto} bind def
/V {rlineto} bind def
/N {newpath moveto} bind def
/Z {closepath} bind def
/C {setrgbcolor} bind def
/f {rlineto fill} bind def
/g {setgray} bind def

and so later on in the file, where there are complex path definitions, these macros would save tons of space.

haha, I just got it. prologue and postscript

Show thread

i don’t know exactly when or how those path macros became so ubiquitous , but if you look at a typical postscript file in the wild, it will be using those macro shortcuts for paths, almost never the native moveTo lineTo etc functions.
and these postscript macros are what SVG’s pathdata standard are based onz

here’s gnuplot’s prologue, where I swiped those from

Show thread

it seems like a strange thing to call a library, a strange system all around. but the idea was that to have a system flexible enough to print any kind of file. so you’d have a prologue for every kind of file you’d want to print, and then to print it, you’d just send the prologue, and then the actual file itself, unaltered. the postscript prologue sets up arbitrary file formats as a printing dsl.

so, if you look through github, there’s prologues for printing mail queues.

Show thread

you could in principle make a prologue for nicely printing markdown documents. then to “convert” markdown to postscript, you could just

cat readme.markdown >

Show thread

postscript fonts being prologues has legal implications. In the USA it was ruled that it is not possible to copyright the design of a font. however, it’s still possible to trademark the name of a font.

in the modern era, US based font foundries hold copyrights on their fonts. but- this is critical- their copyrights are for the font *programs* not the font *designs* since computer programs are copyrightable and fonts are not.

thus you could get cdroms of “10,000 fonts” which were knockoffs

Show thread

is there a conclusion to this? it’s that postscript is way cooler an idea than you think, even if you already think postscript is pretty cool.

Show thread

oh yeah, also this:
adobe illustrator saves everything in the default document swatch and palette patterns to your document prologue. if for whatever reason you wanna get rid of garbage and shrink your adobe illustrator document, delete everything out of your document libraries.

Show thread

if anything can be called a native app for the postscript language/format, it would be adobe illustrator. perhaps older versions moreso than recent versions. both postscript and illustrator were originally created by John Warnock, with illustrator evolving from an internal tool adobe was using to create postscript fonts.

the native file format for illustrator up until version 9 was postscript. after that, PDF, which is a dialect of postscript designed to avoid the wrath of Turing’s ghost

Show thread

it turns out that the concept for your printing language being “cool” doesn’t prevent the major downsides of the real world practical problems with software ecosystems at scale

Show thread

Postscript became the basis for the display system in the NeXT operating system, and the NeWS unix system.

there are many old timers, especially Don Hopkins, who say that NeWS was amazing and they wish modern systems were more like this.

when NeXT became Mac OSX, licensing restrictions meant Apple had to drop display postscript, which they replaced with a system called Quartz. Quartz is interesting, because it is “not postscript” in the same way that dalvik is “not java”

Show thread

in Quartz, you have all the same native drawing commands and implicit context as you have in postscript- accessed via objective C or plain C drawing instructions.

in Quartz you can swap out different drawing contexts, so that usually you’re drawing to the screen, but you can also draw to a special context that produces PDFs. it turns out this is the entirity of how printing works in native cocoa apps. neat! are there other contexts for drawing directly to various bitmap formats.

Show thread

when Apple created an OSX feature called Dashboard, they created a widget platform for dashboard widgets, which were little bundles of html and javascript files, plus a few extra APIs available from javascript that gave dashboard widgets some superpowers.

one of these apis was a thin javascript wrapper around Quartz2D which you could access by including a <canvas> html tag.

Show thread

you might already know the rest of this story. Canvas tag got standardised into html5, and so now all modern browsers contain a stripped down javascriptified version of postscript inside of them.

Cairo and Pango seem exist almost only to help inplement this “not postscript”

yep, canvas tag’s lineage traces right back to postscript

Show thread

i suppose that also means that if the supreme court decides you can copyright an API, that might affect Quartz, and the canvas API by extension.

Show thread

i just looked at this history of Cairo and- yep- although it doesn’t derive from Quartz2D you could call it a sibling or a cousin. it was created to implement display postscript in x windows.

Show thread

John Pound is an artist who has been developing his personal postscript prologue for over 20 years. He's almost got it how he likes it.

Show thread

I guess this is the POSTSCRIPT FACTS thread now. Here's another.

I remember reading somewhere, i don't know where, that to implement postscript on some new imaging device, you needed at minimum to implement a trapezium primitive: A four sided shape where the top and bottom edges are parallel but the other two sides are free to be any angle.

The basic postscript library defined all other primitives in terms of the trapezium

Show thread

A Raster Image Processor or RIP is strange artefact of the printing industry. (I don't even know if they're used anymore). These are essentially standalone computers whose one job in life is turning PostScript into pixels, on/off timed signals for an imaging device- typically a film negative, direct-to-plate system or laser printer. the RIP CONTROLS LASERS MAN.

Show thread
Show more

@zens Amusingly, the raw X11 primitives for drawing are also based on Postscript's primitives as well, or so says my Xlib manual. :)

@kensanata uhhhhmmmm, no, i kind of started the thread thinking it would just be those first two posts. i just somehow kept going?

i am planning on making a blog one of these days to move my stream of consciousness threads to.

@zens Well, it is what it is, then. People can do their own research online. Thanks for the pointers in any case!

Show more

@zens this is incredible.

*points to newspaper*
"is this postscript?"

@inscript there’s at least one regularly published sunday comic that i know was made with Adobe Illustrator (which outputs postscripts) U Can With Beakman and Jax. (written by jok church)
he has an amazing TED talk in a video somewhere.

@zens I remember when MacOS 10 betas were still being reported in magazines; Quartz was (at that time) referred to as "Display PDF", if memory serves me correctly.

@vertigo yes, somehow the “display pdf” meme got started, but it’s not entirely accurate to describe it that way, i don’t think.

@vertigo reading a bit more in wikipedia, the exact distinction waa that quartz2D adopted the graphics model from pdf, (nearly identical to the graphics model from postscript) which had better licensing terms- but unlike display postscript- quartz 2d doesn’t use any actual postscript or pdf’s version of postscript- the “graphics model” is programmed directly from C (or objective c)

@vertigo so you could call it “display pdf” but it would be misleading since no one is going to write a pdf out by hand in a text editor.

@vertigo the description of NeWS on wikipedia, paraphrased:
a lot like modern “ajax” websites, except instead of javascript, you had postscript. instead of CSS you had postscript. instead of html you had postscript. and instead of json you had postscript data.

@zens there are whole prologues for printer emulation. I remember using one that was a fair emulation of an Epson 9-pin.

The standardization of prologues got to such a point that Adobe proposed "distilling" PostScript to an ultra-portable PS standard: you can still find the old '' script online. After a while people got worried about the whole executable code thing, so PDF got started.

I don't miss debugging giant PS prepress jobs one bit

@zens It feels like “the human compiler at work” to try to do table-based compression by hand instead of using gzip or similar (which some formats have built-in).


The United States LZW patent expired on 20 June 2003. The counterpart patents in the United Kingdom, France, Germany and Italy expired on 18 June 2004, the Japanese patents expired on 20 June 2004, and the Canadian patent expired on 7 July 2004.

But there are other table-based compression algorithms that doesn’t use explicitly LWZ. Including gzip♥ is probably what I was thinking of! RIP my memory!♥

@Sandra by then adobe had already well and truly moved on to PDF that does use compressed binary streams

@zens That, I do remember. Back in the day we had to use pdf.gz because of the patent. Also mupdf and evince didn’t exist so PDFs looked pretty rough 🔖 There was a font hinting bug so glyphs weren’t properly on base

@Sandra there’s also the small matter that, looking at the timelines, postscript had already been around several years before the first paper on lzw was published

@zens Because of Adobe’s patent on their compression, I mean. I had DEFLATE and LZW mixed up with each other. All this is so far in the past that I’m happy to not be remembering it♥👵 Back in the bad old days of Burn All GIFs, having to deal with ESR and RMS etc. It was an awful time all over

@Sandra on the other hand, nothing stopping anyone from implementing inflate or lzw as a postscript prologue. not very handy for people who still want to read the source. and you’d need a certain minimum size to make it worthwhile.

@zens That’s why I wanna Unix philosophy and do it in post-processing via gzip or similar♥

@Sandra depends on what the postscript is for, i suppose.

@clacke The issue is less a matter of interpretation and more an issue of embedding data (such as fonts). Also PostScript can’t handle alpha transparency in vector images, only mask transparency. The former can be worked around by storing texts as paths, and there’s a cockamamie workaround for the latter that renders the border areas with Cairo.

@Sandra @clacke According to this spec, starting with pdf 1.4, it cannot be straightforwardly interpreted by a postscript printer because of the transparency issue.

Before this, it looks like a prologue is possible, but would be defeating the supposed advantages of using PDF over postscript- (Primarily performance and seekability- Postscript would need to execute all 249 prior pages before it could render page 250, for instance. PDF in essence sandboxes each page, font, image asset)

@Sandra @clacke PDF also includes a bunch of shit that you can't print.

like, for instance, did you know a PDF document is fully scriptable with javascript? oh yes.

@Sandra @clacke I had no doubt. reply ambiguity is weird.

Anyway, I looked it up, and it turns out ghostscript contains a pdf prolog thingy. Or rather, a handfull of postscript files that together implement pdf 1.2

@zens @Sandra I should have remembered that! You'd print or convert a PDF with `gs -sPDFWRITE` or something.
@zens @Sandra I meant specifically for printing on a PS printer, so seekability or interactivity wouldn't be a factor.

But the transparency sounds like an issue. I guess you'd have to write a complete rasterization layer in PS and at that point lose the scalability present in the input.

@clacke @Sandra sorry, I'm wrong. page 22 here describes how to convert pdf to postscript

where it menitions "procedurre sets" i note that is what adobe calls the list of single letter macros mentioned up thread. Apparently PDF standardised some of them?


this thread of yours is very interesting 👀

In some way, the fact that many features are provided by libraires is similar to the scheme idea that it's better to subtract features and allow the language to express what's needed

I knew the story of displayPostscript, and also the relativeness with svg

I didn't consider the consequences of the copyrightability of APIs

Thanks !

Sign in to participate in the conversation

Merveilles is a community project aimed at the establishment of new ways of speaking, seeing and organizing information — A culture that seeks augmentation through the arts of engineering and design. A warm welcome to any like-minded people who feel these ideals resonate with them.