WeasyPrint icon indicating copy to clipboard operation
WeasyPrint copied to clipboard

"word-break: break-all" does not seem to work

Open ondras opened this issue 1 year ago • 3 comments

HTML:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
</head>
<body>
  <style>
    p {
      width: 320px;
      background-color: #eee;
      text-align: justify;
      word-break: break-all;
    }
  </style>

<p>Link <a href="#">https://www.w3.org/community/webed/wiki/A_Short_History_of_JavaScript</a> link link.</p>

</body>
</html>

Browser rendering: obrazek

WeasyPrint rendering: obrazek

Versions:

weasyprint             62.3
libpango-1.0-0:amd64              1.50.12+ds-1 
libpangocairo-1.0-0:amd64         1.50.12+ds-1
libpangoft2-1.0-0:amd64           1.50.12+ds-1 

ondras avatar Oct 04 '24 13:10 ondras

Thanks for the report.

You’re right. It’s somehow supported, because it breaks words when it’s obliged to, but it should always break words instead.

liZe avatar Oct 05 '24 07:10 liZe

(Related to #1153, #1507 and #1534.)

liZe avatar Oct 05 '24 07:10 liZe

With word-break: break-all, We should probably set the wrap option earlier:

https://github.com/Kozea/WeasyPrint/blob/d0ac723854fa8515be0948ccd803c7594e844c15/weasyprint/text/line_break.py#L478-L479

liZe avatar Oct 05 '24 07:10 liZe