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

Emoji vertically misaligned with text #2355

Closed
tagatac opened this issue Jan 21, 2025 · 1 comment · Fixed by #2358
Closed

Emoji vertically misaligned with text #2355

tagatac opened this issue Jan 21, 2025 · 1 comment · Fixed by #2358
Labels
bug Existing features not working as expected
Milestone

Comments

@tagatac
Copy link
Contributor

tagatac commented Jan 21, 2025

When I convert multi-line text containing emoji from HTML to PDF with WeasyPrint 63.1 on MacOS, the emoji are not aligned vertically with the surrounding text and often collide with characters from the line above. For example, converting

<!doctype html>
<html>
    <head>
        <title>iMessage</title>
        <meta charset="utf-8">

        <style>
            @page {
                margin: 50px;
                width: 900px;
            }
            body {
                font-size: 12pt;
                word-wrap: break-word;
            }
            img {
                max-width: 880px;
                max-height: 1010px;
            }
        </style>

    </head>
    <body>
        qypgqypgqypg<br/>
        qypg🙂qypg<br/>
    </body>
</html>

yields thanks.pdf.
Image

Is this user error? Is there any guidance on how to improve the alignment?

I've found that a slight modification to the png emoji case in draw_first_line gives better alignment: tagatac@c567ad2

@liZe
Copy link
Member

liZe commented Jan 21, 2025

Hi!

Thanks for the report. I don’t get exactly the same result as you, but you’re right: removing the shift seems to improve the rendering. This value has been set in the first commit enabling emoji support in WeasyPrint without Cairo, I guess it’s safe to remove.

Could you please open a pull request? 😄

@liZe liZe added the bug Existing features not working as expected label Jan 21, 2025
@liZe liZe added this to the 64.0 milestone Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Existing features not working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants