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

Color emoji not rendered #2506

Open
smaznet opened this issue Dec 30, 2020 · 8 comments
Open

Color emoji not rendered #2506

smaznet opened this issue Dec 30, 2020 · 8 comments

Comments

@smaznet
Copy link

smaznet commented Dec 30, 2020

Are you using the latest version? Is the version currently in use as reported by npm ls sharp the same as the latest version as reported by npm view sharp dist-tags.latest?

Yes [email protected]

What are the steps to reproduce?
i tried this code to convert svg to text

<svg height="117" width="512">
 <rect x="0" y="0" width="512" height="117" stroke-width="3px" stroke="white" fill="black" rx="30"/>
 <text x="50%" y="50%" fill="white" font-size="5em" baseline-shift="-25%" lengthAdjust="spacing" textLength="90%" text-anchor="middle">😂</text>
</svg>

i tested it on w3schools.com it shows this
image

but using sharp i got this
image

and i installed noto-color-emoji

@smaznet smaznet added the triage label Dec 30, 2020
@lovell
Copy link
Owner

lovell commented Dec 30, 2020

Hi, this is probably due to an issue with rendering coloured fonts, most likely in cairo as there are a few possible candidates here - https://gitlab.freedesktop.org/cairo/cairo/-/issues?scope=all&utf8=%E2%9C%93&state=opened&search=emoji

@vsnthdev

This comment has been minimized.

@lovell
Copy link
Owner

lovell commented Aug 24, 2022

This is likely to be due to https://gitlab.freedesktop.org/cairo/cairo/-/issues/326

@PeterKohlichhaus
Copy link

I'm having the same issue and I haven't been able to solve it. I would like to use Twitter Color Emoji rather than noto though. Creating a font.conf with hinting enabled did nothing, and FC_DEBUG=1024 does say the file is being loaded. FC_DEBUG=1 shows a bunch of fonts from the

path, but all of them have hinting set to false.
pango-view doesn't seem to help either. while sharp can render emojis with outline (but no color), pango-view shows no emojis at all.

@penchochris
Copy link

penchochris commented Jul 17, 2023

Any solution to this @lovell ? I'm trying with Apple Color Emoji

@andre-luiz1997
Copy link

I am getting the same issue on sharp. I have tested with noto-color-emoji and with emoji-one on ubuntu 22, but without success.

I have already tried

This is likely to be due to https://gitlab.freedesktop.org/cairo/cairo/-/issues/326

@Runi-c
Copy link

Runi-c commented Jan 16, 2024

Same issue, in my case pango-view does render color emoji but sharp does not. Have spent multiple hours playing with fontconfig configs and debug vars, as well as different fonts.

The fact that I can get pango-view to render what I want perfectly but not sharp seems to suggest there's a possible bug in the way sharp or perhaps libvips is using pango, right? I don't understand how these components connect well enough to figure out how it's possible that only sharp isn't working...

Edit:
This command works: pango-view --backend=cairo --font=sans-serif -q -o test.png test.txt
But this code doesn't:

sharp({ text: { text: "...", font: "sans-serif", rgba: true } });

The emoji is rendered correctly with pango-view and uses the right font, but is not rendered at all with sharp.

@kleisauke
Copy link
Contributor

This is due to that librsvg renders all text as paths to workaround a Pango bug, see for details:
https://gnome.pages.gitlab.gnome.org/librsvg/devel-docs/text_layout.html#emoji-is-broken

So, this issue is currently blocked on https://gitlab.gnome.org/GNOME/librsvg/-/issues/911.

Note that the text operation can be used as an alternative, which should work with colored emoji glyphs after PR lovell/sharp-libvips#228 (sharp v0.33.5).

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

No branches or pull requests

8 participants