Fix overflow-wrap
, support word-break: break-all
#1534
Merged
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.
Previously, if
overflow-wrap: anywhere
(orbreak-word
) was set on an inline element (like an<a>
or<span>
) whose first word occurred towards the end of a line, it would have broken that word, even if doing so wasn't necessary (and wouldn't have happened were it not for the wrapping element).This pipes through a
is_line_start
argument tosplit_text_box
that only allows the break on a word if it's the first word in a line.Additionally, this adds support for the
break-all
value forword-break
. Thekeep-all
andbreak-word
properties are not yet supported: the former seems like it is likely to require a Pango setting that I haven't yet dug into, and the latter has to set a value in another CSS property and I haven't dug into the CSS settings portion of WeasyPrint too much yet.I'm not thrilled with the updated if statement in line_break.py, so feel free to modify it if you'd prefer different formatting.
This references #1153, but as above, doesn't fully close it yet. (There may not be a ton of work remaining, though!)