Kozea / WeasyPrint

The awesome document factory
https://weasyprint.org
BSD 3-Clause "New" or "Revised" License
7.23k stars 686 forks source link

clarification: line breaking algorithm #2264

Open ondras opened 1 month ago

ondras commented 1 month ago

Hi, I am trying to understand WeasyPrint in more detail. As far as I know, there are two families of line-breaking algorithms: fast-and-ugly, typically implemented by web browsers, and expensive-but-nice (e.g. Knuth-Plass) that are used in more serious typography. What kind of line breaking algorithm is implemented in WeasyPrint, please?

liZe commented 1 month ago

Hi!

What kind of line breaking algorithm is implemented in WeasyPrint, please?

We’re a browser, we implement the ugly one. :smile:

But happily for you, things will change, even in browsers: the new text-wrap-style provides new ways to break lines, including a pretty value that is not specified but is a great opportunity to implement something close to the Knuth-Plass algorithm.

Interested in turning this issue into a feature request like "Support text-wrap-style"? (Note that it may take a lot of work to implement.)

ondras commented 1 month ago

Interested in turning this issue into a feature request like "Support text-wrap-style"? (Note that it may take a lot of work to implement.)

Yeah! Interested a lot -- because I am typesetting a book with WeasyPrint and the line-breaking algorithm is an important part. Unfortunately, I am afraid that this feature, due to its complexity, will not make it in time (the book needs to be published in 1-2 months).

Related to line breaking -- I just submitted https://github.com/Kozea/WeasyPrint/issues/2267

liZe commented 1 month ago

Unfortunately, I am afraid that this feature, due to its complexity, will not make it in time (the book needs to be published in 1-2 months).

Probably not. It may be part of a bigger change, like #1840.