[Tex/LaTex] XeTeX and Fedora: can’t use OTF fonts

fontsfontspecxetex

When trying to compile a document with XeLaTeX, I'm getting the following error:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
! 
! The font "Linux Libertine Slanted O" cannot be found.
! 
! See the fontspec documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  

Now, I've got the font files installed, /usr/share/texlive/texmf-dist/fonts/opentype/public/libertineotf contains the font files that I need.

Fontconfig doesn't see those files, however. I tried adding the directory with fc-cache and it reports having added 30 new fonts, but I still can't see them when running fc-list.

Now it all kinda works well on Linux Mint, I'm on Fedora now, and it somehow doesn't work anymore.

What am I doing wrong?

I'm using Fedora 18, with everything latex related installed from the official repos.
This is XeTeX, Version 3.1415926-2.5-0.9999 (TeX Live 2013/dev) is what xelatex reports. Fontconfig is the one installed that came with Fedora 18.

Best Answer

In section 4.2 (p6) of the fontspec manual, it says:

4.6 By file name

XETEX and LuaTEX also allow fonts to be loaded by file name instead of font name. When you have a very large collection of fonts, you will sometimes not wish to have them all installed in your system’s font directories. In this case, it is more convenient to load them from a different location on your disk. This technique is also necessary in XETEX when loading OpenType fonts that are present within your TEX distribution, such as /usr/local/texlive/2010/texmf-dist/fonts/opentype/ public. Fonts in such locations are visible to XETEX but cannot be loaded by font name, only file name; LuaTEX does not have this restriction.

This means that you cannot simply use

\setmainfont{Linux Libertine O}

with XeLaTeX unless the file is seen by your system.

In order to use TeX distribution fonts with XeLaTeX, you need to load them by hand which gets very tedious.

Your best alternative is to use the libertine TeX package (\usepackage{libertine}).