5

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.

3
  • 1
    On linux it depends on their fontconfig configuration (which is not under the control of texlive). See tug.org/texlive/doc/texlive-en/texlive-en.html#x1-340003.4.4. On windows fontconfig is under control of the texsystem (TL and miktex) and normally "everything works". But be careful with xelatex: it doesn't like if if a font exists twice on a system. Sep 12, 2013 at 8:28
  • Does this mean: if I would follow these directions and make fontconfig also look into the TEXMFHOME folders I could also find a font by name that is located in TEXMFHOME? And would this also work the other way round, i.e. finding a system font by filename?
    – uli_1973
    Sep 13, 2013 at 9:14
  • I don't know, I don't have linux. I only know that fontconfig is used to find fonts. (But I'm not sure what xetex does exactly if you give a filename). Sep 13, 2013 at 9:27

1 Answer 1

6

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.

2
  • So, to make that clear to me: a font that is installed in ~/.fonts on Linux will be found by FontConfig but not by kpathsea. This is right? So if I want a font to be installed in the TEXMF tree (because it will be distributed through TeX distros) and to be found both by Xe- and Lua-LaTeX it has to be called by its filename because XeLaTeX wouldn't find it otherwise in the TEXMF tree. Right?
    – uli_1973
    Sep 13, 2013 at 14:18
  • 1
    Right (although you can configure FontConfig to look for fonts under TEXMF tree, but that is probably not suitable for use case). Sep 13, 2013 at 14:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .