TransWikia.com

fontspec Error: The font "Libertinus Serif" cannot be found

TeX - LaTeX Asked by N. Hunt on August 14, 2020

I have a short tex file, to be compiled with xetex (eventually I will
be adding IPA, but since the following doesn’t work, I have omitted that):

documentclass{article}
usepackage{polyglossia}
setmainlanguage{english}
setotherlanguage[variant=ancient]{greek}
setmainfont{Libertinus Serif}

begin{document}

The Greek word textgreek{βάραθρον} means `gulf', `pit' or `cleft'.

end{document}

Result:

kpathsea:make_tex: Invalid filename `Libertinus Serif', contains ' '

! Package fontspec Error: The font "Libertinus Serif" cannot be found.

which is extremely curious since I have just installed texlive (2020). Not
the whole bundle, but certainly basic and extra packages, fonts and the
Greek language pack.

I have traced execution with ‘truss’ (Solaris) but I’m afraid I can’t
tell from that what is wrong.

find /opt/texlive -name ‘libert‘ give me 83 file names, so I’m pretty
sure the font is installed.

I would be grateful for some help with this.

Noel Hunt

Postscript: I did try the usepackage{libertinus} option but that didn’t work, but running the luaotfload-tool command told me that the font names database wasn’t found and it was created (kpsewhich LibertinusSerif-Regular.otf showed the file in the right place). After luaotfload-tool ran, xetex runs correctly. So, it was the otf fonts database being non-existent it seems. It is odd though, because as I said initially, it was fresh install of texlive. Many thanks to those who responded to my question.

One Answer

If your installation is configured correctly, you need to install the Libertinus fonts. They are in the MikTeX or TeX Live package libertinus-fonts, and might also be available in your operating system’s package manager.

You can also download and install the fonts from the repository, although then you won’t get automatic updates.

You can test whether the font is installed with the command kpsewhich LibertinusSerif-Regular.otf. You can also check whether it’s in a system directory with luaotfload-tool --find "Libertinus Serif". Depending on your OS, fc-match "Libertinus Serif" might also work.

If the font is there, but not being found, you might want to ensure that your TeX directories are being searched for fonts, then rebuild your font caches. For LuaTeX, the command is luaotfload-tool --update --force --prefer-texmf -v.

If the fonts are installed, but XeTeX is not finding them, you can try loading usepackage{libertinus}, or attempt to load the recommended way:

setmainfont{LibertinusSerif}[
   UprightFont = *-Regular,
   BoldFont = *-Bold,
   ItalicFont = *-Italic,
   BoldItalicFont = *-BoldItalic,
   Extension = .otf]

This searches by filename, which might still work even when looking up the family name does not.

Answered by Davislor on August 14, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP