2007-01-30

I am having second thoughts on my attraction to PostScript. I had a chance to do some reading, and PostScript 3 has some quaint limitations. It still does not have transparency. PDF has transparency groups starting in version 1.4, but they are a kludge both at the source code and implementation levels. I also hate the way Unicode text is handled. Having to manually construct character conversion tables to create some kind of Frankenstein virtual font is just mind-boggling. (Okay LaSi is neat. It is ridiculous that you need it, but baroquely satisfying. Cedilla goes beyond that.)

It occurred to me this morning that saying PostScript is "SVG without the programmatic accessibility of XML" is basically the same idea for me as calling it "Lisp without macros". It is write-only code. What I really want is a data structure than can be easily parsed, manipulated based on embedded tags and/or pattern recognition, and stored again without losing semantic content. (A Lisp macro!) PostScript's inherent jumble of postfix operaters make it hard to manipulate in that fashion. More and more, I think writing a graphics interpreter on top of Quartz is the right path.

The previous paragraph doesn't quite capture what I mean. The power of Lisp macros is that you can take an arbitrary Lisp data structure, transform it in an arbitrarily complex way, and the result will be a Lisp data structure which you can continue to work on. This means you can run the original data through multiple macros to accomplish different tasks. This is akin to Unix command pipes, where the output of one program is fed into the next program, and multiple commands can be chained together to accomplish jobs far beyond the power of any single component. PostScript may be Turing complete and you can build powerful tools out of the basic operators, but in my mind it just cannot compare to a Lisp-equivalent language for semantic power.

Now what I really want is the ability to design simple languages for separate tasks and to build custom interpreters to transform those inputs into forms accessible by others. When I look at it that way, I see why I keep coming back to SVG. XML has the multiple transformation property of Lisp data but has achieved greater popular acceptance with a corresponding abundance of toolkits and libraries. Everyone can use XML without abandoning their favorite language. If I were to design languages in Lisp, I would have to implement the entire toolchain to transform them to their destination format. XML already has an infrastructure for that type of work.

On the other paw, the SVG1.1 spec unzipped is over seven megabytes. That's a lot of verbose gibberish to wade through to figure out what is important. I think I will meditate on it for a while and play with PostScript and imageToPNG2.