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

Emojis are rasterized #1338

Closed
zellermario opened this issue Apr 16, 2021 · 2 comments
Closed

Emojis are rasterized #1338

zellermario opened this issue Apr 16, 2021 · 2 comments
Labels
bug Existing features not working as expected

Comments

@zellermario
Copy link

Hi.

When I generate PDF from HTML files that contain emojis, emojis are embedded as raster images in the output.
E.g. when I use an HTML file with the below text as input,

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
</head>
<body>
    <h1>Emojis are rasterized. 😞</h1>
</body>
</html>

I get the following PDF as output: out.pdf.

Before installing an emoji font, the emojis were, of course, not displayed in the output. But after installing Noto Color Emoji, they are displayed as shown in the example.

My output for weasyprint -i is the following:

System: Linux
Machine: x86_64
Version: #1 SMP Debian 4.19.171-2 (2021-01-30)
Release: 4.19.0-14-cloud-amd64

WeasyPrint version: 52.4
Python version: 3.7.3
Cairo version: 11600
Pango version: 14203
CairoSVG version: 2.5.2

Any ideas why this happens?

@liZe liZe added the bug Existing features not working as expected label Apr 21, 2021
@liZe
Copy link
Member

liZe commented Apr 21, 2021

Hello!

We rely on Cairo to generate the PDF file, and Cairo only supports emojis as PNG files included in font files. Vector emojis included in fonts (SVGinOT) are actually only supported by a very small amount of applications (mainly Firefox, Edge and Photoshop, see twemoji-color-font about that. As far as I know, Noto Color Emoji only contains raster emojis.

But you’re right, Cairo doesn’t do a very good job when generating PDF files with colored emojis. They’re probably downscaled for some reason, as if they were rendered on a low-density raster surface. I don’t know if there’s a way to fix that 😒.

The current master branch, that doesn’t rely on Cairo, doesn’t support colored emojis. When we’ll add the support of colored emojis back, we’ll try to 1) support vector emojis, and 2) use large raster images.

@liZe
Copy link
Member

liZe commented Jul 28, 2021

The problem is solved … now that colored emojis are not supported anymore :/.

Let’s continue the discussion in #1406.

@liZe liZe closed this as completed Jul 28, 2021
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

No branches or pull requests

2 participants