I'm an new user of Arch Linux and TeXLive 2021, I update all my packages from tlmgr just now on. When I tried to use xelatex to compile the tex file below

\setmainfont{Libertinus Serif}
    Here are some lines to read. 

I got the error of

xdvipdfmx:fatal: Invalid font: -1

I paste the whole log here: https://pastebin.ubuntu.com/p/FJzRCZJjC6/

When I first use xelatex -no-pdf main to get main.xdv, and use xdvipdfmx to compile my .xdv file, it output

$ xdvipdfmx -vv main.xdv
<FONTMAP:/usr/local/texlive/2021/texmf-var/fonts/map/pdftex/updmap/pdftex.map><FONTMAP:/usr/local/texlive/2021/texmf-var/fonts/map/dvipdfmx/updmap/kanjix.map><FONTMAP:/usr/local/texlive/2021/texmf-dist/fonts/map/dvipdfmx/ckx.map>DVI Comment:  XeTeX output 2021.09.01:2042
main.xdv -> main.pdf
fontmap: /usr/local/texlive/2021/texmf-dist/fonts/type1/public/libertinus-type1/LibertinusSerif-Regular.pfb/0/H/65536/0/0 -> /usr/local/texlive/2021/texmf-dist/fonts/type1/public/libertinus-type1/LibertinusSerif-Regular(Identity-H)
xdvipdfmx:fatal: Invalid font: -1 (0)

No output PDF file written.

How can I fix it?

I maybe know where the problem is. In TeXLive, there are two types of Libertinus, they are type1 and opentype. The packages are libertinus-type1 and libertinus-fonts

enter image description here

When I use \setmainfont{Libertinus Serif} to change font instead of \setmainfont{LibertinusSerif-Regular.otf}, xelatex will consider that I'm using the type1 version font, not .otf version. Then the problem occurs.

  • In order to produce an XDV file you need to call xelatex -no-pdf main. Alternatively, try xelatex -output-driver="xdvipdfmx -vv" main so to get more diagnostic messages.
    – egreg
    Sep 1, 2021 at 12:16
  • @egreg ok, I forgot to say in my question, I used xelatex -no-pdf main, and the -vv option's output I've post in the question
    – Syvshc
    Sep 1, 2021 at 12:44
  • I may know the reason of this problem. This will be supplemented to my question
    – Syvshc
    Sep 1, 2021 at 12:55
  • yes you sometimes need to exclude the type1 fonts from the search path. See e.g. tex.stackexchange.com/a/319946/2388 Sep 1, 2021 at 13:07


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.