I'm using the fontspec package to load some fonts for xelatex. The way our /etc/fonts/local.conf cat file is set up, fontspec finds an old version of a particular font (DejaVu Sans Mono) in /usr/share/fonts/dejavu/, rather than the newer version in our TeXLive 2016 directory.
I can tell fontspec to find the DejaVu font in the right directory using the 'Path' argument, like:
Code: Select all
\setmonofont[Path=/foo/bar/2016/texmf-dist/fonts/truetype/public/dejavu/]{DejaVuSansMono.ttf}
If there were a macro that pointed to an installation's texmf-dist dir (as specified by the kpsewhich variable TEXMFDIST), then I could have a portable definition in my .tex (or .sty) file. Is there? Google may be my friend, but it hasn't told me the answer to this one...
I guess an alternative (kludge) would be to run kpsewhich and send its output to a file, and read the file. I could do that using the code here:
http://tex.stackexchange.com/questions/ ... tance-home
But xelatex refuses to allow \write18 unless you specify -shell-escape on the command line--for the very good reason that it's a security risk (if you compile someone else's malicious latex code).
And no, I can't edit the computer's /etc/fonts/local.conf file, because I'm not root.
So putting my question differently, is there a way to determine the value of TEXMFDIST from within xelatex without running \write18? Or is there another way to do what I want (find the correct DejaVu font file) from within xelatex? I don't want to rely on a command line argument to xelatex, or setting my personal .texcnf file, or anything like that--I want the solution to be self-contained in my .tex file.