7

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?

  • 1
    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
  • 1
    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
2

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
t not loadable: Metric (TFM) file or installed font not found.
<to be read again> 
                   relax 
l.3 \setmainfont{OptimaLTStd-Medium.otf}

? 

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
  • @PeterWilson actually that's what I'd expect (I think I will edit the wording in my answer) classically if the tfm font metrics are not available before giving the missing font error tex runs maketextfm to try to make some tfms from metafont sources, so running makexxx before getting the error is expected but of course the script fails completely when given a xetex font spec in square brackets. – David Carlisle Mar 13 '18 at 20:08
  • If you edit your answer to take into account the several comments and my answers then I'm pretty sure that I will accept it. – Peter Wilson Mar 15 '18 at 19:43

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.