I’ve been mucking about with groff. With what, you ask? Groff! Otherwise known as GNU Troff, and if that doesn’t clue you in (it probably doesn’t), then let me explain.
Troff is an oooooold Unix tool for typesetting. It was born way, way back in the early 1970s as part of the original Unix documentation toolkit. In the old days, this was the tool you used to print formatted docs. The first version was written to drive a phototypesetter (a GSI C/A/T, in case you were wondering)—this is back in the days when phototypesetting was nouveau. Later in the 1970s, it was modified to be usable with any typesetter. Around that time, our friends at Coach House Press (now you begin to understand where I’m coming from) got hold of it and developed a version of it that was up to the standards of professional printing/publishing: better hyphenation & justification, kerning, and so on. The result was SQTroff, where SQ stood for SoftQuad, the Coach House’s software startup.
Coach House did their typesetting via Troff all through the 1980s. By then Troff could produce Postscript output, so it was used to drive laser printers and imagesetters and such modern output devices. Here’s an interesting note: although Coach House eventually went to Mac-based DTP in the 1980s, the Troff way of working is still in use at publishers like Wilfrid Laurier U Press and even the Porcupine’s Quill. If you pay attention to Canadian literary presses, you probably already know that Porcupine’s Quill is very proud of their fine printing on ‘heritage’ equipment; you may not have known that Unix is part of that.
So this brings us to Groff. When Unix largely went open source in the late 80s and early 90s (via GNU and Linux), the vast majority of the legacy tool suite was re-written under a free license. Hence Troff became Groff. And, Groff developer James Clark (a very big name in the XML world) was well-enough connected to Softquad that the free-licensed tool included a good portion of the typographic improvements made there (although not some of the software-maintenance facilities in SQTroff).
The most important thing about Groff is that it is still around, and still maintained. Because it’s part of the free software toolkit which underlies almost everything these days, Groff is a ubiquitous (though mostly ignored) component in modern operating systems. If you run Mac OS X, you already have it on your hard drive! If you run Linux… natch. Windows may be another story, but it’s still easily installed. We may take for granted that nobody has thought about doing typesetting and page layout this way since the days of PageMaker and QuarkXPress, but that doesn’t mean Groff is obsolete. In fact, it has been actively maintained and used ever since.
Got a Mac? Here’s a thing to try out:
Write a text file. Give it some nice long paragraphs, and separate the paragraphs with blank lines (this will serve as our cheapest-possible typesetting code :-). Save is as example.txt
Open up the Terminal… navigate to the folder where you saved example.txt. Type this in the terminal:
groff -mom example.txt > example.ps; open example.ps
You should see Preview open up with a typeset version of your text; note the H&J, and if you typed “fi” anywhere, note the ligature. This is a demo of Groff’s bare, default behaviour, with no formatting instructions. Beyond this, Groff is almost infinitely malleable and directable. Have a look at the docs for the “mom” macro set at http://www.schaffter.ca/mom/momdoc/toc.html
So what’s the point? At the base level, high-quality typesetting exists—for free—outside the normal Adobe-controlled world. Yes, it’s a batch-processing model, uninformed by the WYSIWYG world we’ve been living in for a generation. But…
But, I ask you to consider this: when we write and design for the Web, when we separate content from formatting by writing clean markup and designing elegant CSS stylesheets, we are doing something similar: we’re preparing the templating and general instructions for how things will look, and then applying that to well prepared (marked-up) content.
Groff is no different. And so I suggest that an opportunity exists to leverage this venerable technology in Web-first workflows, to produce beautifully formatted print out of marked-up content online. We did this already by piping HTML content into InDesign with ickmull. Hugh McGuire’s Pressbooks project incorporates that, plus a second TEX-based templated output option as well. We could go further…
To the best of my knowledge, nobody has written a general-purpose HTML-to-Groff transformation—such a thing would combine well-formed HTML (such as you might have already in Wordpress or Drupal) with a set of templates and stylesheets, and produce perfect Postscript/PDF output. What’s more, it would do it using free software. And it would be simple: Groff is a tiny little piece of software compared to anything remotely comparable, output-wise.
Nobody has written that transformation piece. But I am going to.