[OS X TeX] Font issue with dvisvgm and lualatex

Alexander,J jalex at lse.ac.uk
Mon Jan 8 10:09:38 CET 2024


Hi all,

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.

Here’s a minimal file:

% figure.tex
\documentclass[dvisvgm]{article}
\usepackage{tikz}

\usepackage{fontspec} % comment out when using pdflatex
\setmainfont{Optima} % comment out when using pdflatex

\begin{document}
\pagestyle{empty}

\begin{tikzpicture}
  \draw[fill=black] (0,0) rectangle (2,2);
  \draw (0.93, 0) node[anchor=north, draw=white] {\bf Game (a)\strut};
\end{tikzpicture}

\newpage

\begin{tikzpicture}
  \draw[fill=blue] (0,0) rectangle (2,2);
  \draw (0.93, 0) node[anchor=north] {\em Game (b)\strut};
\end{tikzpicture}
\end{document}

Now process this using LuaLaTeX and dvisvgm as follows:

lualatex —output-format=dvi figure.tex
dvisvgm -n —page=1- figure.dvi

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.

However, if I comment out the relevant lines and process with pdflatex as follows:

pdflatex —output-format=dvi figure.tex
dvisvgm -n —page=1- figure.dvi

The fonts appear correctly.

Is this a bug in lualatex, or am I not using the ‘fontspec’ package correctly?  Any suggestions would be hugely appreciated!

Best wishes,

Jason

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/macostex-archives/attachments/20240108/25d1a8a2/attachment.htm>
-------------- next part --------------
----------- Please Consult the Following Before Posting -----------
TeX FAQ: https://www.tug.org/mactex/faq/index.html
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/TeX/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: https://www.tug.org/mactex/index.html
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex


More information about the macostex-archives mailing list.