Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kerning issue inside <span> tag under certain font style + sizes #1135

Open
darren-yang-clio opened this issue Nov 20, 2024 · 0 comments
Open

Comments

@darren-yang-clio
Copy link

Issue description

When pdf gets generated, under the certain condition (i.e. Font Style: Georgia, Times New Roman. Font size: 14), whitespace or &nbsp; "seemed" stripped out therefore there is no space in between.

HTML string that causes the problem

<p style="margin:0px;padding:0px;color:rgb(65, 65, 65);font-family:sans-serif;font-size:14px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:normal;background-color:rgb(255, 255, 255);">
    <span style="font-family:Georgia , serif;font-size:14px;">This document is signable and can have up&nbsp;</span>
    <span contenteditable="false" style="background-color:orange;font-family:Georgia , serif;font-size:14px;" class="fr-deletable">Something</span>
    <span style="font-family:Georgia , serif;font-size:14px;">&nbsp;to 1 contact signer</span>
</p>

It looks like below, there is no space between up and Something
image

However, if I change it to have &nbsp not in any type of tag, then it generates file as expected
...can have up&nbsp;</span><span.. => ...can have up</span>&nbsp;<span..

I know usually kerning problem can be solved through adjusting dpi and zoom. However the problem is it affects the visual appearances of pdf (i.e. shifting the layouts and etc), which is too critical for existing data.

Currently, it's configured dpi: 75, zoom: 1.28
I know current library's default (and industry standard) is dpi: 96 and zoom: 1. Changing the values to these don't help kerning issue. Starting from dpi value 100 resolves kerning issue but it affects the visual appearances too much.

AFAIK, I can reproduce this problem regardless of browsers and OS.

Expected or desired behavior

  • &nbsp in <span> tag not being "stripped-out" during pdf generation, therefore it can be displayed as a empty space

System specifications

wicked_pdf gem version (output of cat Gemfile.lock | grep wicked_pdf): wicked_pdf (2.8.1)

wkhtmltopdf version (output of wkhtmltopdf --version): wkhtmltopdf 0.12.6 (with patched qt)

whtmltopdf provider gem and version if one is used:

platform/distribution and version (e.g. Windows 10 / Ubuntu 16.04 / Heroku cedar): Mac Sonoma 14.4, Windows 11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant