24

I'm trying to display Emoji Characters inside my XeLaTeX Document. It seems to work for some glyphs like the numbers and pound sign but not for all. Here is a MWE:

\documentclass{scrartcl} 
\usepackage{fontspec}

\setmainfont{Apple Color Emoji} % The emoji Font 

\begin{document}
\char"0030{}  %Works
\char"1F60D{} % Doesent Work should out put SMILEY FACE WITH HEART SHAPED EYES
\end{document}

What is the reason for this strange behavior and is there a way to include Emojis in XeLaTeX?

Edit: selected emjoi

It seems the Character is there. It is selectable but not visible. I can copy&paste it.

  • How doesn't it work? Fails to compile? Wrong glyph? No glyph? Are there error messages in the .log file that would help us? – Seamus Dec 27 '12 at 13:48
  • Welcome to TeX.SX. – Claudio Fiandrino Dec 27 '12 at 13:56
  • @Seamus It does compile without any warnings beside the LaTeX warning: "xparse/redefine-command". It is just that the glyph is not there. The first one (an zero) is there but there is no smiley face. – lemen Dec 27 '12 at 13:59
  • To expand on Minustar's answer, if you find an appropriate graphic (vector glyph or otherwise), you can incorporate it as a macro that scales with fontsize using this answer: tex.stackexchange.com/questions/224357/… – Steven B. Segletes Jan 30 '15 at 13:39
  • Is not a characters, but look this post: [Something between \frownie and \smiley][1]. [1]: tex.stackexchange.com/questions/58901/… – Giacomo Alessandroni Jan 31 '15 at 17:13
8

Apple's emoji aren't encoded as normal characters do. They are in fact some PNG-like images embedded in some proprietary table in the AppleEmoji font. There is no reason to ever expect support of this Apple(tm) feature in XeLaTeX.

You might try to google if someone has found a way to export the smileys as separate images and import them in your document.

Or you might try an alternative based on other fonts that properly encode the characters as vector glyphs.

  • 3
    For future readers: Emoji are now part of Unicode, support for them may land some day... – Demurgos Oct 31 '17 at 10:52
  • @Demurgos indeed, \setmainfont{DejaVu Sans} can now render the \char"1F60D{} emoji ... although the visual rendition is different than Apple's emoji image. – l --marc l Feb 20 at 7:01
14

XeTeX can display black and white Emoji character just fine, provided that the font supports them.

Coloured Emojis however are much trickier, there weren’t any standard ways for fonts to include coloured glyphs prior to the standardisation of Emoji, so each company came with its own way; Apple (sbix table, embedded coloured bitmaps), Google (CBDT & CBLC, embedded coloured bitmaps), Microsoft (CPAL & COLR tables, scalable glyph layers) and Mozilla / Adobe (SVG table, embedded full SVG graphics in the fonts, together with animations!).

XeTeX (or rather its PDF driver, xdvipdfmx) does not know what to do with those glyphs and font tables, and it is not even clear yet what it should do: just keep the tables in the font when it embeds it in the PDF and let the PDF viewer handle the rendering, or interpret the table and extract the bitmaps and embed them directly in the PDF (in case of Apple and Google tables) / apply the glyph layer and their colours and embed them as individual colored glyphs (in case of Microsoft tables) / interpret the SVG and embed it as PDF graphic (in case of Mozilla / Adobe table, not even considering the animations)?

7

There are a few packages now available:

6

See this page Emoji in LaTeX documents, which may provide a way to work it out, and this answer: https://tex.stackexchange.com/a/59125/44227

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.