Open MultisampledNight opened 8 months ago
So breaking the canvas across pages if it doesn't fit? You're right it is slightly insane... but the more I think about it the more possible it is...
After all the elements have been processed the canvas does know its final size so it could split the drawables so that each part can fit in the correct space. Two issues I have with this, is how can we find how much space is left and how do we split content?
I don't think giving break hints to the canvas works in the way you think it does btw.
Split content could be drawn two times with a clip mask + an offset. Implementing this should definitely be possible.
Problem
Somehow I ended up building a pseudo DSL rendered with cetz for an amateur protocol documentation. However, those can end up being quite long when displayed, in this case also being several pages wide for one listing combining all of them in that document.
Possible solution
Implementation of split lines (name up to bikeshedding). Adding a split line at height k
content
s, one for "above k" and "below k" respectivelyNow, if the full drawing does happen to fit on one page, it is unmodified. However, if it doesn't, typst's layouting will hopefully take advantage of there actually being 2 distinct
content
s which can now be rendered.This could also be scaled up to any number of split lines.
Tricky edge cases
EDIT: Possible API design
should result in something akin to this if typst takes advantage of the split opportunity/line at the page break (displayed here as dashed):
Other notes
This is slightly insane. Keeping this here anyway for further thoughts and input.