5

I read from the official manual (http://wiki.contextgarden.net/Fonts_in_LuaTex#How_LuaTeX_handles_system_fonts) that I need to export OSFONTDIR="/usr/local/share/fonts;$HOME/.fonts" to specify where the fonts should be looked for. However, it will only search fonts and .fonts. If I have fonts in the sub directories of these two, they won't be discovered. I find it inconvenient.

Is it possible to make it search the subfolders?

  • Welcome to TeX-sx. Font searching by LuaTeX in this regard is format-neutral: the search path is an engine thing. I've altered the tags to reflect that. – Joseph Wright Oct 30 '14 at 7:30
5

Like other TeX-related environmental variables, controlling OSFONTDIR requires understanding how variables are expanded by kpathsea. The key is to know that // (two consecutive / chars) is treated as a 'recursive' marker. Thus what you want is

export OSFONTDIR="/usr/local/share/fonts//;$HOME/.fonts//"

Before you alter this value, I'd be tempted to check the current setting with

kpsewhich --var-value=OSFONTDIR

as it may already be correct.

  • I'm currently using my Windows system (TL2014) which reports C:/Windows/fonts// from kpsewhich --var-value=OSFONTDIR, which would be 'right', so I'd be cautious and check the value before making any changes. – Joseph Wright Oct 30 '14 at 8:37
  • 1
    Note that ConTeXt separates kpsewhich variables for MkII (which are defined in texmf.cnf) from those for MkIV (which are defined in texmfcnf.lua). To search for the variables in texmfcnf.lua, you need to use: mtxrun --expand-var OSFONTDIR. – Aditya Nov 3 '14 at 18:57
1

run

luaotfload-tool -fuvvv --log=stdout

and it shows you where fonts are searched

0

I'm not sure how or if you can do this in your TeX system, so this is just a partial answer. You can do something like (the syntax on your system might be different)

for d in $HOME/.fonts/*/; do
    OSFONTDIR+=":$d"
done

to recursively add all subdirectories of $HOME/.fonts to OSFONTDIR.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.