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.
Close #301.
I was wrong about so many things.
The line breaking algorithm is really well defined in the Text 3 module. It does not rely on fragmentation, that's so cool. Most of the rules were already supported, the spec mainly relies on the "soft wrap opportunities" that's not defined in the spec, but…
This "soft wrap opportunities" thing is very, very well supported by Pango. As for everyting around Unicode, I thought that it was complicated, and it is actually really more complicated than just complicated. Did I want to rewrite this? OMG, I was crazy. But…
After reading the current code, the only real missing feature to cleanly support line breaking was to remove the soft wrap opportunities at tags boundaries. And that's all. Pango is incredible to cut lines, it just doesn't know specific CSS rules (as space trimming and stripping), but we don't care. We can imagine workarounds in WeasyPrint, that's not bad, everybody does that (except "real" browsers that can hire Behdad to rewrite Pango for their needs). And…
We already have the workarounds. We don't have to rewrite the line breaking algorithm, because Pango + workarounds is actually a really smart way to do what we want to do. There's no important thing to add, except from cleaning some complicated
*-wrap
and*-break
attributes and from line-breaks at tags boundaries. And…Line-breaks at tags boundaries are now correctly supported. That's what this PR is about. That's all, and that was pretty easy. And…
Let's talk about right-to-left and bidi. Let's talk about RTL support #106. Pango already handles this in text. I'm now sure that we can handle this for boxes, thanks to some features Pango will provide, and a lot of tests. Thanks to the W3C, we already have tests. So… Let's go!