10:1 Woe to those who decree iniquitous decrees, and the writers who keep writing oppression, 2 to turn aside the needy from justice and to rob the poor of my people of their right, that widows may be their spoil, and that they may make the fatherless their prey! 3 What will you do on the day of punishment, in the ruin that will come from afar? To whom will you flee for help, and where will you leave your wealth? 4 Nothing remains but to crouch among the prisoners or fall among the slain. Also, it feels wrong – create each paragraph on their own page and then move them back once you know its size. While that could be understood as a sufficient approach, it is a rather big change in the way processing works right now and I didn't want to do that. I was thinking of doing something similar, but that means we'd have to break before every paragraph and move them back up after we are done processing, according to the rules of orphans and widows. The (ehem, rather hackish) way this is achieved is by forcing a page break before processing and then move it back up one page if there is still enough space left on the page. The thing is, that here it is directly defined at parsing level, that this paragraph can't be broken. That is one of the starting points I had. If page-break-inside:avoid section has broken to new page but fits on one side - then move Breaking the entire paragraph would still totally be according to spec though, as that paragraph is a "should" not a "must". That would be closely resembling what I outlined as 2.
The spec states that orphan and widow have to taken care for whenever you break, but it also contains a "best breaking practice" section, which states, what is a desired behavior on how to break exactly. Your proposed configuration option seems like a totally different setting to a CSS default, I can see the usefulness of it though. Putting it per default to 0 (don't deal with widows or orphans), 1 as "break before paragraph and 2 meaning "smart break the paragraph if possible". In light of that, I'd actually suggest to have the configuration option a number defining the way to deal with them (allows to have more complex behaviors later, too, like letter spacing ) ). What I would suggest is that in the mPDF configuration file config.php there is a default widows and orphans setting of 1 which produces the same behaviour as the previous mPDF 6.0 release, i.e. Not actually that hard to do, once I am able to put a page break where I want ?. So in this case, it breaking at line 5 and printing 6 and 7 on the second page (if configured to do so). Like, let's say, we have a paragraph of 7 lines and 6 would fit on one page, leaving a widow on the page after? Well, As of now, I am only able to tell that once we have already printed line 6, and as we can't move back and "unprint" them at that point (it seems), it is still the same issue.īut yes, I was thinking of adding support for more complex behaviors (which might possibly be configuration options).
What if when a widow or orphan is detected, the page break or column break is applied within the current block rather than before the current block? That might mean the block has to be at least as large as the number of lines specified in the widows and orphans settings.