Discussion:
[XeTeX] Insert Smileys in XeLaTeX
Marek Stepanek
2014-12-16 11:24:42 UTC
Permalink
Hello all!


It's quite a while, that I am reading this newsgroup. But I was always
using LaTeX. Now I am close to switch to XeLaTeX or even XeTeX.

I want to offer for Christmas a large dialogue with SMS put into a
LaTeX-file. And it turns out to be a huge problem, because one day my
girl-friend discovered the icons and smileys on her iPhone ... You
imagine the disaster :-)

My first step was going to wikipedia: http://en.wikipedia.org/wiki/XeTeX

I put together a test file, based on the first example. I replaced the
"Linux Libertine O", which is not installed on my computer, with Lucida
Grande. This font is displaying these smileys well in my text editor
BBEdit and my Terminal too (with an other font: Menlo Regular), but not
in the compiled XeLaTeX-file.

Here my example:

- And thank you for your help - it is urgent - for obvious reasons :-)


marek


***

\documentclass[11pt]{article}
\usepackage{fontspec}
% from an other example to test the smiley:
%\usepackage{txfonts}
% not installed:
% \setmainfont[Ligatures=TeX]{Linux Libertine O}
% and here are some Problems:
% \setmainfont[Ligatures=TeX]{Menlo Regular}
\setmainfont[Ligatures=TeX]{Lucida Grande}
\begin{document}
\section{Unicode support}

\subsection{English}
All human beings are born free and equal in dignity and rights.

\subsection{Íslenska}
Hver maður er borinn frjáls og jafn öðrum að virðingu og réttindum.

\subsection{Русский}
Все люди рождаются свободными и равными в своем достоинстве и
правах.

\subsection{Tiếng Việt}
Tất cả mọi người sinh ra đều được tự do và bình đẳng về nhân phẩm và
quyền lợi.

\subsection{Ελληνικά}
Ὅλοι οἱ ἄνθρωποι γεννιοῦνται ἐλεύθεροι καὶ ἴσοι στὴν ἀξιοπρέπεια
καὶ τὰ δικαιώματα.

\section{Legacy syntax}
When he goes---``Hello World!''\\
She replies—“Hello dear!”

% \section{Ligatures}
% \fontspec[Ligatures={Common, Historical}]{Lucida Grande Bold}
% Questo è strano assai!

% \section{Numerals}
% \fontspec[Numbers={OldStyle}]{Lucida Grande}Old style: 1234567\\
% \fontspec[Numbers={Lining}]{Lucida Grande}Lining: 1234567

\section{Smileys}
😘 - 👃 - 💓💛💞💗💕💓 - 🐒 - 🚨🚁 - 🏁 - 😇 - 👷👃🐻 - 🍇🍞🍗🍴💊 ...

\end{document}


--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
Simon Cozens
2014-12-16 12:32:14 UTC
Permalink
Post by Marek Stepanek
I put together a test file, based on the first example. I replaced the
"Linux Libertine O", which is not installed on my computer, with Lucida
Grande. This font is displaying these smileys well in my text editor
BBEdit and my Terminal too (with an other font: Menlo Regular), but not
in the compiled XeLaTeX-file.
The problem is that in your terminal and BBEdit, the system is
performing font substitution; neither Menlo nor Lucida Grande contain
the emoji characters, so the system shows you the characters in a
different font. (Probably Apple Color Emoji)

