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 support #1484

Closed
0kzh opened this issue Nov 3, 2021 · 4 comments
Closed

Emoji support #1484

0kzh opened this issue Nov 3, 2021 · 4 comments

Comments

@0kzh
Copy link

0kzh commented Nov 3, 2021

Are there any options I can specify to get emojis to render properly? Example:

Input

<body>
  🥺
</body>

Output

🥺 

Details

  • WeasyPrint 53.3, also tried with 52.2
  • Python 3.7
  • MacOS Big Sur 11.6
@liZe
Copy link
Member

liZe commented Nov 3, 2021

Hello!

You have to set an encoding supporting emojis, with weasyprint -e utf-8 input.html output.pdf, or adding <meta charset="utf-8"> into your HTML header (assuming that your file is in utf-8).

Side note: colored emojis are not supported in the current stable version (v53.x), but they are in the previous versions and will be in the next versions (see #1406).

@liZe liZe closed this as completed Nov 3, 2021
@0kzh
Copy link
Author

0kzh commented Nov 3, 2021

Hey! I just tried that but the result is a question mark block:

Screen Shot 2021-11-03 at 1 13 38 PM

However, when I copy it + paste it elsewhere, the emoji renders correctly.
Any ideas why this might be happening?

@liZe
Copy link
Member

liZe commented Nov 3, 2021

Any ideas why this might be happening?

You don’t have any font installed with black and white emojis. This character probably comes from a default font that replaces unknown characters with question marks.

Try WeasyPrint 52 or the current master branch, and you should get images if you have a font installed with colored emojis.

@jmhammond
Copy link

Thanks @liZe! I run grade reports for my students and have some silly emojis in there that didn't appear now. In case anyone else just needs a quick-and-dirty fix, I downgraded weasyprint via:

pip3 install 'weasyprint<53.0' --force-reinstall

and the reports generated like old times. It's probably not elegant, but I just needed it to work this afternoon 😄

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

3 participants