I have a web application that runs on apache tomcat. The user for the process is "www". The home directory of this user is "/nonexistent" and I do not want to change that. (It is set to a nonexistent directory so that nobody can login with this user, even if the server process is hacked somehow and somebody gains control over the user account.) This web serice uses xelatex to produce pdf reports from a database. Some of the pdf reports require special true type fonts. These fonts could be installed in ~/.fonts for any regular user. But this www user does not have a valid home directory, and it should not. The question is: can I specify the fonts directory to xelatex somehow? I'm already using TEXTINPUTS to specify search path for tex files, but I could not find anything similar for font files. So is there an environment variable or a command line option for this? If not, then what are my other options? I would like to keep the webapp specific true type fonts separated from the fonts of the base livetex distribution, for obvious reasons. Is it possible?

  • 1
    xetex uses fontconfig. The texlive documentation contains a section which explains how you can add fonts in the texmf-tree to the search path of xetex. You could perhaps adapt it to your situation. tug.org/texlive/doc/texlive-en/texlive-en.html#x1-340003.4.4 Commented Apr 10, 2016 at 12:12
  • Or you could simply add an additional fontconfig directory - it doesn't need to be in a TEXMF tree if that's inconvenient. Actually, maybe that's what @UlrikeFischer meant.
    – cfr
    Commented Apr 10, 2016 at 12:37
  • Sorry, that cannot be adapted to my situation. Section 3.4.4 tells: "if you want to make the TEX Live fonts available to only one user, you can do the following: Copy the texlive-fontconfig.conf file to ~/.fonts.conf, where ~ is your home directory.". If your read my question then it is clear that the home directory of the user is non-existent. It is not possible to use ~/.fonts.conf, because ~ does not exist.
    – nagylzs
    Commented Apr 10, 2016 at 13:07
  • How about \setmainfont[ExternalLocation={some_directory}]{some_file.ttf} ? It is not an environment, but the tex files are already generated by a program. I just read this here: tex.stackexchange.com/questions/169688/…
    – nagylzs
    Commented Apr 10, 2016 at 13:14
  • 1
    Put them in /usr/local/texlive/texmf-local/fonts/truetype
    – egreg
    Commented Apr 10, 2016 at 13:42

1 Answer 1


ExternalLocation does work indeed.


You must log in to answer this question.

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