4

I have an .otf font in same dir with .tex files. I'm using XeLaTex to work with this font, consider following code

 \documentclass[a4paper,12pt]{article}
 \usepackage[xetex]{graphicx}
 \usepackage{fontspec}
 \usepackage{xunicode}
 \usepackage{xltxtra}
 \usepackage[utf8]{inputenc}
 \usepackage[usenames,dvipsnames]{xcolor}
 \usepackage[T1]{fontenc}
 \usepackage{fullpage}
 \usepackage{csvtools}
 \usepackage{graphicx} 
  ...
  \begin{document}
   ...
     \begin{minipage}{84mm}
       \fontspec {Collator.otf}
       \sffamily 
       \centering
       \fontsize{32}{32} \textbf{\strut \insertName}
     \end{minipage}
   ...
   \end{document}

yields error

Font EU1/Collator.otf(0)/m/n/12=[Collator.otf]/ICU: at 12.0pt not loadable: Metric (TFM) file or installed font not found.

On \fontspec {Collator.otf} line, but it should find this font in project directory.

Is there any other options or I'm doing something wrong?

Speravir
  • 19,491
sigrlami
  • 143
  • 1
  • 5
  • 4
    There are many things wrong with this document: you should not load inputenc or fontenc using XeLaTeX. You shouldn't pass the driver to graphicx; the csvtools package is obsolete and replaced by the datatool package. The typical way to use a font with XeLaTeX is to simply install it with your other system fonts and XeLaTeX will find it automatically. Is there a reason you need the font in the local directory? – Alan Munn Apr 02 '13 at 02:02
  • @AlanMunn Yes, I want to use this font on other machines, where I have no administrative rights. – sigrlami Apr 02 '13 at 02:05

1 Answers1

6

There are many problems with your document. See the following question for some basics about using XeLaTeX.

It is possible to use local fonts with XeLaTeX but you have to specify the path explicitly. See the following question for details.

Instead of using \fontspec directly, you should always define a new font family to load a font.

Here's a fixed version of your document.

% !TEX TS-program = XeLaTeX

\documentclass[a4paper,12pt]{article}

\usepackage{fontspec}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{fullpage}
\usepackage{csvtools} 
% This is obsolete and has been replaced by datatool
\usepackage{graphicx} 
\newfontfamily\collfont[Path=./]{Collator.otf}
\begin{document}
    \begin{minipage}{84mm}
      \collfont
      \sffamily 
      \centering
      \fontsize{32}{32} \textbf{\strut INSERT NAME}
    \end{minipage}
  \end{document}

output of code

Alan Munn
  • 218,180