There is a line breaking/text overlapping problems in chemical content. Attached is the snap images of problems. How to prevent this issue in PDF? Please advice.
Forum › Bugs
Text overlapping/line breaking problem.
Are those long words using regular hyphen-minus, or some other character like en-dash?
For example, this seems to work as expected:
For example, this seems to work as expected:
<div style="width: 5cm; border: solid red thin; text-align: justify">
this is a test abcdef-abcdef-abcdef-abcdef-abcdef-abcdef-abcdef-abcdef-abcdef-abcdef-abcdef-abcdef-abcdef-
</div>
I have used "hyphens:auto" in paragraph style. This seems to work as expected, but some places I found the same problem.
CSS:
abstract p, p {hyphens:auto !important;prince-linebreak-magic:auto !important;}
CSS:
abstract p, p {hyphens:auto !important;prince-linebreak-magic:auto !important;}
Would you be able to email me (mikeday@yeslogic.com) some HTML and CSS that demonstrates the problem?
I can fix the overflow problem by this rather blunt solution:
This replaces the U+2010 HYPHEN characters with the regular hyphen-minus character followed by a zero-width space to allow line-breaking at that point.
It should guarantee no text overflow (assuming the words don't get longer than a column, which will require use of overflow-wrap: break-word) however it does result in some very unpleasant word gaps and awkward justification.
body {
prince-text-replace: '\2010' '-\200b'
}
This replaces the U+2010 HYPHEN characters with the regular hyphen-minus character followed by a zero-width space to allow line-breaking at that point.
It should guarantee no text overflow (assuming the words don't get longer than a column, which will require use of overflow-wrap: break-word) however it does result in some very unpleasant word gaps and awkward justification.
I have tried this solution, no text overflow in the output. But it result some word gaps and awkward justification. Is there any other way to resolve the word gaps.