[Tex/LaTex] How to use emoji package for lualatex with TeX Live 2019 (fontproblem)

fontsluatextexlive-2019

I want to use the emoji package from texlive luatex. I have TexLive 2019 under Ubuntu 20.04.

I utilized the following commands to install the package, which is not part of the ubuntu texlive distribution:

tlmgr init-usertree

tlmgr repository add ftp://tug.org/historic/systems/texlive/2019/tlnet-final
tlmgr repository list
tlmgr repository remove http://mirror.ctan.org/systems/texlive/tlnet
tlmgr option repository ftp://tug.org/historic/systems/texlive/2019/tlnet-final

tlmgr install emoji  --verify-repo=none

My minimal example:

\documentclass{article}
\usepackage{emoji}
\setemojifont{Noto Color Emoji}

\begin{document}

\emoji{grinning}

\end{document}

Trying to compile this with lualatex-dev results in no PDF-file but a warning and an error message:

This is LuaTeX, Version 1.10.0 (TeX Live 2019/Debian) 
 restricted system commands enabled.
(./emoji.tex
LaTeX2e <2020-02-02> patch level 2
 L3 programming layer <2020-02-14>
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/home/andreas/texmf/tex/lualatex/emoji/emoji.sty
(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.sty
(/usr/share/texlive/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def)))
(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.cfg)))) (./emoji.aux
) (/usr/share/texlive/texmf-dist/tex/latex/base/ts1cmr.fd)

Package emoji Warning: It seems that you have not declare an emoji font.
(emoji)                You should use "\setemojifont " to set a font.

[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./emoji.aux))
 406 words of node memory still in use:
   3 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 4 attribute, 48 glue_spec
, 4 attribute_list, 1 write nodes
   avail lists: 1:1,2:17,3:2,4:1,5:21,6:1,7:13,9:7
</usr/share/texmf/fonts/opentype/public/lm/lmroman10-regular.otf></usr/share/fo
nts/truetype/noto/NotoColorEmoji.ttf
! error:  (file /usr/share/fonts/truetype/noto/NotoColorEmoji.ttf) (ttf): loca 
table not found
!  ==> Fatal error occurred, no output PDF file produced!

I also tried \setemojifont{NotoColorEmoji.ttf}[Path=/usr/share/fonts/truetype/noto/] and \setemojifont{Emoji One} but I get an equivalent result.

The fonts are installed, and in the place indicated by the lualatex message. Lualatex works, and I can set different fonts using \setmainfont{}.

I looked at loca table not found and How to use Noto Color Emoji with lualatex? but neither concerns the emoji package and neither contains a working solution for my problem. The first is closed and the second does not contemplate the relevant error message loca table not found.

I can use the emoji package with Twitter Color Emoji and Segoe UI Emoji, but the result is black and white.

So, is there any way to get the emoji package to work with TexLive 2019, Ubuntu 20.04 and Noto Color Emoji or Emoji One?

Best Answer

To answer my own question: Ubuntu 20.04's TeX Live 2019 claims to provide luahbtex (in the description of the texlive-luatex package) but in fact it doesn't. To make matters worse it silently links lualatex-dev, which is supposed to run on luahbtex, to luatex.

One can use the following workaround:

  1. Download https://mirrors.rit.edu/CTAN/systems/texlive/tlnet/archive/luahbtex.x86_64-linux.tar.xz (or whatever corresponds to your architecture). You can use another mirror, of course.

  2. Put the luahbtex binary from this package into /usr/local/bin and in the same directory create lualatex-dev as a soft link to luahbtex.

  3. In /var/lib/texmf/fmtutil.cnf-TEXLIVEDIST change the line

    lualatex-dev luatex language.dat,language.dat.lua lualatex.ini

    to

    lualatex-dev luahbtex language.dat,language.dat.lua lualatex.ini.

    (That is, change the engine from luatex to luahbtex.)

  4. Run sudo fmtutil-sys --byfmt=lualatex-dev.

  5. Using lualatex-dev you can now compile any TeX file using the emoji package or otherwise relying on luahbtex without problem. (In case of emoji here's no need to use \setemojifont{} except you want to change the font the package chooses by itself.)

Related Question