Open Source Publishing – Graphic Design Caravan

The Flow of Text in MasterPages

Tools · April 23rd, 2007 ·

The scripting in Scribus happens in the house of Python. The Scribus module is loaded into scripts with the standard import scribus or from scribus import *. In this post, we’ll be using only one function off this module:

createText(x, y, width, height)

This function puts a TextBox of the specified width and height at the (x, y)-coordinates of your document. This is its documentation.

The TextBoxes of Scribus Templates are eerily insular. Since we really didn’t find a way to make text flow in Scribus MasterPages, we were forced to write a script. It builds on a script that was posted some time ago on the Scribus mailing list.

We have added an alternate to the Flow of Text that may be useful to the users of the script. The TextFlow in the original is fine, but ours is fine, too. To push the Text as a River metaphor a bit further: the text must flow, and we’re redirecting it with a Dam.

To see the difference, it’s probably best to run the script itself. Fetch the TextBoxes.py and Boxes.py files, and put them in the same directory. Open Scribus and load a document. Things will only work if there’s already a Scribus document open.

even = [[30, 30, 10, 10], [50, 50, 20, 20], [80, 80, 30, 30]]
odd = [[30, 240, 10, 10], [50, 210, 20, 20], [80, 170, 30, 30]]

The above are the lines in Boxes.py where you specify the size and position of your TextBoxes. It uses the same units as your Already opened Scribus document. Note that you can have different layouts for odd and even pages. Once you’ve written a layout, execute TextBoxes.py from the aptly named Script menu.

Boxes.py may be the only file that you will need to edit. It has a couple of other tweakable parameters. Explore : )

Tags: · ,