# Fontspec says filename includes a [ but it doesn't

Using xelatex to process this:

\documentclass{memoir}
\usepackage{fontspec}
\setmainfont{OptimaLTStd-Medium.otf}
\begin{document}
Some text.
\end{document}


results in a reported error

kpathsea:make_tex: Invalid fontname [OptimaLTStd-Medium.otf]/OT', contains ['


I use the Ubuntu OS. I purchased the Linotype Optima fonts and put them in directory /usr/share/fonts/opentype/Linotype/Optima/OptimaLTStd-Medium.otf etc. (as recommended by Ubuntu). I ran fc-cache and then fc-list which reported all the Optima fonts I had installed.

The filenames of the fonts do not include any [ or ] so why the error message?

• does \setmainfont{OptimaLTStd-Medium} work? – David Carlisle Mar 12 '18 at 22:16
• I have only the regular weight, but its behavior suggests that \setmainfont{Optima LT Std Medium} would work. Can you try that? – Thérèse Mar 13 '18 at 0:58
• @DavidCarlisle \setmainfont{OptimaLTStd-Medium} works. I included the .otf extension following Example 1 in the fontspec manual. – Peter Wilson Mar 13 '18 at 19:46
• @Thérèse \setmainfont{Optima LT Std Medium} worked as did \setmainfont{Optim LT Std Medium Italic} for an italic style. – Peter Wilson Mar 13 '18 at 20:03
• it's a natter of practising the dark arts to see which one works. if I remember correctly if you do {OptimaLTStd-Medium} then xetx will ask fontconfig for a file with that internal font name, but if you use {OptimaLTStd-Medium.otf then xetex will ask kpathsea to do a tex filename search for a font file with that name, so I think in your case fc-list is working but not the tex kpathse setup – David Carlisle Mar 13 '18 at 20:04

I think it means that xetex didn't find the fonts then it's falling back on the classic tex make tfm scripts to try to make a font which then give a spurious error over the xetex font name convention.

I get the error about a bracket in the filename, but only after errors from fontspec saying it can not find the font (not surprising in my case as I don't have it)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "OptimaLTStd-Medium" cannot be found.
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................

l.3 \setmainfont{OptimaLTStd-Medium.otf}

?
kpathsea:make_tex: Invalid filename [OptimaLTStd-Medium.otf]/OT', contains '['
! Font TU/OptimaLTStd-Medium.otf(0)/m/n/10=[OptimaLTStd-Medium.otf]/OT at 10.0p

If you get the kpathsea:make_tex: Invalid filename \[OptimaLTStd-Medium.otf]/OT', contains '[' without the !!!!!!!!! error first from fontspec then it's a different issue and I'll probably delete this.
• The error message comes from kpathsea:make_tex before fontspec says it can't find the file. Note that the two comments to my question both solved my problem, though in different ways. Any chance that someone will produce a fontspec` guide for simple minded folk (apologies to Will Robertson)? – Peter Wilson Mar 13 '18 at 20:04