For some reason I can't get xelatex to use Apple Color Emoji, but the
Symbola font (available from http://users.teilar.gr/~g1951d/Symbola.zip
Post by Marek Stepanek
\section{Smileys}
\fontspec[Symbola]
Post by Marek Stepanek
😘 - 👃 - 💓💛💞💗💕💓 - 🐒 - 🚨🚁 - 🏁 - 😇 - 👷👃🐻 - 🍇🍞🍗🍴💊 ...
and it should all work.


--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mailman/li
Khaled Hosny
2014-12-16 16:40:52 UTC
Permalink
Post by Simon Cozens
Post by Marek Stepanek
I put together a test file, based on the first example. I replaced the
"Linux Libertine O", which is not installed on my computer, with Lucida
Grande. This font is displaying these smileys well in my text editor
BBEdit and my Terminal too (with an other font: Menlo Regular), but not
in the compiled XeLaTeX-file.
The problem is that in your terminal and BBEdit, the system is
performing font substitution; neither Menlo nor Lucida Grande contain
the emoji characters, so the system shows you the characters in a
different font. (Probably Apple Color Emoji)
For some reason I can't get xelatex to use Apple Color Emoji, but the
Symbola font (available from http://users.teilar.gr/~g1951d/Symbola.zip
Apple Color Emoji uses the new “sbix” table for colored Emojis, which
basically embeds colored bitmaps in the font file, but xdvipdfmx does
not support that table. I’m not sure what is the proper way to
handle this; should it just keep the table in the font when embedding
it in the PDF (so it will work only in PDF viewers that support it) or
extract the bitmaps and insert them directly in the PDF? Either way
means xdvipdfmx needs to understand the table (either to subset it or to
extract the bitmaps).

Regards,
Khaled


--------------------------------------------------
Subscriptions, Archive, and List info
Zdenek Wagner
2014-12-16 12:33:15 UTC
Permalink
Post by Marek Stepanek
Hello all!
It's quite a while, that I am reading this newsgroup. But I was always
using LaTeX. Now I am close to switch to XeLaTeX or even XeTeX.
I want to offer for Christmas a large dialogue with SMS put into a
LaTeX-file. And it turns out to be a huge problem, because one day my
girl-friend discovered the icons and smileys on her iPhone ... You
imagine the disaster :-)
My first step was going to wikipedia: http://en.wikipedia.org/wiki/XeTeX
I put together a test file, based on the first example. I replaced the
"Linux Libertine O", which is not installed on my computer, with Lucida
Grande. This font is displaying these smileys well in my text editor
BBEdit and my Terminal too (with an other font: Menlo Regular), but not
in the compiled XeLaTeX-file.
I do not see all your smileys on my computer which means that I do not
have a proper font installed. What you should do first is to make sure
that Lucida Grande really contains the characters. Visibility in a
text editor is not a good proof. Font rendering engines usually work
in such a way that if a character is not present in the current font,
they render it using a replacement font. The idea is that a reasonable
character in a reasonable font must always be displayed. However,
Xe(La)TeX does not do that. If a character is missing, it is treated
as a missing character exactly as in the original 8-bit TeX. You
should display the character map by some application and verify
existence. You can use fontforge. If you use gucharmap, you have to
right-click to the character in order to find which font was used for
rendering it.

Hope this hepls.

Zdeněk Wagner
http://hroch486.icpf.cas.cz/wagner/
http://icebearsoft.euweb.cz
Post by Marek Stepanek
- And thank you for your help - it is urgent - for obvious reasons :-)
marek
***
\documentclass[11pt]{article}
\usepackage{fontspec}
%\usepackage{txfonts}
% \setmainfont[Ligatures=TeX]{Linux Libertine O}
% \setmainfont[Ligatures=TeX]{Menlo Regular}
\setmainfont[Ligatures=TeX]{Lucida Grande}
\begin{document}
\section{Unicode support}
\subsection{English}
All human beings are born free and equal in dignity and rights.
\subsection{Íslenska}
Hver maður er borinn frjáls og jafn öðrum að virðingu og réttindum.
\subsection{Русский}
Все люди рождаются свободными и равными в своем достоинстве и
правах.
\subsection{Tiếng Việt}
Tất cả mọi người sinh ra đều được tự do và bình đẳng về nhân phẩm và
quyền lợi.
\subsection{Ελληνικά}
Ὅλοι οἱ ἄνθρωποι γεννιοῦνται ἐλεύθεροι καὶ ἴσοι στὴν ἀξιοπρέπεια
καὶ τὰ δικαιώματα.
\section{Legacy syntax}
When he goes---``Hello World!''\\
She replies—“Hello dear!”
% \section{Ligatures}
% \fontspec[Ligatures={Common, Historical}]{Lucida Grande Bold}
% Questo è strano assai!
% \section{Numerals}
% \fontspec[Numbers={OldStyle}]{Lucida Grande}Old style: 1234567\\
% \fontspec[Numbers={Lining}]{Lucida Grande}Lining: 1234567
\section{Smileys}
😘 - 👃 - 💓💛💞💗💕💓 - 🐒 - 🚨🚁 - 🏁 - 😇 - 👷👃🐻 - 🍇🍞🍗🍴💊 ...
\end{document}
--------------------------------------------------
http://tug.org/mailman/listinfo/xetex
--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mailman/l
Marek Stepanek
2014-12-16 16:04:41 UTC
Permalink
Thank you Zdeněk Wagner and Simon Cozens for your immediate help. Very
interesting suggestions you made. I never cared much about font
questions before. I even did not know, where to look for them on my Mac ...

