# Use an *.otf font with fontspec

I an running Tex Live 2012 and would like to use the font Fira Sans in my documents. Unfortunately it is a relatively new font so not included in any of the packages for this version of Texlive.

However I have downloaded the .otf files and placed them in /home/gthomson/texmf/fonts/opentype/Fira and am trying to call them in xeLatex like this, following the fontspec docs:

\documentclass[12pt,twoside]{article}

\usepackage{fontspec}

\begin{document}

\setmainfont{FiraSans-Regular.otf}[
Path = /home/gthomson/texmf/fonts/opentype/Fira,
BoldFont = FiraSans-Bold.otf,
ItalicFont = FiraSans-Italic.otf,
BoldItalicFont  = FiraSans-BoldItalic.otf]

\section{EXAMPLE}

EXAMPLE EXAMPLE EXAMPLE EXAMPLE EXAMPLE\\
\textbf{EXAMPLE} \textbf{EXAMPLE} \textbf{EXAMPLE} \textbf{EXAMPLE} \textbf{EXAMPLE}\\
\textit{EXAMPLE} \textit{EXAMPLE} \textit{EXAMPLE} \textit{EXAMPLE} \textit{EXAMPLE}\\

\end{document}


This only works partially as while the font is loaded, only the regular version is, not the bold or italicised versions. This is despite the files being located in the same location. Furthermore the call for these fonts is printed out So what I get looks like this:

[ Path = /home/gthomson/texmf/fonts/opentype/Fira, BoldFont = FiraSans- Bold.otf, ItalicFont = FiraSans-Italic.otf, BoldItalicFont = FiraSans-BoldItalic.otf]

1 EXAMPLE

EXAMPLE EXAMPLE EXAMPLE EXAMPLE EXAMPLE

EXAMPLE EXAMPLE EXAMPLE EXAMPLE EXAMPLE

EXAMPLE EXAMPLE EXAMPLE EXAMPLE EXAMPLE

How can I get all versions of the font to load?

• It should be Path = /home/gthomson/texmf/fonts/opentype/Fira/ (note the trailing /). – karlkoeller Mar 19 '15 at 6:07
• @karlkoeller Thanks, but the original problem still stands. – G_T Mar 19 '15 at 6:21

Since you have TeX Live 2012, you probably have an old version of fontspec which does not support the new syntax for \setmainfont.

So, either

1. Update your TeX distribution (recommended)

or

1. Use the old syntax, that is

\setmainfont[
Path = /home/gthomson/texmf/fonts/opentype/Fira/,
BoldFont = FiraSans-Bold.otf,
ItalicFont = FiraSans-Italic.otf,
BoldItalicFont  = FiraSans-BoldItalic.otf]
{FiraSans-Regular.otf}


\setmainfont{FiraSans-Regular.otf}[
Path = /home/gthomson/texmf/fonts/opentype/Fira/,
BoldFont = FiraSans-Bold.otf,
ItalicFont = FiraSans-Italic.otf,
BoldItalicFont  = FiraSans-BoldItalic.otf]


Note, however, that the path should contain a trailing /.

Just FYI, the new syntax has been introduced with fontspec v2.4 (2014/06/01), so, if you have an older version, you have to use the old syntax.

• Thanks so much. I am using Elementary OS 'Luna', based off Ubuntu 12.04. I understand that getting the new version of TeX Live requires Ubuntu 14.04. Am I correct? – G_T Mar 19 '15 at 6:33
• @G_T You can install "Vanilla" TeX Live. See tex.stackexchange.com/q/1092/27635 – karlkoeller Mar 19 '15 at 6:53
• In case anyone wonders, I'd like to add that the newer versions of fontspec which have the new syntax still support the old syntax for backwards compatibility. (I still use the old syntax) – Sverre Mar 19 '15 at 11:50