Suppress hyphenation on the last line of pages #39
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@kalaspuffar @PaulRambags I've added a new method
allowsEndingPageOnHyphen()
to the FormatterConfiguration API along the lines of the existingallowsEndingVolumeOnHyphen()
method, but I could also have merged the two into a single new method that accepts an enum (true|false|except-at-volume-breaks).@fredrikschill rightly remarked that never allowing hyphenation at page breaks could also become the default behavior, and nobody would have any problems with this. This means dropping
allowsEndingVolumeOnHyphen()
.This morning we also mentioned that we might want to make an exception for compound words: we could allow compound words to be hyphenated across pages (except at volume boundaries maybe, but we also said that we should consider to try not breaking blocks across volumes by default, i.e. the current behavior when a
volume-transition
element is present).Regarding compound words that contain a hyphen: CSS does not consider breaking the word after the hyphen as "hyphenation", so in Pipeline I follow this recommendation and so even when hyphenation is disallowed at page breaks, I do allow breaking after a hard hyphen. (I might provide ways to suppress it though, and/or I might also make the hyphenation smarter so that words like "t-shirt" and "e-mail" are not considered compound words.)
Regarding compound words that don't contain a hyphen: recognizing these words is not trivial, I'm afraid it would be way too much work for such a small optimization.
Finally, I'd also like to remind us of the related bug brailleapps/dotify.formatter.impl#46 (
allowsEndingVolumeOnHyphen(false)
does not work when avolume-transition
element is present).