2

I am very inexperienced with LaTeX. I have a tex file that has worked for a long time, then stopped without any changes to the file.

We purchased NeueHaasGrotDisp font. I have the fonts in OTF format.

I am getting the following error:

(C:\myPath\Program\Binaries\miktex\tex\xelatex\fontspec\fontspec.cfg))Running miktex-makemf.exe...
miktex-makemf: The NeueHaasGrotDisp-55Roman source file could not be found.

Running hbf2gf.exe...
hbf2gf (CJK ver. 4.8.3)

Couldn't find `NeueHaasGrotDisp-55Rom.cfg'

miktex-maketfm: No creation rule for font NeueHaasGrotDisp-55Roman.

! Font \zf@basefont=NeueHaasGrotDisp-55Roman at 10.0pt not loadable: Metric(TFM) file or installed font not found.
\zf@fontspec ...ntname \zf@suffix " at \f@size pt 
                                              \unless \ifzf@icu \zf@set@...
l.151 {NeueHaasGrotDisp}

My code:

...
\usepackage{fontspec}

...
%Regular Font
\newfontfamily\nhg [
  Path = {/Program Files (x86)/program/fonts/},
  BoldFont = *-75Bold,
  UprightFont = *-55Roman,
  ItalicFont = *-36ThinItalic,
  Extension = .otf
]

{NeueHaasGrotDisp}
%Light Font
\newfontfamily\nhgl [
  Path = {/Program Files (x86)/program/fonts/}, 
  BoldFont = *-75Bold,
  UprightFont = *-45Light,
  Extension = .otf
]
{NeueHaasGrotDisp}

At /Program Files (x86)/program/fonts/ I have the following files:

  • NeueHaasGrotDisp-36ThinItalic.otf
  • NeueHaasGrotDisp-45Light.otf
  • NeueHaasGrotDisp-55Roman.otf
  • NeueHaasGrotDisp-75Bold.otf

Would this happen if our font license expired? Is this checked when the font is loaded?

  • Are you missing Extension = .otf or similar? – Will Robertson May 12 '15 at 0:26
  • my .tex file doesn't have that code anywhere. Where would I put that? – ajon May 12 '15 at 0:29
  • As one of the keys to \newfontfamily. – cfr May 12 '15 at 0:34
  • I updated my code by including the Extension = .otf as a key to newfontfamily and I got all the same errors. – ajon May 12 '15 at 0:39
  • 2
    Does windows allow paths with that format? I would have assumed you'd need to have Path={C:/Program Files/program/fonts/}. Also, it looks like you're using an extremely old version of fontspec. I recommend updating to the latest version of MiKTeX if possible. – Will Robertson May 13 '15 at 0:10
2

Your path needs to be surrounded by braces {}. I also separate the ending comma-delimiters with a space.

Here is how I would do it.

I used:

  1. Folder called Fonts inside of base directory (where your font files are located)
  2. MinionPro*.otf (grabs all variants, assuming your file name scheme is fontname-type.otf where -type represents: -Bold, -Italic, -Regular, etc.)

(I have an extra file for semibold that I did not load with fontspec. I usually overcome this limitation by creating another font family or by replacing the bold font depending on the situation.)

Code

\documentclass{article}
\usepackage{fontspec}

\newfontfamily\yourcustomnameforthisfont[%
    Path = {Fonts/} ,
    Extension = .otf ,
    UprightFont = *-Regular ,
    ItalicFont = *-It ,
    BoldFont = *-Bold ,
    BoldItalicFont = *-BoldIt
    ]{MinionPro}
\usepackage{lipsum}
\begin{document}
{\yourcustomnameforthisfont\lipsum}
\end{document}

Output

(Note that I am missing the lipsum package in the screenshot and the \yourcustomnameforthisfont. The screenshot is to show the relationship between the \newfontfamily code and the files.) enter image description here

  • I made those changes and the result is the same. Also note that I have the OTF files outside of Miktex. They are just in a random place on the computer (but my path is right). that shouldn't be a factor right? I also read something about a cache. Might the font be missing from the cache? – ajon May 12 '15 at 8:03
0

As @Will_Robertson pointed out, I had an old version of fontspec installed. I actually had multiple versions of fontspec installed in different folders in miktex. Miktex was finding the older version and using it. Once I deleted the old version, it started working.

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.