Allow text to flow through arbitrary frames (PR ready)
Opened this issue · 2 comments
I have added support for arbitrary placement of text:
The above image is from a new example that use these changes. The user defines a list of "frames", four-tuples with x-position, y-position, width, and height that they want the text to flow through. These can be given to skeleton.frame_layout()
which uses them to create matching columns. The big change is that now the algorithms are flexible enough to deal with the columns suddenly changing size, which didn't really work previously.
My fork is at https://github.com/tophatpanda/python-typesetting, and I'd be happy to open a pull request if you like my changes.
Changes:
- Made changes to
knuth.py
andtexlib/wrap.py
to make their algorithms handle a changing column-size halfway through a paragraph. - Added a new
frame_layout()
toskeleton.py
. composing.py
has improved handling of single-line paragraphs.- I changed
document.py
and the py-londinium example a little bit by moving the conversion of inches into mm into the example'stypeset.py
. I wanted to use millimeters for my new example to easily set the page size to A4. setup.py
was missing thetypesetting.texlib
package.- The new example uses Lovecraft's short story "Dagon" (which is out of copyright) as a kind of expanded lorem-ipsum.
Thank you for such a well-thought out library (and a great presentation to match :). I'm not that used to GitHub, so I'm anticipating that you may want me to tweak things :P.
Interesting! I'll try to take a look later this weekend or early next week.
(This week is winding up pretty astronomy-heavy in terms of my open source activity, so it might be another couple of weeks before I have time.)