brandon-rhodes / python-typesetting

A Python library letting you invoke TeX-inspired typesetting algorithms
https://www.youtube.com/watch?v=e7RVO0Sqr4s
158 stars 12 forks source link

Allow text to flow through arbitrary frames (PR ready) #9

Open tophatpanda opened 4 years ago

tophatpanda commented 4 years ago

I have added support for arbitrary placement of text:

frames-and-floats_thumbnail

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:

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.

brandon-rhodes commented 4 years ago

Interesting! I'll try to take a look later this weekend or early next week.

brandon-rhodes commented 4 years ago

(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.)