Linux Printing and Automating Card Layout

I spent a while fighting with Linux printing. It was mostly working, but postscript, which most the programs used as an intermediate step, was cutting off the top of the page. After pouring through documentation and commentary, switching printing systems, and generally trying to untangle the print pipeline, it became apparent that something down at the base level had become convinced that OBVIOUSLY I was using A4 paper. The upshot is that in course of trying things out, I got an easier to manage print system, complete with full-featured ‘print setup’ dialog boxes in most GUI applications.

The reason I was doing this, is that I’ve been experimenting with the new generation of Harmony, a tile game that I’ve been working on, on and off (mostly off) for seven years or so. While investigating the linux drawing programs, I discovered that several could use Scaleable Vector Graphics files, a text based format that might be amenable to script-based modification to pump out cards from a template. This is especially useful since none of the programs I tried had all of the features I use in WordPerfect’s draw that enable fairly fast card layout (primarily: edit group, zoom to object, fairly robust selection guidelines, copy/paste keystrokes)

The roadblock that’s been plaguing me in Harmony for the last couple of years has been cognitive overload in finding patterns. I’ve finally resolved on a course of action, but I’ve also made the cards (I’m still in the habit of calling them cards even though it is more of tile game now) circular. This means I need to draw arcs around the sides. The problem is, the SVG people decided that, rather than implementing arcs as a simple angular parameter to the ellipse primitive, they made it part of the path element, a general, and therefore complex, sub-language. The format of the arc command in the path sub-language has also been made rather non-intuitive in order to make it fit with thte sub-language. Consequently, the creates of the drawing programs, perhaps wisely, do not support the arc command on either import or export – modifiyability is severely impaired.

At this point I remembered that one of the programs was written in Python (with a few core components in compiled C), complete with a plug-in architecture. This allows me to manipulate the programs ellipse object (with far more intuitive arc parameter) directly. I now have the beginnings of my own custom card factory, able to pump out arbitrary combinations. A little more work should able to build up a batch importer to automatically instance the object and do a page layout. The biggest obstacle is the game text – multiline text isn’t a primitive in the editor, it is a plug-in with a custom dialog box. Perhaps if I’m loading from file (rather than pasting in the separate fields and making each card manually) I can instance the multiline text object directly and avoid the special dialog box.

Posted Friday, November 28th, 2003 under War Story.

Comments are closed.