Right aligned text with white-space: pre-wrap
When printing right aligned text and element has white-space: pre-wrap there is invalid right padding.
Example HTML
<html>
<head>
<title>Text align right and white-space: pre-wrap</title>
<style>
div {
text-align: right;
white-space: pre-wrap;
background-color: #ff9494;
}
</style>
</head>
<body>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum</div>
</body>
</html>
PDF results
Same example with text-align: left;
Thanks for the bug report, there’s something wrong with this trailing space.
It may be related to #751.
Here’s the relevant part of the specification:
If white-space is set to pre-wrap, the UA must (unconditionally) hang this sequence, unless the sequence is followed by a forced line break, in which case it must conditionally hang the sequence instead. It may also visually collapse the character advance widths of any that would otherwise overflow.
Note that we currently don’t hang spaces (even with other values), but just trim them.
Implementing Level 4 should help, as it splits white-space into dedicated sub-properties.