Yes. It is the font Apple Color Emoji. But all tricks (but I dont know
many) to make it render with this font and xelatex were not working.
Also the suggested Symbola-font is not doing it.

Is there an easy way, to map the codepoints with little icons? For
example: UTF8 F0 9F 98 98 (U+1F618 (U+D83D U+DE18)) goes with this icon
etc ...

Thank you again


marek
Post by Zdenek Wagner
I do not see all your smileys on my computer which means that I do not
have a proper font installed. What you should do first is to make sure
that Lucida Grande really contains the characters. Visibility in a
text editor is not a good proof. Font rendering engines usually work
in such a way that if a character is not present in the current font,
they render it using a replacement font. The idea is that a reasonable
character in a reasonable font must always be displayed. However,
Xe(La)TeX does not do that. If a character is missing, it is treated
as a missing character exactly as in the original 8-bit TeX. You
should display the character map by some application and verify
existence. You can use fontforge. If you use gucharmap, you have to
right-click to the character in order to find which font was used for
rendering it.
Hope this hepls.
Zdeněk Wagner
http://hroch486.icpf.cas.cz/wagner/
http://icebearsoft.euweb.cz
--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http
Zdenek Wagner
2014-12-16 16:34:24 UTC
Permalink
Thank you Zdeněk Wagner and Simon Cozens for your immediate help. Very
interesting suggestions you made. I never cared much about font
questions before. I even did not know, where to look for them on my Mac ...
Yes. It is the font Apple Color Emoji. But all tricks (but I dont know
many) to make it render with this font and xelatex were not working.
Also the suggested Symbola-font is not doing it.
Is there an easy way, to map the codepoints with little icons? For
example: UTF8 F0 9F 98 98 (U+1F618 (U+D83D U+DE18)) goes with this icon
etc ...
There must be something wrong in your computer. I have installed
Symbola in my Fedora Linux and now I see all symbols even in your
mail. Are you sure that the font is properly installed? Do you have
eny error message?

I do not know Mac, I only know how to ask fontconfig in Linux whether
the font can be located. It returns quite a lot of information but the
very beginning is important:

$ fc-match -v Symbola
Pattern has 32 elts (size 48)
family: "Symbola"(s)
familylang: "en"(s)
style: "Regular"(s)
stylelang: "en"(s)
fullname: "Symbola"(s)

The only change I made in your file is as follows:
\setmainfont[Ligatures=TeX]{Symbola}

The font does not contain characters for all languages, e. g.
Vietnamies, otherwise the document compiles without errors, see the
attached PDF. This means that you should use other font for texts.
Automatic switching may be achieved by the ucharclasses package.

Zdeněk Wagner
http://hroch486.icpf.cas.cz/wagner/
http://icebearsoft.euweb.cz
Thank you again
marek
Post by Zdenek Wagner
I do not see all your smileys on my computer which means that I do not
have a proper font installed. What you should do first is to make sure
that Lucida Grande really contains the characters. Visibility in a
text editor is not a good proof. Font rendering engines usually work
in such a way that if a character is not present in the current font,
they render it using a replacement font. The idea is that a reasonable
character in a reasonable font must always be displayed. However,
Xe(La)TeX does not do that. If a character is missing, it is treated
as a missing character exactly as in the original 8-bit TeX. You
should display the character map by some application and verify
existence. You can use fontforge. If you use gucharmap, you have to
right-click to the character in order to find which font was used for
rendering it.
Hope this hepls.
Zdeněk Wagner
http://hroch486.icpf.cas.cz/wagner/
http://icebearsoft.euweb.cz
--------------------------------------------------
http://tug.org/mailman/listinfo/xetex
Álvar Ibeas
2014-12-16 16:19:26 UTC
Permalink
Post by Marek Stepanek
Also the suggested Symbola-font is not doing it.
Hello,

The font Symbola includes the charactes of your file. If you haven't
already done this, you can try:

\fontspec{Symbola}

instead of

\fontspec[Symbola]



--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mailman/listinfo/xetex

Loading...