WeasyPrint icon indicating copy to clipboard operation
WeasyPrint copied to clipboard

Text in table with style="direction: rtl;" overlaps collapsed border

Open kygoh opened this issue 1 year ago • 2 comments

The leftmost and rightmost 'XX' for the table (with style="direction: rtl") at the bottom of the following screenshot overlap the left and right border:

Screenshot 2024-02-03 at 11 33 26 PM

Html adapted from http://test.weasyprint.org/suite-css21/chapter17/section18/test4/:

<style>
  table {
  border-collapse:collapse;
  margin-bottom: 1em;
  }
  tr {
  border-left: 5px solid fuchsia;
  border-right: 5px solid purple;
  }
  td.right {
  background-color: yellow;
  border-bottom: 5px solid orange;
  }
  td.left {
  background-color: aqua;
  border-bottom: 5px solid teal;
  }
</style>
<table style="direction: ltr;">
 <tr>
 <td class="left">XX</td>
 <td class="right">XX XX XX</td>
 </tr>
</table>


<table style="direction: rtl;">
  <tr>
  <td class="right">XX XX XX</td>
  <td class="left">XX</td>
  </tr>
</table>

Any pointers on where to troubleshoot?

kygoh avatar Feb 03 '24 15:02 kygoh

Hi!

Thanks for the report. Two (!) pull requests have been opened, but I don’t know if we’ll manage to get an easy and clean fix.

liZe avatar Feb 07 '24 16:02 liZe

Code and test cases until commit d29ba8c in PR #2056 seems to imply content_box_x function has to take into account direction: rtl; when called by:

  • TableBox
  • TableCellBox

but not when called by BlockBox in PR #2059.

The test cases haven't cover direction: rtl; for these boxes:

  • PageBox
  • InlineBox
  • InlineBlockBox
  • BlockReplacedBox
  • InlineReplacedBox
  • FlexBox
  • TableCaptionBox
  • TableRowGroupBox
  • FootnoteAreaBox
  • MarginBox

Are there more test cases to be created?

kygoh avatar Feb 11 '24 07:02 kygoh