26

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.

7
  • 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
    Commented Dec 27, 2012 at 13:48
  • Welcome to TeX.SX. Commented Dec 27, 2012 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
    Commented Dec 27, 2012 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/… Commented Jan 30, 2015 at 13:39
  • Is not a characters, but look this post: [Something between \frownie and \smiley][1]. [1]: tex.stackexchange.com/questions/58901/… Commented Jan 31, 2015 at 17:13

4 Answers 4

9

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.

2
  • 5
    For future readers: Emoji are now part of Unicode, support for them may land some day...
    – Demurgos
    Commented Oct 31, 2017 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. Commented Feb 20, 2019 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)?

1
8

There are a few packages now available:

7

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

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .