-
Notifications
You must be signed in to change notification settings - Fork 369
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Avoid line break between html elements and text #39
Comments
@i4ntch1k - Sorry for leaving this for so long. I can confirm this is a bug. It shouldn't break at the boundaries of inline elements (unless there is a legitimate breaking opportunity). I'll investigate shortly. Thanks again. |
Hi, is there a workaround for this? |
Hi @MichelSlice Sorry, no fix. I thought it would be rare that someone wants to markup a partial word. Could you give a hint of your use case? |
Hi,
We're generating a document that has a sentence that looks like:
"Your new policy number is *AAA-123-014*, please keep this number with you"
Notice how the non-bold comma is right after the bold *AAA-123-014*?
The comma gets wrapped to the next line depending on how the text gets
positioned on the page.
The HTML looks something like the following, with the comma outside the
<strong/> element:
<div>Your new policy number is <strong>AAA-123-014</strong>, please keep
this number with you</div>
…On Tue, Feb 13, 2018 at 5:34 AM, danfickle ***@***.***> wrote:
Hi @MichelSlice <https://github.com/michelslice>
Sorry, no fix. I thought it would be rare that someone wants to markup a
partial word. Could you give a hint of your use case?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#39 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/Ag6ztg9S1Q1CyAx7AaAu4pbaA4YcI8JXks5tUWUwgaJpZM4KLG0E>
.
|
I can confirm it's still an issue on the latest version 0.0.13-RC. Our use case is for example:
Can also confirm it's because strong is inline. Without any inlines in the way the wrapping is correct. |
Hi @aRusenov The problem is that the applicable code is in a 300 line critical method with no tests! It's a bit of a mess. Have a look: openhtmltopdf/openhtmltopdf-core/src/main/java/com/openhtmltopdf/layout/InlineBoxing.java Line 61 in a3302ea
|
My workaround for commas and points after an inline element (strong, em..): place any problematic symbol inside the inline tag. Regexp |
* Add version 1.1.5 to 1.1.8 to README changelog and refer to commit log for newer releases Signed-off-by: XSpielinbox <55600187+xspielinbox@users.noreply.github.com> * Fix changelog according to corrected 1.1.4 tag Signed-off-by: XSpielinbox <55600187+xspielinbox@users.noreply.github.com> --------- Signed-off-by: XSpielinbox <55600187+xspielinbox@users.noreply.github.com>
Considering the following example:
Firefox, Safari, Chrome will never break between the texts in spans and the (immediate-)surrounding characters.
But, depending on the position of the text, openhtmltopdf may put a line break between:
This results in not properly formatted text.
The texts here in the spans should be considered as being on the same level as the surrounding text.
More generally, this should probably be the default behavior for any inline tags.
The text was updated successfully, but these errors were encountered: