danfickle / danfickle/openhtmltopdf

Paragraph algorithm breaks lines between tt element comma immediately after it

Open
#830 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.2k
Forks
423
PR merge metrics
No merged PRs in 30d

Description

I have a `tt` element immediately followed by a comma, with no space between them. The paragraph algorithm (justifying) places the comma on the next line. It should rather keep the comma on the same line.

The following HTML reproduces the problem.

```

@page {
size: A4;
margin: 2cm;
}

body {
font-family: sans-serif;
font-size: 10pt;
line-height: 1.25em;
}


This is a test to show that the paragraph algorithm breaks lines between the end of an inline block and, a comma immediately following said inline block.

```

Tested using the following code to convert the HTML to PDF.

```
try (OutputStream out = Files.newOutputStream(new File("/tmp/x.pdf").toPath())) {
PdfRendererBuilder prb = new PdfRendererBuilder();
prb.useFastMode();
prb.toStream(out);
prb.withFile(new File("/tmp/x.html"));
try (PdfBoxRenderer renderer = prb.buildPdfRenderer()) {
renderer.createPDF();
}
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.