TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to use an OpenType font for a document, so I'm trying to compile it with xelatex. I followed the answers on this question:

How do I use an OpenType font with my LaTeX document?

However, when I try to compile it, it still gives me an error complaining it can't find the metrics file. But why does it need one? Can't I just use the .otf file without converting it?

share|improve this question
If you are getting something like Metric (TFM) file or installed font not found, this actually means that XeLaTeX/fontspec couldn't find the .otf (or .ttf) file. It also means that you are using an old version of fontspec, because the current version of has a much more helpful error message. – Caramdir Nov 3 '11 at 2:04
I renamed the otf file to OpenBaskerville, put it into the document working directory, and put exactly OpenBaskerville into the "setmainfont" command. Now I'm getting this error message: ! Undefined control sequence. \zf@set@font@type ...onttype \zf@basefont \zf@tfm \or \zf@atsuitrue \ifnum \... l.7 \setmainfont{OpenBaskerville} – Peterson Silva Nov 3 '11 at 2:07
If you are referring to the file name (and not the font name for installed fonts), you should add the extension, e.g. \setmainfont{OpenBaskerville.otf}. – Caramdir Nov 3 '11 at 2:08
Also it seems that old versions of XeLaTeX/fontspec don't find fonts in the document directory (at least the version that comes shipped with Ubuntu doesn't seem to be able to do that). So you might want to upgrade to a current TeX distribution version. – Caramdir Nov 3 '11 at 2:14

To answer the question why xelatex needs metrics: Every typesetting system needs them to decide where to put chars on the page, where to break a line, where to break a page. Without knowledge about width, height and depth of the chars (and some other information like kerning) typesetting it not possible.

The old engines like pdftex needed the metrics in external files (in tfms). This files had to be present at the start of the compilation. The new engines xetex and luatex are able to extract the metrics on-the-fly during the compilation from the original fonts. But naturally they must be able to find the font during compilation - and this can fail for various reasons (wrong font name, font cache not up-to-date, bugs, ...).

Without more exact informations from you (complete minimal example, exact wording of the error message, where is the font, log-file) it is difficult to say why it did fail for you.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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