mgieseki / dvisvgm

A fast DVI, EPS, and PDF to SVG converter
https://dvisvgm.de
GNU General Public License v3.0
294 stars 28 forks source link

Support emoji fonts #162

Open stone-zeng opened 2 years ago

stone-zeng commented 2 years ago
\documentclass{standalone}
\usepackage{emoji}
\begin{document}
\emoji{grinning-face}
\end{document}

Using dvilualatex + dvisvgm, we get the following SVG output:

<?xml version='1.0' encoding='UTF-8'?>
<!-- This file was generated by dvisvgm 2.11.1 -->
<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='9.164pt' height='6.833pt' viewBox='-72.000004 -68.870364 9.164 6.833'>
<style type='text/css'>
<![CDATA[text.f0 {font-family:AppleColorEmoji:mode=harf;language=dflt;;font-size:10px}
]]>
</style>
<g id='page1'>
<text class='f0' x='-72.000004' y='-62.037364'>😀</text>
</g>
</svg>

It gives some warning as well:

processing of PostScript specials is disabled (Ghostscript not found)
pre-processing DVI file (format version 2)
WARNING: font file 'AppleColorEmoji:mode=harf;language=dflt;.mf' not found
processing page 1
  WARNING: 1 PostScript special ignored. The resulting SVG might look wrong.
  graphic size: 9.198365pt x 6.858624pt (3.232856mm x 2.410531mm)
  WARNING: can't embed font 'AppleColorEmoji:mode=harf;language=dflt;'
  output written to 1.svg
1 of 1 page converted in 0.422046 seconds

Especially we can see that the emoji font (AppleColorEmoji) is not embedded.

For more information, the dviasm to get the following output:

[preamble]
id: 2
numerator: 25400000
denominator: 473628672
magnification: 1000
comment: ' LuaTeX output 2021.11.11:1517'

[postamble]
maxv: 0pt
maxh: 272.729996pt
maxs: 5
pages: 1

[font definitions]
fntdef: AppleColorEmoji:mode=harf;language=dflt; at 10pt

[page 1 0 0 0 0 0 0 0 0 0]
push:
  right: -72.270004pt
  down: -72.270004pt
  xxx: 'header=l3backend-dvips.pro'
pop:
push:
  push:
    push:
      push:
        push:
          right: -72.270004pt
          down: -62.270004pt
          fnt: AppleColorEmoji:mode=harf;language=dflt; at 10pt
          set: '😀'
        pop:
      pop:
    pop:
  pop:
pop:
mgieseki commented 2 years ago

This issue must be fixed in LuaTeX because the format of the font definition fnt: AppleColorEmoji:mode=harf;language=dflt; at 10pt is not supported by dvisvgm. Unfortunately, I can't be of much help here.

Ivorforce commented 1 year ago

I ran across this issue as well, generating an SVG file with the same warnings. Should an issue be opened at LuaTex?

mgieseki commented 1 year ago

Yes, that's an issue that should be addressed by the LuaTeX team. I can't do much from my side here.