Fonts & Character Setsfontspec cannot resolve font

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
Post Reply
daij52
Posts: 1
Joined: Mon Oct 25, 2021 1:13 pm

fontspec cannot resolve font

Post by daij52 »

Greetings. I am running texlive on my linux mint system. I also have a very old mac mini that is too slow for the typesetting job I am working on.

I have read the first part of the fontspec manual, where it describes how to set fonts using specific paths to otf files.

I (naively) copied a set of otf files from my mac mini to my linux system, and then attempted to set the main font using fontspec, identifying the upright, italic, and bold font files copied from the mac. But fontspec reports that it cannot resolve the font. I am using luatex as the main engine. Here is the latex code:

Code: Select all

 \documentclass{memoir}

\usepackage{fontspec}

\setmainfont{  IgnoreFontspecFile,
  UprightFont = /home/david/fonts/ACaslonPro-Regular.otf,
  BoldFont = /home/david/fonts/ACaslonPro-Bold.otf,
  ItalicFont = /home/david/fonts/ACaslonPro-Italic.otf,
  BoldItalicFont = /home/david/fonts/ACaslonPro-Bolditalic.otf
  }

\begin{document}
This is a test.
\end{document}
The log file is attached. (However, this is my first post in this forum, so I don't really understand the effect of "attaching" a file.)

Should this work?
Attachments
fontspec.log
(58.32 KiB) Downloaded 173 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
zauguin
Posts: 4
Joined: Thu Jan 24, 2019 9:50 pm

fontspec cannot resolve font

Post by zauguin »

Generally fontspec only expects a name for the font in it's main argument, ll other options are given in a separate optional argument. So all the things you wrote between `{}` need to go between `[]` and you additionally need to provide some name in `{}`. So e.g.

Code: Select all

\documentclass{memoir}

\usepackage{fontspec}

\setmainfont[IgnoreFontspecFile,
  UprightFont = /home/david/fonts/ACaslonPro-Regular.otf,
  BoldFont = /home/david/fonts/ACaslonPro-Bold.otf,
  ItalicFont = /home/david/fonts/ACaslonPro-Italic.otf,
  BoldItalicFont = /home/david/fonts/ACaslonPro-Bolditalic.otf
]{ACaslonPro}

\begin{document}
This is a test.
\end{document}
should work. (Untested, since I don't have the font) It's more common to pass the path and extension as separate options though:

Code: Select all

\documentclass{memoir}

\usepackage{fontspec}

\setmainfont[IgnoreFontspecFile,
  Path = /home/david/fonts/,
  Extension = .otf,
  UprightFont = *-Regular,
  BoldFont = *-Bold,
  ItalicFont = *-Italic,
  BoldItalicFont = *-Bolditalic
]{ACaslonPro}

\begin{document}
This is a test.
\end{document}
Post Reply