[Tex/LaTex] fontspec (xelatex) finding fonts by name, installed or in TEXMFHOME

fontsfontspecinstallingluatexxetex

This is related to my other question: fontspec search path in TEXMFHOME

I'm trying to write a package using a specific opentype font through fontspec.

Using TeXLive 2013 on a Debian computer (a fellow confirms the same behaviour for Mac OS X) I see the following behaviour:

  • Font installed as system font (in ~/.fonts):
    lualatex finds it by its font name and its file name
    xelatex finds it by its font name but not by its file name
  • Font installed in TEXMFHOME (~/texmf/fonts/opentype/FONT/):
    lualatex finds it by its font name and its file name
    xelatex finds it by its file name but not by its font name

Is it really true that xelatex (TeXLive on Linux/Mac at least) does find files only by font name when installed as system font and only by file name when installed in the texmf tree? Or am I missing something?

And if that's true could someone please tell me if it's the same on Windows/other TeX distros?

I'm interested in a most generic answer because I will have to tell the user (for arbitrary OS/distro combinations) where to copy (or link) the font folder after downloading the package.

Best Answer

Short answer, Yes.

When XeTeX is asked to load a font by its file name, it passes the name to kpathea library, so this works like any other TeX file path searching (e.g. \input’d files).

When it is asked to load a font by font name, it will use FontConfig on Linux and Windows, and Core Text font manager on Mac, so whatever fonts they can find, XeTeX will be able to use.