[Tex/LaTex] Spaces in font names

greekxetex

I have an updated TeX Live distribution.

Following Fonts for PolyTonic Greek I copied the code exactly:

\documentclass{article}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
    
    
\newcommand\test[1]{%
  #1\\{\fontspec{#1}Βίβλος γενέσεως Ἰησοῦ Χριστοῦ υἱοῦ Δαυὶδ υἱοῦ Ἀβραάμ.}
  \par\medskip}
    
\setlength{\parindent}{0pt}
    
\begin{document}
    
\test{CMU Serif}
\test{EB Garamond}
\test{GFS Artemisia}
\test{GFS Baskerville}
\test{GFS Bodoni}
\test{GFS Complutum}
\test{GFS Didot}
\test{GFS Olga}
\test{GFS Porson}
\test{GFS Solomos}
\test{Junicode}
\test{Linux Libertine O}
\test{Old Standard}
\end{document}

into c.tex and then did xelatex c. This returned the following error:

/usr/local/texlive/2013/texmf-dist/tex/latex/tipa/t3cmr.fd)kpathsea:make_tex:
Invalid fontname `CMU Serif', contains ' '

fontspec error: "font-not-found" l.14 \test{CMU Serif}

Thus its first objection is to a space in a font name. How can that linked example work with a whole list of fonts with spaces in their names? And it also appears that no font whose name contains the strings "Serif" and "CMU" is part of TeX Live 2013:

find /usr/local/texlive -type f | egrep -i serif | egrep -i cmu

What am I missing?

Best Answer

The error is not really due to a space in the font name, but rather in the fact that the font “CMU Serif” is not available as a system font.

On a GNU/Linux box with TeX Live, the simplest way to make all fonts in TeX Live available to the system is to copy the pointers to the font directories to /etc/fonts/conf.d and do fc-cache:

sudo cp $(kpsewhich -var-value TEXMFSYSVAR)/fonts/conf/texlive-fontconfig.conf /etc/fonts/conf.d/09-texlive.conf
sudo fc-cache -fsv

Just tried on a GNU/Linux box and here's the output:

enter image description here

Related Question