sharp icon indicating copy to clipboard operation
sharp copied to clipboard

Color emoji not rendered

Open smaznet opened this issue 4 years ago • 8 comments

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 avatar Dec 30 '20 12:12 smaznet

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

lovell avatar Dec 30 '20 14:12 lovell

Will this issue ever get fixed 🤔 the upstream issue has been open from 2 years now 🤷‍♂️

vsnthdev avatar Jul 19 '21 18:07 vsnthdev

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

lovell avatar Aug 24 '22 16:08 lovell

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.

PeterKohlichhaus avatar Jan 16 '23 13:01 PeterKohlichhaus

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

penchochris avatar Jul 17 '23 15:07 penchochris

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

andre-luiz1997 avatar Dec 15 '23 12:12 andre-luiz1997

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.

Runi-c avatar Jan 16 '24 23:01 Runi-c