<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
<div>Hi all,</div>
<div><br>
</div>
<div>I’ve encountered a curious font problem with lualatex and dvisvgm, and I was wondering if people might have some ideas as to what may be going on. Basically, font selection commands in later pages actually affect the appearance of fonts on *earlier* pages.
I don’t know if this because I’m using the ‘fontspec’ package incorrectly, or if it’s possibly a lualatex issue.</div>
<div><br>
</div>
<div>Here’s a minimal file:</div>
<div><br>
</div>
<blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div>% figure.tex</div>
<div>\documentclass[dvisvgm]{article} </div>
<div>\usepackage{tikz}</div>
<div><br>
</div>
<div>\usepackage{fontspec} % comment out when using pdflatex </div>
<div>\setmainfont{Optima} % comment out when using pdflatex</div>
<div> </div>
<div>\begin{document}</div>
<div>\pagestyle{empty}</div>
<div><br>
</div>
<div>\begin{tikzpicture}</div>
<div> \draw[fill=black] (0,0) rectangle (2,2);</div>
<div> \draw (0.93, 0) node[anchor=north, draw=white] {\bf Game (a)\strut};</div>
<div>\end{tikzpicture}</div>
<div><br>
</div>
<div>\newpage</div>
<div><br>
</div>
<div>\begin{tikzpicture}</div>
<div> \draw[fill=blue] (0,0) rectangle (2,2);</div>
<div> \draw (0.93, 0) node[anchor=north] {\em Game (b)\strut};</div>
<div>\end{tikzpicture} </div>
<div>\end{document}</div>
</blockquote>
<br>
<div>Now process this using LuaLaTeX and dvisvgm as follows:</div>
<div><br>
</div>
<blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div>lualatex —output-format=dvi figure.tex</div>
<div>dvisvgm -n —page=1- figure.dvi</div>
</blockquote>
<br>
<div>If you inspect figure-1.svg and figure-2.svg in a viewer (e.g., Gapplin), you’ll notice that the \em font command in the second picture actually overrides the \bf font command in the first picture! Both labels appear in italics.</div>
<div><br>
</div>
<div>However, if I comment out the relevant lines and process with pdflatex as follows:</div>
<div><br>
</div>
<blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div>
<div>pdflatex —output-format=dvi figure.tex</div>
<div>dvisvgm -n —page=1- figure.dvi</div>
</div>
</blockquote>
<div><br>
</div>
<div>The fonts appear correctly.</div>
<div><br>
</div>
<div>Is this a bug in lualatex, or am I not using the ‘fontspec’ package correctly? Any suggestions would be hugely appreciated!</div>
<div><br>
</div>
<div>Best wishes,</div>
<div><br>
</div>
<div>Jason</div>
<div><br>
</div>
</body>
</html>