Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix overflow-wrap, support word-break: break-all #1534

Merged
merged 2 commits into from
Jan 16, 2022

Conversation

aschmitz
Copy link
Contributor

@aschmitz aschmitz commented Jan 5, 2022

Previously, if overflow-wrap: anywhere (or break-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 to split_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 for word-break. The keep-all and break-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!)

Previously, if `overflow-wrap: anywhere` (or `break-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 to `split_text_box` that
only allows the break on a word if it's the first word in a line.
This adds support for the `break-all` value for `word-break`. The
`keep-all` and `break-word` properties are not yet supported.
@liZe liZe added this to the 55.0 milestone Jan 8, 2022
@liZe liZe merged commit d06ad07 into Kozea:master Jan 16, 2022
@liZe
Copy link
Member

liZe commented Jan 16, 2022

Thanks for the pull request! 💜

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants