dompdf / dompdf/dompdf

Text alignment combined with whitespace styling not correctly interpreted

Open
#2,186 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug css
Dominant language
PHP
Stars
11.2k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

When text is styled with both whitespace and text alignment declarations the spacing and layout of the text is not always correctly interpreted.

For example, if the white-space styling is pre or pre-wrap then the spacing should not be adjusted to justify the text.

<html>
<head>
</head>
<body>
<div style="background: #c0c0c0; font-family: Courier; font-weight: normal; text-align: justify; white-space:pre-line;">LOOK AT SOME OF THESE TEST VALUES LOOK AT SOME OF 
  THESE TEST VALUES LOOK AT SOME OF THESE TEST VALUES LOOK AT SOME
   OF THESE TEST VALUES LOOK AT SOME OF THESE TEST VALUES LOOK AT SOME
    OF THESE TEST VALUES LOOK AT SOME OF THESE TEST VALUES LOOK AT
     SOME OF THESE TEST VALUES LOOK AT SOME OF THESE TEST VALUES LOOK AT SOME OF THESE TEST VALUES</div>
</body>
</html>

TODO: investigate further, this is based on browser rendering, not all combinations tested

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. Start by reproducing the supplied HTML in dompdf and a browser, then trace the handling of text-align with white-space: pre, pre-wrap, and pre-line; done means spacing and layout match the expected browser behavior without unjustified text.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, html, php
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.